Announcement

Collapse
No announcement yet.

Basket groups vs. basket items

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Basket groups vs. basket items

    Can someone please explain why basket groups exist, and how they are used?

    In my experience, it seems like basket:groups and basket:items are almost always identical. But I've written a lot of modules that work with BasketItems, and I'm concerned that they may not work correctly in some cases.

    My impression is that groups are identical to lines, except when the store uses "Buy X Get Y" discounts, in which case groups are used to link the X's and Y's. Also, there are apparently some cases where the store will take a single BasketItem with a quantity greater than 1, and split it into several BasketItems that each have a quantity of 1. But I don't know exactly when that happens, and when the items are merged back together.

    Can I get a complete explanation of how and when groups are different from item, please?

    Thanks --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    #2
    basket:groups was introduced when Miva 9 was released back in 2014. It's meant to replace the basket:items array so it is mostly identical. However it does support "grouping" line items in the basket when discounts are being applied which is why it was added in the first place.

    Here is an example of what it does.

    Lets say you had a price group for Buy X Get Y. where if you but 2 items you get 1 free. Using basket:items array here is how that looks in the basket:. There are 2 basket line items and one is free.
    basket_items.png



    Now with basket:groups, Miva is able to identify that the free item is the same as the other non-free items so it groups them together into a single line item in the basket. It creates a better end user experience.


    basket_groups.png

    We kept basket:items for backwards compatibility but all default templates use basket:groups.

    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Hi Brennan, thanks for helping with this. A couple of follow-up questions:

      1. Continuing the above example, will there be 2 BasketItems in the DB? And 2 OrderItems after the order is completed?

      2. Besides Buy X Get Y discounts, are there any other cases where basket:groups will be different from basket:items?

      Thanks --
      Kent Multer
      Magic Metal Productions
      http://TheMagicM.com
      * Web developer/designer
      * E-commerce and Miva
      * Author, The Official Miva Web Scripting Book -- available on-line:
      http://www.amazon.com/exec/obidos/IS...icmetalproducA

      Comment

      Working...
      X