Bewertung für gekaufte Produkte


german 11101
Kunden erlauben Produkte zu bewerten, die Sie tatsächlich auch gekauft haben.

Finde in catalog/product_reviews_write.php
<?php
  if ($messageStack->size('review') > 0) {
      echo $messageStack->output('review');
  }
?>

Davor einfügen:

<?php
// ##### Start: Products Review Write Check
        // see if this person has left a review
    $query_allready = tep_db_query("select reviews_id from reviews where products_id = '" . (int)$product_info['products_id'] . "' AND customers_id = '" . (int)$customer_id . "'");
    if (tep_db_num_rows($query_allready) > 0)
        {
        $error = true;
?>
            <div class="col-sm-12 mb-4 w3-center"><div class="w3-border w3-border-green w3-pale-green w3-padding"><?php echo REVIEWS_CUSTOMER_ALREDY_REVIEWD_INFO_TITLE;?></div></div>
    <?php }else{

        // see if this customer purchased the product
        // only if not test account then we check this
        $b_bought_product = false;
        // grab all orders by this customer
        $query = tep_db_query("select orders_id from orders where customers_id = '" . (int)$customer_id . "'");

        // check all orders from this customer
        if (tep_db_num_rows($query) > 0)
        {
            // if they have, check orders
            while ($arr_order_ids = tep_db_fetch_array($query))
            {
                $order_id_curr = $arr_order_ids['orders_id'];
                // for this order_id, iterate through products and compare products_ids the one being reviewed
                $products_id_of_order_query = tep_db_query("select products_id from orders_products where orders_id = '" . (int)$order_id_curr . "'");
                while ($arr_product_ids = tep_db_fetch_array($products_id_of_order_query))
                {
                    $products_id_curr = $arr_product_ids['products_id'];
                    if ($products_id_curr == $product_info['products_id'])
                    {
                        $b_bought_product = true;
                    }
                }
            }
        }

        if (!$b_bought_product)
        {
        $error = true;
?>
        <div class="col-sm-12 mb-4 w3-center"><div class="w3-border w3-border-red w3-sand w3-padding"><?php echo REVIEWS_CUSTOMER_NOT_PURCHASED_TITLE;?></div></div>
<?php }else{ /* (Start: Products Review Write Check) */ ?>

Finde:

  <div class="buttonSet">
    <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>

    <?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'triangle-1-w', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params(array('reviews_id', 'action')))); ?>
  </div>
</div>

</form>

Danach einfügen:

<?php /* (Start: Products Review Write Check) */
   }    
  }
// ##### END: Product Reviews Write Check
?>

Füge hinzu, in der Sprachdatei: catalog/includes/languages/german/product_reviews_write.php

define('REVIEWS_CUSTOMER_ALREDY_REVIEWD_TITLE', '<span class="w3-text-black">Keine Bewertung mehr möglich. Sie haben dieses Produkt bereits bewertet.</span>');
define('REVIEWS_CUSTOMER_NOT_PURCHASED_TITLE', '<span class="w3-text-black">Keine Bewertung möglich. Sie haben dieses Produkt bisher noch nicht gekauft.</span>');

##################

Finde in: catalog/product_reviews.php

<div class="buttonSet">
    <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_WRITE_REVIEW, 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, tep_get_all_get_params()), 'primary'); ?></span>

    <?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'triangle-1-w', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params())); ?>
  </div>
</div>

Ersetze mit:

<div class="buttonSet row">

<?php if ($product_info['products_reviews_status'] == '0'){
if (isset($_SESSION['customer_id'])) {
// ##### Start: Products Review Write Check
        // see if this person has left a review
    $query_allready = tep_db_query("select reviews_id from reviews where products_id = '" . (int)$product_info['products_id'] . "' AND customers_id = '" . (int)$customer_id . "'");
    if (tep_db_num_rows($query_allready) > 0)
        {
        $error = true;

  if ($messageStack->size('product_reviews') > 0) {?>
            <div class="col-sm-12 mb-2 w3-center"><div class="w3-border w3-border-green w3-pale-green w3-round w3-padding"><?php echo REVIEWS_CUSTOMER_ALREDY_REVIEWD_INFO_TITLE;?></div></div>
<?php }else{
    ?>
            <div class="col-sm-12 mb-2 w3-center"><div class="w3-border w3-border-green  w3-sand w3-padding"><?php echo REVIEWS_CUSTOMER_ALREDY_REVIEWD_TITLE;?></div></div>
    <?php }}else{

        // see if this customer purchased the product
        // only if not test account then we check this
        $b_bought_product = false;
        // grab all orders by this customer
        $query = tep_db_query("select orders_id from orders where customers_id = '" . (int)$customer_id . "'");

        // check all orders from this customer
        if (tep_db_num_rows($query) > 0)
        {
            // if they have, check orders
            while ($arr_order_ids = tep_db_fetch_array($query))
            {
                $order_id_curr = $arr_order_ids['orders_id'];
                // for this order_id, iterate through products and compare products_ids the one being reviewed
                $products_id_of_order_query = tep_db_query("select products_id from orders_products where orders_id = '" . (int)$order_id_curr . "'");
                while ($arr_product_ids = tep_db_fetch_array($products_id_of_order_query))
                {
                    $products_id_curr = $arr_product_ids['products_id'];
                    if ($products_id_curr == $product_info['products_id'])
                    {
                        $b_bought_product = true;
                    }
                }
            }
        }

        if (!$b_bought_product)
        {
        $error = true;?>
        
            <div class="col-sm-12 mb-2 w3-center"><div class="w3-border w3-border-red  w3-sand w3-padding"><?php echo REVIEWS_CUSTOMER_NOT_PURCHASED_TITLE;?></div></div>
      <?php }else{?>
            <div class="col-sm-12 mb-2"><?php echo tep_draw_button(IMAGE_BUTTON_WRITE_REVIEW, 'fas fa-comment-alt', tep_href_link('product_reviews_write.php', tep_get_all_get_params()), 'primary', NULL, 'btn btn-success btn-block');?></div>

        <?php
        }    
      }
// ##### END: Product Reviews Write Check
?>
<?php }else{?>
    <div class="col-sm-12 mt-2 mb-2 w3-center"><div class="w3-padding w3-border w3-sand">
    <div class=""><?php echo REVIEWS_CUSTOMER_LOGIN_TITLE;?><hr class="hr-gr mt-2 mb-2"></div>
    <div class=""><?php echo tep_draw_button(REVIEWS_CUSTOMER_BUTTON_LOGIN_TITLE, 'fa fa-user-alt', tep_href_link('product_reviews_write.php', tep_get_all_get_params()), 'primary', NULL, 'btn btn-info btn-block'); ?></div>
    <div class="clearfix"></div></div></div>
<?php }}?>

Füge hinzu in der Sprachdatei: catalog/includes/languages/german/product_reviews.php

define('REVIEWS_CUSTOMER_LOGIN_TITLE', '<b class="w3-text-black">Nur für registrierte Kunden.</b><br><span class="w3-small">Sie müssen dieses Produkt auch gekauft haben, um bewerten zu können.</span>');
define('REVIEWS_CUSTOMER_ALREDY_REVIEWD_TITLE', '<b class="w3-text-black">Keine Bewertung mehr möglich. Sie haben dieses Produkt bereits bewertet.</span>');
define('REVIEWS_CUSTOMER_ALREDY_REVIEWD_INFO_TITLE', '<span class="w3-text-black">Danke für Ihre Bewertung. Sie wurde an uns übermittelt und sollte bald freigeschaltet werden.</span>');
define('REVIEWS_CUSTOMER_NOT_PURCHASED_TITLE', '<span class="w3-text-black">Keine Bewertung möglich. Sie haben dieses Produkt bisher noch nicht gekauft.</span>');
define('REVIEWS_CUSTOMER_BUTTON_LOGIN_TITLE', 'Bitte einloggen');


##################

Code für Produktbewertungen im Kundenbereich.
Dieser Abschnitt ermöglicht dir, dem Kunden eine Liste anzuzeigen mit allen bisher gekauften Produkten, die bewertet werden können.
Im Kundenbereich wird diese an beliebiger Stelle implementiert.

Es werden alle gekauften Produkte angezeigt.
Produkte, die nicht verfügbar sind, werden extra markiert.
Bereits bewertete Produkte werden in einer separaten Box eingeblendet.

Füge hinzu in: catalog/account.php

<?php
  $customer_total_prod_query = tep_db_query("select o.customers_id, op.products_name, op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . $_SESSION['customer_id'] . "' and o.orders_id = op.orders_id and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1' group by op.products_name order by op.products_name ASC");
    if (tep_db_num_rows($customer_total_prod_query) > 0)
        {

$reviewed_count_query = tep_db_query("select count(r.products_id) as count from reviews r left join products p on r.products_id = p.products_id where customers_id = '" . $_SESSION['customer_id'] . "' and p.products_reviews_status = '0' and p.products_status = '1'");
$reviewed_count = tep_db_fetch_array($reviewed_count_query);
$count = $reviewed_count['count'];

$reviewed_count_plus_query = tep_db_query("select count(r.products_id) as count from reviews r left join products p on r.products_id = p.products_id where customers_id = '" . $_SESSION['customer_id'] . "' and p.products_reviews_status = '0'");
$reviewed_count_plus = tep_db_fetch_array($reviewed_count_plus_query);
$count_plus = $reviewed_count_plus['count'];

$customer_count_revcount_query = tep_db_query("select o.customers_id, op.products_name, op.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . $_SESSION['customer_id'] . "' and p.products_id = op.products_id and o.orders_id = op.orders_id and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1' and p.products_status = '1' and p.products_reviews_status = '0' group by op.products_name order by op.products_name ASC");
$customer_count_revcount = tep_db_num_rows($customer_count_revcount_query) - $count;
?>
<header class="w3-camo-forest w3-padding w3-xlarge"><i class="fa fa-star w3-text-yellow" style="text-shadow: 1px 0 #fff, 0 -1px transparent, -1px 0 #fff, 0 1px #fff"></i> <?php echo MY_ACCOUNT_REVIEW_NOW_PRODUCTS . ' ' . $customer_count_revcount;?></header>
<div class="w3-border mb-4"><div class="clearfix"></div><hr class="hr-trans mb-1 mt-2">
<div class="w3-padding"><div class="w3-border w3-border-red w3-padding mb-2 w3-text-red w3-pale-red"><?php echo MY_ACCOUNT_REVIEW_PRODUCTS_TODAY_NO_AVALIABLE_HEADER_INFO;?></div><div class="clearfix"></div><hr class="hr-gr mb-1 mt-1"></div>
<?php
$query_allready_rows = '';
  $customer_reviews_query = tep_db_query("select o.customers_id, op.products_name, op.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . $_SESSION['customer_id'] . "' and p.products_id = op.products_id and o.orders_id = op.orders_id and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1' and p.products_reviews_status = '0' group by op.products_name order by op.products_name ASC");
  while ($customer_reviews = tep_db_fetch_array($customer_reviews_query)){
$query_allready_rows++;
if (strlen($query_allready_rows) < 1) {
$query_allready_rows = '0' . $query_allready_rows;
}

$products_revd_status_query = tep_db_query("select products_status from products where products_id = '" . $customer_reviews['products_id'] . "'");
$products_revd_status = tep_db_fetch_array($products_revd_status_query);

    $query_allready = tep_db_query("select reviews_id from reviews r left join products p on r.products_id = p.products_id where r.products_id = '" . (int)$customer_reviews['products_id'] . "' AND customers_id = '" . (int)$_SESSION['customer_id'] . "' and p.products_reviews_status = '0'");
    if (tep_db_num_rows($query_allready) > 0)
        {
        $error = true;
}else{
?>
<div class="col-sm-6">
<?php
$printlist_category_query = tep_db_query("select c.categories_id, c.categories_product_qty, c.category_stock_status, c.category_stock_info_status, c.cat_stock_att_image, cd.categories_id, cd.categories_name, cd.categories_stock, cd.categories_stock_alternatively, cd.categories_stock_replacement from products p, categories c, categories_description cd, products_to_categories pc where p.products_id = '" . $customer_reviews['products_id'] . "' and p.products_id = pc.products_id and pc.categories_id = cd.categories_id and cd.categories_id = c.categories_id and cd.language_id = '" . (int)$languages_id . "'");
$printlist_category = tep_db_fetch_array($printlist_category_query);
?>
<?php if ($products_revd_status['products_status'] == '1'){?>
<div class="mb-1 mt-1 w3-padding w3-border w3-border-red w3-sand">
<?php }else{?>
<div class="mb-1 mt-1 w3-padding w3-border w3-border-red w3-pale-red">
<?php } if ($products_revd_status['products_status'] == '1'){?>
<a rel="preconnect" itemprop="url" href="<?php
if (SHOW_EXTENDED_BROWSER_ADDRESS == 'True'){
$originalpnlString = $customer_reviews['products_name'];
$outputpnlString = '=' . $printlist_category['categories_name'] . '-' . preg_replace('/s+/', '-', $originalpnlString);
}else{
$outputpnlString = '';
}
echo tep_href_link('product_info.php', 'products_id=' . $customer_reviews['products_id']) . $outputpnlString; ?>"><span class="w3-text-teal w3-hover-text-black"><?php echo $query_allready_rows . ' ' . $customer_reviews['products_name'];?></span></a>
<?php }else{?>
<span class="w3-text-red"><?php echo $query_allready_rows . ' ' . $customer_reviews['products_name'];?></span>
<?php }?>

<?php if ($products_revd_status['products_status'] == '1'){?>
<span class="pull-right hidden-xs hidden-sm"><?php echo tep_draw_button(MY_ACCOUNT_REVIEW_PRODUCTS_LG_MD, 'fa fa-pencil-alt', tep_href_link('product_reviews_write.php', 'products_id=' . $customer_reviews['products_id'] . $outputpnlString), 'primary', NULL, 'btn btn-info btn-xs'); ?></span>
<span class="pull-right hidden-md hidden-lg"><?php echo tep_draw_button(MY_ACCOUNT_REVIEW_PRODUCTS_SM_XS, 'fa fa-pencil-alt', tep_href_link('product_reviews_write.php', 'products_id=' . $customer_reviews['products_id'] . $outputpnlString), 'primary', NULL, 'btn btn-info btn-xs'); ?></span>
<?php }else{?>
<span class="pull-right"><span class="w3-border w3-border-red w3-white w3-padding-small"><i class="fa fa-minus-circle w3-text-red"></i></span></span>
<?php }?>
</div>
</div>
<?php
}
}?>
<?php }else{?>
<header class="w3-red w3-padding w3-xlarge"><i class="fa fa-star w3-text-yellow" style="text-shadow: 1px 0 #fff, 0 -1px transparent, -1px 0 #fff, 0 1px #fff"></i> <?php echo MY_ACCOUNT_REVIEW_NOW_PRODUCTS;?></header>
<div class="w3-border mb-4"><div class="clearfix"></div><hr class="hr-trans mb-1 mt-2">
<div class="w3-padding"><?php echo MY_ACCOUNT_REVIEW_NO_PRODUCTS_FOR_REVIEW;?></div>
<?php }?>
<div class="clearfix"></div><hr class="hr-trans mb-2 mt-1">
</div>

<?php
  $customer_no_reviews_prod_query = tep_db_query("select o.customers_id, op.products_name, op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . $_SESSION['customer_id'] . "' and o.orders_id = op.orders_id and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1' group by op.products_name order by op.products_name ASC");
  $customer_no_reviews_prod = tep_db_fetch_array($customer_no_reviews_prod_query);

    $query_allready_prod_reviewed = tep_db_query("select reviews_id from reviews where products_id = '" . (int)$customer_no_reviews_prod['products_id'] . "' AND customers_id = '" . (int)$_SESSION['customer_id'] . "'");
    if (tep_db_num_rows($query_allready_prod_reviewed) > 0)
        {
?>
<header class="w3-camo-forest w3-padding w3-xlarge"><?php echo MY_ACCOUNT_PRODUCTS_REVIEWED . ' ' . $count_plus;?></header>
<div class="w3-border mb-4"><div class="clearfix"></div><hr class="hr-trans mb-2 mt-2">

<?php
$query_no_allready_rows = '';
  $customer_no_reviews_query = tep_db_query("select o.customers_id, op.products_name, op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . $_SESSION['customer_id'] . "' and o.orders_id = op.orders_id and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1' group by op.products_name order by op.products_name ASC");
  while ($customer_no_reviews = tep_db_fetch_array($customer_no_reviews_query)){
$query_no_allready_rows++;
if (strlen($query_no_allready_rows) < 1) {
$query_no_allready_rows = '0' . $query_no_allready_rows;
}

$products_status_query = tep_db_query("select products_status from products where products_id = '" . $customer_no_reviews['products_id'] . "'");
$products_status = tep_db_fetch_array($products_status_query);

    $query_allready_reviewed = tep_db_query("select reviews_id from reviews r left join products p on r.products_id = p.products_id where r.products_id = '" . (int)$customer_no_reviews['products_id'] . "' AND customers_id = '" . (int)$_SESSION['customer_id'] . "' and p.products_reviews_status = '0'");
    if (tep_db_num_rows($query_allready_reviewed) > 0)
        {
    while ($allready_reviewed = tep_db_fetch_array($query_allready_reviewed)){
?>
<div class="col-sm-6">

<?php if ($products_status['products_status'] == '1'){?>
<div class="mb-1 mt-1 w3-padding w3-border w3-border-green w3-food-pistachio">
<?php }else{?>
<div class="mb-1 mt-1 w3-padding w3-border w3-border-red w3-pale-red">
<?php }?>
<?php
$printlist_norev_category_query = tep_db_query("select c.categories_id, c.categories_product_qty, c.category_stock_status, c.category_stock_info_status, c.cat_stock_att_image, cd.categories_id, cd.categories_name, cd.categories_stock, cd.categories_stock_alternatively, cd.categories_stock_replacement from products p, categories c, categories_description cd, products_to_categories pc where p.products_id = '" . $customer_no_reviews['products_id'] . "' and p.products_id = pc.products_id and pc.categories_id = cd.categories_id and cd.categories_id = c.categories_id and cd.language_id = '" . (int)$languages_id . "'");
$printlist_norev_category = tep_db_fetch_array($printlist_norev_category_query);
?>
<?php if ($products_status['products_status'] == '1'){?>
<a rel="preconnect" itemprop="url" href="<?php
if (SHOW_EXTENDED_BROWSER_ADDRESS == 'True'){
$originalnorevString = $customer_no_reviews['products_name'];
$outputnorevString = '=' . $printlist_norev_category['categories_name'] . '-' . preg_replace('/s+/', '-', $originalnorevString);
}else{
$outputnorevString = '';
}
echo tep_href_link('product_info.php', 'products_id=' . $customer_no_reviews['products_id']) . $outputnorevString; ?>"><span class="w3-text-teal w3-hover-text-black"><?php echo $query_no_allready_rows . ' ' . $customer_no_reviews['products_name'];?></span></a>
<?php }else{?>
<span class="w3-text-red"><?php echo $query_no_allready_rows . ' ' . $customer_no_reviews['products_name'];?></span>
<?php }?>
<span class="pull-right">
<a rel="preconnect" itemprop="url" href="<?php echo tep_href_link('product_reviews.php', 'products_id=' . $customer_no_reviews['products_id']) . $outputnorevString; ?>">
<?php if ($products_status['products_status'] == '1'){?>
<span class="w3-border w3-border-green w3-hover-border-black w3-white w3-padding-small"><i class="fa fa-check w3-text-green w3-hover-text-black"></i></span>
<?php }else{?>
<span class="w3-border w3-border-red w3-hover-border-black w3-white w3-padding-small"><i class="fa fa-minus-circle w3-text-red w3-hover-text-black"></i></span>
<?php }?>
</a></span>
</div>

</div>
<?php
  }
}
}?>
<div class="clearfix"></div><hr class="hr-trans mb-2 mt-1">
</div>
<?php }?>

Füge hinzu in die Sprachdaei: catalog/includes/languages/german/account.php

define('MY_ACCOUNT_PRODUCTS_REVIEWED', 'Bereits bewertete Produkte');
define('MY_ACCOUNT_REVIEW_NOW_PRODUCTS', 'Offen stehende Bewertungen');
define('MY_ACCOUNT_REVIEW_PRODUCTS_LG_MD', 'Jetzt bewerten');
define('MY_ACCOUNT_REVIEW_PRODUCTS_SM_XS', '');
define('MY_ACCOUNT_REVIEW_PRODUCTS_TODAY_NO_AVALIABLE_HEADER_INFO', 'Alle mit <span class="w3-border w3-border-red w3-white w3-padding-small"><i class="fa fa-minus-circle w3-text-red"></i></span> markierten Produkte sind heute nicht verfügbar.');
define('MY_ACCOUNT_REVIEW_NO_PRODUCTS_FOR_REVIEW', 'Sie haben bisher noch keine Produkte erworben, die Sie bewerten könnten.');

Konstruiert für w3c-Commerce.
Bei anderen Versionen die DIV CSS-Formatierung anpassen.

Warum Ihre E-Mailadresse ?
Bei Bedarf werde ich Sie kontaktieren um Ihnen mit der Umsetzung zu helfen.
Ihre E-Mailadresse wird nicht öffentlich gemacht.
Ist dieser Beitrag für Sie hilfreich ?
Durchschnitliche Gesamtbewertung
3.5  aus 2 Bewertungen
Vergeben 1 x 5  Sterne
Vergeben 1 x 2  Sterne
Informationen(2)
Allgemeine Infos
 Kostenloser Werbeeintrag
 Lazy Loading
Beitragszähler
Momentaner Informationsstand:
Kategorien gesamt: 8
Beiträge gesamt: 104
Supportseiten gesamt: 55
Downloads für Mitglieder: 104
Download Zähler: 646
Bewertungen gesamt58
Firmenbewertungen: 26
Supportbewertungen: 25
Beitragswertungen: 7