Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
During development we added lots of products of various product definitions, added them into the basket etc. Now that we have cleaned up our catalog by deleting all the test products we receive an error when I visit the cart, along the lines off:
"Product with SKU 'Some sku' does not exist."
This worries me for a couple of reasons:
1) If a product is deleted, surely it should be removed from Baskets; I have also tried calling TransactionLibrary.ExecuteBasketPipeline(); before retreiving the cart, like so:
TransactionLibrary.ExecuteBasketPipeline();var basket = TransactionLibrary.GetBasket(false).PurchaseOrder;
2) The table uCommerce_OrderLine seems to store the SKU, not the ProductId. What happens if we need to amend a products SKU and a customer already has this product in their basket - feels like we're forced to remove it somehow from their basket, or, show them an error message - neither of which feel right.
Could you please provide some advice on these points.
To advice more clearly on the error, it would be nice to see a stack trace to where the error is actually happening. Can you provide that?
If you want to do some cleanup when products are deleted you may do one or more of the following:
- Remove the product from the basket when it is deleted (You can hook into the delete pipeline for products when it is deleted in the backend).
- Check that all products still exists when the basketpipeline is being executed (you can hook into that aswell) - and either mark or delete orderlines that no longer has the associated product in the database.
Yes OrderLines stores the SKU and the VariantSKU and not a productid. There's various reasons for that, but the headline of it is that orderlines lives longer than a product does. One of the examples is one that you've just given me :)
The order should be able to function if the product no longer exists - because the Sku and VariantSku are only "soft" links to the product. In some cases we try to look up the product - but have a fallback if we cannot find it.
All products should have unique Skus, so to me it sounds like you want to support the case that you add a product to the basket, with a Sku that already exists - but it is another product that no longer exists?
But sure enough it depends ;-)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted