Go Back   Volusion Review Forums - Get the Most from your Online Store > Volusion Forums > Tips & Tricks
User Name
Password Register
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 02-02-2008, 11:03 PM
CarenOnline CarenOnline is offline
Junior Member
 
Join Date: Apr 2007
Posts: 14
Default Only $xx.xx more needed for free shipping!

How can I get my website to add this? I find this very effective in getting me to bump up my purchases at other sites and would like this for mine.
Reply With Quote
  #2  
Old 03-02-2008, 09:19 PM
bookman bookman is offline
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default

You can do the following:
After the div containing the shopping cart summary (id = display_cart_summary) place the following code:
Code:
if (document.getElementById("display_cart_summary").firstChild != null) 
{
    var myDiv = document.getElementById("display_cart_summary").firstChild;
    if (myDiv.className == "cartsummary_full")
    {
        var myText = myDiv.innerHTML;
        var dollars = myText.substring(myText.indexOf("$"),myText.indexOf(")"))
        var cents = parseInt(dollars.substring(1) * 100);
        var toFreeAmount = (5000- cents); // assume free shipping for $50.00 purchases
        amount = toFreeAmount.toString();
        var amount1 = amount.substring(0, amount.length-2);
        var amount2 = amount.substr(-2)
        var value = amount1 + "." + amount2;
        alert(value); // replace this with code to display on the page
        // if toFreeAmount < 0 then qualified for free shipping.
    }
}
Reply With Quote
  #3  
Old 03-04-2008, 02:11 AM
Blar Blar is offline
Member
 
Join Date: May 2006
Posts: 88
Default

Bookman,

Where exactly does this code go? I'd like to try it but when I put it in the shopping cart.asp it messed things up.

Thanks,
__________________
Berri
Decorative Visions Home Collections
www.decorativevisions.com
Reply With Quote
  #4  
Old 03-04-2008, 03:09 AM
jgreco5 jgreco5 is offline
Senior Member
 
Join Date: Jul 2006
Posts: 305
Default

Does not seem to work in v5
Reply With Quote
  #5  
Old 03-04-2008, 11:57 PM
bookman bookman is offline
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default

It goes in the main template - version 5. Note that this is js code so needs to be wrapped in script tags.

I rewrote the code to clean up a couple of things. You can see it at http://www.waldorfbookshop.com
Log in as volusion@waldorfbookshop.com password is volusion. you can find the code inline on the home page though is should be placed in and external file and called when the page is completely loaded. Please don't mess around with the shopping cart too much. thx.

bob
Reply With Quote
  #6  
Old 03-06-2008, 12:31 AM
Shane Shane is offline
Junior Member
 
Join Date: Oct 2005
Location: Columbia, SC
Posts: 19
Default

Bookman, I cant see this on your site. Please help.
__________________
Shane
Front End Audio
Your Ultimate Pro Audio Dealer
Columbia, SC
Reply With Quote
  #7  
Old 03-25-2008, 06:42 AM
supplementsdotnet supplementsdotnet is offline
Junior Member
 
Join Date: Oct 2007
Posts: 18
Default

i changed it a bit to work with my site... how can you make it display just the 2 digits after the period? ($xx.xx instead of $xx.xxxx)
Code:
<script language="javascript">
if (document.getElementById("display_cart_summary").firstChild != null) 
{
    var myDiv = document.getElementById("display_cart_summary").firstChild;
    if (myDiv.className == "cartsummary_full")
    {
        var myText = myDiv.innerHTML;
        var dollars = myText.substring(myText.indexOf("$"),myText.indexOf(")"))
        var cents = parseInt(dollars.substring(1) * 100);
        var toFreeAmount = (10000- cents); // assume free shipping for $100.00 purchases
        amount = toFreeAmount.toString();
        var amount1 = amount.substring(0, amount.length-2);
        var amount2 = amount.substr(-2)
        var value = amount1 + "." + amount2;
        document.writeln('<b>$',value,' needed for you to recieve FREE shipping!</b>'); // replace this with code to display on the page
        // if toFreeAmount < 0 then qualified for free shipping.
    }
}
</script>
Reply With Quote
  #8  
Old 03-26-2008, 02:29 AM
bongowrld bongowrld is offline
Member
 
Join Date: Feb 2006
Posts: 43
Default

Thanks for this great script. I tried it and I noticed that when you surpass the "free shipping" amount, the count starts showing in Negative amount.

Is there a way to prevent displaying when the amount has been surpassed?

Many thanks for your contribution :-)
__________________
website
Reply With Quote
  #9  
Old 04-05-2008, 11:14 PM
supplementsdotnet supplementsdotnet is offline
Junior Member
 
Join Date: Oct 2007
Posts: 18
Default

did anyone figure out how to only display the 2 places for the cents instead of 4? and also being able to change it to say "This order ships free" instead of a negative number would be cool
Reply With Quote
  #10  
Old 04-06-2008, 03:32 AM
zevious's Avatar
zevious zevious is offline
Senior Member
 
Join Date: Oct 2005
Posts: 128
Default

Quote:
Originally Posted by supplementsdotnet View Post
did anyone figure out how to only display the 2 places for the cents instead of 4? and also being able to change it to say "This order ships free" instead of a negative number would be cool
Here is a piece of javascript code that formats to 2 digits:

function formatCurrency(amount) {
var i = parseFloat(amount);
if(isNaN(i)) { i = 0.00; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if(s.indexOf('.') < 0) { s += '.00'; }
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
return s;
}

Just add this code and add the following:

formatCurrency(value);

AFTER
var value = amount1 + "." + amount2;
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +0. The time now is 06:31 PM.