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
Comment #1
ibuildit commentedI 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.
Comment #2
subhojit777Hi 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 :)
Comment #3
subhojit777Comment #5
subhojit777