I'm trying to create a custom report for my store that would display a list of customers and their purchases, something like:

date| client name | Name of Product|

I can't seem to get both the client name and the product name in 1 report
Am I missing something, or is this not possible?

thanks
m

Comments

madsph’s picture

Sorry for being so long to answer. I have been offline for 3 weekes (holiday :-D)

You can try importing this and see if that is something like what you are trying to do.

$view = new view;
$view->name = 'customer_purchase';
$view->description = 'List of customers and what they purchased';
$view->tag = 'customer product';
$view->view_php = '';
$view->base_table = 'uc_orders';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'created' => array(
    'label' => 'Date',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'date_format' => 'small',
    'custom_date_format' => '',
    'exclude' => 0,
    'id' => 'created',
    'table' => 'uc_orders',
    'field' => 'created',
    'relationship' => 'none',
  ),
  'name' => array(
    'label' => 'Name',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_user' => 1,
    'overwrite_anonymous' => 0,
    'anonymous_text' => '',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'users',
    'field' => 'name',
    'relationship' => 'none',
  ),
  'title' => array(
    'label' => 'Product',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'exclude' => 0,
    'id' => 'title',
    'table' => 'uc_order_products',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => 'name',
  'override' => 1,
  'sticky' => 1,
  'order' => 'asc',
  'columns' => array(
    'created' => 'created',
    'name' => 'name',
    'title' => 'title',
  ),
  'info' => array(
    'created' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'name' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'title' => array(
      'sortable' => 1,
      'separator' => '',
    ),
  ),
  'default' => 'name',
));
$handler->override_option('row_options', array(
  'inline' => array(
    'created' => 'created',
    'name' => 'name',
    'title' => 'title',
  ),
  'separator' => '',
));

I am using the latest development version of uc_views, so if you are running a really old copy it might not work.

Hope this helps.

micheleannj’s picture

Excellent! I'll try it out.
Hope you had a good vacation and thanks for getting back to my requests.

m

micheleannj’s picture

Hmmm...I got "Field handler uc_order_products.title is not available."
I'm using uc_views 6.x-2.0

Any ideas?

madsph’s picture

Ah - yes. In you version we haven't made uc_order_products a base table yet...

Hmmm. are you able to use the 'Node: Title' field in stead?

madsph’s picture

Assigned: Unassigned » madsph
Status: Active » Closed (fixed)