Jump to content

Add Attributes/Combinations name in products name


FerrA

Recommended Posts

Hi to all guys,

 

everyone can share with us a code snippet for add the attributes/combinations name after the products name?

 

For example "Product one" have combination called (two, three)

 

On product page now appear as product name "Product one" and you can select the combinations "two and three".

I what that, when users select a combination the product name will be updated. So Select combination "three" the product name will be "Product one - Three".

 

Anyone can share a code parts for do that?

Link to comment
Share on other sites

You need two changes.

1. In your (child)-themes .tpl add the reference after the product name {$product.reference_to_display}
2. When a combination is chooses presta updates only parts of the page. You need a JS to listen for changes and update accordingly e.g.

prestashop.on('updatedProduct', function(e) {$('#mylabelxyz').text($('.product-reference').text())}); 

 

Link to comment
Share on other sites

  • 3 weeks later...
On 30/1/2024 at 8:53 AM, JBW dice:

$product.reference_to_display

This is my $product.reference_to_display on /templates/catalog/_partials

 

{if isset($product.reference_to_display) && $product.reference_to_display neq ''}
      <div class="product-reference">
        <label class="label">{l s='Reference' d='Shop.Theme.Catalog'} </label>
        <span>{$product.reference_to_display}</span>
      </div>
    {/if}

 

 

where I put this line?

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