// id_warehouse is now on the order details and not on orders table
This commit is contained in:
@@ -147,7 +147,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$order->id_address_delivery = (int)$id_address;
|
||||
$order->id_currency = $id_currency;
|
||||
$order->id_lang = (int)($cart->id_lang);
|
||||
$order->id_warehouse = $package_list[$id_address][$id_package]['id_warehouse'];
|
||||
$order->id_cart = (int)($cart->id);
|
||||
$order->reference = $reference;
|
||||
|
||||
@@ -203,7 +202,7 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
// Insert new Order detail list using cart for the current order
|
||||
$order_detail = new OrderDetail(null, null, $this->context);
|
||||
$order_detail->createList($order, $cart, $id_order_state, $product_list);
|
||||
$order_detail->createList($order, $cart, $id_order_state, $product_list, 0, true, $package_list[$id_address][$id_package]['id_warehouse']);
|
||||
$order_detail_list[] = $order_detail;
|
||||
|
||||
// Adding an entry in order_carrier table
|
||||
|
||||
@@ -147,8 +147,6 @@ class OrderCore extends ObjectModel
|
||||
*/
|
||||
public $reference;
|
||||
|
||||
/** @var int Id warehouse */
|
||||
public $id_warehouse;
|
||||
|
||||
protected $tables = array ('orders');
|
||||
|
||||
@@ -163,7 +161,6 @@ class OrderCore extends ObjectModel
|
||||
'id_lang' => 'isUnsignedId',
|
||||
'id_customer' => 'isUnsignedId',
|
||||
'id_carrier' => 'isUnsignedId',
|
||||
'id_warehouse' => 'isUnsignedId',
|
||||
'secure_key' => 'isMd5',
|
||||
'payment' => 'isGenericName',
|
||||
'recyclable' => 'isBool',
|
||||
@@ -280,7 +277,6 @@ class OrderCore extends ObjectModel
|
||||
$fields['date_add'] = pSQL($this->date_add);
|
||||
$fields['date_upd'] = pSQL($this->date_upd);
|
||||
$fields['reference'] = pSQL($this->reference);
|
||||
$fields['id_warehouse'] = pSQL($this->id_warehouse);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -125,11 +125,15 @@ class OrderDetailCore extends ObjectModel
|
||||
|
||||
/** @var float $tax_rate **/
|
||||
public $tax_rate;
|
||||
|
||||
/** @var int Id warehouse */
|
||||
public $id_warehouse;
|
||||
|
||||
protected $tables = array('order_detail');
|
||||
|
||||
protected $fieldsRequired = array(
|
||||
'id_order',
|
||||
'id_warehouse',
|
||||
'product_name',
|
||||
'product_quantity',
|
||||
'product_price');
|
||||
@@ -137,6 +141,7 @@ class OrderDetailCore extends ObjectModel
|
||||
protected $fieldsValidate = array(
|
||||
'id_order' => 'isUnsignedId',
|
||||
'id_order_invoice' => 'isUnsignedId',
|
||||
'id_warehouse' => 'isUnsignedId',
|
||||
'product_id' => 'isUnsignedId',
|
||||
'product_attribute_id' => 'isUnsignedId',
|
||||
'product_name' => 'isGenericName',
|
||||
@@ -218,6 +223,7 @@ class OrderDetailCore extends ObjectModel
|
||||
|
||||
$fields['id_order'] = (int)$this->id_order;
|
||||
$fields['id_order_invoice'] = (int)$this->id_order_invoice;
|
||||
$fields['id_warehouse'] = pSQL($this->id_warehouse);
|
||||
$fields['product_id'] = (int)$this->product_id;
|
||||
$fields['product_attribute_id'] = (int)$this->product_attribute_id;
|
||||
$fields['product_name'] = pSQL($this->product_name);
|
||||
@@ -410,11 +416,11 @@ class OrderDetailCore extends ObjectModel
|
||||
$this->tax_calculator = $tax_manager->getTaxCalculator();
|
||||
}
|
||||
|
||||
$this->ecotax_tax_rate = 0;
|
||||
if (!empty($product['ecotax']))
|
||||
$this->ecotax_tax_rate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$this->ecotax_tax_rate = 0;
|
||||
if (!empty($product['ecotax']))
|
||||
$this->ecotax_tax_rate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
$this->tax_computation_method = (int)$this->tax_calculator->computation_method;
|
||||
$this->tax_computation_method = (int)$this->tax_calculator->computation_method;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,11 +453,11 @@ class OrderDetailCore extends ObjectModel
|
||||
*/
|
||||
protected function setDetailProductPrice(Order $order, Cart $cart, $product)
|
||||
{
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
$customer_address = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
$customer_address = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
$this->specificPrice = SpecificPrice::getSpecificPrice(
|
||||
(int)$product['id_product'],
|
||||
$this->specificPrice = SpecificPrice::getSpecificPrice(
|
||||
(int)$product['id_product'],
|
||||
(int)$order->id_shop,
|
||||
(int)$order->id_currency,
|
||||
(int)$customer_address->id_country,
|
||||
@@ -498,8 +504,8 @@ class OrderDetailCore extends ObjectModel
|
||||
* @param int $id_order_status
|
||||
* @param int $id_order_invoice
|
||||
* @param bool $use_taxes set to false if you don't want to use taxes
|
||||
*/
|
||||
protected function create(Order $order, Cart $cart, $product, $id_order_state, $id_order_invoice, $use_taxes = true)
|
||||
*/
|
||||
protected function create(Order $order, Cart $cart, $product, $id_order_state, $id_order_invoice, $use_taxes = true, $id_warehouse = 0)
|
||||
{
|
||||
if ($use_taxes)
|
||||
$this->tax_calculator = new TaxCalculator();
|
||||
@@ -518,6 +524,7 @@ class OrderDetailCore extends ObjectModel
|
||||
$this->product_reference = empty($product['reference']) ? null : pSQL($product['reference']);
|
||||
$this->product_supplier_reference = empty($product['supplier_reference']) ? null : pSQL($product['supplier_reference']);
|
||||
$this->product_weight = (float)($product['id_product_attribute'] ? $product['weight_attribute'] : $product['weight']);
|
||||
$this->id_warehouse = $id_warehouse;
|
||||
|
||||
$productQuantity = (int)(Product::getQuantity($this->product_id, $this->product_attribute_id));
|
||||
$this->product_quantity_in_stock = ($productQuantity - (int)($product['cart_quantity']) < 0) ?
|
||||
@@ -549,7 +556,7 @@ class OrderDetailCore extends ObjectModel
|
||||
* @param int $id_order_invoice
|
||||
* @param bool $use_taxes set to false if you don't want to use taxes
|
||||
*/
|
||||
public function createList(Order $order, Cart $cart, $id_order_state, $product_list, $id_order_invoice = 0, $use_taxes = true)
|
||||
public function createList(Order $order, Cart $cart, $id_order_state, $product_list, $id_order_invoice = 0, $use_taxes = true, $id_warehouse = 0)
|
||||
{
|
||||
$this->vat_address = new Address((int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
$this->customer = new Customer((int)($order->id_customer));
|
||||
@@ -558,7 +565,7 @@ class OrderDetailCore extends ObjectModel
|
||||
$this->outOfStock = false;
|
||||
|
||||
foreach ($product_list as $product)
|
||||
$this->create($order, $cart, $product, $id_order_state, $id_order_invoice, $use_taxes);
|
||||
$this->create($order, $cart, $product, $id_order_state, $id_order_invoice, $use_taxes, $id_warehouse);
|
||||
|
||||
unset($this->vat_address);
|
||||
unset($products);
|
||||
@@ -568,7 +575,7 @@ class OrderDetailCore extends ObjectModel
|
||||
/**
|
||||
* Get the state of the current stock product
|
||||
* @return array
|
||||
*/
|
||||
*/
|
||||
public function getStockState()
|
||||
{
|
||||
return $this->outOfStock;
|
||||
|
||||
@@ -995,7 +995,6 @@ CREATE TABLE `PREFIX_orders` (
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_carrier` int(10) unsigned NOT NULL,
|
||||
`id_warehouse` int(10) unsigned DEFAULT 0,
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
`id_cart` int(10) unsigned NOT NULL,
|
||||
@@ -1077,6 +1076,7 @@ CREATE TABLE `PREFIX_order_detail` (
|
||||
`id_order_detail` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_order` int(10) unsigned NOT NULL,
|
||||
`id_order_invoice` int(11) default NULL,
|
||||
`id_warehouse` int(10) unsigned DEFAULT 0,
|
||||
`product_id` int(10) unsigned NOT NULL,
|
||||
`product_attribute_id` int(10) unsigned default NULL,
|
||||
`product_name` varchar(255) NOT NULL,
|
||||
|
||||
@@ -4,4 +4,9 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('2', '108', '1', '1', '1', '1');
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('3', '108', '1', '1', '1', '1');
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('4', '108', '0', '0', '0', '0');
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('5', '108', '0', '0', '0', '0');
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('5', '108', '0', '0', '0', '0');
|
||||
|
||||
|
||||
|
||||
ALTER TABLE `PREFIX_orders` DROP COLUMN `id_warehouse`;
|
||||
ALTER TABLE `PREFIX_order_detail` ADD COLUMN `id_warehouse` int(10) unsigned DEFAULT 0 AFTER `id_order_invoice`;
|
||||
@@ -639,4 +639,6 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#gift').checkboxChange(function() { $('#gift_div').show('slow'); }, function() { $('#gift_div').hide('slow'); });
|
||||
});
|
||||
|
||||
@@ -740,5 +740,4 @@ $(document).ready(function() {
|
||||
// If the multishipping mode is on, check the box "I want to specify a delivery address for each products I order.".
|
||||
if (typeof(multishipping_mode) != 'undefined' && multishipping_mode)
|
||||
$('#multishipping_mode_checkbox').click()
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -224,3 +224,19 @@ function resizeAddressesBox(nameBox)
|
||||
});
|
||||
$(nameBox).height(maxHeight);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$.fn.checkboxChange = function(fnChecked, fnUnchecked) {
|
||||
if ($(this).attr('checked') && fnChecked)
|
||||
fnChecked.call(this);
|
||||
else if(fnUnchecked)
|
||||
fnUnchecked.call(this);
|
||||
console.log('fff');
|
||||
|
||||
if (!$(this).attr('eventCheckboxChange'))
|
||||
{
|
||||
$(this).live('change', function() { $(this).checkboxChange(fnChecked, fnUnchecked) });
|
||||
$(this).attr('eventCheckboxChange', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -196,7 +196,7 @@
|
||||
{if $giftAllowed}
|
||||
<h3 class="gift_title">{l s='Gift'}</h3>
|
||||
<p class="checkbox">
|
||||
<input type="checkbox" name="gift" id="gift" value="1" {if $cart->gift == 1}checked="checked"{/if} onclick="$('#gift_div').toggle('slow');" />
|
||||
<input type="checkbox" name="gift" id="gift" value="1" {if $cart->gift == 1}checked="checked"{/if} />
|
||||
<label for="gift">{l s='I would like the order to be gift-wrapped.'}</label>
|
||||
<br />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user