Auto-refresh on Shopping Cart Page

Questions and answers about ShopSite Custom Templates

Auto-refresh on Shopping Cart Page

Postby miriamcb » Fri Oct 28, 2011 5:52 am

I have a custom template that uses some javascript to call addresses and auto-fills the zip code box on the shopping cart page so we can figure sales tax.

At one point, this was auto-refreshing when a new zip code was entered, but now it is not and I can't figure out what I did to change this. It seems, that if I press 'enter' after the zip code has been auto-filled it will calculate this but how can this occur automatically?

The url with no products in the cart is (but it obviously has to have a product in it).

https://www.goodiemags.com/store/shopsite/sc/order.cgi?storeid=*22b7342a7eac8b705f863004d07795dd4f0d2a&function=show

Thanks!
miriamcb
 
Posts: 41
Joined: Mon Sep 26, 2011 1:13 pm

Re: Auto-refresh on Shopping Cart Page

Postby Jim » Fri Oct 28, 2011 10:59 am

If you have certain features enabled, Tax by zip, UPS, USPS, FedEx etc, then ShopSite inlcudes a function to check if the zip has changed. If none of those features are enabled the function is blank so you won't get the auto recalc when it changes.
Without any of the features enabled this is the function code:
<script type="text/javascript" language="JavaScript">
<!--
function zip_changed() {
}
// -->
</script>

With features enabled this is the function.
<script type="text/javascript" language="JavaScript">
<!--
function zip_changed() {
var func;
func = document.getElementsByName("function");
for (i = 0; i < func.length; i++) {
if (func[i].type == "hidden") {
zip_recalc = 1;
func[i].value = "zip_code_changed";
window.document.order.submit();
}
}
}
// -->
</script>
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Auto-refresh on Shopping Cart Page

Postby miriamcb » Wed Nov 30, 2011 5:47 pm

Hi,

I do have the Tax by Zip and a Flat Rate Shipping option enabled. From what I can tell in the javascript, the function zip-chnaged is showing up, but it doesn't seem to be working. Can you take a look at the code and tell me what I'm missing?!

Thanks!

Miriam
miriamcb
 
Posts: 41
Joined: Mon Sep 26, 2011 1:13 pm

Re: Auto-refresh on Shopping Cart Page

Postby Jim » Wed Nov 30, 2011 8:45 pm

Do you have javascript enabled in your browser? It can be turned off in most browsers.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Auto-refresh on Shopping Cart Page

Postby miriamcb » Wed Nov 30, 2011 10:42 pm

It is enabled in all of the browsers that I'm using to test (Firefox, Safari, Chrome and IE 9).
miriamcb
 
Posts: 41
Joined: Mon Sep 26, 2011 1:13 pm

Re: Auto-refresh on Shopping Cart Page

Postby Jim » Thu Dec 01, 2011 7:52 am

I'm not a javascript programmer so I don't understand what is going on in the code. I do see some things that are highlighted in red when I view the source of the page that may be causing issues.
Code: Select all
 onClick="return popup(this, 'Delivery')"><img src="http://www.goodiemags.com/store/media/GoodieMagsQuestion.gif"</A>

the <img src=" displays in red.
Code: Select all
<td class="orderinginstructions" colspan"3">

the colspan"3" displays in red.


Since you have code that automatically fills in the zip when a location is selected that may be overriding the recalc when the zip is changed. But I don't know enough about javascript to know where the problem is. Maybe someone else on the forum would have an idea.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 81 guests

cron