I need to pass product variable defined in hook_theme() and invoked in #theme
but not sure how to pass product variables in #theme
Please suggest.
function storeinv_theme() {
return array(
'storeinv_pickup' => array(
'variables' => array('product' => NULL),
),
);
}
function storeinv_uc_product_description($product) {
$description = array(
'pickup' => array(
'#product' => array(
'#type' => 'value',
'#value' => $product,
),
'#theme' =>'storeinv_pickup',
'#weight' => 1,
),
);
return $description;
}
function theme_storeinv_pickup($product){
$data = $product['#value']->data;
if (isset($data['pickup']['store_id']))
{
$store_id = $data['pickup']['store_id'];
$day = $data['pickup']['day'];
$date = date( 'l m/d/Y g:ia', strtotime( $day ) );
$result = views_get_view_result('field_altstoreid_value','default');
foreach($result as $k => $v){
if ($store_id == $v->field_altstoreid){
$name = $v->title;
return "<p>Pickup " .$date."at " . $name." </p>";
}
}
}
else {
return '';
}
}