New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce ability to copy an product #3605
introduce ability to copy an product #3605
Conversation
Ability to set skippable attributes and a code style refactoring will follow soon - please do not merge yet :) |
and split the logic into smaller functions for better readability
Done - a bagisto developer please review this PR. Thanks a lot ! |
@thyseus Could you fix all the below cases:
|
Thanks for reviewing! I will add all this tomorrow. |
I couldnt wait until tomorrow and implemented everything (with at least the languages my translator tool was able to do). I "blocked" the possibility to copy an 'booking' event because i think this would be to cumbersome and would not really make sense :) please review again. thanks! |
Hi @thyseus
|
@vaishaliwebkul i improved the blocking 'booking' products and also improved the copying of an 'configurable' product type. The variants should now also properly be copied. Please check again if i got it right this time. Can you elaborate on the last error you reported? I do not understand what you mean / can not reproduce. Oh and i also translated some strings to german (my mother language) that you missed so far while merging. Thanks ! |
@thyseus Ok, Thanks I will review this PR for German lang also. |
Ah i see. Will look into it. |
@vaishaliwebkul are you sure the mentioned fields are still not copied properly? In my user tests everything is fine, and the automated tests also checks that the relations of the copy are saved properly. Could you please try again ? If the error still persists, could you send me a copy of the exact demo data that you try to copy? Besides of that i wrapped the copy operation around a transaction - if anything fails, it should automatically roll back to the original state now. |
73a210f
to
4add783
Compare
@thyseus Thanks |
@thyseus linked products are not getting copied |
can we change url key every time when we copy any product? As of now when we copy 2nd time same product - https://prnt.sc/tv7r6l |
@vaishaliwebkul Wow, this took me some time to find the bug. Here is the solution: 326c19f :) - please try again, the original product should now not be touched. @bhanu-webkul I added a random 6 letter suffix to the name and url_key of the copy and avoided "copy of copy of ..." cascades. I do not think that linked products should also be copied, this would be unexpected behavior in my opinion. |
@bhanu-webkul i implemented a method to set globally if a copy of a product should be automatically linked to the original ( |
@thyseus Please reset the last commit, as the issue occurs in copy category Another bug, getting an exception when copy configurable product |
@vaishaliwebkul i fixed the bug with the empty categories and i set "linkProductsOnCopy" to default: off. What was the original intent of @bhanu-webkul about the linked products ? |
@thyseus |
I see. I did not know that documentation yet. Thanks a lot. So is the current implementation/behavior as intended ? |
@thyseus |
@vaishaliwebkul i added a fix that makes copying of |
@thyseus Actual Behaviour: the existing variant label option(Green-s) can be added into the configurable product again by copying the variant. https://prnt.sc/txk29z |
@vaishaliwebkul i do not really get the point of that. I do the following scenario:
I now have a total of 10 products, 5 from the original, 5 copied ones.
So in my opinion we should allow the admin to create the "Invalid" state so it is easier for him to create all "combinations" that he need. If you want, i can block the copying of "simple" products that had been created by a "configurable" completely, but i think this is a bad decision. |
@thyseus So kindly block the copy for a simple product that is created by the configurable product & show the alert https://prnt.sc/txk1ey |
@vaishaliwebkul ok - i blocked the ability to copy a product variant (having parent_id) |
@thyseus |
This feature works the same as the "copy cart rule" feature.
Additional copies may follow if our project needs them - or can be added manually by copying this code as example.