"Shopping cart block" view without default display (block)?

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by laVera on February 18, 2016 at 1:06pm

Hello,

I have been working on other issues of my ecommerce, but when I decided to work on the cart, I noticed the default view that create the shopping cart block (commerce_cart_block) ,has not a default display mode (block) so is not available as block...

But if try to access to edit the default block, I get an access denied, even more if I do add a block display, it get named block_1...

I think it should in some weird ghost state. But this is happening me even in new installation, and I did searched into my custom code if there was the "commerce_cart_block" string (is the machine name of this view) but no results, so I don't know how could be I overwriting it.

Any ideas please? (I don't know where else to check)

AttachmentSize
view1.png 21.15 KB
view2.png 65.66 KB
view3.png 41.3 KB
view4.png 69.74 KB

Comments

This view is called from a

Posted by mnico on February 18, 2016 at 2:47pm

This view is called from a block created by the module commerce_cart, here is the code:

<?php
/**
* Implements hook_block_view().
*/
function commerce_cart_block_view($delta) {
global
$user;

// Prepare the display of the default Shopping Cart block.
if ($delta == 'cart') {
// Default to an empty cart block message.
$content = theme('commerce_cart_empty_block');

// First check to ensure there are products in the shopping cart.
if ($order = commerce_cart_order_load($user->uid)) {
$wrapper = entity_metadata_wrapper('commerce_order', $order);

// If there are one or more products in the cart...
if (commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()) > 0) {

// Build the variables array to send to the cart block template.
$variables = array(
'order' => $order,
'contents_view' => commerce_embed_view('commerce_cart_block', 'default', array($order->order_id), $_GET['q']),
);

$content = theme('commerce_cart_block', $variables);
}
}

return array(
'subject' => t('Shopping cart'), 'content' => $content);
}
}
?>

The function commerce_embed_view calls the views. That's why the view does not have the display "block" ;)

Thanks mnico! that explain

Posted by laVera on February 18, 2016 at 5:48pm

Thanks mnico! that explain why is not showing in views, now I have to check why it doesn't show at blocks (looks like a blocks + features issue now).

Thanks!

Just in case, the name of the

Posted by mnico on February 18, 2016 at 11:43pm

Just in case, the name of the block showing this "view" is "Shopping cart"

Voy a ver

Posted by sentidos5 on February 26, 2016 at 9:21am

Latin America

Group categories

Latin America

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /