Jump to content

more info on product-list


genny_ruos

Recommended Posts

Hello,

the products and combination prices set by default are displayed in the product-list.tpl.

It's a possible show a description of the combinations set Like Color - Black, Disk space - 16GB.

The value $product.id_product_attribute is available.

I can get the descriptions?

 

 

For examples, in the product.tpl, attributes are displayed in a select statement:

{if isset($groups)}

<!-- attributes -->

<div id="attributes">

{foreach from=$groups key=id_attribute_group item=group}

{if $group.attributes|@count}

<p>

<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>

{assign var="groupName" value="group_$id_attribute_group"}

<select name="{$groupName}" id="group_{$id_attribute_group|intval}"

onchange="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">

{foreach from=$group.attributes key=id_attribute item=group_attribute}

<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>

{/foreach}

</select>

</p>

{/if}

{/foreach}

</div>

{/if}

 

Thanks a lot.

See soon.

post-311157-0-94907700-1337938660_thumb.jpg

post-311157-0-14830300-1337938674_thumb.jpg

Link to comment
Share on other sites

You can always toss a "{debug}" into any template to trigger Smarty's debug function which will normally show you what variables and objects are available at the current scope. I am pretty sure that the details you want are not present in the product data at the category listing stage as combinations and such are not normally generated until you get to the product detail page. The big issue is that combinations can be resource intensive so historically, Prestashop has tried to avoid them until the customer has drilled down to a single product.

 

It is not impossible to add them at the category stage but you can't do it via the template alone, it would have to be done either via a module that triggers on something like the "productListAssign" hook or by overriding CategoryController::productListAssign() with a custom version (there may be other methods that suit your needs better, that was just the first one I saw). Either way you would then assign the extra details to Smarty for use in your custom template.

 

Cheers

Edited by codegrunt (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...