Skip to content
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

Duplicate a product in multistore context #27148

Open
2 tasks done
Tracked by #9723
hadran9 opened this issue Dec 30, 2021 · 3 comments
Open
2 tasks done
Tracked by #9723

Duplicate a product in multistore context #27148

hadran9 opened this issue Dec 30, 2021 · 3 comments
Labels
1.7.7.0 Affects versions BO Category: Back Office Bug Type: Bug Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Multistore Label: Which BO under menu is concerned Needs Specs Status: issue needs to be specified Old Products Page Concerns the old product page Verified The issue has been reproduced

Comments

@hadran9
Copy link

hadran9 commented Dec 30, 2021

Prerequisites

Describe the bug and add screenshots

Hello,
I've encountered an issue during the duplication of the products in PrestaShop when I'm using the multistore context.

So, When we have a product with different information in each shop, and we try to duplicate the product in a single shop, the duplication works successfully, but when we try to duplicate the product in the multistore context(all shops), it duplicates the information from the first shop(the shop with id 1) in all the other shops.

Expected behavior

I'm expecting when we're duplicating the product on "all shops" it will duplicate the information of each shop in the correct one.

Steps to reproduce

  1. We have two shops: Shop 1 and Shop 2
  2. We're going to create a product in the first Shop (Shop 1): https://jmp.sh/0AlN2nE
  3. We're going to add the information of this product in the second Shop (Shop 2): https://jmp.sh/dfiXlZg
  4. We have now a product (id 22 in my example) with different information on each shop
  5. We're going to change the context to all shops: https://jmp.sh/oL3G9pH
  6. We're going to duplicate this product: https://jmp.sh/6fw3FJu
  7. The product has been duplicated successfully: https://jmp.sh/LvEIsXa
  8. Now we're going to change the context to Shop 1: https://jmp.sh/hwqCr3U (As we can see in the image, the product duplication is working successfully for the first shop, check the name and the description of the product)
  9. Now we're going to change the context to Shop 2: https://jmp.sh/5xfP8Au (As we can see again in the image, the product duplication has taken the information of the first shop to the second shop, check the name and the description of the product)

PrestaShop version(s) where the bug happened

1.7.7.0 to 1.7.8.1

PHP version(s) where the bug happened

7.3

If your bug is related to a module, specify its name and its version

No response

@hadran9 hadran9 added the Bug Type: Bug label Dec 30, 2021
@hibatallahAouadni hibatallahAouadni changed the title Duplicating a porduct in multistore context Duplicate a product in multistore context Dec 30, 2021
@hibatallahAouadni
Copy link
Contributor

Hello @hadran9

Your issue seems related to this one #14958
Could you please check it and feedback.

Thanks!

@hibatallahAouadni hibatallahAouadni added 1.7.7.0 Affects versions Multistore Label: Which BO under menu is concerned NMI Status: issue needs more information Old Products Page Concerns the old product page BO Category: Back Office labels Dec 30, 2021
@hadran9
Copy link
Author

hadran9 commented Dec 31, 2021

Hello @hibatallahAouadni, Thank you for your reply,

Actually I'm aware of that issue, and I'm aware of the updates that you've made on the files.
But the problem is when you guys have fixed the issue, you have only fixed the price, and let everything else untouched.

You have only changed the method duplicatePrices in the class Product, and you've let all the other duplication method untouched.

Here's a code snippet of the duplication method duplicateProduct() which is located in src/Adapter/Product/AdminProductDataUpdater.php:

                    && Category::duplicateProductCategories($id_product_old, $product->id)
                    && Product::duplicateSuppliers($id_product_old, $product->id) 
                    && ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
                    && GroupReduction::duplicateReduction($id_product_old, $product->id)
                    && Product::duplicateAccessories($id_product_old, $product->id) 
                    && Product::duplicateFeatures($id_product_old, $product->id)
                    && Product::duplicateSpecificPrices($id_product_old, $product->id)
                    && Pack::duplicate($id_product_old, $product->id)
                    && Product::duplicateCustomizationFields($id_product_old, $product->id)
                    && Product::duplicatePrices($id_product_old, $product->id)
                    && Product::duplicateTags($id_product_old, $product->id)
                    && Product::duplicateTaxes($id_product_old, $product->id)
                    && Product::duplicateDownload($id_product_old, $product->id)) 

As you can see above, the only method that have been fixed in the PR #14958 was duplicatePrices(), and all the other ones are still the same.

I hope that this will help, if you need more information feel free to ask. I'll try to answer you ASAP.

@hibatallahAouadni
Copy link
Contributor

Hello @hadran9

Thanks for the clarification 🙏
I reproduce the issue with PS1778 and PS1782, see the attached screen record below:

https://watch.screencastify.com/v/JWz2Rzqfc632IT6Ug2tL

I’ll add this to the debug backlog so that it’s fixed.

Please be aware that due to the high number of reported issues, some bugs might take a very long time to be resolved. If this issue is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider hiring a specialist to help you.

If you manage to get the problem fixed, then please contribute the fix back to the project as a Pull Request. Remember that the more people contribute, the better PrestaShop becomes for everyone.

Thanks!

@hibatallahAouadni hibatallahAouadni added Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Needs Specs Status: issue needs to be specified Verified The issue has been reproduced and removed NMI Status: issue needs more information labels Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.7.0 Affects versions BO Category: Back Office Bug Type: Bug Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Multistore Label: Which BO under menu is concerned Needs Specs Status: issue needs to be specified Old Products Page Concerns the old product page Verified The issue has been reproduced
Projects
None yet
Development

No branches or pull requests

2 participants