Tags/topics: 
2
Answers
Vote up!
0
Vote down!

Views commerce exportable ?

Hi all,

I spotted a problem of size on the views of trade ... the views commerce_cart_form is not exportable in features (as it is in the code commerce_cart.pages.inc Line 48). But how to export this view without touching the code, because the only solution would be to clone the views for export in the features but chaner commerce_embed_views code in order to have good views in my site ... ? how can we do differently?

Asked by: woprrr
on July 20, 2012

2 Answers

Vote up!
1
Vote down!

The most of the hand would be less convenient to create a custom module to alter the output of the views created in commerce and add the fields that you want with an export views.

method:

Creates a custom module with the next hook:

<?php
/**
 * Implementation of hook_views_default_views_alter().
 */
function yourmodule_views_default_views_alter(&$views) {
 
// Alter only the 'view_name' view.
 
if (array_key_exists('view_name', $views)) {
   
$view = new view;
   
$view->name = 'view_name';

// PASTE YOUR VIEWS EXPORT CODE

    // Override the existing view with this new definition.
   
$views['view_name'] = $view;
  }
}
?>

This method may seem difficult adopted the point of view or if you change the views we must do every time export but that's exactly what makes Feature when it exports the views. Pending a possible alternative.

Answer by: woprrr
Posted: Jul 20, 2012
Vote up!
0
Vote down!

Hi,
I was wondering if this is still the case.
I find it quite awesome that with commerce custom products you can have the products customized, but you need to edit the view to show the customization in the cart.

If you try to deploy it, features shows you that view and lets you select it, but you can feature it as much as you want, it just doesn't happen. Thats kind of annoying.

Would be awesome if there would be an easier solution than the hook. It does work, but it's not as nice as using features.

Answer by: bechtold
Posted: Jun 13, 2014