igor.i Posted November 22, 2014 Posted November 22, 2014 Greetings, I would like to assign different image size of a product, according to Category: for the Packages (category ID = 261), the image size should be larger than the assigned size for other products/titles. I added new category in Images (see att. ), "box_default_pack" (no.9, 900x467px.) and then added the following code in themes/default/product.tpl, at lines 178-189: {if $have_image} {if $Category->id == 261} <span id="view_full_size"> <img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'box_default_pack')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {else} <span id="view_full_size"> <img src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {/if} {else} <span id="view_full_size"> <img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {else} <span id="view_full_size"> <img src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {/if} Unfortunately, I am testing this online and can not see where the error is - all I get is a blank page. If I am to assign smarty code, where (in which file/s) should I do it, and what the code should be? I apologize if this has been answered; I did my best to find the answer. I am using PrestaShop™ 1.5.3.1 Any help would be much appreciated! Share this post Link to post Share on other sites More sharing options...
PascalVG Posted November 22, 2014 Posted November 22, 2014 (edited) Let's re-format the code a iittle: {if $have_image} {if $Category->id == 261} <span id="view_full_size"> <img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}" {if $jqZoomEnabled} class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'box_default_pack')}" {else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {else} <span id="view_full_size"> <img src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {/if} {else} <span id="view_full_size"> <img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}" {if $jqZoomEnabled} class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')}" {else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {else} <-- Seems to have 2 x else <span id="view_full_size"> <img src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" /> <span class="span_link">{l s='View full size'}</span> </span> {/if} Seems to have 2 x else pascal Edited November 22, 2014 by PascalVG Editor messed up. reformatted text... (see edit history) Share this post Link to post Share on other sites More sharing options...
igor.i Posted November 22, 2014 Posted November 22, 2014 Thanks for the reply and the suggestion, PascalVG. I tried removing any of both {else} tags, but the results are not good. Will create a localhost envoriment soon and will let you know. Best regards, II Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now