I managed to hide the content of the block by editing the template file of the cart blocks but I'd like the entire block to hide if there are no products in the cart.

This was easy to do in the normal commerce cart module, but this seems to be working differently... any ideas? Thanks!!

Comments

ibuildit’s picture

I fixed it. Unfortunately I have never made a patch and I am swamped in work and don't have the time to create one now.

This is what I did (new lines marked with "+")

/**
* Implements hook_block_view().
*/
function dc_ajax_add_cart_block_view($delta = '') {
+$commerce_cart = dc_ajax_add_cart_get_commerce_cart_details();
+$line_items = $commerce_cart['wrapper']->commerce_line_items;
+$quantity = commerce_line_items_quantity($line_items, commerce_product_line_item_types());
$block = array();
switch ($delta) {
case 'ajax_shopping_cart':
+ if($commerce_cart['order'] && $quantity != 0){
$block['subject'] = t('Shopping cart');
$block['content'] = dc_ajax_add_cart_get_shopping_cart();
+ }
break;

case 'ajax_shopping_cart_teaser':
$block['content'] = dc_ajax_add_cart_get_shopping_cart_teaser();
break;
}

return $block;
}

Now I would love to be able to update the block with AJAX so it hides when you delete an item from the cart.

subhojit777’s picture

Component: Code » User interface
Issue summary: View changes
Status: Active » Postponed

Hi Jakob,

Thanks for testing this module. This is a feature request, I guess we should implement this feature once the module is a "full-project". Right now I am concentrating on bug fixes and its full-project access (its been an year since the module is in sandbox, didnot get time to fix its issues :p ). I would be happy to get more feature requests for this module :)

subhojit777’s picture

Version: » 7.x-1.x-dev
Assigned: Unassigned » subhojit777
Status: Postponed » Active

  • subhojit777 committed 207f73a on 7.x-1.x-dev
    Issue #1966860 by subhojit777: Added How can I hide the block if the...
subhojit777’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2
Status: Active » Closed (fixed)