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

Configurable product with swatches, doesn't show tier pricing when clicking edit in cart OR when active swatch set with url hash #28270

Closed
pixiemediaweb opened this issue May 18, 2020 · 28 comments · Fixed by #29137
Assignees
Labels
Component: Admin Fixed in 2.4.x The issue has been fixed in 2.4-develop branch 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 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Triage: Done Has been reviewed and prioritized during Triage with Product Managers

Comments

@pixiemediaweb
Copy link

pixiemediaweb commented May 18, 2020

Preconditions (*)

  1. Magento 2.3.5

Steps to reproduce (*)

  1. Create a configurable product with swatch options
  2. Add tier prices to one of the options
  3. Go to configurable product PDP
  4. Select the tier price product
  5. Add the product to cart
  6. Click on edit button from mini cart/ cart page
  7. Check the tier price is not shown on edit product page
  8. Load the page with #attribute_id=value_id to preset the swatch value

Expected result (*)

  1. Tier price block should show

Actual result (*)

  1. Tier price does not show

Solution (*)

The issue lies in file;
/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js

The function _UpdatePrice: function () { has a dependency on if this.options.tierPriceTemplate being defined on hashed options being set on load, which it isnt.

Here's the change to ensure it gets defined;

Before:

_UpdatePrice: function () {
        var $widget = this,
            $product = $widget.element.parents($widget.options.selectorProduct),
            $productPrice = $product.find(this.options.selectorProductPrice),
            result = $widget._getNewPrices(),
            tierPriceHtml,
            isShow;

        $productPrice.trigger(
            'updatePrice',
            {
                'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
            }
        );

        isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;

        $product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();

        if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {
            if (this.options.tierPriceTemplate) {
                tierPriceHtml = mageTemplate(
                    this.options.tierPriceTemplate,
                    {
                        'tierPrices': result.tierPrices,
                        '$t': $t,
                        'currencyFormat': this.options.jsonConfig.currencyFormat,
                        'priceUtils': priceUtils
                    }
                );
                $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();
            } 

After;

_UpdatePrice: function () {
        var $widget = this,
            $product = $widget.element.parents($widget.options.selectorProduct),
            $productPrice = $product.find(this.options.selectorProductPrice),
            result = $widget._getNewPrices(),
            tierPriceHtml,
            isShow;

        $productPrice.trigger(
            'updatePrice',
            {
                'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
            }
        );

        isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;

        $product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();

        if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {
            // ADDED HERE
            if (this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html()) {
                tierPriceHtml = mageTemplate(
                    this.options.tierPriceTemplate,
                    {
                        'tierPrices': result.tierPrices,
                        '$t': $t,
                        'currencyFormat': this.options.jsonConfig.currencyFormat,
                        'priceUtils': priceUtils
                    }
                );
                $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();
            }

Additional information
more detailed steps and screens #28270 (Comment)

@m2-assistant
Copy link

m2-assistant bot commented May 18, 2020

Hi @pixiemediaweb. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Add a comment to Assigning an issue: @magento I am working on this


@ghost ghost added this to Ready for QA in Community Backlog May 18, 2020
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label May 18, 2020
@swathishs swathishs self-assigned this May 29, 2020
@m2-assistant
Copy link

m2-assistant bot commented May 29, 2020

Hi @swathishs. 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.

@swathishs
Copy link

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @swathishs. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @swathishs, here is your Magento instance.
Admin access: https://i-28270-2-4-develop.instances.magento-community.engineering/admin_bac1
Login: 9a4a9882 Password: 351d853ea175
Instance will be terminated in up to 3 hours.

@swathishs
Copy link

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @swathishs. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@swathishs
Copy link

@pixiemediaweb: I have created a configurable product with color swatch options and tried to pre-set the value. But couldn't able to select the red option in my scenario. Please find the attachment below for reference
image
Link-https://i-28461-2-4-develop.instances.magento-community.engineering/config-product-by-ajith.html#color=red

Could you give some more information on how to pre-set the #attribute_id=value_id

@swathishs
Copy link

Hi @pixiemediaweb
Feel free to reopen once you update the comment
Thanks !!

@ghost ghost moved this from Ready for QA to Done (last 30 days) in Community Backlog Jun 16, 2020
@pixiemediaweb
Copy link
Author

@swathishs - you need to use the attribute ID and value ID in the hash. It will look something like #123=56 where 123 is the attribute ID for colour and 56 is the value for red

@pixiemediaweb
Copy link
Author

Hi @pixiemediaweb
Feel free to reopen once you update the comment
Thanks !!

I cant reopen it because you closed it. I provided the complete cause and the solution in my original post, can you reopen please

@swathishs swathishs reopened this Jun 24, 2020
@ghost ghost unassigned swathishs Jun 24, 2020
@ghost ghost moved this from Done (last 30 days) to Ready for QA in Community Backlog Jun 24, 2020
@swathishs swathishs self-assigned this Jun 24, 2020
@swathishs
Copy link

@pixiemediaweb : Could you please provide extra steps to reproduce the issue and it will be helpful if you put the screenshot

@pixiemediaweb
Copy link
Author

Hi @swathishs - no problem, might be easier if you could resurrect a demo instance with a configurable swatch product so I can show you how M2 natively supports pre-selecting of configurable options by their option and value IDs

@swathishs
Copy link

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @swathishs. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @swathishs, here is your Magento instance.
Admin access: https://i-28270-2-4-develop.instances.magento-community.engineering/admin_de9e
Login: 27b16d64 Password: 41d56df9d1bf
Instance will be terminated in up to 3 hours.

@ghost ghost moved this from Ready for Dev to PR In Progress in Community Backlog Jul 15, 2020
srsathish92 added a commit to srsathish92/magento2 that referenced this issue Jul 15, 2020
@engcom-Alfa engcom-Alfa added the Triage: Ready for Triage Issue is ready to me triaged with Product Manager label Jul 18, 2020
@ghost ghost added the Priority: P3 May be fixed according to the position in the backlog. label Jul 20, 2020
@engcom-Alfa engcom-Alfa added Triage: Done Has been reviewed and prioritized during Triage with Product Managers and removed Triage: Ready for Triage Issue is ready to me triaged with Product Manager labels Jul 20, 2020
@ghost ghost moved this from PR In Progress to Ready for Dev in Community Backlog Jul 21, 2020
@ghost ghost assigned engcom-Kilo Jul 22, 2020
@ghost ghost moved this from Ready for Dev to PR In Progress in Community Backlog Jul 22, 2020
@engcom-Alfa
Copy link
Contributor

Hi @pixiemediaweb . Thanks for collaboration. This PR was reviewed on Community Contribution Triage meeting. The recording of the meeting you can look by the link

@slavvka slavvka added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jul 29, 2020
@slavvka slavvka closed this as completed Jul 29, 2020
@ghost ghost moved this from PR In Progress to Done (last 30 days) in Community Backlog Jul 29, 2020
magento-engcom-team added a commit that referenced this issue Jul 29, 2020
…t edit #29137

 - Merge Pull Request #29137 from srsathish92/magento2:bug/28270-config-prod-via-edit-cart-with-tier-price
 - Merged commits:
   1. 2765164
   2. d516e27
   3. c5e4aa5
   4. 13f5cae
   5. 59c187f
   6. 7d0d91d
   7. 22c74f9
   8. 441e2cd
@magento-engcom-team magento-engcom-team added the Reported on 2.3.5 Indicates original Magento version for the Issue report. label Nov 13, 2020
@m2-community-project m2-community-project bot removed this from Done (last 30 days) in Community Backlog Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Fixed in 2.4.x The issue has been fixed in 2.4-develop branch 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 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Triage: Done Has been reviewed and prioritized during Triage with Product Managers
Projects
Development

Successfully merging a pull request may close this issue.

7 participants