View Full Version : Dynamic Text - Cart totals
Totti
15th November 2007, 03:48 PM
Hi,
Was just wondering if anyones figured out a way to display cart total as dynamic text on their website - ie a little field somewhere on the header of their site so that the user doesn't have to click view cart to see how much they're up to.
Many thanks.
dferguson
11th February 2008, 12:40 PM
Hi
We are working on new template features, and this should be one of them.
j0anne04
25th May 2008, 01:08 PM
Just wondering how this feature is going; any updates yet?? I would like to implement this in my online store also.
Robby
26th May 2008, 05:58 AM
Ditto!
aschiller
27th May 2008, 09:59 AM
ezimerchant Professional version 4.0.80 released this morning now has support for a mini cart to be displayed. Please see www.easygift.com.au for the first implementation of the new feature.
To insert the item count use:
<script>document.write(getCartCount());</script>
To insert the cart total use:
<script>document.write(getCartTotal());</script>
arken
2nd June 2008, 09:52 AM
So I guess we put this code in all the 5 category pages?
d.ferguson
2nd June 2008, 11:45 AM
The code can go into all of the theme files (categorypage.htm, content.htm, productpage.htm, viewcart.htm, search.htm)
This way, the minicart will appear on every page of your site. The ideal place would be in the top right hand corner of the page, thou that would depend on your site design.
arken
3rd June 2008, 07:57 AM
I've had a go on the mini cart however i have a concern. Say for example you have 3 different items in the cart, the mini cart shows 3 items, however if on one of those items the quantity is 10, the mini cart will still only display 3 items, rather than 12. Any way around this so the mini cart actually shows the total quantity of all the items? Because I know I will get customers saying that the mini cart is not displaying their totals correctly.
arken
3rd June 2008, 08:04 AM
I've also noticed the 2nd script doesn't work correctly.
<script>document.write(getCartTotal());</script>
Has it been tested on a site? I noticed Easy gift doesn't use it??
lamery
3rd June 2008, 10:02 AM
Apologies, the getCartTotal information I supplied was wrong - as it is formatting a currency value we need to pass it some formatting arguments. The following is likely to be what most people want:
<script>document.write(getCartTotal("$",",",2,".",false, true, 1))</script>
Regarding counting cart lines or items, I think it is best to let the site designer have flexibility to go either way.
I will add a getCartItemCount function in version 4.0.81 to satisfy the other definition of cart items.
In the meantime those that just can't wait for the release can add the following javascript to their sites:
function getCartItemCount()
{
var count = 0;
var cart = new Cart(document.cookie);
for(var line in cart.lines)
count += cart.lines[line].quantity;
return count;
}
Robby
3rd June 2008, 01:50 PM
I have tried the cart total script but I can't get it to work.
I have inserted:
<DIV align=right></B><FONT color=#ffffff>Cart Total:
<SCRIPT>document.write(getCartTotal("$",",",2,".",false, true, 1))</SCRIPT>
The "Cart Total:" part is displayed in the place I want it but no cart totals after it. What am I doing wrong?
Robyn
lamery
3rd June 2008, 04:56 PM
Just to clarify this functionality is only available in our latest release (this feature appears in 4.0.80.1) you may need to get the latest update (http://www.ezimerchant.com/downloads.asp)
Robby
3rd June 2008, 05:03 PM
I am using the latest version. Build date 27th May 2008.
I currently have the cart total script added into my live content page but not the "Cart Total:" part. So could you have a peek at what maybe wrong.
http://www.thehorsestall.com.au
Robyn
aschiller
4th June 2008, 11:15 AM
The problem is that the content pages (those build using the content.htm template file) do not include the ezimpro400.js script file. If you edit the content.htm template file and insert <SCRIPT language="javascript" type="text/javascript" SRC="ezimpro400.js"></SCRIPT> just before the closing </HEAD> then generate, it should work fine.
Robby
4th June 2008, 02:02 PM
Thanks for your help.
It seems to work sometimes but appears to be intermitent. At least on my PC!
The Category and Product pages work fine. It is just the Content and Search pages that still play up.
Can some other users pretend to do an order on my site and let me know what happens to the total in the top right hand corner.
www.thehorsestall.com.au
Robyn
arken
4th June 2008, 03:50 PM
Hi,
Yes sometimes it's not showing. i'm just about to upload my site. I'll see what happens there. It would be good to get the page to do an auto refresh when someones adds a product as well as the mini cart won't update until that's done.
arken
4th June 2008, 04:30 PM
I've just uploaded my site. Seems to be having the same problem. Any ideas: http://www.directpoolsupplies.com.au/index.htm
arken
4th June 2008, 04:42 PM
It's ok when there is $0.00 dollars. It only happens when there is an amount showing.
Robby
5th June 2008, 06:25 AM
I have added these two lines above the </HEAD> and that seems to work. They are what was in the product page source.
<SCRIPT language=javascript src="eziproducts.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="ezimpro400.js" type=text/javascript></SCRIPT>
Although it still does not refresh until you move pages or F5.
My "buy action" is to use a message. Could the refresh command be added to the OK button in the message box??
Robyn
www.thehorsestall.com.au
arken
5th June 2008, 11:42 AM
Yep. mines all good now too. ditto on the page refresh.
lamery
5th June 2008, 02:37 PM
I will add an automatic refresh into the next build (4.0.82.1) and post here when available
lamery
6th June 2008, 01:19 PM
4.0.82.1 is out - it includes the getCartItemCount function and it refreshes the mini cart when a user adds a product to the cart when a add to cart message is turned on (not view the cart page)
arken
7th June 2008, 10:47 AM
Thanks Luke. all works great. just one thing I've noticed that I'm sure didn't happen before. When we close the browser or even the next day we we turn everything back on, if there were any items in the cart the previous day, they are still there the next day. We do get a lot of returning customers. If they buy something today, then return tomorrow, those items are still in the cart. There must be a cookie hanging around somewhere?? Is there a way to clear this when the browser is closed?
Robby
7th June 2008, 02:13 PM
Thanks Luke.
Love it and it works fine.
Robyn
www.thehorsestall.com.au
lamery
10th June 2008, 08:48 AM
Hi arken,
The shopping cart contents have been persistent like this for years. It is an easy change to make, just take the expiry off the cookie string as it is assigned. Trouble is I'm sure their is another side to the fence on this request. It is difficult to make a change like that and not have someone affected and wanting it back the other way. The usual answer is - make it an option, however, we strive to make ezimerchant as simple as possible and if we take the make it an option road for every feature ezimerchant stops being simple and starts being a labyrinth of questions.
Basically, I am happy to discuss this change with the community (as with most changes) but I really need to find a smart way forward.
d.ferguson
10th June 2008, 09:06 AM
The cart uses session cookies? So a reboot or close of (all) the browsers clears the contents of the cart.
arken
10th June 2008, 04:59 PM
Hi Dave,
Yes that use to be the case, but with the latest version it doesn't happen that way now. The contents of the cart are still there the next day when we turn the computer back on.
Robby
11th June 2008, 09:03 AM
I don't understand why it is a problem, as long as it disappears once the customer has made the order.
Some customers may take a few days to decide what they are going to order and at least now they don't have to keep re-entering it. (At least I am like that!!)
Robyn
d.ferguson
11th June 2008, 09:53 AM
Its never dissapeared after an order has been made.. What made the products dissapear from the cart was the session.. (so when they close their browsers after making an order or rebooting their PC it would clear the cart contents)
The cart contents should be session based - its been like that since the very beginning.
lamery
11th June 2008, 11:10 AM
The new cart script in the lastest version follows all the same rules as the previous versions including the setting the expires property on the cookie to 5 years in the future. The only way I can think that the old carts did manage to turn the cookie back into a session one is other code the swept in after saving the cookie to turn it from persistent back to session, I don't see that code though..
lamery
11th June 2008, 03:42 PM
I have reviewed the older code again - there were two paths on saving the shopping cart. The most commonly taken path did use session cookies. As this was previously the common case we are reverting the cart to be a session cookie in 4.0.83 which will be out shortly.
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.