public function getItemBaS($orderId, $returnArray = 0)
{
/*$db = JFactory::getDBO();
$config['dbo'] = $db;
Table::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
$table = Table::getInstance('PhocacartOrderUsers', 'Table', $config);
$tableS = JTable::getInstance('PhocacartOrderUsers', 'Table', $config);*/
// Billing and Shipping
$userItems = $this->getItemUser($orderId);
// Billing
/*if(isset($orderId) && (int)$orderId > 0) {
$return = $table->load(array('order_id' => (int)$orderId, 'type' => 0));
if ($return === false && $table->getError()) {
throw new Exception($table->getErrorMsg());
return false;
}
}
// Shipping
if(isset($orderId) && (int)$orderId > 0) {
$returnS = $tableS->load(array('order_id' => (int)$orderId, 'type' => 1));
if ($returnS === false && $tableS->getError()) {
throw new Exception($tableS->getErrorMsg());
return false;
}
}*/
// Convert to the JObject before adding other data.
$properties = array();
if (isset($userItems[0]['type']) && $userItems[0]['type'] == 0) {
$properties['b'] = $userItems[0];
}
if (isset($userItems[1]['type']) && $userItems[1]['type'] == 1) {
$properties['s'] = $userItems[1];
}
/*$properties['b'] = $table->getProperties(1);
$properties['s'] = $tableS->getProperties(1);
*/
/*if ($returnArray == 1) {
$region = $this->getRegion($properties['b']['country'], $properties['b']['region'] );
$properties['b']['countrytitle'] = $region['countrytitle'];
$properties['b']['regiontitle'] = $region['regiontitle'];
$region = $this->getRegion($properties['s']['country'], $properties['s']['region'] );
$properties['s']['countrytitle'] = $region['countrytitle'];
$properties['s']['regiontitle'] = $region['regiontitle'];
return $properties;
}*/
if ($returnArray == 1) {
return $properties;
}
//$itemS = JArrayHelper::toObject($propertiesS, 'JObject');
//$item = JArrayHelper::toObject($properties, 'JObject');
$item = new JObject();
//stdClass();
if (!empty($properties['b']) && is_object($item)) {
foreach ($properties['b'] as $k => $v) {
$newName = $k . '_phb';
$item->{$newName} = $v;
}
}
//Add shipping data to billing and do both data package
if (!empty($properties['s']) && is_object($item)) {
foreach ($properties['s'] as $k => $v) {
$newName = $k . '_phs';
$item->{$newName} = $v;
}
}
return $item;
}