Jump to content

ean13 and combinations


Recommended Posts

You must make changes in some files Product.php, product.tpl and product.js I'll try to explain.

 

STEP 1

Edit the file: yourshop.com/classes/Product.php

Locate the 3 lines of code like this:

SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name` as `attribute`, agl.`name` as `group`

And change each one to:

SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name` as `attribute`, agl.`name` as `group`, pa.`ean13`

STEP 2

Edit the file: yourshop.com/themes/your-theme/product.tpl

Locate the code:

tabInfos['id_attribute_group'] = '{$aC.id_attribute_group|intval}';

Next, add a new line with the following code:

tabInfos['ean13'] = '{$aC.ean13}';

Now you need add a <div> to display it, you need to put this inside the next foreach:

{foreach from=$groups key=id_attribute_group item=group}
    {if $group.attributes|@count}

It could be as follows:

{foreach from=$groups key=id_attribute_group item=group}
	{if $group.attributes|@count}
		<div>EAN13: <span id="ean13_{$id_attribute_group|intval}"></span></div>

STEP 3

Finally you need edit the file: yourshop.com/themes/your-theme/js/product.js

Locate the code:

$('select[name=group_' + attributesCombinations[a]['id_attribute_group'] + ']').val(attributesCombinations[a]['id_attribute']);

Next, add a new line with the following code:

$('#ean13_' + attributesCombinations[a]['id_attribute_group']).html(attributesCombinations[a]['ean13']);

I have tested and works.

 

I hope this help you.

Link to comment
Share on other sites

thanks for your help but for step 2 I have a problem, I not find the code: tabInfos['id_attribute_group'] = '{$aC.id_attribute_group|intval}';

 

I have the 1.6 version of prestashop than I think that new layout not have the same code of 1.5 version

 

You have any idea?

thanks

Link to comment
Share on other sites

  • 5 weeks later...
Thanks for your input, it has been very useful to me, 

I can think of that color attributes which does not change the EAN 

EAN me the word appears on screen release 

would be possible to hide if the attribute color has in its combination EAN? 

 

thanks

Link to comment
Share on other sites

×
×
  • Create New...