[*] CO : Additional Shipping Cost / Purchase Price / Reduction Amount texc in OrderDetails
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11345 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+1
-1
@@ -380,7 +380,7 @@ class CartCore extends ObjectModel
|
||||
p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`, p.`price`, p.`weight`,
|
||||
stock.`quantity` quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`active`, p.`date_add`,
|
||||
p.`date_upd`, t.`id_tax`, tl.`name` AS tax, t.`rate`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
||||
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery');
|
||||
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery, p.`wholesale_price`');
|
||||
|
||||
// Build FROM
|
||||
$sql->from('cart_product cp');
|
||||
|
||||
@@ -93,7 +93,7 @@ class HelpAccessCore
|
||||
if (array_key_exists('image', $infos) && $infos['image'] != 'none')
|
||||
{
|
||||
$content .= '
|
||||
<a class="help-button" href="#" onclick="showHelp(\''.HelpAccess::URL.'\',\''.$label.'\',\''.$iso_lang.'\',\''.$ps_version.'\',\''.$infos['version'].'\',\''.$country.'\');" title="'.Tools::htmlentitiesUTF8($infos['tooltip']).'">
|
||||
<a class="help-button" href="#" onclick="showHelp(\''.HelpAccess::URL.'\',\''.Tools::safeOutput($label).'\',\''.Tools::safeOutput($iso_lang).'\',\''.Tools::safeOutput($ps_version).'\',\''.Tools::safeOutput($infos['version']).'\',\''.Tools::safeOutput($country).'\');" title="'.Tools::htmlentitiesUTF8($infos['tooltip']).'">
|
||||
<img id="help-'.$label.'" src="../img/admin/'.Tools::htmlentitiesUTF8($infos['image']).'" alt="" class="middle" style="margin-top: -5px"/> '.Tools::displayError('HELP').'
|
||||
</a>';
|
||||
if (!empty($infos['tooltip']))
|
||||
|
||||
@@ -81,6 +81,12 @@ class OrderDetailCore extends ObjectModel
|
||||
/** @var float */
|
||||
public $reduction_amount;
|
||||
|
||||
/** @var float */
|
||||
public $reduction_amount_tax_excl;
|
||||
|
||||
/** @var float */
|
||||
public $reduction_amount_tax_incl;
|
||||
|
||||
/** @var float */
|
||||
public $group_reduction;
|
||||
|
||||
@@ -129,6 +135,12 @@ class OrderDetailCore extends ObjectModel
|
||||
/** @var int Id warehouse */
|
||||
public $id_warehouse;
|
||||
|
||||
/** @var float additional shipping price tax excl */
|
||||
public $total_shipping_price_tax_excl;
|
||||
|
||||
/** @var float additional shipping price tax incl */
|
||||
public $total_shipping_price_tax_incl;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -150,6 +162,8 @@ class OrderDetailCore extends ObjectModel
|
||||
'product_price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
|
||||
'reduction_percent' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'reduction_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||
'reduction_amount_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||
'reduction_amount_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||
'group_reduction' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'product_quantity_discount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'product_ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13'),
|
||||
@@ -397,6 +411,8 @@ class OrderDetailCore extends ObjectModel
|
||||
$price = Tools::convertPrice($this->specificPrice['reduction'], $order->id_currency);
|
||||
$this->reduction_amount = (float)(!$this->specificPrice['id_currency'] ?
|
||||
$price : $this->specificPrice['reduction']);
|
||||
$this->reduction_amount_tax_incl = $this->reduction_amount;
|
||||
$this->reduction_amount_tax_excl = Tools::ps_round($this->tax_calculator->removeTaxes($this->reduction_amount_tax_incl), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +442,10 @@ class OrderDetailCore extends ObjectModel
|
||||
$this->total_price_tax_incl = (float)$product['total_wt'];
|
||||
$this->total_price_tax_excl = (float)$product['total'];
|
||||
|
||||
$this->purchase_supplier_price = (float)$product['wholesale_price'];
|
||||
if ($product['id_supplier'] > 0)
|
||||
$this->purchase_supplier_price = (float)ProductSupplier::getProductPrice((int)$product['id_supplier'], $product['id_product'], $product['id_product_attribute']);
|
||||
|
||||
$this->setSpecificPrice($order);
|
||||
|
||||
$this->group_reduction = (float)(Group::getReduction((int)($order->id_customer)));
|
||||
@@ -490,6 +510,7 @@ class OrderDetailCore extends ObjectModel
|
||||
|
||||
if ($use_taxes)
|
||||
$this->setProductTax($order, $product);
|
||||
$this->setShippingCost($order, $product);
|
||||
$this->setDetailProductPrice($order, $cart, $product);
|
||||
|
||||
// Set order invoice id
|
||||
@@ -535,5 +556,24 @@ class OrderDetailCore extends ObjectModel
|
||||
{
|
||||
return $this->outOfStock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the additional shipping information
|
||||
*
|
||||
* @param Order $order
|
||||
* @param $product
|
||||
*/
|
||||
public function setShippingCost(Order $order, $product)
|
||||
{
|
||||
$tax_rate = 0;
|
||||
|
||||
$carrier = OrderInvoice::getCarrier((int)$this->id_order_invoice);
|
||||
if (isset($carrier) && Validate::isLoadedObject($carrier))
|
||||
$tax_rate = $carrier->getTaxesRate(new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
|
||||
$this->total_shipping_price_tax_excl = (float) $product['additional_shipping_cost'];
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -288,5 +288,11 @@ ALTER TABLE `PREFIX_product` ADD COLUMN `advanced_stock_management` tinyint(1) d
|
||||
DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_PDF_ENCODING';
|
||||
DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_PDF_FONT';
|
||||
|
||||
|
||||
ALTER TABLE `PREFIX_order_detail`
|
||||
ADD `reduction_amount_tax_incl` FLOAT( 20.6 ) NOT NULL AFTER `reduction_amount` ,
|
||||
ADD `reduction_amount_tax_excl` FLOAT( 20.6 ) NOT NULL AFTER `reduction_amount_tax_incl`;
|
||||
|
||||
ALTER TABLE `PREFIX_order_cart_rule` ADD `value_tax_excl` DECIMAL(17, 2) NOT NULL DEFAULT '0.00';
|
||||
ALTER TABLE `PREFIX_order_cart_rule` ADD `id_order_invoice` INT NOT NULL DEFAULT '0' AFTER `id_cart_rule`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user