HotcakesCommerce / hotcakes-commerce-core

The core of the e-commerce part of the overall solution. This is an ecommerce shopping cart solution built on top of the DNN (DotNetNuke) CMS. Anyone can do commerce online now!
https://mmmcommerce.com
MIT License
68 stars 55 forks source link

Import Product Choices - Duplicate Shared Choices #379

Open tpperlman opened 2 years ago

tpperlman commented 2 years ago

Describe the bug

We're attempting to import our product database and everything seems to work except for the Choices tab where it either creates duplicate shared choices or throws an error if the shared choice already exists. We do however notice that if we export any products using shared choices it will import without error, but once we add even one new shared choice to a product an exception error is returned.

Software Versions

To Reproduce

Steps to reproduce the behavior:

  1. Upload the populated XLS import file into a blank store (no products or shared choices). Please make sure that one or more products use the same shared choice (e.g. dropdown for size). Notice it does work correctly but it creates separate new shared choices for each product instead of using an existing one as stated in the docs.
  2. Wipe the store of all products and shared choices.
  3. Create a new shared choice and specify it in the Choices tab of the import for two or more products. The import routine will return the following error:

Row 3 thrown exception: An error occurred while updating the entries. See the inner exception for details.

System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_hcc_ProductOptions'. Cannot insert duplicate key in object 'dbo.hcc_ProductOptions'.

Expected behavior

Choices should not create duplicates or return a duplicate error if one exists.

Screenshots

Here is an example of the Choices tab:

shared choices

Additional context

Add any other context about the problem here.

tpperlman commented 2 years ago

Thank you @WillStrohl. We ended up just doing all the choices at the product level instead of shared choices. We didn't realize that you couldn't remove an option on a product-level without deleting it from the shared choice. We were assuming that when you created variants that only the ones created would appear in the dropdown list on the detail page.

WillStrohl commented 2 years ago

@tpperlman Can you please e-mail a copy of the XLS you're using to solutions@upendoventures.com? We're having issues fully duplicating the issue you reported.