Jump to content

Display Only Attribute Name In Pack Content


Zecan

Recommended Posts

Hello,

I am creating packs of products on my prestashop 1.6.1.2
The packs contain a lot of same product but with different attributes.

You can see it there :

http://www.canz.fr/promotions-et-packs-graffiti-bombe-de-peinture/430-pack-xx-large-iota-bombes-a-graffiti-moins-cheres.html

 

When you go down you see "Pack Content".
It displays all the thumbs of products with the "name - attribute name- attribute ref" of each.

I would like to keep only the last part, not the name part as it is always the same.

 

For example : Ironlak Premium 400ml - Bombe de Peinture Couleur-Bolt - Marron Sombre

I will only keep : Bolt - Marron Sombre. So nothing is repeated.

I checked in product-list.tpl

<h5 itemprop="name">
						{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
						<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
							{$product.name|truncate:245:'...'|escape:'html':'UTF-8'}
						</a>
					</h5>

I've tried

 

{$product.reference|truncate:245:'...'|escape:'html':'UTF-8'}

But it displays the same reference for all attributes, it displays the reference of product not of the attribute. I could not find a variable to display this.

Anyone can help? Thx.
Regards,

 

Zecan.

 

Link to comment
Share on other sites

Array ( 
[id_product] => 8 [id_supplier] => 0 
[id_manufacturer] => 2 
[id_category_default] => 6 
[id_shop_default] => 1 
[id_tax_rules_group] => 2 
[on_sale] => 0 
[online_only] => 0 
[ean13] => 0 
[upc] => 
[ecotax] => 0.000000 
[quantity] => 19 
[minimal_quantity] => 1 
[price] => 3.4 
[wholesale_price] => 0.000000 
[unity] => [unit_price_ratio] => 0.000000 
[additional_shipping_cost] => 0.00 
[reference] => IR400 
[supplier_reference] => 
[location] => 
[width] => 0.000000 
[height] => 0.000000 
[depth] => 0.000000 
[weight] => 0.440000 
[out_of_stock] => 2 
[quantity_discount] => 0 
[customizable] => 0 
[uploadable_files] => 0 
[text_fields] => 0 
[active] => 1 
[redirect_type] => 404 
[id_product_redirected] => 0 
[available_for_order] => 1 
[available_date] => 0000-00-00 
[condition] => new 
[show_price] => 1 
[indexed] => 1 
[visibility] => both 
[cache_is_pack] => 0 
[cache_has_attachments] => 1 
[is_virtual] => 0 
[cache_default_attribute] => 3321 
[date_add] => 2013-05-26 18:44:54 
[date_upd] => 2016-01-14 13:11:24 
[advanced_stock_management] => 0 
[pack_stock_type] => 3 
[id_shop] => 1 
[id_lang] => 1 
[description] =>  ..........
[link_rewrite] => bombe-de-peinture-ironlak-premium-graffiti 
[meta_description] => Bombe de Peinture Ironlak pour le graffiti Acrylique et Brillante. 
[meta_keywords] => bombe de peinture,ironlak,spray,aerosol,acrylique,brillante,graffiti,carrosserie 
[meta_title] => 
[name] => Ironlak Premium 400ml - Bombe de Peinture Couleur-Bolt - Marron Sombre 
[available_now] => 
[available_later] => 
[id_image] => 8-127 
[legend] => Ironlak Premium 400ml - Bombe de Peinture 
[category_default] => Bombes de Peinture 
[pack_quantity] => 2 
[id_product_pack] => 430 
[id_product_attribute_item] => 3321 
[id_product_attribute] => 3321 
[rate] => 20 
[tax_name] => TVA 
[allow_oosp] => 0 
[category] => bombes-de-peinture 
[link] => http://www.canz.fr/bombes-de-peinture/8-bombe-de-peinture-ironlak-premium-graffiti.html 
[attribute_price] => 0 
[price_tax_exc] => 2.833333 
[price_without_reduction] => 3.4 
[reduction] => 0 
[specific_prices] => 
[quantity_all_versions] => 2566 

I only get this.

[Name] is the only one which display the attribute name.

Is there a way to truncate it?

Link to comment
Share on other sites

Thank you Musicater.

But it's still not what I need. It displays

 

"Ironlak Premium 400ml..."
So the 25 first letters.

 

What I need is here in green :

 

Ironlak Premium 400ml - Bombe de Peinture Couleur-Bolt - Marron Sombre
 

I can't find any solution with regular variables. Any ideas?

Link to comment
Share on other sites

Thank you for the link, this is very interesting.

I've tried this :

<h5 itemprop="name">
						{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
						<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
							
							
						{assign var="bar_at" value=$produt.name|strpos:"-"}	
						{$product.name|substr:($bar_at+1)}


						</a>
					</h5>

But it doesn't work, it just cut the first letter of the full name.

Link to comment
Share on other sites

I think I can make it work using this

{assign var="bar_at" value=$produt.name|strpos:"|"}	
						{$product.name|substr:($bar_at+1)}

But it means that $product.name has to display this

Ironlak Premium 400ml - Bombe de Peinture Couleur | Bolt - Marron Sombre

 

instead of this

 

Ironlak Premium 400ml - Bombe de Peinture Couleur-Bolt - Marron Sombre

 

Do you know where I can edit the $product.name variable so as to try to change the separator to |  between attribute group name and attribute name ?

Link to comment
Share on other sites

Ok. The best I could do is

{assign var="bar_at" value=$product.name|strpos:"Couleur-"}	
{$product.name|substr:($bar_at)}

We get this :

Couleur-Bolt - Marron Sombre

 

And it means that it only works with product with attribute group name as "Couleur".
It is not solved, if someone has a better idea, thank you.

Link to comment
Share on other sites

  • 2 weeks later...

there is no need paid service or tpl edit ;)

upload first orginal .tpl file(product-list.tpl)

open this file ,

classes / Pack.php

find this line

$line['name'] .= ' '.$value['group_name'].'-'.$value['attribute_name'];

replace like this

$line['name'] = $value['attribute_name'];

Note: i don't tested if not works write here i will try help you.

 

Regards..

Link to comment
Share on other sites

Hi Safa, thank you.

I've been trying now for two weeks and your help solved it very quickly.

The most funny is that I tried that you said one week before but I forgot to remove the "." before the =

It works like a charm now. I Mark it as SOLVED.

Best regards,

Bertrand.

  • Like 1
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...