Website designs and more
Services
About
Portfolio
Contact

How to add a MySQL query to a Zen Cart page

Aug 2, 2011 | Zen Cart Tips | 0 comments

It took me a while to figure out how to write my own MySQL query with the correct PHP syntax that Zen Cart likes. I thought I’d share it with you.

For example. Lets say you want to find out how many reviews were made for a particular product and display the number on the product description page. You would use the following and place it on your /includes/templates/YOUR-TEMPLATE/templates/tpl_product_info_display.php page. Of course, modify the style to match your page.
[php]
Execute($this_sku_sql_for_reviews);
if($this_sku_reviews->fields[‘status’] == 1) {
echo “

“. $this_sku_reviews->fields[‘products_id’].” reviews

“;
}
?>
[/php]

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.