Remove coupon code if customer logs out or if basket is empty

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • heatherwebdev
    Mivite

    • May 2017
    • 157

    #1

    Remove coupon code if customer logs out or if basket is empty

    Hi, I'm wondering if theres a way to get any coupon codes in the basket to remove if the basket is empty or the customer logs out. I cant find any info on how they are set to expire, I assume its a cookie.
  • Kent Multer
    Mega Mivite









    • Mar 2006
    • 3253

    #2
    Baskets expire after a certain amount of time with no activity by the shopper. The expiration time is controlled by an admin setting. The default setting is 60 minutes, but some store owners make it longer -- hours, or even days -- so that shopper's basket contents will remain for a longer time.
    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

    • heatherwebdev
      Mivite

      • May 2017
      • 157

      #3
      So the coupon expires with the basket? Is there a way that I can remove the coupon when the basket is emptied?

      Comment

      • Bruce - PhosphorMedia
        Developer Partner











        • Mar 2006
        • 11257

        #4
        Certianly doable. There are a bunch of Basket/Coupon functions in the API docs https://docs.miva.com/api-functions.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment

        • heatherwebdev
          Mivite

          • May 2017
          • 157

          #5
          I've tried this at the beginning of my basket page and its not deleting my coupon, do I have the wrong value in there or should it be placed somewhere particular?

          <mvt:do file="g.Module_Feature_PGR_DB" name="l.success" value="BasketCoupon_Delete_All_Coupon(l.settings:c oupon:id)" />

          Comment

          • Bruce - PhosphorMedia
            Developer Partner











            • Mar 2006
            • 11257

            #6
            I suspect that function (since its using an 'id' parameter) needs to be inside a loop that is generating a list of coupons. Try using:

            <mvt:do file="g.Module_Feature_PGR_DB" name="l.success" value="BasketCoupon_Delete_All_Basket(g.basket:bas ket_id)" />

            (Note, have not specifically used this function before--at least not in templates so...)

            Probably put this in the "Empty Basket" section.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment

            • heatherwebdev
              Mivite

              • May 2017
              • 157

              #7
              Thanks for that, it does show the coupon code removed from the basket page, but when I go to the next page, I can still the discount still being applied

              Comment

              Working...
              X