Latest

Tuesday, July 11, 2017

Cart contents in Crinsane Laravel Shopping Cart is Empty

Asked by: G. Curs


Has anyone experienced the same issue as mine.

I have a problem in accessing the cart content with another function in my controller. The cart content was empty. My code goes like this:

function addToCart($productArray){
 ---code here to insert to cart

echo $this->getHtml();
};


function getHtml(){
---code here to display the cart
---the cart contents is ok here

return $html;
}

The cart contents can be displayed in my page but when I tried to delete the item using the row id, the cart was empty.

function removeItem(Request $request){

//I printed here the Cart contents but it was empty.
 Cart::remove($request->all()[id]);
 echo 1;
exit;


Source

No comments:

Post a Comment

Adbox