close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

identify if item is in the cart

Thread began 9/02/2010 1:20 pm by CraigR | Last modified 12/13/2010 10:36 am by Heckie | 1597 views | 15 replies |

CraigRBeta Tester

identify if item is in the cart

what is the most effective way of determining if a particular item is in the cart ?

i have tried the following, (and it seems to work), but I am just being cautious..

<?php
while (!$WA_Store_Cart->EOF()) {
if ($WA_Store_Cart->DisplayInfo("ID") == 123) {
echo 'item 123 is in the cart !';
}
$WA_Store_Cart->MoveNext();
}
$WA_Store_Cart->MoveFirst();
?>

Sign in to reply to this post

Jason ByrnesWebAssist

use the $cartName->InCart(id) function:

php:
if($WA_Store_Cart->InCart("123") == true) echo("item 123 is in the cart");
Sign in to reply to this post

CraigRBeta Tester

Thanks Jason, that looks more like it.

Sign in to reply to this post

Jason ByrnesWebAssist

No worries.

Sign in to reply to this post

CraigRBeta Tester

thanks for this reply Jason, it has just posed a related question.

say, for example, i had the category column in my ecart instance, what syntax would I use to determine if an item of category '123' was in the cart ?


Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

use the cart ConditionalTotal function

The ConditionalTotal function takes the following arguments:
Return Colum
Conditional Column
Conditional Value

It returns the Subtotal of the Return Column Where the Conditional Column matches the Conditional Value

php:
if($WA_Store_Cart->ConditionalTotal("Quantity", "Category", "123") > 0) echo "Category 123 is in the cart";
Sign in to reply to this post

CraigRBeta Tester

thanks Jason, works like a charm !

Sign in to reply to this post

Jason ByrnesWebAssist

No Worries, I'm glad your asking these questions to get these hidden cart functions out there.

Sign in to reply to this post

CraigRBeta Tester

I love this extension, the more I ask of it, the more it seems to do.

I have now realised that these functions appear in the eCart definition page

A comment above each one, (or at least the ones which aren't self explanatory), explaining their purpose, would be a great help.

Sign in to reply to this post

Dave BuchholzBeta Tester

I second that request

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...