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_id
and 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="' . 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
}
?>

 

posted @ 2014-08-19 17:40  小鱼阁工作室  阅读(331)  评论(0编辑  收藏  举报
Copyright © 小鱼阁工作室 版权所有 -zencart外贸建站,织梦企业建站,ecshop商城,二次开发,产品采集,模板修改!