Closed mlocati closed 10 months ago
PS: I've updated the Doctrine event listener: now it only calculates the new fields only in case of changes (instead of processing all the loaded products and variations)
Wow, this look impressive. I've read your notes on the issue about this, and I agree that the variation quantities and the total quantities should be linked. Otherwise it's just confusing as to why there are two quantities.
I'll merge this, and will do a bit of testing this week.
I'll merge this, and will do a bit of testing this week.
I've used this query in my tests when editing a product in the dashboard:
SET @pID = 1;
SELECT 'Product' AS What, pQty AS Qty, pQtyUnlim AS Unlimited, null as Disabled FROM CommunityStoreProducts WHERE pID = @pID
UNION ALL
SELECT CONCAT('Variation ', pvID), pvQty, pvQtyUnlim, pvDisabled FROM CommunityStoreProductVariations WHERE pID=@pID
You may want to reuse it to check the stored data :wink:
This PR adds the following options at
/dashboard/store/settings#settings-products
:If that option is enabled and a product has variations, users won't see this details when editing it:
those two fields will be automatically populated (and kept up-to-date) by listening to the Doctrine
preFlush
event. That listener (which will be called whenever we are writing something to the database), will check all the loaded entities, and update (if required) the twopQty
/pQtyUnlim
fields for the products (see the newAutoUpdaterQuantitiesFromVariations
class).In order to automatically update those two fields, users can also use:
cstore:product:quantity:update
CLI commandAutomatic Product Quantity Updater
Automated JobAutomatic Product Quantity Updater
Task (for ConcreteCMS v9+)Fix #763