V1.4.0 released: Upsell feature, New Product Page, New Stats Module, Security fixes

This commit is contained in:
Rohit Jain
2019-06-28 18:41:13 +05:30
parent 102343d2c0
commit b5d5bd7129
3884 changed files with 124528 additions and 70020 deletions

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2015 PrestaShop
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -19,7 +19,7 @@
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -126,6 +126,7 @@ class AdminStockCoverControllerCore extends AdminController
if (Tools::isSubmit('id_product')) {
// if a product id is submit
$this->list_no_link = true;
$this->lang = false;
$this->list_id = 'details';
$this->tpl_list_vars['show_filter'] = false;
@@ -143,7 +144,8 @@ class AdminStockCoverControllerCore extends AdminController
$this->_select = 'a.id_product_attribute as id, a.id_product, stock_view.reference, stock_view.ean13,
stock_view.upc, stock_view.usable_quantity as stock';
$this->_join = ' INNER JOIN
$this->_join = 'INNER JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = a.id_product AND p.advanced_stock_management = 1)';
$this->_join .= ' INNER JOIN
(
SELECT SUM(s.usable_quantity) as usable_quantity, s.id_product_attribute, s.reference, s.ean13, s.upc
FROM '._DB_PREFIX_.'stock s
@@ -177,6 +179,7 @@ class AdminStockCoverControllerCore extends AdminController
'.Shop::addSqlAssociation('product_attribute', 'pa', false).'
INNER JOIN `'._DB_PREFIX_.'stock` s ON (s.id_product = a.id_product)';
$this->_group = 'GROUP BY a.id_product';
$this->_where = 'AND a.advanced_stock_management = 1';
self::$currentIndex .= '&coverage_period='.(int)$this->getCurrentCoveragePeriod().'&warn_days='.(int)$this->getCurrentWarning();
if ($this->getCurrentCoverageWarehouse() != -1) {
@@ -362,20 +365,12 @@ class AdminStockCoverControllerCore extends AdminController
*/
protected function getQuantitySold($id_product, $id_product_attribute, $coverage)
{
$query = new DbQuery();
$query->select('SUM(od.product_quantity)');
$query->from('order_detail', 'od');
$query->leftJoin('orders', 'o', 'od.id_order = o.id_order');
$query->leftJoin('order_history', 'oh', 'o.date_upd = oh.date_add');
$query->leftJoin('order_state', 'os', 'os.id_order_state = oh.id_order_state');
$query->where('od.product_id = '.(int)$id_product);
$query->where('od.product_attribute_id = '.(int)$id_product_attribute);
$query->where('TO_DAYS("'.date('Y-m-d').' 00:00:00") - TO_DAYS(oh.date_add) <= '.(int)$coverage);
$query->where('o.valid = 1');
$query->where('os.logable = 1 AND os.delivery = 1 AND os.shipped = 1');
$quantity = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
return $quantity;
return StockManagerFactory::getManager()->getProductOutForCoverage(
$id_product,
$id_product_attribute,
$coverage,
(($this->getCurrentCoverageWarehouse() == -1) ? null : Tools::getValue('id_warehouse', -1))
);
}
public function initContent()