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

Magento 2 reorder function not working properly #6121

Closed
simonxy opened this issue Aug 11, 2016 · 14 comments
Closed

Magento 2 reorder function not working properly #6121

simonxy opened this issue Aug 11, 2016 · 14 comments
Labels
bug report Component: Sales Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@simonxy
Copy link

simonxy commented Aug 11, 2016

Preconditions

  1. Magento 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, PHP 7.0.x, MySQL 5.6.x
  2. Any browser

Steps to reproduce

  1. login as customer, navigate to Account Dashboard, or Order List;
  2. On any existing order item, click "Reorder" button;
  3. The result shopping cart page shows item from previous order is added. however the bag icon is not updated, and popup minicart doesn't have the reorder item;

Expected result

  1. The bag icon and minicart should be updated accordingly.

Screenshots

  1. Resulting shopping cart
  2. Customer Dashboard, Order List
    3, Link to demo store
@apurv-anand
Copy link

apurv-anand commented Aug 12, 2016

+1. Our platform: M2.1
Please fix on priority or provide a workaround.

blank

@apurv-anand
Copy link

Please assign and act on this on priority. This looks like a major functional issue.

@katmoon katmoon self-assigned this Aug 16, 2016
@katmoon
Copy link
Contributor

katmoon commented Aug 16, 2016

Hi @simonxy @apurv-anand

Thank you for reporting the issue. It is reported as MAGETWO-54964 internally.

Thanks,
Kateryna.

@katmoon katmoon added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Aug 16, 2016
@katmoon katmoon removed their assignment Aug 16, 2016
@sshymko
Copy link

sshymko commented Sep 1, 2016

Experiencing the same issue here on Magento 2.1.
The mini cart does not get updated in result of the reorder.
Browser's local storage where the mini cart is cached only gets refreshed upon POST/PUT requests.
However, the reorder action is a regular link that results in an ordinary GET request.

@katmoon
Copy link
Contributor

katmoon commented Sep 1, 2016

The issue is resolved and will be available in 2.1.2 patch version.

@brideo
Copy link
Contributor

brideo commented Sep 22, 2016

Hey @katmoon,

Is there a commit or work around we can use until the next release?

@katmoon
Copy link
Contributor

katmoon commented Sep 22, 2016

Hi @brideo

The fix will be available with the next non-security patch release.

@sshymko
Copy link

sshymko commented Sep 22, 2016

@brideo,

I don't have access to the official patch, but I can share the workaround we use.
The idea is to listen to the reorder link clicks and invalidate the customer data in the local storage.

The Workaround
Add the following JavaScript to pages with the reorder links (via layout handle customer_account):

require([
    'jquery',
    'Magento_Customer/js/section-config',
    'Magento_Customer/js/customer-data',
    'domReady!'
], function ($, sectionConfig, customerData) {
    'use strict';

    /**
     * Elements - Reorder links
     */
    var s = [
        '.sales-order-view .order-actions-toolbar .actions .reorder',       // sales-order-view
        '.sales-order-history .table-order-items .actions .order',          // sales-order-history
        '.customer-account-index .table-order-items .actions .order',       // customer-account-index
    ];

    /**
     * Events listener
     */
    $(s.join(', ')).on('click', function(event) {
        var sections;

        // anchor contains span, target may be span instead of anchor
        var el = event.target.href ? event.target : event.target.parentElement;

        // check if this is really a redirect link
        if (el.href.match(/reorder/i)) {
            sections = sectionConfig.getAffectedSections(el.href);

            if (sections) {
                customerData.invalidate(sections);
            }
        }
    });

});

Please note that the official unreleased fix is likely very different from the workaround above. It probably changes the request method from GET to POST to match semantics of the operation: entity creation rather than retrieval.

@brideo
Copy link
Contributor

brideo commented Sep 22, 2016

Brilliant thanks @sshymko!

I will make a note to remove it when the next version of Magento is released.

@veloraven
Copy link
Contributor

This issue was fixed in 2.1.2. 2.0.10 and develop branch.
Closed.

@Bartlomiejsz
Copy link
Contributor

@veloraven can you please bring us a link to the commit where this issue was fixed in 2.1 branch?

@AndreKlang
Copy link

@veloraven @katmoon
Can you please do as @Bartlomiejsz asked and supply a reference to where/how this was fixed? Also in what release was this fixed in?

I'm still experiencing this on 2.1.5. I'm guessing that the previous (bad) vendor who made this site overwrote something, so the problem still exists..

@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Oct 26, 2017
@JMLucas96
Copy link

Issue still exists on magento 2.1.8, old prices not updating when reordering...
Any solution?

@JMLucas96
Copy link

Similar issue here #30663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Sales Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests