In production, when I'm duplicating products, the price, quantity and units fields aren't always duplicating accurately. I can't see much of a pattern in regards to why some products duplicate accurately, and others have strange, inconsistent errors.
I was logged in as sstead@student, and sallystead2@gmail...
Examples:




Ok, found the problem. When you clone a product, it won't clone the variants. The default variant that is shown after cloning is the original master variant created with a new product. That means that a cloned product will have the same properties as the parent product when it was created initially. Changes after creation will not affect the later clones.
The solution would be to clone the variants of a product as well. But Kirsten thinks that we should tackle that later. Anyway, when someone has a go on this, they can add code like this to app/models/spree/product_decorator.rb:
# Called by Spree::Product::duplicate before saving.
def duplicate_extra(parent)
# Spree sets the SKU to "COPY OF #{parent sku}".
self.master.sku = ''
parent.variants.each do |v|
self.variants.push v.dup
end
end
That could be it.
reported by FC as "Cloning reverts to the original details of the product - often vastly different to what the current product is, price, pack size, etc, etc"
An Aus user (Synchronicity farm) has drawn our attention to the fact that sometime a product won't duplicate when you click the clone button. I've had a bit of a play and can't work out why sometimes the clone works, and other times it doesn't.
@sstead @kirstenalarsen does the AU team consider this to be enough of a pain for our users that we should dedicate some dev time to looking into it?
A priority user complained about this, but it's easy enough to work around, so I would say not a huge priority. That user would be happier if we did other things (POS, Quickbooks integration)...
From: Danni M notifications@github.com
Sent: 02 February 2018 11:45:54
To: openfoodfoundation/openfoodnetwork
Cc: Sally; Mention
Subject: Re: [openfoodfoundation/openfoodnetwork] Product duplication has errors or not working at all (#660)
@ssteadhttps://github.com/sstead @kirstenalarsenhttps://github.com/kirstenalarsen does the AU team consider this to be enough of a pain for our users that we should dedicate some dev time to looking into it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/openfoodfoundation/openfoodnetwork/issues/660#issuecomment-362450313, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKVzsIceOalIhdU6jxBDnMwLZ6EPXepzks5tQlrCgaJpZM4F2QmN.
i have no idea about user priority, just concerned about where it came from - if it were introduced by spree upgrade for example would that increase the priority of understanding it? @oeoeaio @enricostano @sauloperez
@mkllnk offered a view on what the bug is and how to fix it above, maybe he can also shed light on what caused it?
I think it was introduced when we started hiding the master variant all together and just use normal variants in the user interface (years ago, done by Rob I think). So just a little thing we didn't consider in that change at the time.
I think it was introduced when we started hiding the master variant all together and just use normal variants in the user interface (years ago, done by Rob I think). So just a little thing we didn't consider in that change at the time.
Yeah, would be nice to give some more thoughts again on that "hiding master variant" IMHO
This has now been reported by UK user. Doesn't seem to be high priority.
Doesn't seem to be high priority.
@lin-d-hop what does this mean? Priority for whom? For the UK? Or as a global priority and you'd like to make it one given the feedback?
For user, uk or internationally. I just thought it was worth noting the report on the bug. No actions required.
@lin-d-hop Your last issue shoudl be attached here https://github.com/openfoodfoundation/openfoodnetwork/issues/2756 and @HugsDaniel is working on it, should be fixed next week :-)
Looks like the BEP clone button is now just not working at all.
I wonder if it would be a better move just to remove the clone button altogether?
Any thoughts @myriamboure @RachL @kirstenalarsen