Assign shipping_to_show / billing_to_show to a custom basket field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SidFeyDesigns
    Mighty Mivite








    • Jan 2012
    • 598

    #1

    Assign shipping_to_show / billing_to_show to a custom basket field

    Is there a way to assign the shipping_to_show or billing_to_show to a custom basket field?

    Trying to be able to write a conditional based on whether or not the checkbox was checked on OCST for the other checkout pages

    Example:

    If shipping_to_show EQ 1

    do this

    else if shipping_to_show EQ 0

    do this


    This is the current shipping controls code I have to work with for reference
    Code:
    <span id="shipping_controls" class="controls">
        <mvt:if expr="g.Action AND g.shipping_to_show">
            <input name="shipping_to_show" id="shipping_to_show" type="checkbox" value="1" class="checkbox" checked />
        <mvt:else>
            <input name="shipping_to_show" id="shipping_to_show" type="checkbox" value="1" class="checkbox" />
        </mvt:if>
        <label for="shipping_to_show" class="black" style="vertical-align:text-top">Same As Billing</label>
    </span>
    Thanks
    Nick Harkins
    www.loveisarose.com
  • Leanne
    Mega Mivite






    • Mar 2006
    • 2666

    #2
    Since shipping_to_show is being passed as a form input, it is available as a global variable on the following screen, and as long as you continue passing it and its value as an input, you can pass it along through the checkout (this is assuming you don't need this to become an order custom field for some reason).

    Comment

    • Bruce - PhosphorMedia
      Developer Partner











      • Mar 2006
      • 11256

      #3
      its sometimes easier though to, after the first form post, store the value of the variable (g.shipping_to_show in this case) in a custom basket field so you don't need to repost it in every form, just read it in the head section of 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

      • SidFeyDesigns
        Mighty Mivite








        • Jan 2012
        • 598

        #4
        Thank you Leanne for that input (pun intended ha), but I do agree with Bruce - PhosphorMedia

        I actually got it to work as a custom basket field.

        I left OCST as is:
        Code:
        <span id="shipping_controls" class="controls">
            <mvt:if expr="g.Action AND g.shipping_to_show">
                <input name="shipping_to_show" id="shipping_to_show" type="checkbox" value="1" class="checkbox" checked />
            <mvt:else>
                <input name="shipping_to_show" id="shipping_to_show" type="checkbox" value="1" class="checkbox" />
            </mvt:if>
            <label for="shipping_to_show" class="black" style="vertical-align:text-top">Same As Billing</label>
        </span>
        OSEL:
        Code:
        <mvt:if expr="NOT ISNULL g.shipping_to_show">
            <mvt:item name="customfields" param="Write_Basket( 'shipping_to_show', '1' )" />
            <a href="&mvt:urls:OCST:auto;" class="button button-mini bg-gray nb">Edit Address</a>
        <mvt:else>
            <mvt:item name="customfields" param="Write_Basket( 'shipping_to_show', '0' )" />
            <a href="&mvt:urls:OCST:auto_sep;shipping_to_show=0" class="button button-mini bg-gray nb">Edit Address</a>
        </mvt:if>
        OPAY:
        Code:
        <mvt:item name="customfields" param="Read_Basket( 'shipping_to_show', g.shipping_to_show)" />
        <mvt:if expr="g.shipping_to_show EQ 1">
            <a href="&mvt:urls:OCST:auto;" class="button button-mini bg-gray nb">Edit Address</a>
        <mvt:else>
            <a href="&mvt:urls:OCST:auto_sep;shipping_to_show=0" class="button button-mini bg-gray nb">Edit Address</a>
        </mvt:if>
        BASK:
        Code:
        <mvt:item name="customfields" param="Read_Basket( 'shipping_to_show', g.shipping_to_show)" />
        <mvt:if expr="g.shipping_to_show EQ 1">
            <a href="&mvte:urls:OCST:auto;" title="Proceed to Secure Checkout" class="button button-block button-large-font corners bg-sky black">Secure Checkout</a>
        <mvt:else>
            <a href="&mvte:urls:OCST:auto_sep;shipping_to_show=0" title="Proceed to Secure Checkout" class="button button-block button-large-font corners bg-sky black">Secure Checkout</a>
        </mvt:if>
        With it set up like this, the url back to OCST will always change accordingly dependent on if the user checks the box or even unchecks it later on.

        The checkbox state is always remembered once they click Continue on OCST

        Thank you guys for the help and the point in the right direction.

        Cheers
        Nick Harkins
        www.loveisarose.com

        Comment

        • Bruce - PhosphorMedia
          Developer Partner











          • Mar 2006
          • 11256

          #5
          FYI: If I have to have a Read_Basket call on more than one page, I just add it to the HTML_Profile template. In fact, I sometimes add them their even if just one just so there's only one place to check :)

          You can even do read/writes there...for example,
          IF "g.Shipping_to_show"
          WriteBasket
          ELSE
          ReadBasket
          END
          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

          • SidFeyDesigns
            Mighty Mivite








            • Jan 2012
            • 598

            #6
            Great idea Bruce - PhosphorMedia
            Nick Harkins
            www.loveisarose.com

            Comment

            Working...
            X