// Bugs fix (Collection, SQL optimizations, Backoffice interfaces improvement, ...) + update db_settings_extends.sql for base datas relative to available quantities and suppliers
This commit is contained in:
@@ -177,8 +177,11 @@ a.module_toggle_all{color: #268CCD;}
|
||||
.toolbarBox .process-icon-new-module { background-image: url(process-icon-new-module.png);}
|
||||
.toolbarBox .process-icon-new-module-addon { background-image: url(process-icon-new-module-addon.png);}
|
||||
.toolbarBox .process-icon-save-and-preview { background-image: url(process-icon-preview.png);}
|
||||
.toolbarBox .process-icon-export-stock-state-quantities-csv { background-image: url(process-icon-export-csv.png);}
|
||||
.toolbarBox .process-icon-export-stock-state-prices-csv { background-image: url(process-icon-export-csv-details.png);}
|
||||
.toolbarBox .process-icon-export-csv-orders { background-image: url(process-icon-export-csv.png);}
|
||||
.toolbarBox .process-icon-export-csv-details { background-image: url(process-icon-export-csv-details.png);}
|
||||
.toolbarBox .process-icon-export-stock-mvt-csv { background-image: url(process-icon-export-csv.png);}
|
||||
|
||||
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1;}
|
||||
|
||||
@@ -351,7 +354,7 @@ form#product_form h4 { font-size:18px; font-weight:normal;}
|
||||
.blocLiveEdit { float:right; clear:right; background-color: #EBEDF4; border: 1px solid #C2C4D9;display: block; width:250px;}
|
||||
.blocLiveEdit h2 { margin:0; padding: 0 10px;}
|
||||
.blocLiveEdit p { padding: 0 10px;}
|
||||
.blocLiveEdit a.button {Êfloat: left; margin:10px; display: inline-block;}
|
||||
.blocLiveEdit a.button {�float: left; margin:10px; display: inline-block;}
|
||||
|
||||
|
||||
#modulePosition { width:100%; float:left; clear:left; margin-right:270px;}
|
||||
|
||||
@@ -180,7 +180,7 @@ class ProductSupplierCore extends ObjectModel
|
||||
if ($res && $this->id_product_attribute == 0)
|
||||
{
|
||||
$items = self::getSupplierCollection($this->id_product, false);
|
||||
foreach ($items as &$item)
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if ($item->id_product_attribute > 0)
|
||||
$item->delete();
|
||||
|
||||
@@ -2022,6 +2022,14 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product'))))
|
||||
{
|
||||
// Get all id_product_attribute
|
||||
$attributes = $product->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes))
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
// Get all available suppliers
|
||||
$suppliers = Supplier::getSuppliers();
|
||||
|
||||
@@ -2044,7 +2052,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (!in_array($associated_supplier->id_supplier, $suppliers_to_associate))
|
||||
{
|
||||
$associated_supplier->delete();
|
||||
unset($associated_suppliers[$key]);
|
||||
unset($associated_supplier);
|
||||
}
|
||||
|
||||
// Associate suppliers
|
||||
@@ -2069,14 +2077,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$this->confirmations[] = $this->l('Suppliers of the product have been updated');
|
||||
|
||||
// Get all id_product_attribute
|
||||
$attributes = $product->getAttributesResume($this->context->language->id);
|
||||
if (empty($attributes))
|
||||
$attributes[] = array(
|
||||
'id_product_attribute' => 0,
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
// Manage references and prices
|
||||
foreach ($attributes as $attribute)
|
||||
foreach ($associated_suppliers as $supplier)
|
||||
@@ -2148,7 +2148,37 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if ($product->id_supplier == $supplier->id_supplier)
|
||||
$product->wholesale_price = Tools::convertPrice($price, $id_currency);
|
||||
{
|
||||
if ((int)$attribute['id_product_attribute'] > 0)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'product_attribute
|
||||
SET supplier_reference = "'.$reference.'",
|
||||
wholesale_price = '.(float)Tools::convertPrice($price, $id_currency).'
|
||||
WHERE id_product = '.(int)$product->id.'
|
||||
AND id_product_attribute = '.(int)$attribute['id_product_attribute'].'
|
||||
LIMIT 1
|
||||
');
|
||||
}
|
||||
else
|
||||
{
|
||||
$product->wholesale_price = Tools::convertPrice($price, $id_currency); //converted in the default currency
|
||||
$product->supplier_reference = $reference;
|
||||
$update_product = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//int attribute with default values if possible
|
||||
if ((int)$attribute['id_product_attribute'] > 0)
|
||||
{
|
||||
$product_supplier = new ProductSupplier();
|
||||
$product_supplier->id_product = $product->id;
|
||||
$product_supplier->id_product_attribute = (int)$attribute['id_product_attribute'];
|
||||
$product_supplier->id_supplier = $supplier->id_supplier;
|
||||
$product_supplier->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1865,25 +1865,27 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
{
|
||||
if ($manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $supply_order->id_warehouse, true) <= $threshold)
|
||||
{
|
||||
// sets supply_order_detail
|
||||
$supply_order_detail = new SupplyOrderDetail();
|
||||
$supply_order_detail->id_supply_order = $supply_order->id;
|
||||
$supply_order_detail->id_currency = $order_currency->id;
|
||||
$supply_order_detail->id_product = $item['id_product'];
|
||||
$supply_order_detail->id_product_attribute = $item['id_product_attribute'];
|
||||
$supply_order_detail->reference = $item['reference'];
|
||||
$supply_order_detail->supplier_reference = $item['supplier_reference'];
|
||||
$supply_order_detail->name = Product::getProductName($item['id_product'], $item['id_product_attribute'], $supply_order->id_lang);
|
||||
$supply_order_detail->ean13 = $item['ean13'];
|
||||
$supply_order_detail->upc = $item['upc'];
|
||||
$supply_order_detail->quantity_expected = (int)$threshold;
|
||||
$supply_order_detail->exchange_rate = $order_currency->conversion_rate;
|
||||
|
||||
$product_currency = new Currency($item['id_currency']);
|
||||
if (Validate::isLoadedObject($product_currency))
|
||||
{
|
||||
// sets supply_order_detail
|
||||
$supply_order_detail = new SupplyOrderDetail();
|
||||
$supply_order_detail->id_supply_order = $supply_order->id;
|
||||
$supply_order_detail->id_currency = $order_currency->id;
|
||||
$supply_order_detail->id_product = $item['id_product'];
|
||||
$supply_order_detail->id_product_attribute = $item['id_product_attribute'];
|
||||
$supply_order_detail->reference = $item['reference'];
|
||||
$supply_order_detail->supplier_reference = $item['supplier_reference'];
|
||||
$supply_order_detail->name = Product::getProductName($item['id_product'], $item['id_product_attribute'], $supply_order->id_lang);
|
||||
$supply_order_detail->ean13 = $item['ean13'];
|
||||
$supply_order_detail->upc = $item['upc'];
|
||||
$supply_order_detail->exchange_rate = $order_currency->conversion_rate;
|
||||
$supply_order_detail->unit_price_te = Tools::convertPriceFull($item['unit_price_te'], $order_currency, $product_currency);
|
||||
$supply_order_detail->quantity_expected = (int)$threshold;
|
||||
$supply_order_detail->save();
|
||||
}
|
||||
else
|
||||
$supply_order_detail->unit_price_te = 0;
|
||||
|
||||
$supply_order_detail->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,11 +365,41 @@ INSERT INTO `PREFIX_product` (`id_product`, `indexed`, `id_supplier`, `id_manufa
|
||||
(8, 1, 0, 0, 1, 3, 0, 1, '0', 0.00, 0, 25.041806, 0.000000, '', NULL, 0, 2, 0, 0, 0, 0, 1, NOW(), NOW(), '0000-00-00'),
|
||||
(9, 1, 2, 2, 1, 3, 0, 1, '0', 0.00, 0, 124.581940, 0.000000, '', NULL, 0, 2, 0, 0, 0, 0, 1, NOW(), NOW(), '0000-00-00');
|
||||
|
||||
INSERT INTO `PREFIX_product_supplier` (`id_product_supplier`, `id_product`, `id_product_attribute`, `id_supplier`, `product_supplier_reference`, `product_supplier_price_te`, `id_currency`) VALUES
|
||||
(1, 1, 0, 1, '', '0.000000', 1),
|
||||
(2, 2, 0, 1, '', '0.000000', 1),
|
||||
(3, 6, 0, 1, '', '0.000000', 1),
|
||||
(4, 7, 0, 1, '', '0.000000', 1);
|
||||
INSERT INTO `ps_product_supplier` (`id_product_supplier`, `id_product`, `id_product_attribute`, `id_supplier`, `product_supplier_reference`, `product_supplier_price_te`, `id_currency`) VALUES
|
||||
(1, 1, 0, 1, '', '0.000000', 0),
|
||||
(2, 1, 25, 1, '', '0.000000', 0),
|
||||
(3, 1, 26, 1, '', '0.000000', 0),
|
||||
(4, 1, 27, 1, '', '0.000000', 0),
|
||||
(5, 1, 28, 1, '', '0.000000', 0),
|
||||
(6, 1, 29, 1, '', '0.000000', 0),
|
||||
(7, 1, 30, 1, '', '0.000000', 0),
|
||||
(8, 1, 31, 1, '', '0.000000', 0),
|
||||
(9, 1, 32, 1, '', '0.000000', 0),
|
||||
(10, 1, 33, 1, '', '0.000000', 0),
|
||||
(11, 1, 34, 1, '', '0.000000', 0),
|
||||
(12, 1, 35, 1, '', '0.000000', 0),
|
||||
(13, 1, 36, 1, '', '0.000000', 0),
|
||||
(14, 1, 39, 1, '', '0.000000', 0),
|
||||
(15, 1, 40, 1, '', '0.000000', 0),
|
||||
(16, 1, 41, 1, '', '0.000000', 0),
|
||||
(17, 1, 42, 1, '', '0.000000', 0),
|
||||
(18, 5, 0, 1, '', '0.000000', 0),
|
||||
(19, 5, 12, 1, '', '0.000000', 0),
|
||||
(20, 5, 13, 1, '', '0.000000', 0),
|
||||
(21, 5, 14, 1, '', '0.000000', 0),
|
||||
(22, 5, 15, 1, '', '0.000000', 0),
|
||||
(23, 8, 0, 1, '', '0.000000', 0),
|
||||
(24, 2, 0, 1, '', '0.000000', 0),
|
||||
(25, 2, 7, 1, '', '0.000000', 0),
|
||||
(26, 2, 8, 1, '', '0.000000', 0),
|
||||
(27, 2, 9, 1, '', '0.000000', 0),
|
||||
(28, 2, 10, 1, '', '0.000000', 0),
|
||||
(30, 6, 0, 1, '', '0.000000', 0),
|
||||
(31, 7, 0, 1, '', '0.000000', 0),
|
||||
(32, 7, 19, 1, '', '0.000000', 0),
|
||||
(33, 7, 22, 1, '', '0.000000', 0),
|
||||
(34, 7, 23, 1, '', '0.000000', 0),
|
||||
(35, 9, 0, 2, '', '0.000000', 0);
|
||||
|
||||
INSERT INTO `PREFIX_product_shop` (`id_product`, `id_shop`) (SELECT `id_product`, 1 FROM `PREFIX_product`);
|
||||
|
||||
@@ -1480,37 +1510,41 @@ INSERT INTO `PREFIX_module_group` (`id_group`, `id_module`) VALUES
|
||||
("3", "54"),
|
||||
("3", "55");
|
||||
|
||||
INSERT INTO `PREFIX_stock_available` (`id_stock_available`, `id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES
|
||||
(1, 2, 7, 1, 1, 10, 0, 2),
|
||||
(2, 2, 8, 1, 1, 20, 0, 2),
|
||||
(3, 2, 9, 1, 1, 30, 0, 2),
|
||||
(4, 2, 10, 1, 1, 40, 0, 2),
|
||||
(5, 5, 12, 1, 1, 100, 0, 2),
|
||||
(6, 5, 13, 1, 1, 99, 0, 2),
|
||||
(7, 5, 14, 1, 1, 50, 0, 2),
|
||||
(8, 5, 15, 1, 1, 25, 0, 2),
|
||||
(9, 7, 19, 1, 1, 50, 0, 2),
|
||||
(10, 7, 22, 1, 1, 60, 0, 2),
|
||||
(11, 7, 23, 1, 1, 70, 0, 2),
|
||||
(12, 1, 25, 1, 1, 50, 0, 2),
|
||||
(13, 1, 26, 1, 1, 50, 0, 2),
|
||||
(14, 1, 27, 1, 1, 50, 0, 2),
|
||||
(15, 1, 28, 1, 1, 50, 0, 2),
|
||||
(16, 1, 29, 1, 1, 50, 0, 2),
|
||||
(17, 1, 30, 1, 1, 50, 0, 2),
|
||||
(18, 1, 31, 1, 1, 50, 0, 2),
|
||||
(19, 1, 32, 1, 1, 50, 0, 2),
|
||||
(20, 1, 33, 1, 1, 50, 0, 2),
|
||||
(21, 1, 34, 1, 1, 50, 0, 2),
|
||||
(22, 1, 35, 1, 1, 50, 0, 2),
|
||||
(23, 1, 36, 1, 1, 50, 0, 2),
|
||||
(24, 1, 39, 1, 1, 50, 0, 2),
|
||||
(25, 1, 40, 1, 1, 50, 0, 2),
|
||||
(26, 1, 41, 1, 1, 50, 0, 2),
|
||||
(27, 1, 42, 1, 1, 50, 0, 2),
|
||||
(28, 6, 0, 1, 4, 1, 0, 2),
|
||||
(29, 8, 0, 1, 8, 1, 0, 2),
|
||||
(30, 9, 0, 1, 15, 1, 0, 2);
|
||||
INSERT INTO `ps_stock_available` (`id_stock_available`, `id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES
|
||||
(1, 1, 25, 1, 0, 10, 0, 0),
|
||||
(2, 1, 0, 1, 0, 160, 0, 0),
|
||||
(3, 1, 26, 1, 0, 10, 0, 0),
|
||||
(4, 1, 27, 1, 0, 10, 0, 0),
|
||||
(5, 1, 28, 1, 0, 10, 0, 0),
|
||||
(6, 1, 29, 1, 0, 10, 0, 0),
|
||||
(7, 1, 30, 1, 0, 10, 0, 0),
|
||||
(8, 1, 31, 1, 0, 10, 0, 0),
|
||||
(9, 1, 32, 1, 0, 10, 0, 0),
|
||||
(10, 1, 33, 1, 0, 10, 0, 0),
|
||||
(11, 1, 34, 1, 0, 10, 0, 0),
|
||||
(12, 1, 35, 1, 0, 10, 0, 0),
|
||||
(13, 1, 36, 1, 0, 10, 0, 0),
|
||||
(14, 1, 39, 1, 0, 10, 0, 0),
|
||||
(15, 1, 40, 1, 0, 10, 0, 0),
|
||||
(16, 1, 41, 1, 0, 10, 0, 0),
|
||||
(17, 1, 42, 1, 0, 10, 0, 0),
|
||||
(18, 5, 12, 1, 0, 100, 0, 0),
|
||||
(19, 5, 0, 1, 0, 400, 0, 0),
|
||||
(20, 5, 13, 1, 0, 100, 0, 0),
|
||||
(21, 5, 14, 1, 0, 100, 0, 0),
|
||||
(22, 5, 15, 1, 0, 100, 0, 0),
|
||||
(23, 8, 0, 1, 0, 25, 0, 0),
|
||||
(24, 2, 7, 1, 0, 30, 0, 0),
|
||||
(25, 2, 0, 1, 0, 120, 0, 0),
|
||||
(26, 2, 8, 1, 0, 30, 0, 0),
|
||||
(27, 2, 9, 1, 0, 30, 0, 0),
|
||||
(28, 2, 10, 1, 0, 30, 0, 0),
|
||||
(29, 9, 0, 1, 0, 15, 0, 0),
|
||||
(30, 6, 0, 1, 0, 75, 0, 0),
|
||||
(31, 7, 19, 1, 0, 40, 0, 0),
|
||||
(32, 7, 0, 1, 0, 120, 0, 0),
|
||||
(33, 7, 22, 1, 0, 40, 0, 0),
|
||||
(34, 7, 23, 1, 0, 40, 0, 0);
|
||||
|
||||
INSERT INTO `PREFIX_order_carrier` (`id_order`, `id_carrier`, `date_add`) VALUES
|
||||
(1, 2, NOW());
|
||||
|
||||
@@ -329,7 +329,7 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
|
||||
(152, 'PS_CARRIER_DEFAULT_SORT', '0', NOW(), NOW()),
|
||||
(153, 'PS_STOCK_MVT_INC_REASON_DEFAULT', '1', NOW(), NOW()),
|
||||
(154, 'PS_STOCK_MVT_DEC_REASON_DEFAULT', '2', NOW(), NOW()),
|
||||
(155, 'PS_ADVANCED_STOCK_MANAGEMENT', '1', NOW(), NOW()),
|
||||
(155, 'PS_ADVANCED_STOCK_MANAGEMENT', '0', NOW(), NOW()),
|
||||
(156, 'PS_ADMINREFRESH_NOTIFICATION', '1', NOW(), NOW()),
|
||||
(157, 'PS_STOCK_MVT_TRANSFER_TO', '7', NOW(), NOW()),
|
||||
(158, 'PS_STOCK_MVT_TRANSFER_FROM', '6', NOW(), NOW()),
|
||||
@@ -1505,12 +1505,6 @@ INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `n
|
||||
(8, 4, 'Supply Order'),
|
||||
(8, 5, 'Supply Order');
|
||||
|
||||
INSERT INTO `PREFIX_warehouse` (`id_warehouse`, `id_currency`, `id_address`, `id_employee`, `reference`, `name`, `management_type`) VALUES
|
||||
(1, 1, 0, 1, 'default_warehouse', 'default warehouse', 'WA');
|
||||
|
||||
INSERT INTO `PREFIX_warehouse_shop` (`id_warehouse`, `id_shop`) VALUES
|
||||
(1, 1);
|
||||
|
||||
INSERT INTO `PREFIX_address_format` (`id_country`, `format`)
|
||||
(SELECT `id_country` as id_country, 'firstname lastname\ncompany\nvat_number\naddress1\naddress2\npostcode city\nCountry:name\nphone' as format FROM `PREFIX_country`);
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class StatsBestProducts extends ModuleGrid
|
||||
),
|
||||
array(
|
||||
'id' => 'quantity',
|
||||
'header' => $this->l('Available Quantity for sale'),
|
||||
'header' => $this->l('Available quantity for sale'),
|
||||
'dataIndex' => 'quantity',
|
||||
'width' => 150,
|
||||
'align' => 'right'
|
||||
|
||||
@@ -259,7 +259,7 @@ class StatsProduct extends ModuleGraph
|
||||
<tr>
|
||||
<th>'.$this->l('Ref.').'</th>
|
||||
<th>'.$this->l('Name').'</th>
|
||||
<th>'.$this->l('Available Quantity for sale').'</th>
|
||||
<th>'.$this->l('Available quantity for sale').'</th>
|
||||
</tr>
|
||||
</thead><tbody>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user