This issue is probably related to the other SKU change related issues that are out there, but I wasn't sure which to add this too as the descriptions didn't quite match the issue I have had to deal with.
The bottom line is my client was unable to update the stock levels for a product after changing the SKU.
I'm not entirely sure how they managed to do what they did, but they ended up with 2 products that shared a stock level.
From my investigation of revisions etc
Product 1 seemed to start with SKU: prod1
after several revisions the SKU was changed to prod2
Product 2 seemed to start with SKU: prod1
Product 1 had 2 entries with Product SKU showing as prod2 in both but the Stock SKU had entries for both prod1 and prod2.
Product 1 had 1 entry with a Product SKU but no Stock SKU listed
Any time Product 1 was edited and the /node/123/edit/stock page was visited the stock levels of Product 2 were displayed.
Any time Product 2 was edited and the /node/234/edit/stock page was visited the correct stock levels of Product 2 were displayed.
I fixed this by manual editing of the database changing nid to Product2s nid next to the SKU prod1 in the uc_product_stock
and then I also had to edit the uc_products table and find all entries for Product 1 and edit the SKU for the older revisions, once all entries showed the newer SKU the /node/123/edit/stock page now showed the correct SKU and stock level and so updating was possible once more.
This is not an ideal fix, but I was confident that the changes made to the SKU were made before the site actually went live and so no historical data was required to be kept.
Is there a way to change the form on /node/123/edit/stock so that it grabs the newest revision rather than the oldest revision. Not sure how this will affect the other issues, but I thought the investigation may add some new light on the subject.
|PASSED: [[SimpleTest]]: [MySQL] 2,943 pass(es).|
|PASSED: [[SimpleTest]]: [MySQL] 2,945 pass(es).|
|FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ubercart-stock_page_node_revision_fix-1637336-10-6.x-2.x.patch. Unable to apply patch. See the log in the details link for more information.|
|PASSED: [[SimpleTest]]: [MySQL] 1,709 pass(es).|