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

How do i cycle through shopping cart item ids?

Thread began 1/08/2013 11:18 pm by sonomahorowitz424857 | Last modified 1/09/2013 11:55 am by Jason Byrnes | 376 views | 1 replies |

sonomahorowitz424857

How do i cycle through shopping cart item ids?

Hello All,
I've been using eCart for a while now and have finally come across the need to count how many times a specific id (or array of ids) exists in the shopping cart.
I think i know what i need to do, i just do know how to cycle through the item id's in the shopping cart.
I plan to use something along the lines of
$sausage_ids = array("1001","1002",1003",1004");
$prepaid_sausage = $customer_account['prepaid_sausages'];
$sausage_count = 0;
do{
if($shopping_cart_item in_array($sausage_ids)) $sausage_count ++;
}while(I DON'T KNOW WHAT TO PUT HERE TO CYCLE THROUGH SHOPPING CART ITEMS);
if($sausage_count <= $prepaid_sausage){
//do something
}
else{
//do something else
}

I tried to search the board to find the answer, but did not succeed.
Thank you to whoever can provide me the answer!
-Sam

Sign in to reply to this post

Jason ByrnesWebAssist

there is no need to cycle through the cart to get an items quantity. you can use the eCart GetInfo function

for example, to return the quantity for item ID 1001, use:

$yourCartName->GetInfo("1001", "Quantity");

where yourCartName is the name of the eCart object

you could loop through your array using this code:

php:
<?php

$return 
"";
$sausage_ids = array("1001","1002","1003","1004");
foreach(
$sausage_ids as $k => $v) {
    if(
$yourCartName->InCart($v)) $return .= "the quantity of item ".$v." is ".$yourCartName->GetInfo($v"Quantity")."<br />";
}
echo 
$return;
?>
Sign in to reply to this post

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