Jump to content

Changing product name dynamically


Recommended Posts

Hi,

 

Is there a way to change product name (a little bit) whenever a customer selects an attribute of that product?

 

Example:

Product name : Salt

Attributes: 200gm, 500gm, 1kg

 

Attribute selected          Product Name displayed

200gm                           Salt, pouch

500gm                           Salt, Jar

1kg                                Salt, Bootle

 

please help if this is possible in Prestashop

 

 

Thanks

 

Link to comment
Share on other sites

Hi mk,

This is not possible by PrestaShop by default. It needs some programming.

 

Should the name be changed permanently, or only temporarily, on that page only?

 

If only temporarily on that page (i.e. for informational purpose only), you probably could use some Javascript/jquery function to change the name dynamically.

- You could maybe use the attribute-value metatitle field to store the addition you want to use for that attribute value. (You may have to add this metatitle to the SQL query where the attribute values are retrieved and sent to the product page, as I expect this not to be there by default)

- Then add some onchange event to the attribute value select fields (radio buttons, check box or drop down boxes etc) where you call the javascript function to add/change the name.

 

Haven't tried it, but expect something like this should work.

 

 

If you want to change names permanently, I expect problems when re-using the product for other times/customers etc. as the name is then changed already...

 

My 2 cents,

pascal.

Link to comment
Share on other sites

Javascript in themes/<your theme folder>/product.tpl. Adjustments for adding the metatitle in the attributevalues array I expect in classes/Attribute.php and maybe controllers/ProductController.php. Not sure if I forget any though...

 

If I have time, I will give it a quick try, but please try yourself as well.

 

Pascal.

  • Like 1
Link to comment
Share on other sites

  • 7 years later...
On 1/31/2015 at 3:26 PM, PascalVG said:

Javascript in themes/<your theme folder>/product.tpl. Adjustments for adding the metatitle in the attributevalues array I expect in classes/Attribute.php and maybe controllers/ProductController.php. Not sure if I forget any though...

 

If I have time, I will give it a quick try, but please try yourself as well.

 

Pascal.

Hello @PascalVG

I have same issue i had done some changes in displayAjaxRefresh() function and trying to display the titltle but it show blank can it possible to display the combination details which are displaying at the admin page can we show it in .tpl file below is attached screenshot.

image.thumb.png.216b0a0ea19cdabcbdb54640aeedd89b.png

 

Can we show same details in front of product title in product.tpl file

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