I'm trying to create tracking options and add them to an existing tracking category (that has tracking options) like this:
$option = new TrackingCategory\TrackingOption();
$option->setName($name);
$tracking->addOption($option);
$tracking->save();
Each time I do so, apart from adding the FIRST tracking option to a tracking category, I get the following exception:
A validation exception occurred (For each specified tracking option the name must be unique)
Validation errors:
For each specified tracking option the name must be unique.
The value of $name does not exist in the tracking category before this, but it still says it must be unique?
It only happens when I try to add a new one. I also notice that it does actually create the tracking option, but the error means that when I try adding the tracking variable to a line item and save it for an invoice - it does not save the line item as there has been an error.
Hi,
I'm trying to create tracking options and add them to an existing tracking category (that has tracking options) like this:
Each time I do so, apart from adding the FIRST tracking option to a tracking category, I get the following exception:
The value of
$name
does not exist in the tracking category before this, but it still says it must be unique?It only happens when I try to add a new one. I also notice that it does actually create the tracking option, but the error means that when I try adding the tracking variable to a line item and save it for an invoice - it does not save the line item as there has been an error.
Thanks