Posted by kreutzer on December 14, 2011 at 11:50am
1 follower
| Project: | UC Node Checkout |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I'm using UC Node Checkout to first have users fill up a form (Node) and then attach a specific product to that. I have a computed CCK field in the node which computes the number of days. I'd like this value to be reflected in the product qty when I press "add to cart." I've tried to add this in the .module file of this module, around line 846 (function uc_node_checkout_uc_cart_item), but somehow my coding is not upto the mark.
The included code in the .module file is:
<?php
function uc_node_checkout_uc_cart_item($op, &$item) {
switch ($op) {
case 'load':
// Load the entire related node into the item array for use in display.
if (isset($item->data['node_checkout_nid']) &&
$node = node_load($item->data['node_checkout_nid'])) {
$item->checkout_node = $node;
}
?>So the node is loaded, and I'd like to do something like the following:
<?php
// field name of computed field is field_totaldays - Get value
$dayqty =& $node->{'field_totaldays'}[0]['value'];
$item->qty = $dayqty;
?>But the above code is obviously wrong. Can somebody please help?
Thanks.