Using ZenCart for Affiliate Products
July 30th 2009 09:26 pm
There’s no quicky way to set up your Zen Cart store so that each product has your affiliate link to a vendor’s site, but I found a suggestion on the Zen Cart forum and developed it a little.
I’ve set up one of my stores to be an affiliate site for the products. Here are the steps to take:

I’ve set up one of my stores to be an affiliate site for the products. Here are the steps to take:
- Set your site to be in Showcase mode with or w/o prices (Admin/Configuration/My Store/Store Status)
- For each product you set up, put in your affiliate link for the product url.
- By default, the product url shows very inconspicuously on the product page as ‘click here for more product information’ but you can change includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php so that it shows a big Ordering Information button instead. I also created a separate button that says Product Details for the category page.
- Create a Product Details button, name it button_product_details.gif and put it in the includes/templates/YOURTEMPLATE/buttons/english.
- Also create a button_ordering_info.gif button.
- Then in includes/languages/english/button_names.php add:
define(’BUTTON_IMAGE_PRODUCT_DETAILS’, ‘button_product_details.gif’); define(’BUTTON_PRODUCT_DETAILS_ALT’, ‘Product Details’); define(’BUTTON_IMAGE_ORDERING_INFO’, ‘button_ordering_info.gif’); define(’BUTTON_ORDERING_INFO_ALT’, ‘Ordering Info’);
- In includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php, find div id=”cartadd” and in that division, replace this:
with this:
echo $display_qty; echo $display_button;
This will put a nice Ordering Info button on your product page. Note that the above will link to a new window. If you want to stay within the same browser window, omit target="_blank".<?php echo '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false) . '" target="_blank">' . zen_image_button(BUTTON_IMAGE_ORDERING_INFO , BUTTON_ORDERING_INFO_ALT) . '</a>'; ?>
- In that same file, find id=”productInfoLink” class=”productGeneral centeredContent” in the p tag and replace this:
with this:
<?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?>
Again, omit target="_blank" if you want the same browser window.<?php echo '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false) . '" target="_blank">' . zen_image_button(BUTTON_IMAGE_ORDERING_INFO , BUTTON_ORDERING_INFO_ALT) . '</a>'; ?>
- Showcase mode means everywhere a Buy It Now button ordinarily shows, it will show a Contact Us link. But that’s not what I want. So change the Contact Us link on the category pages to the nice Product Details button you created in a previous step by changing includes/modules/YOURTEMPLATE/product_listing.php. Just find this text:
and replace it with this text:
$lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . 'def<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
$lc_text .= '<br /><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_PRODUCT_DETAILS , BUTTON_PRODUCT_DETAILS_ALT) . '</a><br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
- I wanted to do a similar thing on the All Products page but this time I wanted to remove the Contact Us link entirely and make the default ‘…more info’ more prominent than my template has by default.
- Remove the contact us link in admin by configuration/all listing — set Display Product Buy Now Button to 0.
- Make the ‘more info’ more noticeable (this part is optional depending on your template) by editing includes/templates/YOUR TEMPLATE/templates/tpl_modules_products_all_listing.php. You can either replace it with the Product Details button by replacing this (it appears in a few places):
with this:
>' . MORE_INFO_TEXT
OR you can just make the ‘more info’ more noticeable by tweaking the css.><br clear="all">' . zen_image_button(BUTTON_IMAGE_PRODUCT_DETAILS , BUTTON_PRODUCT_DETAILS_ALT)
- In includes/templates/YOURTEMPLATE/css/stylesheets.css add this:
a.moreinfo {color: blue; font-weight: bold; text-decoration: underline;}
a.moreinfo:hover {color: purple; font-weight: bold;}
Note: make sure you add it after the normal anchor styles or else it won’t take effect. - In includes/templates/YOUR TEMPLATE/templates/tpl_modules_products_all_listing.php look for every chunk of text that has MORE_INFO_TEXT and find the beginning of the anchor tag. It will look like
Just add class=”moreinfo” right before href, but make sure you leave a space before and after. So the beginning of your anchor tag should now look like the following:
<a href=
<a class="moreinfo" href=
- In includes/templates/YOURTEMPLATE/css/stylesheets.css add this:
- If you’re also using a Featured Products or New Products section, you can make the same changes.
- I removed the New Products, Specials, and Reviews from my site map by editing includes/templates/YOURTEMPLATE/templates/tpl_site_map_default.php and commenting out the appropriate line.

brent responded on 20 Aug 2009 at 6:44 pm #
Great post! this will be really helpful.
I like the screenshots of the theme you are using. Did you design that yourself? I am looking for a decent zen cart template that isn’t so crowded as most of them are.
brent
susb8383 responded on 12 Sep 2009 at 11:04 am #
Hi Brent,
That template is Cherry Zen and it’s a free one. The default color is red but you can easily change it to one of several, so I used orange I think.
beyoyo responded on 17 Oct 2009 at 9:51 am #
Any way to make a hybrid store? I am selling some or our own product and some that are to be linked outside. It seems its an either or with the showcase settings.
susb8383 responded on 17 Oct 2009 at 3:13 pm #
I haven’t been able to find a way to do both. It is either all one of the other. I’m still waiting for someone to create a contribution to do it product-by-product.
But you may be able to find someone to do it for you on elance.com or rentacoder.com.