How to remove sideboxes from product pages in Zen Cart
It took me a while to figure this one out. The Zen forum contains a more elaborate solution that includes removing a sidebar from the category pages as well as the product description pages. I just wanted to remove the sidebar from the product description pages. So far, this seems to work fine for me. I thought I’d share it with you.
Simply copy and paste the code below as the first line of your PHP code on the /includes/templates/YOUR-TEMPLATE/templates/tpl_product_info_display.php page.
<?php // to disable right sidebar $flag_disable_right = true; // to disable left sidebar $flag_disable_left = true; ?>
Fun Stuff:
How to add a MySQL query to a Zen Cart page
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 $this_sku_sql_for_reviews = "SELECT COUNT(products_id) as products_id, status FROM reviews where products_id = '" . $_GET['products_id'] . "'"; $this_sku_reviews = $db->Execute($this_sku_sql_for_reviews); if($this_sku_reviews->fields['status'] == 1) { echo "<p align=\"center\" style=\"font-size:10px;margin-bottom:5px;\">". $this_sku_reviews->fields['products_id']." reviews</p>"; } ?>
Fun Stuff:
How to place social media links in Zen Cart
There’s been a lot of discussion about whether the default Facebook like button code is good or not for SEO. Not to mention all the errors on the Facebook side (Like button), that makes it too time consuming to deal with.
To try and play it safe, I decided to add my own PHP code that should not have the same issues. But, it’s not going to show the number of likes (or Tweets). It simply adds the current page link to each social media site button. It’s using the correct Facebook URL (currently), and will open the correct page on Facebook along with a link to your page. It also allows the user to place a comment and then share.
I added the same type of functionality to the Twitter and Google +1 buttons, too. Right click and save the icons below to your server. Make sure you change the path in the image tag to wherever you upload the icon on your web server.
I recommend placing this code in your /includes/templates/YOUR-TEMPLATE/templates/tpl_product_info_display.php page so the social links appear on your product description pages. You’ll have to find the right spot to place them because every template is different. Try placing it after the <!–eof Product description –> tag and see how that works for you.
Actually, this also works on most any PHP page. It works on demo area below!
DEMO
Below is the code.
<?php $urlforshare = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; //echo $urlforshare; $urlforshare2 = str_replace('/', '%2F', $urlforshare); ?> <div style="border: 1px solid #cbcbcb;background-color:#ececec; width:175px; margin-top:17px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td style="text-align:center !important; padding-top:5px;padding-bottom:5px;" align="center"> <a href="http://www.facebook.com/sharer/sharer.php?u=<?php echo $urlforshare2;?>" target="_blank" title="Share on Facebook" rel="nofollow"><img src="facebook.gif" alt="Share on Facebook" width="16" height="16" border="0"></a> </td> <td style="text-align:center !important; padding-top:5px;padding-bottom:5px;" align="center"> <a href="http://twitter.com/intent/tweet?text=<?php echo $products_name; ?>&url=<?php echo $urlforshare2;?>" target="_blank" title="Tweet This Page" rel="nofollow"><img src="tweet.gif" alt="Tweet This Page" width="50" height="16" border="0"></a> </td> <td style="text-align:center !important; padding-top:5px;padding-bottom:5px;" align="center"> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><g:plusone size="small" count="false"></g:plusone> </td> <td style="text-align:center !important; padding-top:5px;padding-bottom:5px;" align="center"> <p style="font-size:11px;font-weight:bold;color:#2c5987;">SHARE</p> </td> </tr> </table> </div>
Fun Stuff:
Pet Domain For Sale
A great pet domain with a Google Page Rank of 2! This gives you a great head start. It’s live and is currently an affiliate site. I’m willing to sell with the Zen Cart installation or just the domain. Make me a reasonable offer and it could be yours! www.save-on-petsupplies.com










