Ubercart uc_cart_get_contents get data from standard class

eriesABCEK

New Member
I'm writing a custom module for one of my projects and I'm having a bit of an issue. What I'm trying to do is get a piece of data from uc_cart_get_contents() into a variable so that I can use it in a calculation: Here's my var_export:\[code\]array ( )array ( 0 => stdClass::__set_state(array( 'cart_item_id' => '5', 'cart_id' => '1', 'nid' => '9', 'qty' => '10', 'changed' => '1287074120', 'data' => array ( 'attributes' => array ( 3 => '4', ), 'shippable' => '1', 'restrict_qty' => '0', 'module' => 'uc_product', ), 'title' => 'Chicago Canyon', 'vid' => '9', 'cost' => 1.16, 'price' => 11.16, 'weight' => 0, 'module' => 'uc_product', 'model' => 'chicago-canyon-p-card-p-env', )), )\[/code\]But what if I want to put the model of each item in the cart into a variable, and based upon that variable adjust the item's price.If it was an array I would do this:\[code\]$items= uc_cart_get_contents();$model = $items[model];\[/code\]but that doesn't work, it's a std class. I'm so so lost. Please help!
 
Back
Top