ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Paypal advanced form javascript to set shipping after applying a discount

July 03, 2010 9:23am

Subscribe [1]
  • #1 / Jul 03, 2010 9:23am

    patrick-vibes

    63 posts

    Hi Folks, I am trying to figure out how to set the additional item shipping field of my paypal add to cart form but apply a discount to it first.

    My setup has 4 shipping regions as select option, I have javascript in there to set the price of a hidden field “shipping” depnding on the region, what I want to do is have a hidden shipping 2 field that takes the region shipping price selected and divides it by 2.

    I am not a Javascript guru by any means, I fumbled my way through putting in what I have so far:

    <form action="https://www.paypal.com/cgi-bin/webscr" name="f1" method="post" target="paypal" class="paypal">
    <fieldset>
    
    <h4>€ {release_price}</h4>
    
    <p><input type="hidden" name="cmd" value="_cart" /><br />
    <input type="hidden" value="{site_url}index.php/store/release/{segment_3}" name="return" />  <br />
    <input type="hidden" value="{site_url}" name="cancel_return" />  <br />
    <input type="hidden" name="currency_code" value="EUR" /><br />
    <input type="hidden" value="1" name="add" /><br />
    <input type="hidden" value="[email protected]" name="business" /><br />
    <input type="hidden" name="item_number" value="{release_code}" /></p>
    
    <p><input type="hidden" value="{related_entries id="release_artist"}{title}{/related_entries} | {title} ({release_type})" name="item_name" /><br />
    <input type="hidden" value="{release_price}" name="amount" /></p>
    
    <p><!--here is my shipping region drop down box to set the price--><br />
    <select name="shipping" id="shipping"><br />
    <option value="">---Ship to---</option><br />
    <option value="1.50">Ireland</option><br />
    <option value="2.00">UK</option><br />
    <option value="2.00">Europe</option><br />
    <option value="2.00">Worldwide</option><br />
    </select></p>
    
    <p><!--value needs to be set as per the region ie shipping/2--><br />
    <input type="hidden" name="shipping2" value="" id="shipping2" /></p>
    
    <p> </p>
    
    <p> </p>
    
    <p><br />
    <input type="submit" class="cartbut" value="Add to cart" name="submit"><br />
    <input type="submit" class="cartbut" value="View Cart" name="submit"></p>
    
    <p></fieldset><br />
    </form>

    Any help greatly appreciated.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases