Closed (fixed)
Project:
Ubercart Views
Version:
6.x-3.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
1 Nov 2009 at 04:31 UTC
Updated:
17 Nov 2009 at 03:40 UTC
Jump to comment: Most recent file
Hi,
I added support for the physical Weight on uc_orders_products by inserting this near line 90 of 'uc_views.views.inc'
<?php
$data['uc_order_products']['weight'] = array(
'title' => t('Weight'),
'help' => $order_products['fields']['weight']['description'],
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_float',
),
);
However when i tried to change the [field][handler] from the default 'views_handler_field' to ubercart's (RC6) handler for weights 'uc_product_handler_field_weight' it turned ugly. I cant remember right now what happened.
I Will report more on this, but i feel it maybe related to the same issue #614032: Views with Order total field blank in UC2.0 here.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | uc_views_handler_field_weight.inc_.zip | 820 bytes | psy |
Comments
Comment #1
psy commentedThe ugliness reported when the field handler is set to 'uc_product_handler_field_weight' was 'Fatal error: Cannot access empty property in /home/blah/public_html/sites/all/modules/ubercart/uc_product/views/uc_product_handler_field_weight.inc on line 14'.
Comment #2
psy commentedHere is a working solution
Add this to uc_views_views_handlers() handlers array near line 845 of 'uc_views.views.inc':
'uc_views_handler_field_weight' => array('parent' => 'views_handler_field',),
And put this file 'uc_views_handler_field_weight.inc' (attached and listed) to the views folder
Finally change the weight field element from above to use the new field_handler
This works for me
Comment #3
madsph commentedThanks.
I will take a look into this and then get back to you.
Comment #4
madsph commentedI worked around the problem you had about using the default weight handler from uc_products by adding the weight unit as an additional field to the weight.
Your patch is committed to the dev branch. Thank you for the great work.
Comment #5
psy commented@madsph
And thanks for yours!