Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Session Variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

condliffe
Starting Member

1 Posts

Posted - April 05 2004 :  07:18:16  Show Profile  Reply with Quote
Hi Guys, I'm new to the forums, but plan to hang around for a while - i'm working on a shop for a client www.shades.co.uk.

My question is this - are there any specific Session variables (or functions) in VP ASP which contain the number of items in the shopping cart, total value of items in the shopping cart, and the current logged in user's name.

If not, what would people consider the best method of getting this data?

I have identified the minicart ASP page as a potential source of this information, but I thought I'd ask here first.

These values are to appear on every page of the site, hence the question.

Thanks to all in advance,

Jamie

devshb
Senior Member

United Kingdom
1904 Posts

Posted - April 05 2004 :  15:55:41  Show Profile  Visit devshb's Homepage  Reply with Quote
please feel free to correct me anyone if I'm wrong, but....

if you use:
x=GetSess("CartCount")
that'll put the count of cart "items" into x. But in that case I think "item" refers to the number of different products in the cart, not the physical total quantity.
ie that'll show count(products) not sum(qty)

To get what you're after, I think your best bet is to create a hacked-about copy of the NavigateShowMiniCart function that's in shopproductsubs.asp (which I've done before for exactly this scenario), where you copy that function to another one (say, NavigateShowTinyCart), strip out all the html-printing commands in that copied function, and just use the totalling/counting logic. Then at the end of the function (when you've got the total count/amt), just print a simple/small html table with your cart icon and the total amt/count. I couldn't find anywhere that did this calculation/summing without printing spurious html output (even the "SHORT" version was too long and did lots of html stuff I didn't want it to do), so I ended up building a self-contained copy of the function with the minimal amount of html that was needed for the "tinycart".

When hacking about that copied function, you'll only need the bits which are relevant to the "SHORT" cart format.


But, the mini-cart might be good enough for what you're doing; it depends. You could try it and see; just add:
<% NavigateShowMiniCart("SHORT") %>
to the header file and see if it's ok for you.
My guess is that it won't be ok, because you'll want to display this miniform even if the cart is empty, and will also want to make other changes (such as adding the username as you mentioned), in which case you'll probably be better off just doing the above so that you've got more control over the html/format etc.

Also, I remember having problems when just using the session's cart total for the amount as it was sometimes out of synch with the true total of the cart, so the only way to get a true count/sum of qty/cost of the cart was to go through all the calc logic that's in something like the minicart function.

Simon Barnaby
Freelance Developer
Java-E UK
[email protected]

Edited by - devshb on April 05 2004 16:47:02
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00