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

Old price excluding TAX is incorrectly replaced by JavaScript #11998

Closed
VesnaS opened this issue Nov 3, 2017 · 38 comments · May be fixed by #34983
Closed

Old price excluding TAX is incorrectly replaced by JavaScript #11998

VesnaS opened this issue Nov 3, 2017 · 38 comments · May be fixed by #34983
Assignees
Labels
Component: Catalog Component: Tax Issue: needs update Additional information is require, waiting for response Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@VesnaS
Copy link

VesnaS commented Nov 3, 2017

Preconditions

  1. Tested on Magento versions 2.4-develop
  2. PHP 7.2

Steps to reproduce

  1. In Admin, set Stores -> Configuration -> SALES -> Tax -> Price Display Settings -> Display Product Prices In Catalog to "Including and Excluding Tax"
  2. Configure tax class and set it for the product
  3. Set special price for the product
  4. In vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml, set "skip_adjustments" to FALSE for "old-price"

Expected result

  1. On product detail view page in frontend, old price and new price are displayed with and without TAX

Actual result

  1. New price and old price excluding TAX are the same. This happens because JavaScript in vendor/magento/module-catalog/view/base/web/js/price-box.js replaces prices incorrectly.

old_price_bug_report

@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 3, 2017
@magento-engcom-team
Copy link
Contributor

@VesnaS, thank you for your report.
We've created internal ticket(s) MAGETWO-83250 to track progress on the issue.

@joachimVT
Copy link

I can confirm this having the same issue on version 2.2.2

schermafbeelding 2017-12-18 om 14 50 08

@MaximilianSchwarz
Copy link

I have the same issue in Magento 2.2.2. Is there any new information about this bug?

@HashDefineElectronics
Copy link

HashDefineElectronics commented May 27, 2018

Hi All,

My Issue

When the store is configure to allow both Include and Exclude tax to be display on the product page then the following happens to me.

On products with special price enabled, The
special price value for excluding tax will be set to Old price excluding tax.
This is because the Excluding tax html element for Special price and Old price using the same price type. This means that price-box.js is unable to differentiate between prices when it loads.

tax price issue

Ideally, which ever code set the data-price-type for each of these element should also make sure that it take into account that when both tax types are displayed.

The quick solution

My quick fix is to override the data-price-type value before price-box.js store the price options.

Steps

  • First copy MAGE_ROOT/app/code/Magento/Catalog/view/base/web/js/price-box.js to your theme or module. (ie MAGE_ROOT/app/design/frontend/VENDOR/YOUR_THEME/Magento_Catalog/web/js/my-price-box.js
  • update the requirejs-config.js from your module: (*MAGE_ROOT/app/design/frontend/VENDOR/YOUR_THEME/Magento_Catalog/requirejs-config.js)
var config = {
    map: {
        '*': {
               priceBox:'Magento_Catalog/js/my-price-box',
        }
   }
};
  • Insert the following code into function _setDefaultsFromDataSet after line 191 in marv-price-box.js.
label = $(element).data('label')
if(type && label) {
    type += label;
}

It should look like this:


        /**
         * setDefaultsFromDataSet
         */
        _setDefaultsFromDataSet: function _setDefaultsFromDataSet() {
            var box = this.element,
                priceHolders = $('[data-price-type]', box),
                prices = this.options.prices;

            this.options.productId = box.data('productId');

            if (_.isEmpty(prices)) {
                priceHolders.each(function (index, element) {
                    var type = $(element).data('priceType'),
                        label = $(element).data('label'),
                        amount = parseFloat($(element).data('priceAmount'));

                    $(element).data('priceType', type + label)

                    if(type && label) {
                       type += label;
                    }

                    if (type && !_.isNaN(amount)) {
                        prices[type] = {
                            amount: amount
                        };
                    }
                });
            }
        },

@malikt
Copy link

malikt commented Jun 30, 2018

Any solution to this issue?

@malikt
Copy link

malikt commented Jun 30, 2018

i was able to do a quick fix for it, but it will be a good to have a better and permanent solution by the team.

@DanielRuf
Copy link
Contributor

i was able to do a quick fix for it

Can you show it for us?

@duckchip
Copy link
Contributor

@magento-engcom-team Any news on this issue?

@melaniajitaru
Copy link

Hi,

This error also appears in Magento 2.3.3. Do you have any news on how to fix it? @magento-engcom-team

Thanks.

@engcom-Alfa engcom-Alfa self-assigned this Dec 26, 2019
@m2-assistant
Copy link

m2-assistant bot commented Dec 26, 2019

Hi @engcom-Alfa. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@engcom-Alfa engcom-Alfa added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Component: Tax Component: Catalog and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Dec 26, 2019
@Krielkip
Copy link
Contributor

@LeanderFS nice found 👍 (I haven't used tier prices for this use case)

@engcom-Lima
Copy link
Contributor

Hi @VesnaS,

Thank you for reporting the issue.

I have tried this issue on the fresh installation Magento 2.4-dev but I am not able to reproduce it.
Steps followed to reproduce the issue:

  1. In Admin, set Stores -> Configuration -> SALES -> Tax -> Price Display Settings -> Display Product Prices In Catalog to "Including and Excluding Tax"
  2. Configure tax class and set it for the product
  3. Set special price for the product
  4. In vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml, set "skip_adjustments" to FALSE for "old-price"

Output: On product detail view page in frontend, old price and new price are displayed with and without TAX
Screenshot from 2022-02-02 19-03-39

Kindly recheck the issue on Magento 2.4-develop branch and elaborate the steps if the issue is still reproducible.
Thank you.

@engcom-Lima engcom-Lima added Issue: needs update Additional information is require, waiting for response Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch and removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch labels Feb 2, 2022
@sdzhepa sdzhepa removed Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. labels Feb 9, 2022
@Krielkip
Copy link
Contributor

Krielkip commented Feb 9, 2022

22 days ago

Hi @engcom-Lima ,
You need to follow the actions told by @LeanderFS .
See reply:
#11998 (comment)

@m2-assistant
Copy link

m2-assistant bot commented Aug 3, 2022

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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@engcom-Bravo
Copy link
Contributor

Hi @VesnaS

Thank you for reporting and collaboration.
Verified the issue on Magento 2.4-develop branch but could not able to reproduce the issue.
Followed above comment

Kindly refer this video,If I am missing anything steps please provide information.
Please try to check in latest 2.4 develop branch with Php 8.1.

Thanks.

@engcom-Bravo
Copy link
Contributor

Hi @VesnaS,

We have noticed that this issue has not been updated for a period of 14 Days.
Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Component: Tax Issue: needs update Additional information is require, waiting for response Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging a pull request may close this issue.