Announcement

Collapse
No announcement yet.

Restrict adding an item to the Cart if the Cart is empty.

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

    Restrict adding an item to the Cart if the Cart is empty.

    My goal is to prevent adding a specific product to the cart if the cart is empty, and to pop up a message explaining why it can't be added. The item is not cost-effective to ship unless it is with something else, so there is a price, but no shipping cost.

    The solution could be a module, or it might just be some code (for the specific product) so that when the add to cart button is clicked:
    If the cart is empty, display "You must first have another item in your cart." - EXIT.

    I realize that the customer could then remove everything except for the free-ship item, but there is already a note in the description stating that the item can only be purchased with another item (a note which customers miss or ignore) so cancelling an occasional order wouldn't be as big of a problem as the frequent orders are now.

    #2
    Re: Restrict adding an item to the Cart if the Cart is empty.

    <mvt:comment>Check if the basket is empty:</mvt:comment>
    <mvt:foreach iterator="item" array="basket:items">
    <mvt:assign name="g.basket_empty" value=" 'N' " />
    </mvt:foreach>
    Last edited by wajake41; 10-08-15, 12:46 PM.
    Larry
    Luce Kanun Web Design
    www.facebook.com/wajake41
    www.plus.google.com/116415026668025242914/posts?hl=en


    Comment


      #3
      Re: Restrict adding an item to the Cart if the Cart is empty.

      All you really need is a conditional. If the basket it empty, display a message instead of the Add button.
      Best,
      Pamela

      Consultant / Developer / Trainer
      Contributing Editor to Practical Ecommerce
      Author of the Official Guides for Miva Merchant
      pamelahazelton.com

      Comment

      Working...
      X