Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <mvt:comment>
  2. | ------------------------------------------------
  3. | Variant Basket Item Replacement (VBIR) with fix for Skipped Replacements
  4. | ------------------------------------------------
  5. | This custom functionality replicates the VBIR module,
  6. | The main difference is that the standard VBIR module ties into the ADPR, ADPM, actions and sometimes products item don't get updated.
  7. | This code will always ensure that the basket item codes are updated.
  8. </mvt:comment>
  9.  
  10. <mvt:foreach iterator="item" array="basket:items">
  11.  
  12. <mvt:comment>
  13. | We only need to do this process for items with a single variant part
  14. </mvt:comment>
  15. <mvt:if expr="miva_array_elements( l.settings:item:parts ) NE 1 ">
  16. <mvt:foreachcontinue/>
  17. </mvt:if>
  18.  
  19. <mvt:comment>
  20. | Update the DB with our custom variant code logic
  21. </mvt:comment>
  22. <mvt:if expr="l.settings:item:parts[1]:code NE l.settings:item:code">
  23. <mvt:assign name="l.settings:query:query" value="'UPDATE ' $ g.Store_Table_Prefix $ 'BasketItems SET code = ? WHERE line_id = ?'" />
  24. <mvt:assign name="l.settings:query:bind_parameters[1]" value="l.settings:item:parts[1]:code" />
  25. <mvt:assign name="l.settings:query:bind_parameters[2]" value="l.settings:item:line_id" />
  26. <mvt:item name="sql" param="l.settings:query"/>
  27.  
  28. <mvt:comment>
  29. | Update the current page's `l.settings:basket:items[]:code` and `l.settings:basket:groups[]:code` values for the current element
  30. </mvt:comment>
  31. <mvt:assign name="l.settings:item:code" value="l.settings:item:parts[1]:code" />
  32. <mvt:assign name="l.result" value="miva_array_search( l.settings:basket:groups, POS1, l.group, 'l.settings:item:code EQ l.group:code' )" />
  33. <mvt:assign name="l.group:code" value="l.settings:item:parts[1]:code" />
  34. </mvt:if>
  35.  
  36.  
  37. </mvt:foreach>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement