首页 > 代码库 > zencart只有购买过此产品的客户才能评价产品

zencart只有购买过此产品的客户才能评价产品

当前登录的客户买过此产品时,才显示评价按钮:

<?php$rev_query = "select count(*) as count from orders o ,orders_products op" ."where op.products_id = ‘" . (int)$_GET[‘products_id‘] . "‘and o.orders_id=op.orders_idand o.customers_id = ‘" . (int)$_SESSION[‘customer_id‘] . "‘" ;$rev = $db->Execute($rev_query);if ($rev->fields[‘count‘]>0){?><div id="productReviewLink" class="buttonRow back"><?php echo ‘<a href="http://www.mamicode.com/‘ . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . ‘">‘ . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . ‘</a>‘; ?></div><br class=”clearBoth” /><?php}?>