| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Fetch Cart Content | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Fetch Cart Content
I want to fetch the cart contents on the checkout page. How to do that? Also after that I would need to get details on each of the cart products e.g. name, description, sku etc.
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#2
|
|||||||||
|
|||||||||
Re: Fetch Cart Content
I was able to fetch the information using the following piece of code:
foreach($this->getCart()->getItems() as $item){ $listItems[$count] = array( "ItemId"=> $item->getSku(), "ItemDescription"=>$item->getName(), "ItemQuantity"=>$item->getAmount(), "ItemPrice"=>$item->getItemPrice(), "ItemTotalAmount"=>$item->calculateTotal(), "ItemImageURL"=>$item->getImageURL(), ); $orderTotalAmount += $item->calculateTotal(); $count++; }
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: Fetch Cart Content
I believe you don't need the $count variable as "$listItems[] = array(...)" will work too.
Also, it is a bad idea of doing this: "$orderTotalAmount += $item->calculateTotal();". You should use "$order->getTotal()" and "$order->getSubtotal()" methods instead.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#4
|
|||||||||
|
|||||||||
Re: Fetch Cart Content
Thanks!
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
|
|||
X-Cart forums © 2001-2020
|