Can't delete product through ajax
Posted: 26 Jan 2018, 10:24
Good day!
I'm having some trouble getting the remove product ajax/jsonapi functionality to work. I did some debugging and came to the strange conclusion that adding a product works fine. After adding the product the output of $this->get()->getProducts() (in ext\ai-controller-frontend\controller\frontend\src\Controller\Frontend\Basket\Standard.php on line 237) is as expected, it contains the added product. I can also remove the product using $this->get()->removeProduct(0);. However, when I use the standard javaScript function bound to the mini basket remove button, I get an exception: "Product with array key "0" not available". Doing some further debugging, I found out that $this->get()->getProducts() returns an empty array in the deleteProduct function (in ext\ai-controller-frontend\controller\frontend\src\Controller\Frontend\Basket\Standard.php on line 245).
I can however remove products if I don't use the javascript function and call the url /basket?b_action=delete&b_position=0 directly. I'm pretty much starting to run out of ideas as to where the problem may lay.
Many thanks in advance!
My installation details:
- Aimeos 2017.10 (latest via composer)
- Laravel 5.5.*
- PHP 7.1
- Linux (Ubuntu 16.04.1)
I'm having some trouble getting the remove product ajax/jsonapi functionality to work. I did some debugging and came to the strange conclusion that adding a product works fine. After adding the product the output of $this->get()->getProducts() (in ext\ai-controller-frontend\controller\frontend\src\Controller\Frontend\Basket\Standard.php on line 237) is as expected, it contains the added product. I can also remove the product using $this->get()->removeProduct(0);. However, when I use the standard javaScript function bound to the mini basket remove button, I get an exception: "Product with array key "0" not available". Doing some further debugging, I found out that $this->get()->getProducts() returns an empty array in the deleteProduct function (in ext\ai-controller-frontend\controller\frontend\src\Controller\Frontend\Basket\Standard.php on line 245).
I can however remove products if I don't use the javascript function and call the url /basket?b_action=delete&b_position=0 directly. I'm pretty much starting to run out of ideas as to where the problem may lay.
Many thanks in advance!
My installation details:
- Aimeos 2017.10 (latest via composer)
- Laravel 5.5.*
- PHP 7.1
- Linux (Ubuntu 16.04.1)