// Stock Available : Improve BackOffice interfaces with groups of shops management + bugs fix
This commit is contained in:
1 parent
7733bc9efe
commit
f426575405
13 files changed
+42
-36
No files matched your search
@@ -29,10 +29,10 @@
|
|||||||
{block name="override_tpl"}
|
{block name="override_tpl"}
|
||||||
|
|
||||||
<h2>{$manufacturer->name}</h2>
|
<h2>{$manufacturer->name}</h2>
|
||||||
|
|
||||||
<h3>{l s='Total addresses:'} {count($addresses)}</h3>
|
<h3>{l s='Total addresses:'} {count($addresses)}</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
{if !count($addresses)}
|
{if !count($addresses)}
|
||||||
{l s='No address for this manufacturer'}
|
{l s='No address for this manufacturer'}
|
||||||
{else}
|
{else}
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
{/foreach}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<h3>{l s='Total products:'} {count($products)}</h3>
|
<h3>{l s='Total products:'} {count($products)}</h3>
|
||||||
{foreach $products AS $product}
|
{foreach $products AS $product}
|
||||||
<hr />
|
<hr />
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}" class="button">{l s='Edit'}</a>
|
<a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}" class="button">{l s='Edit'}</a>
|
||||||
<a href="?tab=AdminProducts&id_product={$product->id}&deleteproduct&token={getAdminToken tab='AdminProducts'}" class="button" onclick="return confirm('{l s='Delete item #'}{$product->id} ?');">{l s='Delete'}</a>
|
<a href="?tab=AdminProducts&id_product={$product->id}&deleteproduct&token={getAdminToken tab='AdminProducts'}" class="button" onclick="return confirm('{l s='Delete item #'}{$product->id} ?');">{l s='Delete'}</a>
|
||||||
</div>
|
</div>
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:990px;">
|
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:80%;margin-left:10%;">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{$product->name}</th>
|
<th>{$product->name}</th>
|
||||||
{if !empty($product->reference)}<th width="150">{l s='Ref:'} {$product->reference}</th>{/if}
|
{if !empty($product->reference)}<th width="150">{l s='Ref:'} {$product->reference}</th>{/if}
|
||||||
@@ -85,13 +85,13 @@
|
|||||||
<a href="?tab=AdminProducts&id_product={$product->id}&deleteproduct&token={getAdminToken tab='AdminProducts'}" class="button" onclick="return confirm('{l s='Delete item #'}{$product->id} ?');">{l s='Delete'}</a>
|
<a href="?tab=AdminProducts&id_product={$product->id}&deleteproduct&token={getAdminToken tab='AdminProducts'}" class="button" onclick="return confirm('{l s='Delete item #'}{$product->id} ?');">{l s='Delete'}</a>
|
||||||
</div>
|
</div>
|
||||||
<h3><a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}">{$product->name}</a></h3>
|
<h3><a href="?tab=AdminProducts&id_product={$product->id}&updateproduct&token={getAdminToken tab='AdminProducts'}">{$product->name}</a></h3>
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:990px;">
|
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:80%;margin-left:10%;">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{l s='Attribute name'}</th>
|
<th>{l s='Attribute name'}</th>
|
||||||
<th width="80">{l s='Reference'}</th>
|
<th width="80">{l s='Reference'}</th>
|
||||||
<th width="80">{l s='EAN13'}</th>
|
<th width="80">{l s='EAN13'}</th>
|
||||||
<th width="80">{l s='UPC'}</th>
|
<th width="80">{l s='UPC'}</th>
|
||||||
{if $stock_management}<th class="right" width="40">{l s='Quantity'}</th>{/if}
|
{if $stock_management && $shopContext != Shop::CONTEXT_ALL}<th class="right" width="150">{l s='Available Quantity'}</th>{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
||||||
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
<td>{$product_attribute.reference}</td>
|
<td>{$product_attribute.reference}</td>
|
||||||
<td>{$product_attribute.ean13}</td>
|
<td>{$product_attribute.ean13}</td>
|
||||||
<td>{$product_attribute.upc}</td>
|
<td>{$product_attribute.upc}</td>
|
||||||
{if $stock_management}<td class="right">{$product_attribute.quantity}</td>{/if}
|
{if $stock_management && $shopContext != Shop::CONTEXT_ALL}<td class="right">{$product_attribute.quantity}</td>{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<th width="80">{l s='Reference'}</th>
|
<th width="80">{l s='Reference'}</th>
|
||||||
<th width="80">{l s='EAN13'}</th>
|
<th width="80">{l s='EAN13'}</th>
|
||||||
<th width="80">{l s='UPC'}</th>
|
<th width="80">{l s='UPC'}</th>
|
||||||
{if $stock_management}<th class="right" width="150">{l s='Available Quantity'}</th>{/if}
|
{if $stock_management && $shopContext != Shop::CONTEXT_ALL}<th class="right" width="150">{l s='Available Quantity'}</th>{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
{foreach $product->combinaison AS $id_product_attribute => $product_attribute}
|
||||||
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
<tr {if $id_product_attribute %2}class="alt_row"{/if} >
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<td>{$product_attribute.reference}</td>
|
<td>{$product_attribute.reference}</td>
|
||||||
<td>{$product_attribute.ean13}</td>
|
<td>{$product_attribute.ean13}</td>
|
||||||
<td>{$product_attribute.upc}</td>
|
<td>{$product_attribute.upc}</td>
|
||||||
{if $stock_management}<td class="right">{$product_attribute.quantity}</td>{/if}
|
{if $stock_management && $shopContext != Shop::CONTEXT_ALL}<td class="right">{$product_attribute.quantity}</td>{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
+3
-3
@@ -394,7 +394,7 @@ class CartCore extends ObjectModel
|
|||||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, p.`id_product`, p.`id_category_default`, p.`id_supplier`,
|
pl.`description_short`, pl.`available_now`, pl.`available_later`, p.`id_product`, p.`id_category_default`, p.`id_supplier`,
|
||||||
p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`, p.`price`, p.`weight`,
|
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`,
|
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`, stock.quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
p.`date_upd`, t.`id_tax`, tl.`name` AS tax, t.`rate`, IFNULL(stock.quantity, 0), 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');
|
||||||
|
|
||||||
// Build FROM
|
// Build FROM
|
||||||
@@ -783,7 +783,7 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if ($operator == 'up')
|
if ($operator == 'up')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT stock.out_of_stock, stock.quantity
|
$sql = 'SELECT stock.out_of_stock, IFNULL(stock.quantity, 0)
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
'.Product::sqlStock('p', $id_product_attribute, true, $shop).'
|
'.Product::sqlStock('p', $id_product_attribute, true, $shop).'
|
||||||
WHERE p.id_product = '.$id_product;
|
WHERE p.id_product = '.$id_product;
|
||||||
@@ -825,7 +825,7 @@ class CartCore extends ObjectModel
|
|||||||
/* Add product to the cart */
|
/* Add product to the cart */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT stock.out_of_stock, stock.quantity
|
$sql = 'SELECT stock.out_of_stock, IFNULL(stock.quantity, 0)
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
'.Product::sqlStock('p', $id_product_attribute, true, $shop).'
|
'.Product::sqlStock('p', $id_product_attribute, true, $shop).'
|
||||||
WHERE p.id_product = '.$id_product;
|
WHERE p.id_product = '.$id_product;
|
||||||
|
|||||||
@@ -597,7 +597,7 @@ class CategoryCore extends ObjectModel
|
|||||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`,
|
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`,
|
||||||
il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default,
|
il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default,
|
||||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
|
DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
return (int)count($result);
|
return (int)count($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity, pa.`id_product_attribute`,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
|
||||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
|
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
|
||||||
pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
|
|||||||
+8
-8
@@ -571,7 +571,7 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'product_attribute pa'
|
FROM '._DB_PREFIX_.'product_attribute pa'
|
||||||
.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
||||||
' WHERE pa.default_on = 1 '
|
' WHERE pa.default_on = 1 '
|
||||||
.($minimum_quantity > 0 ? ' AND stock.quantity >= '.(int)$minimum_quantity : '').
|
.($minimum_quantity > 0 ? ' AND IFNULL(stock.quantity, 0) >= '.(int)$minimum_quantity : '').
|
||||||
' AND pa.id_product = '.(int)$id_product;
|
' AND pa.id_product = '.(int)$id_product;
|
||||||
$result = Db::getInstance()->getValue($sql);
|
$result = Db::getInstance()->getValue($sql);
|
||||||
|
|
||||||
@@ -581,7 +581,7 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'product_attribute pa'
|
FROM '._DB_PREFIX_.'product_attribute pa'
|
||||||
.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
||||||
' WHERE pa.id_product = '.(int)$id_product
|
' WHERE pa.id_product = '.(int)$id_product
|
||||||
.($minimum_quantity > 0 ? ' AND stock.quantity >= '.(int)$minimum_quantity : '');
|
.($minimum_quantity > 0 ? ' AND IFNULL(stock.quantity, 0) >= '.(int)$minimum_quantity : '');
|
||||||
$result = Db::getInstance()->getValue($sql);
|
$result = Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1632,7 +1632,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
$sql = 'SELECT pa.*, GROUP_CONCAT(agl.`name`, \''.pSQL($attribute_value_separator).'\',
|
$sql = 'SELECT pa.*, GROUP_CONCAT(agl.`name`, \''.pSQL($attribute_value_separator).'\',
|
||||||
al.`name` SEPARATOR \''.pSQL($attribute_separator).'\') as attribute_designation, stock.quantity
|
al.`name` SEPARATOR \''.pSQL($attribute_separator).'\') as attribute_designation, IFNULL(stock.quantity, 0)
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||||
@@ -1656,7 +1656,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
$sql = 'SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name,
|
$sql = 'SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name,
|
||||||
a.`id_attribute`, pa.`unit_price_impact`, stock.quantity
|
a.`id_attribute`, pa.`unit_price_impact`, IFNULL(stock.quantity, 0) as quantity
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||||
@@ -1775,7 +1775,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = new DbQuery();
|
$sql = new DbQuery();
|
||||||
$sql->select(
|
$sql->select(
|
||||||
'p.*, stock.out_of_stock, stock.quantity as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
'p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
||||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
p.`date_add`,
|
p.`date_add`,
|
||||||
@@ -1972,7 +1972,7 @@ class ProductCore extends ObjectModel
|
|||||||
return (int)$result['nb'];
|
return (int)$result['nb'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity, pl.`description`, pl.`description_short`,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`,
|
||||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
||||||
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
@@ -2766,7 +2766,7 @@ class ProductCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
|
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
|
||||||
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`,
|
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`,
|
||||||
stock.quantity, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`,
|
IFNULL(stock.quantity, 0) as quantity, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`,
|
||||||
pa.`minimal_quantity`, pa.`available_date`, ag.`group_type`
|
pa.`minimal_quantity`, pa.`available_date`, ag.`group_type`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
'.Product::sqlStock('pa', 'pa').'
|
'.Product::sqlStock('pa', 'pa').'
|
||||||
@@ -2838,7 +2838,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`,
|
||||||
pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
||||||
i.`id_image`, il.`legend`, t.`rate`, m.`name` as manufacturer_name, cl.`name` AS category_default,
|
i.`id_image`, il.`legend`, t.`rate`, m.`name` as manufacturer_name, cl.`name` AS category_default,
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class ProductSaleCore
|
|||||||
$groups = FrontController::getCurrentCustomerGroups();
|
$groups = FrontController::getCurrentCustomerGroups();
|
||||||
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
|
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
|
||||||
i.`id_image`, il.`legend`,
|
i.`id_image`, il.`legend`,
|
||||||
ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
|
ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
|
||||||
|
|||||||
+2
-2
@@ -263,7 +263,7 @@ class SearchCore
|
|||||||
return $db->executeS($sql);
|
return $db->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, stock.quantity as quantity,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
||||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
@@ -600,7 +600,7 @@ class SearchCore
|
|||||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT DISTINCT p.*, stock.out_of_stock, stock.quantity as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
|
$sql = 'SELECT DISTINCT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
|
||||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||||
DATEDIFF(
|
DATEDIFF(
|
||||||
p.`date_add`,
|
p.`date_add`,
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class SupplierCore extends ObjectModel
|
|||||||
$nb_days_new_product = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
|
$nb_days_new_product = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
|
||||||
|
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock,
|
$sql = 'SELECT p.*, stock.out_of_stock,
|
||||||
stock.quantity as quantity,
|
IFNULL(stock.quantity, 0) as quantity,
|
||||||
pl.`description`,
|
pl.`description`,
|
||||||
pl.`description_short`,
|
pl.`description_short`,
|
||||||
pl.`link_rewrite`,
|
pl.`link_rewrite`,
|
||||||
|
|||||||
@@ -540,7 +540,6 @@ class StockAvailableCore extends ObjectModel
|
|||||||
public static function addSqlShopRestriction(DbQuery $sql = null, $id_shop = null, $alias = null)
|
public static function addSqlShopRestriction(DbQuery $sql = null, $id_shop = null, $alias = null)
|
||||||
{
|
{
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
$group_ok = false;
|
|
||||||
|
|
||||||
if (!empty($alias))
|
if (!empty($alias))
|
||||||
$alias .= '.';
|
$alias .= '.';
|
||||||
@@ -565,12 +564,17 @@ class StockAvailableCore extends ObjectModel
|
|||||||
$sql = ' AND '.pSQL($alias).'id_group_shop = '.(int)$group_shop->id.' ';
|
$sql = ' AND '.pSQL($alias).'id_group_shop = '.(int)$group_shop->id.' ';
|
||||||
$sql .= ' AND '.pSQL($alias).'id_shop = 0 ';
|
$sql .= ' AND '.pSQL($alias).'id_shop = 0 ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$group_ok = true;
|
|
||||||
}
|
}
|
||||||
|
// else if we are in group context
|
||||||
|
else if ($context->shop() == Shop::CONTEXT_GROUP)
|
||||||
|
{
|
||||||
|
if (is_object($sql))
|
||||||
|
$sql->where(pSQL($alias).'id_shop IN ('.implode(', ', Shop::getShops(true, $group_shop->id, true)).')');
|
||||||
|
else
|
||||||
|
$sql = ' AND '.pSQL($alias).'id_shop IN ('.implode(', ', Shop::getShops(true, $group_shop->id, true)).') ';
|
||||||
|
}
|
||||||
// if no group specific restriction, set simple shop restriction
|
// if no group specific restriction, set simple shop restriction
|
||||||
if (!$group_ok)
|
else
|
||||||
{
|
{
|
||||||
if (is_object($sql))
|
if (is_object($sql))
|
||||||
$sql->where(pSQL($alias).'id_shop = '.(int)$id_shop);
|
$sql->where(pSQL($alias).'id_shop = '.(int)$id_shop);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class AdminManufacturersControllerCore extends AdminController
|
|||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
@@ -606,6 +606,7 @@ class AdminManufacturersControllerCore extends AdminController
|
|||||||
'addresses' => $addresses,
|
'addresses' => $addresses,
|
||||||
'products' => $products,
|
'products' => $products,
|
||||||
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
||||||
|
'shopContext' => Context::getContext()->shop(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return parent::renderView();
|
return parent::renderView();
|
||||||
|
|||||||
@@ -53,14 +53,14 @@ class AdminSuppliersControllerCore extends AdminController
|
|||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addJqueryUi('ui.widget');
|
$this->addJqueryUi('ui.widget');
|
||||||
$this->addJqueryPlugin('tagify');
|
$this->addJqueryPlugin('tagify');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderForm()
|
public function renderForm()
|
||||||
{
|
{
|
||||||
$this->fields_form = array(
|
$this->fields_form = array(
|
||||||
@@ -201,6 +201,7 @@ class AdminSuppliersControllerCore extends AdminController
|
|||||||
'supplier' => $this->object,
|
'supplier' => $this->object,
|
||||||
'products' => $products,
|
'products' => $products,
|
||||||
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
||||||
|
'shopContext' => Context::getContext()->shop(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return parent::renderView();
|
return parent::renderView();
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class AdminTrackingController extends AdminController
|
|||||||
SELECT DISTINCT(id_product)
|
SELECT DISTINCT(id_product)
|
||||||
FROM `'._DB_PREFIX_.'product_attribute`
|
FROM `'._DB_PREFIX_.'product_attribute`
|
||||||
)
|
)
|
||||||
AND stock.quantity <= 0
|
AND IFNULL(stock.quantity, 0) <= 0
|
||||||
)';
|
)';
|
||||||
|
|
||||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes and without available quantities for sale:'));
|
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes and without available quantities for sale:'));
|
||||||
@@ -163,7 +163,7 @@ class AdminTrackingController extends AdminController
|
|||||||
SELECT DISTINCT(id_product)
|
SELECT DISTINCT(id_product)
|
||||||
FROM `'._DB_PREFIX_.'product_attribute`
|
FROM `'._DB_PREFIX_.'product_attribute`
|
||||||
)
|
)
|
||||||
AND stock.quantity <= 0
|
AND IFNULL(stock.quantity, 0) <= 0
|
||||||
)';
|
)';
|
||||||
|
|
||||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of products without attributes and without available quantities for sale:'));
|
$this->tpl_list_vars = array('sub_title' => $this->l('List of products without attributes and without available quantities for sale:'));
|
||||||
|
|||||||
Reference in new issue
Block a user