Announcement

Collapse
No announcement yet.

How do I clear a custom upcharge and update total on BASK?

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

    How do I clear a custom upcharge and update total on BASK?

    All this needs to happen on the same page without any reloads

    This clears a custom upcharge
    HTML Code:
    <mvt:assign name="g.customCharge:type" value="'CustomUpcharge'" />
    <mvt:do file="g.Module_Library_DB" name="l.successClearingCharges" value="BasketCharge_Delete_All_Type( g.basket:basket_id, g.customCharge:type )" />
    And This Reloads the basket charges:
    HTML Code:
    <mvt:do file="g.Module_Library_DB" name="l.successSettingItems" value="BasketChargeList_Load_Basket( g.basket:basket_id, l.settings:basket:groups )" />
    But how do I reload everything else because the "total" via &mvt:basket:formatted_total; is still including the cleared charges.
    Colin Puttick
    Miva Web Developer @ Glendale Designs

    #2
    Place your detection and delete code at the top of the page, and inside that conditional run the Template Render function:

    <mvt:do name="l.result" file="g.Module_Feature_TUI_MGR" value="TemplateManager_Render_Page( 'ABUS' )" />

    It does mean you are loading the basket twice, but with SMT code, I think that's your only choice outside of doing the delete via ajax and rendering the page.
    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


      #3
      Bruce, that might work, I'm just wondering how that wouldn't cause an endless loop on the BASK page. Or maybe I need more coffee and should think about this again later.
      Colin Puttick
      Miva Web Developer @ Glendale Designs

      Comment


        #4
        The refresh would not have the conditional attached which triggered the changes.
        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


          #5
          It's possible to write some template code that will update basket variables such as :formatted_total to the correct values. Note that this code might have to be in the global header, in order to make sure that it updates the mini-basket display, if you're concerned about that.

          There are a couple of utility modules available that let you run template code during the "Action" processing, before the store starts rendering pages. One of these modules is available from me; let me know if you're interested in a copy.

          Also, FYI, there appears to be a bug in one of your code snippets. Your call to BasketChargeList_Load_Basket writes the data into l.settings:basket:groups; I think you want l.settings:basket:charges for that.
          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


            #6
            Personally, I'd do this as a custom module so everything that needs to happen can be done in between the 'update' post and the subsequent page load...if that's what Kent's module does, then that is the better route as you are not loading the page twice.
            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


              #7
              Originally posted by Bruce - PhosphorMedia View Post
              Personally, I'd do this as a custom module so everything that needs to happen can be done in between the 'update' post and the subsequent page load...if that's what Kent's module does, then that is the better route as you are not loading the page twice.
              Yes, that's what my module does. It uses page templates for the "custom" parts, so an off-the-shelf module can serve many purposes.
              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