Jump to content

Adding a specific attribute to product title within the shopping cart


Recommended Posts

I can't figure out how to add a specific attribute to my product titles within the shopping cart. For example, rather than listing items like this:

--

Tux Jacket

Color: black

SKU: 23456

--

 

I would rather display the product like this:

--

Tux Jacket in black

SKU: 23456

--

 

I have found where the listing details are, within the 'shopping-cart-product-line.tpl' file but I'm not sure how to break out the specific attribute to add to the end of the product title. I also don't want to include the attribute category, in the case above, the "color" title. I just want the title and attribute value on one line. Any help would be greatly appreciated!

 

Here's some code from the first example:

 

<p class="product-name"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'html':'UTF-8'}">{$product.name|escape:'html':'UTF-8'}</a></p>
        {if $product.reference}<small class="cart_ref">{l s='SKU'} : {$product.reference|escape:'html':'UTF-8'}</small>{/if}
{if isset($product.attributes) && $product.attributes}<small><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'html':'UTF-8'}">{$product.attributes|escape:'html':'UTF-8'}</a></small>{/if}
 
Thank you!

 

Link to comment
Share on other sites

So I ended up spending all night trying to figure this out to find a simple-ish solution:

 

The variable:

{$product.attributes|escape:'html':'UTF-8'}

 

Also has another version of it's self with just the value, rather than the group title and the value which is:

{$product.attributes_small|escape:'html':'UTF-8'}

 

Who would have known?! So I just utilized that variable within the shopping-cart-product-line.tpl file and specifying the group name.

Link to comment
Share on other sites

  • 6 years later...

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...