Hello, and thanks for this quite usefull module.

Attempting to add the ajax remove + ajax edit quantity to the cart block, we face tricky issues.

First test :
- The content of the page is loaded inside the block instead of the cart view on ajax calls inside the block.
- After reload by adding new element, first ajax call is not effective and the other ones are but there is no reload of the blocK

Second test after creating a page display (?) :
- Only the second ajax call works, not the first one. Strangly, first time there is only one AJAX callback, second time there are two... Difference from first test is that the reload on second ajax call and after does reload the block.
- Cart is correctly updated while adding a new product, but then the ajax cart buttons are not effective anymore with the following issue :
Symfony\Component\HttpKernel\Exception\HttpException : The specified #ajax callback is empty or not callable. dans Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (ligne 67 de /var/www/machines/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).

Comments

eme created an issue. See original summary.

subhojit777’s picture

Version: 8.x-1.0-beta1 » 8.x-1.x-dev
Category: Feature request » Bug report

There are some issues when you use both ajax remove and update in the view. I have tried to debug this, but I am out of ideas. The problem is deep.


If you add a product via an ajax add to cart button, it does not load anyting (certainly because the block has already been reloaded on ajax response).

This module is supposed to do this. If you want the page load, you have to use the normal add to cart button.


This https://github.com/subhojit777/dc_ajax_add_cart/blob/8.x-1.x/modules/dc_... is responsible for the ajax update for the view.

eme’s picture

Issue summary: View changes

Well, I made some more tests. It seems indeed quite tricky... For example, when you add a page display... the content is correctly replaced with the right data ! Unfortunately, it does not work after the reload with the error :

Symfony\Component\HttpKernel\Exception\HttpException : The specified #ajax callback is empty or not callable. dans Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (ligne 67 de /var/www/machines/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).

I'm more precise for my first test and the bugs.

To my mind, there is a first issue with the commerce block and its use of only a master view that are not compatible with AJAX. Then, we still face quite strange bugs. My question is wether we should simply develop a new block without Views (not nice, but maybe less time consuming)...

smartparty’s picture

Having similar issues with our site. D8.5.3 and latest version of module. Our product pages are overridden with a view.

Scenario 1:
Load product page, add item to cart, block updates, expand cart block, click remove button, nothing happens on screen. Refresh page, item appears to be removed from cart.

Scenario 2: Load product page, add item to cart, block updates, expand cart block, change quantity, click update button, nothing happens on screen. Refresh page, item appears to be updated in the cart.

Scenario 3: Load product page with item already in cart, expand cart block, click remove button, item is not removed, entire page loads in the cart block.

Scenario 4:
Load product page with item already in cart, expand cart block, change quantity, click update button, item is not updated, entire page loads in the cart block.

Steps taken to ensure it wasn't the site, created a vanilla install of 8.5.3 and installed commerce and this module plus required modules. All scenarios above are the same on this vanilla site.

shardesty’s picture

Not sure if this is the same issue, but the problem we're having is this:

We created a view page with a slice of our products - sessions at an event. Idea was, that we could filter the sessions on role or whatever, and then allow the attendee to see a list of all events they could attend, and click to add the ones they want to attend to the cart. The Ajax add to cart form works perfectly on initial page load. Click on any product, it adds to cart.

But, if you use any exposed filter to narrow the selection then nothing. You get a flash of a 'please wait' message, but nothing is added to the cart. If you reload the page - get back to the unfiltered view, then it works again.

Any help would be greatly appreciated.

ETA: Not an issue with the add to cart module, it was better exposed filters.

durum’s picture

Scenario 3 from #4 still persists with the latest releases of necessary modules.