[-] WS : Add tax for orders inside order_details api entity
This commit is contained in:
@@ -196,8 +196,12 @@ class OrderDetailCore extends ObjectModel
|
|||||||
'discount_quantity_applied' => array(),
|
'discount_quantity_applied' => array(),
|
||||||
'download_hash' => array(),
|
'download_hash' => array(),
|
||||||
'download_deadline' => array()
|
'download_deadline' => array()
|
||||||
)
|
),
|
||||||
);
|
'associations' => array(
|
||||||
|
'taxes' => array('resource' => 'tax', 'getter' => 'getWsTaxes', 'setter' => false, 'virtual_entity' => true,
|
||||||
|
'fields' => array('id' => array()),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $outOfStock = false;
|
protected $outOfStock = false;
|
||||||
@@ -223,7 +227,7 @@ class OrderDetailCore extends ObjectModel
|
|||||||
$id_shop = null;
|
$id_shop = null;
|
||||||
if ($this->context != null && isset($this->context->shop))
|
if ($this->context != null && isset($this->context->shop))
|
||||||
$id_shop = $this->context->shop->getID();
|
$id_shop = $this->context->shop->getID();
|
||||||
return parent::__construct($id, $id_lang, $id_shop);
|
parent::__construct($id, $id_lang, $id_shop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDownloadFromHash($hash)
|
public static function getDownloadFromHash($hash)
|
||||||
@@ -577,5 +581,14 @@ class OrderDetailCore extends ObjectModel
|
|||||||
$this->total_shipping_price_tax_incl = (float)($this->total_shipping_price_tax_excl * (1 + ($tax_rate / 100)));
|
$this->total_shipping_price_tax_incl = (float)($this->total_shipping_price_tax_excl * (1 + ($tax_rate / 100)));
|
||||||
$this->total_shipping_price_tax_incl = Tools::ps_round($this->total_shipping_price_tax_incl, 2);
|
$this->total_shipping_price_tax_incl = Tools::ps_round($this->total_shipping_price_tax_incl, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWsTaxes()
|
||||||
|
{
|
||||||
|
$query = new DbQuery();
|
||||||
|
$query->select('id_tax as id');
|
||||||
|
$query->from('order_detail_tax', 'tax');
|
||||||
|
$query->join('LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (tax.`id_order_detail` = od.`id_order_detail`)');
|
||||||
|
$query->where('od.`id_order_detail` = '.(int)$this->id_order_detail);
|
||||||
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user