Page 1 of 1

Auto-refresh on Shopping Cart Page

PostPosted: Fri Oct 28, 2011 5:52 am
by miriamcb
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!

Re: Auto-refresh on Shopping Cart Page

PostPosted: Fri Oct 28, 2011 10:59 am
by Jim
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>

Re: Auto-refresh on Shopping Cart Page

PostPosted: Wed Nov 30, 2011 5:47 pm
by miriamcb
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

Re: Auto-refresh on Shopping Cart Page

PostPosted: Wed Nov 30, 2011 8:45 pm
by Jim
Do you have javascript enabled in your browser? It can be turned off in most browsers.

Re: Auto-refresh on Shopping Cart Page

PostPosted: Wed Nov 30, 2011 10:42 pm
by miriamcb
It is enabled in all of the browsers that I'm using to test (Firefox, Safari, Chrome and IE 9).

Re: Auto-refresh on Shopping Cart Page

PostPosted: Thu Dec 01, 2011 7:52 am
by Jim
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.