Discussions

update product display nodes based on sku

I would like to update product display nodes with taxonomy terms based on the sku of the referenced product of each node.
Is that possible programmatically?

It means:

1) I know the sku.
2) I need to find the product by sku of a product display.
3) then I update the taxonomy term of the product display accordingly.

I tried to use EntityFieldQuery() to no success.

If someone could possibly give me an idea on the best approach to do this in DrupalCommerce, or provide urls to documentation I have missed, it is greatly appreciated. Lost a day or two asking Google the wrong questions apparently.

Thanks in advance,

Posted: Nov 8, 2011

Comments

rfay Randy Fay on November 8, 2011

Is there a magic formula to convert SKU to taxonomy term?

Is this a one-time conversion? Or is it ongoing?

If it were a one-time conversion, I'd consider just using Views Bulk Operations to do the whole deal. Actually, even if it were not a one-time, you can run VBO actions from a rule...

Anyway, just some thoughts.