identify last item added to cart
i thought of looping through the cart array to retrieve this information, is there a quicker and easier way to do this ?
thanks
i thought of looping through the cart array to retrieve this information, is there a quicker and easier way to do this ?
thanks
eCart has a built in function you can use to move to the last item added:
$CartName->MoveLast();
However, i just found a bug in this. To get the MoveLast function to work, you will need to edit the WA_eCart_Definition_PHP.php file.
change:
function MoveLast() {
if (!$this->IsEmpty()) {
$this->DisplayIndex = sizeof($this->Items.length) - 1;
}
}
to:
function MoveLast() {
if (!$this->IsEmpty()) {
$this->DisplayIndex = sizeof($this->Items) - 1;
}
}
After moving to the end of the cart array, you should reposition to the pointer at the beginning:
<?php $CartName->MoveLast(); echo($CartName->DisplayInfo("Name")); $CartName->MoveFirst()?>
other functions you may find useful:
Move to the first item added to the cart:
$CartName->MoveFirst();
Move to the next Cart item
$CartName->MoveNext();
Move to the previous cart item
$CartName->MovePrevious();
check if you are in the first Cart item
if($CartName->BOF());
check if you are in the last Cart item
if($CartName->EOF());
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.