// Fix all product_lang sql restrictions with multishop
This commit is contained in:
@@ -108,6 +108,7 @@ if (isset($_GET['ajaxProductAccessories']))
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||
'.Context::getContext()->shop->sqlLang('pl').'
|
||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
|
||||
AND p.`id_product` NOT IN (
|
||||
SELECT a.`id_product_2`
|
||||
@@ -342,6 +343,7 @@ if (isset($_GET['ajaxProductPackItems']))
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||
'.Context::getContext()->shop->sqlLang('pl').'
|
||||
AND p.`id_product` NOT IN (SELECT DISTINCT id_product_pack FROM `'._DB_PREFIX_.'pack`)
|
||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
|
||||
|
||||
|
||||
@@ -53,13 +53,13 @@ else
|
||||
// Excluding downloadable products from packs because download from pack is not supported
|
||||
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false);
|
||||
|
||||
$items = Db::getInstance()->ExecuteS('
|
||||
SELECT p.`id_product`, `reference`, pl.name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product)
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\') AND pl.id_lang = '.(int)Context::getContext()->language->id.
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''));
|
||||
$sql = 'SELECT p.`id_product`, `reference`, pl.name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Context::getContext()->shop->sqlLang('pl').')
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
|
||||
$items = Db::getInstance()->ExecuteS($sql);
|
||||
|
||||
if ($items)
|
||||
foreach ($items AS $item)
|
||||
|
||||
@@ -88,21 +88,20 @@ class AdminTracking extends AdminTab
|
||||
$this->_list['message'] = $this->l('List of out of stock products without attributes:');
|
||||
break ;
|
||||
case 'attributes_nostock':
|
||||
$sql = '
|
||||
SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name, a.`id_attribute`,
|
||||
m.`name` AS manufacturer_name, pl.`name` AS name, p.`weight` AS product_weight, p.`active` AS active
|
||||
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_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
|
||||
WHERE pa.quantity <= 0
|
||||
ORDER BY pa.`id_product_attribute`
|
||||
';
|
||||
$sql = 'SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name, a.`id_attribute`,
|
||||
m.`name` AS manufacturer_name, pl.`name` AS name, p.`weight` AS product_weight, p.`active` AS active
|
||||
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_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
||||
'.Product::sqlStock('p', 'pa').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
|
||||
WHERE stock.quantity <= 0
|
||||
ORDER BY pa.`id_product_attribute`';
|
||||
$this->_list['message'] = $this->l('List of out of stock products with attributes:');
|
||||
break ;
|
||||
}
|
||||
@@ -239,7 +238,7 @@ class AdminTracking extends AdminTab
|
||||
<td>'.$prod['reference'].'</td>
|
||||
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
|
||||
<td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $this->context->currency).'</td>
|
||||
<td>'.(float)$taxrate.'% </td>
|
||||
<td>'.(float)$tax_rate.'% </td>
|
||||
<td align="center">'.$prod['quantity'].'</td>
|
||||
<td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
|
||||
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
|
||||
|
||||
@@ -110,9 +110,12 @@ class AttachmentCore extends ObjectModel
|
||||
{
|
||||
foreach($list as $attachement)
|
||||
$ids_attachements[] = $attachement['id_attachment'];
|
||||
$tmp = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'product_attachment` pa
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pa.`id_product` = pl.`id_product`)
|
||||
WHERE `id_attachment` IN ('.implode(',', array_map('intval', $ids_attachements)).') AND pl.`id_lang` = '.(int)$id_lang.';');
|
||||
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'product_attachment` pa
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pa.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
||||
WHERE `id_attachment` IN ('.implode(',', array_map('intval', $ids_attachements)).')
|
||||
AND pl.`id_lang` = '.(int)$id_lang;
|
||||
$tmp = Db::getInstance()->executeS($sql);
|
||||
$productAttachements = array();
|
||||
foreach($tmp as $t)
|
||||
$productAttachements[$t['id_attachment']][] = $t['name'];
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ class CartCore extends ObjectModel
|
||||
pai.`id_image` as pai_id_image
|
||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->sqlLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = cp.`id_product_attribute`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$id_country.'
|
||||
|
||||
@@ -313,11 +313,11 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
public function getProductsLite($id_lang)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
|
||||
WHERE p.`id_manufacturer` = '.(int)($this->id));
|
||||
$sql = 'SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
||||
WHERE p.`id_manufacturer` = '.(int)$this->id;
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
}
|
||||
/*
|
||||
* Specify if a manufacturer already in base
|
||||
|
||||
+3
-2
@@ -91,7 +91,7 @@ class PackCore extends Product
|
||||
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.id_product = pl.id_product AND pl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.id_product = pl.id_product AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
@@ -134,7 +134,8 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
||||
AND p.`id_product` IN ('.$packs.')';
|
||||
'.Context::getContext()->shop->sqlLang('pl').'
|
||||
AND p.`id_product` IN ('.$packs.')';
|
||||
if ($limit)
|
||||
$sql .= ' LIMIT '.(int)$limit;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
|
||||
+58
-59
@@ -1188,8 +1188,8 @@ class ProductCore extends ObjectModel
|
||||
if (!sizeof($attributes))
|
||||
return false;
|
||||
$attributesList = '';
|
||||
foreach($attributes AS $id_attribute)
|
||||
$attributesList .= '('.(int)($id_product_attribute).','.(int)($id_attribute).'),';
|
||||
foreach ($attributes AS $id_attribute)
|
||||
$attributesList .= '('.(int)$id_product_attribute.','.(int)$id_attribute.'),';
|
||||
$attributesList = rtrim($attributesList, ',');
|
||||
|
||||
if (!Validate::isValuesList($attributesList))
|
||||
@@ -1282,7 +1282,6 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'stock s ON pa.id_product = s.id_product AND pa.id_product_attribute = s.id_product_attribute
|
||||
'.Product::sqlStock('pa', 'pa').'
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
ORDER BY pa.`id_product_attribute`';
|
||||
@@ -2184,11 +2183,11 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Check product availability
|
||||
*
|
||||
* @param integer $qty Quantity desired
|
||||
* @return boolean True if product is available with this quantity
|
||||
*/
|
||||
* Check product availability
|
||||
*
|
||||
* @param integer $qty Quantity desired
|
||||
* @return boolean True if product is available with this quantity
|
||||
*/
|
||||
public function checkQty($qty)
|
||||
{
|
||||
if (Pack::isPack((int)($this->id)) AND !Pack::isInStock((int)($this->id)))
|
||||
@@ -2201,8 +2200,8 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is not a default attribute and create it not
|
||||
*/
|
||||
* Check if there is not a default attribute and create it not
|
||||
*/
|
||||
public function checkDefaultAttributes()
|
||||
{
|
||||
if (!$this->id)
|
||||
@@ -2231,11 +2230,11 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available attribute groups
|
||||
*
|
||||
* @param integer $id_lang Language id
|
||||
* @return array Attribute groups
|
||||
*/
|
||||
* Get all available attribute groups
|
||||
*
|
||||
* @param integer $id_lang Language id
|
||||
* @return array Attribute groups
|
||||
*/
|
||||
public function getAttributesGroups($id_lang)
|
||||
{
|
||||
$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,
|
||||
@@ -2255,32 +2254,32 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete product accessories
|
||||
*
|
||||
* @return mixed Deletion result
|
||||
*/
|
||||
* Delete product accessories
|
||||
*
|
||||
* @return mixed Deletion result
|
||||
*/
|
||||
public function deleteAccessories()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'accessory` WHERE `id_product_1` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete product from other products accessories
|
||||
*
|
||||
* @return mixed Deletion result
|
||||
*/
|
||||
* Delete product from other products accessories
|
||||
*
|
||||
* @return mixed Deletion result
|
||||
*/
|
||||
public function deleteFromAccessories()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'accessory` WHERE `id_product_2` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product accessories (only names)
|
||||
*
|
||||
* @param integer $id_lang Language id
|
||||
* @param integer $id_product Product id
|
||||
* @return array Product accessories
|
||||
*/
|
||||
* Get product accessories (only names)
|
||||
*
|
||||
* @param integer $id_lang Language id
|
||||
* @param integer $id_product Product id
|
||||
* @return array Product accessories
|
||||
*/
|
||||
public static function getAccessoriesLight($id_lang, $id_product, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
@@ -2296,11 +2295,11 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product accessories
|
||||
*
|
||||
* @param integer $id_lang Language id
|
||||
* @return array Product accessories
|
||||
*/
|
||||
* Get product accessories
|
||||
*
|
||||
* @param integer $id_lang Language id
|
||||
* @return array Product accessories
|
||||
*/
|
||||
public function getAccessories($id_lang, $active = true, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
@@ -2331,14 +2330,14 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function getAccessoryById($accessoryId)
|
||||
{
|
||||
return Db::getInstance()->getRow('SELECT `id_product`, `name` FROM `'._DB_PREFIX_.'product_lang` WHERE `id_product` = '.(int)($accessoryId));
|
||||
return Db::getInstance()->getRow('SELECT `id_product`, `name` FROM `'._DB_PREFIX_.'product_lang` WHERE `id_product` = '.(int)$accessoryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link accessories with product
|
||||
*
|
||||
* @param array $accessories_id Accessories ids
|
||||
*/
|
||||
* Link accessories with product
|
||||
*
|
||||
* @param array $accessories_id Accessories ids
|
||||
*/
|
||||
public function changeAccessories($accessories_id)
|
||||
{
|
||||
foreach ($accessories_id as $id_product_2)
|
||||
@@ -2346,8 +2345,8 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new feature to product
|
||||
*/
|
||||
* Add new feature to product
|
||||
*/
|
||||
public function addFeaturesCustomToDB($id_value, $lang, $cust)
|
||||
{
|
||||
$row = array('id_feature_value' => (int)($id_value), 'id_lang' => (int)($lang), 'value' => pSQL($cust));
|
||||
@@ -3135,28 +3134,28 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function getStockMvts($id_lang)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT sm.id_stock_mvt, sm.date_add, sm.quantity, sm.id_order, CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) employee, mrl.name reason
|
||||
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (sm.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (sm.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = sm.id_employee)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = sm.id_product_attribute)
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = '.(int)$id_lang.')
|
||||
WHERE sm.id_product='.(int)$this->id.'
|
||||
GROUP BY sm.id_stock_mvt');
|
||||
$sql = 'SELECT sm.id_stock_mvt, sm.date_add, sm.quantity, sm.id_order, CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) employee, mrl.name reason
|
||||
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (sm.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (sm.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = sm.id_employee)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = sm.id_product_attribute)
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = '.(int)$id_lang.')
|
||||
WHERE sm.id_product='.(int)$this->id.'
|
||||
GROUP BY sm.id_stock_mvt';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
}
|
||||
|
||||
public static function getUrlRewriteInformations($id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (pl.`id_lang` = l.`id_lang`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = pl.`id_lang`)
|
||||
WHERE p.`id_product` = '.(int)$id_product. '
|
||||
AND l.`active` = 1');
|
||||
$sql = 'SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (pl.`id_lang` = l.`id_lang`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = pl.`id_lang`)
|
||||
WHERE p.`id_product` = '.(int)$id_product. '
|
||||
AND l.`active` = 1';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupByIdProduct($id_product)
|
||||
|
||||
+24
-25
@@ -214,31 +214,30 @@ class SupplierCore extends ObjectModel
|
||||
return (int)(sizeof($result));
|
||||
}
|
||||
|
||||
$sql = '
|
||||
SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, s.`name` AS supplier_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice, m.`name` AS manufacturer_name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier` s ON s.`id_supplier` = p.`id_supplier`
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
WHERE p.`id_supplier` = '.(int)($id_supplier).($active ? ' AND p.`active` = 1' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'.
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
)
|
||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||
$sql = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, s.`name` AS supplier_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice, m.`name` AS manufacturer_name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
AND tr.`zipcode_from` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier` s ON s.`id_supplier` = p.`id_supplier`
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
WHERE p.`id_supplier` = '.(int)$id_supplier.($active ? ' AND p.`active` = 1' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'.
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
)
|
||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
if (!$result)
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ class TagCore extends ObjectModel
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT pl.name, pl.id_product
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product'.$context->shop->sqlLang('pl').'
|
||||
WHERE pl.id_lang = '.(int)($id_lang).'
|
||||
AND p.active = 1
|
||||
'.($this->id ? ('AND p.id_product '.($associated ? 'IN' : 'NOT IN').' (SELECT pt.id_product FROM `'._DB_PREFIX_.'product_tag` pt WHERE pt.id_tag = '.(int)($this->id).')') : '').'
|
||||
|
||||
+7
-5
@@ -636,11 +636,13 @@ class ToolsCore
|
||||
/* Products specifics meta tags */
|
||||
if ($id_product = self::getValue('id_product'))
|
||||
{
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`)
|
||||
WHERE pl.id_lang = '.(int)($id_lang).' AND pl.id_product = '.(int)($id_product).' AND p.active = 1');
|
||||
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
||||
WHERE pl.id_lang = '.(int)$id_lang.'
|
||||
AND pl.id_product = '.(int)$id_product.'
|
||||
AND p.active = 1';
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if ($row)
|
||||
{
|
||||
if (empty($row['meta_description']))
|
||||
|
||||
@@ -104,7 +104,7 @@ class BlockViewed extends Module
|
||||
$productsImages = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT i.id_image, p.id_product, il.legend, p.active, pl.name, pl.description_short, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product)
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$this->context->shop->sqlLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
|
||||
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (il.id_image = i.id_image)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default)
|
||||
|
||||
@@ -250,7 +250,7 @@ class WishList extends ObjectModel
|
||||
SELECT wp.`id_product`, wp.`quantity`, p.`quantity` AS product_quantity, pl.`name`, wp.`id_product_attribute`, wp.`priority`, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = wp.`id_product`
|
||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = wp.`id_product`
|
||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = wp.`id_product`'.Context::getContext()->shop->sqlLang('pl').'
|
||||
JOIN `'._DB_PREFIX_.'wishlist` w ON w.`id_wishlist` = wp.`id_wishlist`
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = p.`id_category_default` AND cl.id_lang='.(int)$id_lang.'
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).'
|
||||
|
||||
@@ -1015,7 +1015,7 @@ class CanadaPost extends CarrierModule
|
||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
||||
WHERE p.`active` = 1
|
||||
ORDER BY pl.`name`');
|
||||
foreach ($productsList as $product)
|
||||
|
||||
@@ -122,7 +122,7 @@ class CrossSelling extends Module
|
||||
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
|
||||
FROM '._DB_PREFIX_.'order_detail od
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id)
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.$this->context->shop->sqlLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default)
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
|
||||
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||
|
||||
@@ -992,7 +992,7 @@ class Ebay extends Module
|
||||
{
|
||||
$productTest = Db::getInstance()->getRow('
|
||||
SELECT pl.`name`, pl.`description`
|
||||
FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.')
|
||||
FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.$this->context->shop->sqlLang('pl').')
|
||||
WHERE `id_category_default` = '.(int)$c['id_category']);
|
||||
$id_category_ref_suggested = $ebay->getSuggestedCategories($c['name'].' '.$productTest['name']);
|
||||
$id_ebay_category_suggested = Db::getInstance()->getValue('SELECT `id_ebay_category` FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_category_ref` = '.(int)$id_category_ref_suggested);
|
||||
|
||||
@@ -75,7 +75,7 @@ class FavoriteProduct extends ObjectModel
|
||||
SELECT fp.`id_shop`, p.`id_product`, pl.`description_short`, pl.`link_rewrite`, pl.`name`, i.`id_image`, CONCAT(p.`id_product`, \'-\', i.`id_image`) as image
|
||||
FROM `'._DB_PREFIX_.'favorite_product` fp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = fp.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).$shop->sqlLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$shop->sqlLang('pl').')
|
||||
LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND `default_on` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($id_lang).')
|
||||
|
||||
@@ -1169,7 +1169,7 @@ class FedexCarrier extends CarrierModule
|
||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
||||
WHERE p.`active` = 1
|
||||
ORDER BY pl.`name`');
|
||||
foreach ($productsList as $product)
|
||||
|
||||
@@ -217,7 +217,7 @@ class Secuvad_flux
|
||||
FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac
|
||||
JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`)
|
||||
JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
|
||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`)
|
||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').')
|
||||
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.(int)Context::getContext()->language->id.')
|
||||
WHERE pl.`id_product` = '.(int)($product['product_id']).'
|
||||
ORDER BY c.`level_depth` DESC
|
||||
|
||||
@@ -165,7 +165,7 @@ class StatsBestProducts extends ModuleGrid
|
||||
) AS totalPageViewed
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)($this->getLang()).')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().$this->context->shop->sqlLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'order_detail od ON od.product_id = p.id_product
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON od.id_order = o.id_order
|
||||
WHERE p.active = 1
|
||||
|
||||
@@ -123,7 +123,7 @@ class StatsCatalog extends Module
|
||||
|
||||
$sql = 'SELECT p.id_product, pl.name, pl.link_rewrite
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.id_lang = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.id_lang = '.(int)$id_lang.$this->context->shop->sqlLang('pl').')
|
||||
'.$this->_join.'
|
||||
WHERE p.`active` = 1
|
||||
'.(sizeof($precalc2) ? 'AND p.`id_product` NOT IN ('.implode(',', $precalc2).')' : '').'
|
||||
|
||||
@@ -122,7 +122,7 @@ class StatsCheckUp extends Module
|
||||
WHERE pa.id_product = p.id_product
|
||||
), p.quantity) as stock
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
||||
ORDER BY '.$orderBy;
|
||||
$result = $db->ExecuteS($sql);
|
||||
@@ -194,7 +194,7 @@ class StatsCheckUp extends Module
|
||||
$totals['images'] += (int)$scores['images'];
|
||||
$totals['sales'] += (int)$scores['sales'];
|
||||
$totals['stock'] += (int)$scores['stock'];
|
||||
$descriptions = $db->ExecuteS('SELECT iso_code, description FROM '._DB_PREFIX_.'product_lang pl LEFT JOIN '._DB_PREFIX_.'lang l ON pl.id_lang = l.id_lang WHERE id_product = '.(int)$row['id_product']);
|
||||
$descriptions = $db->ExecuteS('SELECT iso_code, description FROM '._DB_PREFIX_.'product_lang pl LEFT JOIN '._DB_PREFIX_.'lang l ON pl.id_lang = l.id_lang'.$this->context->shop->sqlLang('pl').' WHERE id_product = '.(int)$row['id_product']);
|
||||
foreach ($descriptions as $description)
|
||||
{
|
||||
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description']));
|
||||
|
||||
@@ -102,7 +102,7 @@ class StatsProduct extends ModuleGraph
|
||||
$sql = 'SELECT p.`id_product`, p.reference, pl.`name`, IFNULL(
|
||||
(SELECT SUM(pa.quantity) FROM '._DB_PREFIX_.'product_attribute pa WHERE pa.id_product = p.id_product), p.quantity) as quantity
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').'
|
||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
||||
'.(Tools::getValue('id_category') ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`' : '').'
|
||||
WHERE pl.`id_lang` = '.(int)($id_lang).'
|
||||
@@ -128,7 +128,7 @@ class StatsProduct extends ModuleGraph
|
||||
$sql = 'SELECT pl.name as pname, pl.id_product, SUM(od.product_quantity) as pqty, AVG(od.product_price) as pprice
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = od.product_id AND pl.id_lang = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = od.product_id AND pl.id_lang = '.(int)$id_lang.$this->context->shop->sqlLang('pl').')
|
||||
WHERE o.id_customer IN (
|
||||
SELECT o.id_customer
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
|
||||
@@ -74,7 +74,7 @@ class StatsStock extends Module
|
||||
), p.wholesale_price * p.quantity) as stockvalue
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
||||
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.')
|
||||
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
||||
WHERE 1 = 1
|
||||
'.$filter;
|
||||
$products = Db::getInstance()->ExecuteS($sql);
|
||||
|
||||
@@ -1158,7 +1158,7 @@ class UpsCarrier extends CarrierModule
|
||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 2)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 2'.$this->context->shop->sqlLang('pl').')
|
||||
WHERE p.`active` = 1
|
||||
ORDER BY pl.`name`');
|
||||
foreach ($productsList as $product)
|
||||
|
||||
@@ -1163,7 +1163,7 @@ class UspsCarrier extends CarrierModule
|
||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
||||
WHERE p.`active` = 1
|
||||
ORDER BY pl.`name`');
|
||||
foreach ($productsList as $product)
|
||||
|
||||
Reference in New Issue
Block a user