Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Your module is PAINFULLY awesome, and works fantastically on my UC2 website.
I am working on setting up a mobile theme for my site, and I was curious whether I can restrict the Ajax cart functionality only to the mobile site. In other words, I would like my desktop users to use the normal cart, and the mobile users to use the Ajax cart. Is that possible?
Thanks!
Comments
Comment #1
stewart.adam CreditAttribution: stewart.adam commentedI think this is a great idea! Context could handle nicely, as you could define conditions (i.e. "is on the mobile sub-domain") for displaying the regular cart block and then otherwise display the AJAX cart block. The only tricky part is that you would need to find a module that would let you define the set of conditions in Context... The easiest way I can think of is a sub-domain or a special path for mobile users (e.g. domain.com/m/path) but there may be a module that detects the user-agent and integrates with Context as well.
There is a small problem with uc_ajax_cart, which is that we add the JavaScript to "AJAX-ify" the add to cart links and buttons on every page via hook_init(). I'm going to see if we can change this to the block's callback instead so that the JavaScript would only get added when the block is on the page. If that works, then this should be very easy to setup! I will keep you updated.
Comment #2
hockey2112 CreditAttribution: hockey2112 commentedAwesome, thanks!
Comment #3
stewart.adam CreditAttribution: stewart.adam commentedI've committed this feature to git and it should appear in the next dev release within 24h. You can try it out by enabling "Enable ajax cart functionality only when block is enabled" in the AJAX cart settings.