Jump to content
thirty bees forum

How to surface attribute name from combination within google data feed using datakick module?


Recommended Posts

Posted

Hello,

I'm using the datakick module and trying to figure out how to parse out the color name from my combinations and add it to a google data feed. I have the structure working for everything else except I cannot establish how to pull just the color from a combination that has multiple attributes into the g:color data field. Anyone know this? @datakick

Posted
1 hour ago, datakick said:

There is combinationAttributeValue function: https://www.getdatakick.com/function/combination-attribute-value/

I tried this and doesn't seem to work given the combinations have multiple attributes. If returns null in all scenarios that I tried.

I ended up getting it to work like this.

<g:color>
if(attributeValue.attributeType == 'color', attributeValue.value, trim(toString(null)))
</g:color>

I'm sure there is a better way, but this is the only way I could make this one work. If there is, please show.

Now I'm struggling to figure out how to grab just the size attribute from a combination with many attributes. And insight @datakick?

 

Posted
30 minutes ago, x97wehner said:

If returns null in all scenarios that I tried.

Congrats, you have discovered a bug 🙂

This will be fixed in next release. Meanwhile, you can edit file modules/datakick/engine/prestashop/functions/combination-attribute-value.php

and change lines 97 and 88 from

AND comb.id_product_attribute = ' . (int)$combinationId . '
AND a.id_attribute_group = ' . (int)$attribute . '

to

AND comb.id_product_attribute = ' . $combinationId . '
AND a.id_attribute_group = ' . $attribute . '

With the fix in place, you can extract any attribute value, if you know attribute group id.

For example, if I have these attributes groups:

image.png.bea0eb5e509e5afde45b979cfbe4e07c.png

I can create list of combination, and use combination id + constant 3 to extract color from combination:

combinationAttributeValue(combinations.id, 3)

image.thumb.png.d87708ed9651e327666a513aeb88af85.png

 

 

Posted
23 minutes ago, datakick said:

Congrats, you have discovered a bug 🙂

This will be fixed in next release. Meanwhile, you can edit file modules/datakick/engine/prestashop/functions/combination-attribute-value.php

and change lines 97 and 88 from

AND comb.id_product_attribute = ' . (int)$combinationId . '
AND a.id_attribute_group = ' . (int)$attribute . '

to

AND comb.id_product_attribute = ' . $combinationId . '
AND a.id_attribute_group = ' . $attribute . '

With the fix in place, you can extract any attribute value, if you know attribute group id.

For example, if I have these attributes groups:

image.png.bea0eb5e509e5afde45b979cfbe4e07c.png

I can create list of combination, and use combination id + constant 3 to extract color from combination:

combinationAttributeValue(combinations.id, 3)

image.thumb.png.d87708ed9651e327666a513aeb88af85.png

 

 

Awesome. I appreciate the quick follow-up and fix.

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