I'm using Ubercart core 6.x-2.2 and Views 6.x-2.6.

When looking at the available "Fields" within Views I see the following:

Product: Add to cart form
Product: Buy it now button
Product: Cost
Product: List price
Product: SKU
Product: Sell price
Product: Weight

However, the dimensions are missing:

Product: Unit of Measurements
Product: Length
Product: Width
Product: Height

Would it be possible to make these fields available in Views?

Comments

5n00py’s picture

Sorry, meybe this is offtop, but.
I have problem with dimensions.
On hook_load ubercart set variables like this:
$node->Length;
But on hook_update and hook_insert that use variables like this:
$node->dim_length;

S if I run this code dimensions is set to 0;

$node=node_load($nid);
node_save($node);
dzieyzone’s picture

try to use node instead of fields. You can create a separate display by using this template node-view-.tpl.php

melchoir55’s picture

So I've accomplished this with some php code. Not sure if that is wise, but it is the only thing I could think of.

I created a custom php field with the custom fields module. the code begins with

$node = node_load($data->nid);

This dumps all the data relating to the product into $node. You can then inspect it using devel to get whichever variable names you want. Then you just add some

$output .= print $node->VARIABLENAME;

lines for what you want printed.

lpalgarvio’s picture

subscribing...

we need dimensions in Views/Panels/Display Suite

rodmarasi’s picture

ya, i need this feature too. we want to manipulate dimension, package quantity and shipping field. this is what makes drupal great. we can manipulate the module fields.

lpalgarvio’s picture

No support for dimension in Views yet.
also, no dimension or weight support in Panels yet. and the dev module is not even an official release yet.

I'm loosing all confidence in Ubercart and it's team.

3cwebdev’s picture

Subscribing. I'm also surprised that this feature hasn't been implemented yet.

jazznight17’s picture

Subscribing. agree with setfree.

5n00py’s picture

Status: Active » Needs review
StatusFileSize
new1.97 KB

I created patch for this issue.
I just added db fields to views definitions with default handlers.

In this patch included only 3 fields:

  • Product: Length
  • Product: Width
  • Product: Height

UPD:
This patch for lastest dev revision for 6.x.

3cwebdev’s picture

Awesome! Seems to be working, thanks! Any chance of getting the package quantity and shipping origin zip code added too? ;)

longwave’s picture

This could be added to the uc_views project if the Ubercart maintainers are not interested.

5n00py’s picture

Ok, I can add packege quantity to this patch.
Where I can find zip code?
By default "Product information" doesn't have this field.

5n00py’s picture

StatusFileSize
new2.81 KB

Same patch, but now with "package quantity".

3cwebdev’s picture

i was able to add a shipping origin zip field with the following addition to the same module:


$data['uc_quote_product_locations']['table']['group'] = t('Shipping');
  $data['uc_quote_product_locations']['table']['join'] = array(
    // Index this array by the table name to which this table refers.
    // 'left_field' is the primary key in the referenced table.
    // 'field' is the foreign key in this table.
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );
  
  $data['uc_quote_product_locations']['postal_code'] = array(
    'title' => t('Zip Code'),
    'help' => t('Zip Code'),
    'field' => array(
      'table' => 'node',
      'additional fields' => array(
        'nid' => array(
          'table' => 'node',
          'field' => 'nid',
        ),
      ),
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
      'float' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
  );
longwave’s picture

Status: Needs review » Needs work

Patch in #13 is a good start. I think it would be good to add a new handler that optionally displays the units, and also a single "dimensions" field that shows all 3 values (and units) in a single Views field.

If the shipping origin fields are also to be added, that should be addressed in a new issue.

longwave’s picture

Title: Dimension fields in Ubercart and Views » Dimension and package quantity fields in Views

Marked #985702: Add package quantity field in Views as duplicate, as it seems easier to deal with both in one issue.

lpalgarvio’s picture

yes, please seperate the add to cart button from the quantity field.

arski’s picture

subscribing, having package quantities in Views would be a blast!

5n00py’s picture

TY, longwave! Maybe on this week I could write a handler for dimensions.

akamaus’s picture

5n00py, any progress on #19?

By the way, what are shortcomings of just creating the dimensions field in node with cck?

tr’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
Issue tags: +Release blocker

Tagging.

longwave’s picture

tr’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev

Let's take care of this in 7.x-3.x first.

stewart.adam’s picture

It would be great to expose the default quantity to add to cart too. Attached patch does this against 6.x-dev (sorry don't have the time to update it against 7.x-dev atm).

LTech’s picture

Is there a patch to add dimensions to views for drupal 7?
Will it work in panels?

okokokok’s picture

Patch in #9 works fine for me. Thanks.

extensive’s picture

#9th patch is working fine.
Thanks

longwave’s picture

Status: Needs work » Patch (to be ported)

Committed to 6.x-2.x in http://drupalcode.org/project/ubercart.git/commitdiff/ec7180b

Needs porting to 7.x-3.x

longwave’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -Release blocker

Automatically closed -- issue fixed for 2 weeks with no activity.