I think this might be a similar bug that we found in Vendr, that the bundle ID isn't taken into account for uniqueness. For a quick workaround, you could add the bundleId as a property to the order line, and then use that property as a uniqueness property too. This should then treat them as separate order lines.
We'll need to look at making an update to take bundle ID's into account, but the above workaround should be safe to apply and it would continue to work once the fix is in place.
It might be because they are sharing the same bundleId. You need to make sure that every call to add an order line has a unique bundleId. I think here, your bundle ID is repeated per size option.
I think really each call to TC.AddOrUpdateOrderLine should have it's own properties collection created, as currently you are reusing the properties for each call, hence the error.
Product Bundle - Same Product Id per bundles Item not being added
Hi
I'm trying to bundle products together by the size of the garment. It doesn't seem to want to bundle multiple products with the same productId.
What I have so far when adding to the basket:
This produces:
1) Is the first Main Product, this will be the master where the others will be bundled against.
2) Is the last in the sequence, it seems to just add them all together and take on the last size, L, there should be 5 x XS, 5 x S, 5xM and lastly 5xL
Ive set Product uniqueness property aliases to below:
Can it only bundle products of unique product ids?
Hi Neil,
I think this might be a similar bug that we found in Vendr, that the bundle ID isn't taken into account for uniqueness. For a quick workaround, you could add the
bundleId
as a property to the order line, and then use that property as a uniqueness property too. This should then treat them as separate order lines.We'll need to look at making an update to take bundle ID's into account, but the above workaround should be safe to apply and it would continue to work once the fix is in place.
Hope this helps
Matt
HI Matt
Ive altered the code to:
So it just adds the products to the order with the 'bundleId' as a property.
Then made sure my property type is using the unique key
But i seem to be getting them added together, OrderLine is set at 1.
Am I doing something wrong when AddOrUpdateOrderLine? Do they still need a bundleIdentifier?
By the way, this is using TC 3.4.4
Hey Neil,
Sorry, you still want to use the bundleId as a bundleId, but you also want to use it as a property, so you need to do both.
Hope this helps
Matt
Yeh tried a couple of diffrent combinations but it wont add them. It seems the Bundle and Uniqueness of the product are not being obeyed.
It just gives me 1 x OrderLine and adds all the qty together? Scratching my head with this one, not sure why it wont add them as seperate orderLines?
hmm, seems if i add another unique property it works :)
I guess now i can just group them by the Bundle Identifier to show them as under one order :)
Cheers Matt.
Hey Neil,
It might be because they are sharing the same bundleId. You need to make sure that every call to add an order line has a unique bundleId. I think here, your bundle ID is repeated per size option.
Matt
Yeh, I moved the generation of the bundle Identifier into the for each loop, creating a new GUID each loop.
But just got an error:
An item with the same key has already been added.
I guess its the
part, as that key is already added,
I think this would then work:
I think really each call to
TC.AddOrUpdateOrderLine
should have it's own properties collection created, as currently you are reusing the properties for each call, hence the error.Matt
Nice one Matt, all sorted! :)
is working on a reply...