Using Ubercart 2.11 and 2.x-dev I have tried both the current uc_ajax_cart dev version and 2.3 and encountered the same problems. If the block visibility box is unchecked I can place uc_ajax_cart in a node using php module_load() and print statements. But the block does not refresh when items are added to or removed from it. I get the message that the item is being added or removed, but I have to reload the page to see the updated cart. If I make the block visible on the page the cart is refreshed where I put it and in the content region (Notice that it is now appearing twice on the same page).

I tried making the block visible only on listed pages and then not putting any pages in the list. The result was that the block appeared on all pages. After several hours of fumbling around with uc_ajax_cart 2.2, 2.3 and 2.x-dev I rolled back to 2.1 and all was well again.

I don't know what causes the error, but it appears that the module is not respecting the visibility checkbox or normal block behavior.

Comments

stewart.adam’s picture

If the block visibility box

Are you referring to the Drupal block visibility settings, or the AJAX cart setting "Enable ajax cart functionality only when block is enabled"?

I can place uc_ajax_cart in a node using php module_load() and print statements

While this may be possible to get working, this wasn't the intended use case for the module... It would be far easier, I think, to place a region near your content area and place the AJAX cart block into said area to achieve the same effect. Please post the code you are using to print the block.

rsbecker’s picture

I have had the block in a table for some time. The following worked fine in the pas and works with version 2.1

<?php
$block = module_invoke('uc_ajax_cart', 'block', 'view', 0);
print $block['content'];
?>

It is clear that I do not understand the purpose of that checkbox if it is not to work with the core block module.

stewart.adam’s picture

Are there any errors in your JavaScript console when viewing a page using the code above? Also, what is the status of the checkbox "Enable ajax cart functionality only when block is enabled" in the AJAX cart settings?

rsbecker’s picture

There are no javascript errors showing on the page.

Because I have reverted to uc_ajax_cart 2.1 there is no "Enable ajax cart functionality only when block is enabled" checkbox. The block has been configured but it is disabled.

When I tried version 2.3 the block would work properly only when enabled, regardless of whether the "Enable ajax cart functionality only when block is enabled" was checked. If the block actually was enabled, the code I provided worked correctly, but I had a second copy of the cart in the region to which the block was assigned. If the block was disabled, the cart would appear but would get stuck with the "Cart loading ..." message. If the cart was enabled, but not for the page on which I placed the code, the cart would appear and would load, but it would not seem to update in real time. I would have to reload the page manually to see the updates.