Zencart : How to add reward points to the product listing
As some of you may know, Squirrel Hosting also offer website design. This isn't something we usually mention as our web design team is small and usually always booked up. They recently encountered a problem and a solution to a Zencart module which we have taken the time to write up below for anyone else to use on their own site. This coding tweak is for the rewards point module and allows you to display the products reward points on the product listing page.
Please note before making any changes, it is always recommended that you make a full backup of your Zencart site first.
Reward Points Module : How to add reward points to product listing.
Firstly if you're not familiar with the reward points plugin and have a Zencart site, we suggest that you take a look here. It's a great free plugin that installs on your site and allows you to offer reward points to your customers for every purchase they make. You can set the value of each reward point and the value of points per item if you require. The product info page (tpl_product_info_display.php) will then list the amount of reward points the product is worth. Unfortunately it doesn't add the points to the product listing page. To do this you will need to make the following changes.
1 : Open up product_listing.php
You will need to navigate to;
If you're not using a template then you will find your product_listing.php file in includes/modules/
If you edit the original make sure you make a backup first!
2 : Add the reward points code.
Once you have opened up product_listing.php look around line 103 for
$lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />'; $lc_align = 'right'; $lc_text = $lc_price;
and replace this with
$lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />'; $rewards = GetProductRewardPoints($listing->fields['products_id']); $lc_align = 'right'; $lc_text = '' . $lc_price . '' . $rewards . ' Points';
Then it's simply a case of saving the file and re-uploading it to your site.
We have left '' '' before and between the price - rewards in case you want to add any extra html. If you do you can insert this between the '' e.g. 'HTML CODE HERE'
Download Reward Point Product Listing
If you are in a rush you can download our copy of product_listing.php here
Hope this helps. If you have any issues using the above or have used this on your site then drop a comment below letting us know or why not say thanks by clicking the social links on the top of the site?
Leave a comment
Has this guide helped you? Have an idea for a guide or need help? Let us know below.