Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Ordered.php not sorting properly on 1.9.2.4 branch #123

Open
experius-nl opened this issue Oct 3, 2017 · 1 comment
Open

Ordered.php not sorting properly on 1.9.2.4 branch #123

experius-nl opened this issue Oct 3, 2017 · 1 comment

Comments

@experius-nl
Copy link

experius-nl commented Oct 3, 2017

With the current implementation it is still possible for the Collections to be ordered incorrectly.

Example:

If you take the below (simplified) XML. First tax is moved up because of its before clause, then tax is moved down again because of its after clause. This causes grand_total to be in the wrong spot, but at the time that grand_total was checked it was in the correct spot.

            <nominal>
                <before>subtotal</before>
            </nominal>
            <tax_subtotal>
                <after>freeshipping</after>
                <before>tax,discount</before>
            </tax_subtotal>
            <subtotal>
                <after>nominal</after>
                <before>grand_total</before>
            </subtotal>
            <shipping>
                <after>subtotal,freeshipping,tax_subtotal</after>
                <before>grand_total</before>
            </shipping>
            <grand_total>
                <after>subtotal</after>
            </grand_total>
            <tax_shipping>
                <after>shipping,tax_subtotal</after>
                <before>tax,discount</before>
            </tax_shipping>
            <tax>
                <after>subtotal,shipping</after>
                <before>grand_total</before>
            </tax>

Expected sorting order:
[0] => nominal
[1] => tax_subtotal
[2] => subtotal
[3] => shipping
[4] => tax_shipping
[5] => tax
[6] => grand_total

Actual sorting order:
[0] => nominal
[1] => tax_subtotal
[2] => subtotal
[3] => shipping
[4] => grand_total
[5] => tax_shipping
[6] => tax

@ZieClaw
Copy link

ZieClaw commented Oct 31, 2017

Hello @experius-nl I was having exactly the same issue, look at the issue I opened I have included a fix for this problem. This is due to usort working diffrently in PHP 7 and Magento not adding a sort order to the mrsp which causes it to go crazy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants