Hello,

I have a view of products with some exposed filters. This is an ajax view.

If I use the exposed filters, my view is refreshed with ajax, all works perfectly.

But if I click on the add to cart button I'm redirected to the page : /views/ajax and I see a blank page with some code :

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"mytheme","theme_token":"GAF0LtNOCLpZRsFjHg5NKFidhQv9qLaBDo_oWJUxrbg"},"colorbox":{"opacity":"0.85","current":"{current} sur {total}","previous":"\u00ab Pr\u00e9c.","next":"Suivant \u00bb","close":"Fermer","maxWidth":"98%","maxHeight":"98%","fixed":true,"mobiledetect":true,"mobiledevicewidth":"480px"}},"merge":true}]

If I disable ajax, the add to cart button works correctly (but my views lose the ajax feature with exposed filters).

How to combine the best of both worlds ?

Thanks

Alex

Comments

zmove created an issue. See original summary.

subhojit777’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
supriyarajgopal’s picture

Subscribing.

Facing the exact same issue.

subhojit777’s picture

I edited the existing "Shopping cart block" provided by commerce order module. I enabled ajax in that view, and added a exposed filter field. The filter field is in line items and it is a term reference. This is how I added the field #2425987-6: Product prices not updating correctly in cart block when using commerce pricing attributes and/or a rule that adds to base price .

In this case I don't see that ajax json, but I see an error

Notice: Only variables should be passed by reference in commerce_cart_product_add() (line 1344 of /var/www/drupalvm/commerce-7/sites/all/modules/commerce/modules/cart/commerce_cart.module).

I'll investigate more. I know this is too late to ask.. but if anyone having the same issue can you please add a comment with exact steps how the view was created, what exposed filters are added, so that I can replicate.

subhojit777’s picture

More observation:

  • If there is an ajax view and the dc_ajax_add_cart cart in the same page, their ajax requests are interfering. Say, I am filtering the view, then an ajax form submission request gets triggered in the dc_ajax_add_cart add to cart form.
shabana.navas’s picture

Status: Active » Closed (duplicate)
Related issues: +#2185239: On AJAX-Enabled Views the "Add to Cart" button does not work
subhojit777’s picture

Status: Closed (duplicate) » Closed (won't fix)

Thank you Shabana for digging up the issue. Even though this issue is not duplicate, but it explains the problem that we are having here. Looks like this problem is in the Views system only, and cannot be fixed here. You either have to use this module, or use the view with ajax enabled.