close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Get number of items in cart?

Thread began 2/04/2010 7:14 am by Joe Lowery | Last modified 2/09/2010 2:45 pm by Jason Byrnes | 3214 views | 10 replies |

Joe Lowery

Get number of items in cart?

Is it possible to get the number of items in the shopping cart on the cart.php page?

Sign in to reply to this post

Jason ByrnesWebAssist

Use the following code to show the Total number of items:

php:
<?php echo $WA_Store_Cart->TotalColumn("Quantity"); ?>
Sign in to reply to this post

Joe Lowery

Thanks, Jason - looks like that gives me all the items, including multiple quantities of an item. What I'm really looking for is the total number of unique items. So if someone order 1 widget, 2 wodgets, and 1 gadget, the answer would be 3 instead of 4. Is it possible to get that value?

Thanks - Joe

Sign in to reply to this post

Jason ByrnesWebAssist

OK, for Unique items use:

php:
<?php echo(sizeof($WA_Store_Cart->Items)); ?>
Sign in to reply to this post

Joe Lowery

Perfect! Thanks, Jason.

Sign in to reply to this post

Paul

Is it possible to put this on all the pages, somewhere, once a user logs in? And where would it go?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, you could use that wherever you would like to display the number of items in the cart.

Sign in to reply to this post

Paul

How would I set it up to show "only" if the person is logged in?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

php:
<?php if(WA_Auth_RulePasses("Logged in to users")){ // Begin Show Region ?>

<?php 
echo(sizeof($WA_Store_Cart->Items)); ?> 
<?php // End Show Region ?>
Sign in to reply to this post

Paul

I'm getting this error:

PHP Notice: Undefined index: CategoryName in C:\Inetpub\wwwroot\hcprivate\AcalaMed\acalamedical.com\www\Products_Detail.php on line 469 PHP Fatal error: Call to undefined function WA_Auth_RulePasses() in C:\Inetpub\wwwroot\hcprivate\AcalaMed\acalamedical.com\www\Products_Detail.php on line 486

The code you gave me is what is on line 486.

Line 469 is: <p>Category:&nbsp;<?php echo $row_WADAProducts["CategoryName"]; ?></p>

Thanks

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...