magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Special Price/Cost price being overwritten on product save in alternate storeview - price scope website #37579

Closed IanFiretoys closed 11 months ago

IanFiretoys commented 1 year ago

Preconditions and environment

Steps to reproduce

  1. open product
  2. set special price in default storeview
  3. save product
  4. switch to secondary storeview
  5. open advanced pricing and untick use default on special price
  6. overwrite special price with blank entry
  7. save product

Expected result

special price field is set to empty, essentially removing it from that storeview

Actual result

special price field is set back to "use default"

I would suspect this is an issue with the way empty decimals are being written to the DB, but other important front facing decimals (such as price) aren't able to be left blank.

the same issue occurs with cost price, so that confirms this.

Additional information

this is a bug introduced in 2.4.5, it appears. so if you have an existing database with special prices set to empty in non-default storeviews, if you open and save any product in a non default storeview, regardless of whether you're changing the price. as soon as you hit save, that product will be using the default storeview's special price.

this is catastrophic in circumstances where a) currencies are different, as a 5% discount in GBP on the default storeview could end up as a 95% discount in JPY b) there is an expired special price in the default storeview, as the special price dates are unaffected. so if

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @IanFiretoys. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

IanFiretoys commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @IanFiretoys. Thank you for your request. I'm working on Magento instance for you.

m2-assistant[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

magento-deployment-service[bot] commented 1 year ago

Hi @IanFiretoys, here is your Magento Instance: https://0b59edc1933d779f263f10a15b803753.instances-prod.magento-community.engineering Admin access: https://0b59edc1933d779f263f10a15b803753.instances-prod.magento-community.engineering/admin_8990 Login: b2d20061 Password: 53ea1f5aec0a

IanFiretoys commented 1 year ago

confirmed on 2.4-develop

IanFiretoys commented 1 year ago

currently our only way to set the special price back to blank is with update attributes, which presumably bypasses the save function of the regular product updates

engcom-Bravo commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo, here is your Magento Instance: https://0b59edc1933d779f263f10a15b803753.instances-prod.magento-community.engineering Admin access: https://0b59edc1933d779f263f10a15b803753.instances-prod.magento-community.engineering/admin_cfc3 Login: f18e93ed Password: 3e3ad0717207

engcom-Bravo commented 1 year ago

Hi @IanFiretoys,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is reproducible.Kindly refer the attached video.

Steps to reproduce

Even though we are updating special price for default store view the same price is updating in another store view and also when we untick the use default value and remove special price in another store view after saving it is again ticking the use default value automatically.

https://github.com/magento/magento2/assets/51680745/4cd32a48-444d-4435-b6c2-f9e56f021a66

Hence confirming this issue.

Thanks.

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-8938 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

aasim110 commented 1 year ago

@magento I'm working on this

Aditya-Prakash-Talluru commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @Aditya-Prakash-Talluru. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @Aditya-Prakash-Talluru, here is your Magento Instance: https://0b59edc1933d779f263f10a15b803753.instances-prod.magento-community.engineering Admin access: https://0b59edc1933d779f263f10a15b803753.instances-prod.magento-community.engineering/admin_f80c Login: 67f84048 Password: 6fbd33c0251e

Aditya-Prakash-Talluru commented 1 year ago

@magento I have tried to reproduce the issue in the instance but i am unable to find the use default option under the special price in advance price option.

I followed all the steps as mentioned.

Screenshot 2023-07-17 at 5 30 00 PM Screenshot 2023-07-17 at 5 30 30 PM
IanFiretoys commented 1 year ago

are you following the preconditions also? make sure that the store tree is set up correctly and you have price scope set to website.

Aditya-Prakash-Talluru commented 1 year ago

@IanFiretoys I am able to reproduce the issue.

Aditya-Prakash-Talluru commented 1 year ago

@magento I am working on this

m2-assistant[bot] commented 1 year ago

Hi @Aditya-Prakash-Talluru! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

Aditya-Prakash-Talluru commented 1 year ago

@magento add to contributors team

m2-assistant[bot] commented 1 year ago

Hi @Aditya-Prakash-Talluru! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.

Aditya-Prakash-Talluru commented 1 year ago

@magento I am working on this

Aditya-Prakash-Talluru commented 1 year ago

pecial price field is set back to "use default"

@IanFiretoys @engcom-Bravo

On creating a new product the and special price is not set then the value of the special price is set to null.

On moving to the default store view of the product and checking the advance the price the advance price is already set null with respect to the all store view price. If we remove the default option and change the special price to a value and saving the product.

The same value can be view across all the stores and store views across the website because the scope is set to Website level so the value persists across the website.



On moving to different website checking a store view the special price does not match with the default store view of the Main website.

For changing the price to null the default option is getting linked because Special Price Advance Price.zip the default price of all store views is null and that value is getting inherited.

In the above video new website is created

Aditya-Prakash-Talluru commented 1 year ago

Creates Two Branches : Main Website->Main Website Store ->Default Store view ->Main Website Store-> New Store View

        Main Website ->New store -> New Store View.

        Demo Test Website->Demo Store-> Demo Store view.    
image

On creating a new product the and special price is not set then the value of the special price is set to empty on all store view.

image

On changing the scope from all the store view to the main website-> main store –> default store view and checking the special price value is empty and default price option is ticked.

image

Same with different store view in same store and different store view in different store the value is empty and default is ticked. Main Website ->Main Website Store-> New Store View Main Website ->New store -> New Store View.

If we move to different website and check the store view which is an entirely new tree of Demo Test Website->Demo Store-> Demo Store view and we can see that the special price is set to empty and default price is ticked.

In the scope of product moving to ain Website->Main Website Store ->Default Store view. We untick the default special price and put in a custom special price value and save it.

image

The above same value is reflected across all the store views in that website.

On changing the scope to a different website Demo Test Website->Demo Store-> Demo Store view the price is empty and default value is ticked. This special price is not reflecting the value of the special price from the other website.

image

If the special price in the “All store view” is set then the default value of the these stores on empty will be set to that value as default value. As the price is set to scope: website that seem to be working correct and by default the special price is set to all store view in case of empty for a particular store by adobe commerce.

chittima commented 1 year ago

Internal team is working on this issue

MagentoGuysProjects commented 11 months ago

Do we have any patch available to fix this issue as soon as possible? as we are facing the same issue on magento 2.4.6-p3 version as well.

chittima commented 11 months ago

Hi @MagentoGuysProjects Here is the commit id: https://github.com/magento/magento2/commit/9d5edd1a322ded708dfed19e293b968fdc5b9a8c

o-iegorov commented 11 months ago

Issue is not reproducible on 2.4-develop anymore, closing

raulsinapsis commented 4 months ago

This is still happening in 2.4.6-p4 Not sure if the mentioned commit could fix this, as it seems to involve only admin visualization, but the problem is the data in database

We can't setSpecialPrice(null) programmatically in a concrete website if that product has a special_price value in default scope