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

Original price not shown crossed out before configurable option chosen in 2.1.3 #8670

Closed
maderlock opened this issue Feb 24, 2017 · 3 comments
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@maderlock
Copy link

Preconditions

  1. Magento CE 2.1.3, php 7

Steps to reproduce

  1. Create a configurable product with options
  2. Set price and special price the same on all options
  3. View product view page of product on frontend

Expected result

  1. Original price to be shown crossed out

Actual result

  1. Original price is hidden until an option is chosen

It looks like this was introduced due to #5097. The new JS code checks the selected option and hides the original price if there is no special price difference for that option. The problem is that it also hides the original price if there is no option selected - as is the case on page load. So none of the original prices are initially showing.

The fix seems to be to remove the "no-display" from the original price, and change the condition to do nothing if there is no option selected.

Given how long ago 2.1.3 came out and how basic this problem, I'm wondering if I'm missing something here...?

@maderlock
Copy link
Author

My current workaround for this is a module with frontend requirejs-config.js:

var config = {
config: {
    mixins: {
        'Magento_ConfigurableProduct/js/configurable': {
            'C3_Magento2Fixes/js/configurable': true
        }
    }
}
};

And a mixin in the frontend/web/js of the same module with the following change of logic:

define([
    'jquery'
], function ($) {
    'use strict';

    return function (target) {
        /**
         * @mod Change the logic so that 'undefined' optionIds are left showing
         */
        target.prototype._displayRegularPriceBlock = function (optionId) {
            if (typeof optionId == 'undefined'
                || this.options.spConfig.optionPrices[optionId].oldPrice.amount
                != this.options.spConfig.optionPrices[optionId].finalPrice.amount
            ) {
                $(this.options.slyOldPriceSelector).show();
            } else {
                $(this.options.slyOldPriceSelector).hide();
            }
        };

        return target;
    };
});

The change is really small - the change of '!=' to '=='for optionId == 'undefined', and following it by a || rather than a &&.

@magento-engcom-team magento-engcom-team added G1 Passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 2.1.x Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed non-issue Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release labels Sep 28, 2017
@magento-engcom-team
Copy link
Contributor

@maderlock, thank you for your report.
This seems to be correct Magento behavior. Please refer to the Community Forums or the Magento Stack Exchange site for advice or general discussion about this.
Otherwise you may submit Pull Request with the suggested changes.

Kipperlenny added a commit to Kipperlenny/firegento-magesetup2 that referenced this issue Nov 13, 2017
@ladle3000
Copy link

As far as i can tell this issue stands in 2.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests

3 participants