Mike MacKechnie Posted March 30, 2015 Share Posted March 30, 2015 Does anybody know how to add thumbnail images to the Popular Products box in CCV6? I'm using the crosshatch skin with a few css tweaks but pretty much straight out of the box. This is my source for crosshatch/templates/box.popular.php: <div class="box"> <h3>{$LANG.catalogue.title_popular}</h3> <ol> {foreach from=$POPULAR item=product} <p class="image"> <a href="{$product.url}" title="{$product.name}"> <img src="{$product.image_small}"/> </a> </p> <li><a href="{$product.url}" title="{$product.name}">{$product.name}</a></li> {/foreach} </ol> </div> the "{$product.image_small}" placeholder is not working. I tried "{$product.image}" as well but same result. {$product.url} and {$product.name} work fine so I'm guessing that there's somewhere where I've got to get Smarty to load the $product.image placeholder. I'm a newbie to Smarty so any help would be appreciated. Here's my development CC Store: Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 30, 2015 Share Posted March 30, 2015 At the end of box.popular.php, add {debug}. Be sure to have your browser allow popups. You will be given a popup with all the variables that this template has available. Under $product, you will see that the array elements do not include an image. In the file /classes/gui.class.php, find private function _displayPopularProducts(). In this function you can hard code a statement that will get links to one or all image variants, or we can use a hook. For a hard coded statement, try:Find: $product['sale_price'] = ($sale) ? $GLOBALS['tax']->priceFormat($product['sale_price']) : null; Add after: $product['image_url'] = $this->getProductImage($product['product_id']); Then, the template code now has $product.image_url available. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted March 30, 2015 Author Share Posted March 30, 2015 Good work Mr. Smither - that works perfectly!! Now if I could only get ckeditor to work, we could plan to go live with this....I'll raise another ticket for the ckeditor issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.