Hi all,
I added some 2 extra fields in product. Now I want to access that field in place of sell price where we are calculating the qty*sellprice. Can anyone please help me where I can add this one .Thanks in advance.
you need to use the tapir hooks hook_table_alter(). See the tapir documentation for help
For example see my little module that add an unit price to cart view
<?php
function uc_unit_price_table_alter($table_id, $op, $args = NULL) {
switch ($table_id) {
case 'uc_cart_view_table':
case 'op_products_view_table':
switch ($op){
case 'fields':
$fields[] = array('name' => 'unit_price',
'title' => t('Unit price'),
'weight' => 2,
'enabled' => true,
);
return $fields;
case 'data':
foreach ($args['#parameters'][1] as $item) {
$data['unit_price'][] = uc_currency_format($item->price);
}
return $data;
}
break;
}
}
?>I will add the fields but I dont want to show it. I just want to access that field in place of sell price by writing if condition.
Ah, for that case, I think you need to use a node-product.tpl.php file in which, instead of printing $content, you will print only fields you need.
To easily see what field is available to you, use the excellent content template module
Are you considering to use the other fields price when checking out?? That will require a bit of digging/patching ubercart.
Are you looking for some kind of attributes. If you can list the functionality better, the guys can be of much help.
BTW, good to see another Indian in the forum



