Closed prajwolonta closed 10 years ago
public function postAddToCart() {
$instance = Input::get('instance');
//dd($instance);
$id = Input::get('product_id');
$name = Input::get('product_name');
$qty = Input::get('product_qty');
$price = Input::get('product_price');
Cart::instance($instance)->associate('Product')->add(array('id' => $id, 'name' => $name, 'qty' => $qty, 'price' => $price));
return Redirect::to(URL::previous())
->with('message', 'Added to cart.');
}
THis is my code for adding as a cart or wishlist.
I can't seem to reproduce this. Which session driver are you using?
im using laravel default driver file.
Hi .. I have this code : Cart::instance($instance)->associate('Product')->add(array('id' => $id, 'name' => $name, 'qty' => $qty, 'price' => $price));
if the instance is 'wishlist' the very first time it does not work.. the wishlist instance is not save. But if the instance is "main" first time and second time its "wishlist" then only the wishlist is instantiated.
How can i fix this?