-
-
Save steveosoule/0afcaf8c8688cd9f7a925cf08d33b6b1 to your computer and use it in GitHub Desktop.
Group Products Codes together into new array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mvt:foreach iterator="group" array="basket:groups"> | |
<mvt:comment> <!-- Build Dynamic Array --> </mvt:comment> | |
<mvt:if expr="miva_array_search( l.settings:new_array, 0, l.item, 'l.item:code EQ l.settings:group:code' )"> | |
<mvt:assign name="l.item:quantity" value="l.item:quantity + l.settings:group:quantity" /> | |
<mvt:else> | |
<mvt:assign name="l.success" value="miva_array_insert( l.settings:new_array, l.settings:group, -1 )" /> | |
</mvt:if> | |
<mvt:comment> <!-- Build Dynamic Array --> </mvt:comment> | |
</mvt:foreach> | |
<mvt:foreach iterator="item" array="new_array"> | |
&mvt:item:code; // Total: &mvt:item:quantity; | |
</mvt:foreach> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment