Having the ability to use taxonomy terms as attributes is very useful, and I'm happy it's now supported by BPC. However, adding features like this also tend to open new "cans of worms". Strange things will now happen if you use an autocomplete widget to enter the taxonomy term attributes if you enter term(s) that do not yet exist. This is in itself very useful. Think of a list of Colors. You may have specified a set of common colors as taxonomy terms. But then you get a product where it's said to have a "Maroon" color, which isn't in your list. So you type it into the autocomplete field, which adds it as a new taxonomy term on the fly (avoiding a trip to the taxonomy page). This *seems* to work a first blush, but actually does a number of bad things:

1. It adds the same taxonomy term multiple times to the vocabulary, so you end up with duplicates.
2. It doesn't put the TID into the SKU pattern (presumably becuse ther taxonomy term isn't saved before generating the pattern, so it has no TID).
2. It puts what seems like a placeholder string into the generated Name pattern, rather than the taxonomy term itself.

Presumably, this can be all fixed by doing things in a slightly different order in the BPC module, to make sure any new taxonomy terms get added to the vocabulary (and only once) before using them in generating the name patterns.

-.JM

Comments

sven.lauer’s picture

Status: Active » Fixed

Fixed.

Indeed, the problem was that the validate handler got invoked several times, which created new term instances without saving them.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.