// Context part 15

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7658 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-19 16:17:14 +00:00
parent 3baf0f02a5
commit 4ae81d8acd
39 changed files with 231 additions and 198 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ class BlockCurrencies extends Module
if (Configuration::get('PS_CATALOG_MODE'))
return ;
$currencies = Currency::getCurrencies(false, 1, $this->context->shop->getID());
$currencies = Currency::getCurrencies(false, 1, $this->context);
if (!sizeof($currencies))
return '';
$this->context->smarty->assign('currencies', $currencies);
+2 -2
View File
@@ -387,8 +387,8 @@ class BlockLayered extends Module
p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, p.condition, p.id_manufacturer, stock.quantity,
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
FROM '._DB_PREFIX_.'product p
'.Shop::sqlAsso('product', 'p', true, $context).'
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::sqlLang('pl', $context).')
'.$context->shop->sqlAsso('product', 'p', true).'
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$context->shop->sqlLang('pl').')
'.Product::sqlStock('p', 0).'
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)$context->language->id.')
+2 -2
View File
@@ -311,7 +311,7 @@ class MailAlerts extends Module
$sql = 'SELECT id_product, quantity
FROM '._DB_PREFIX_.'stock
WHERE id_product_attribute = '.(int)$params['id_product_attribute']
.Shop::sqlSharedStock();
.Context::getContext()->sqlSharedStock();
$result = Db::getInstance()->getRow($sql);
if ($this->_customer_qty AND $result['quantity'] > 0)
@@ -480,7 +480,7 @@ class MailAlerts extends Module
$sql = 'SELECT ma.`id_product`, stock.quantity AS product_quantity, pl.`name`, ma.`id_product_attribute`
FROM `'._DB_PREFIX_.'mailalert_customer_oos` ma
JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ma.`id_product`
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = ma.`id_product` AND pl.`id_lang` = '.$id_lang.Shop::sqlLang('pl').'
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = ma.`id_product` AND pl.`id_lang` = '.$id_lang.Context::getContext()->shop->sqlLang('pl').'
'.Product::sqlStock('p', 0).'
WHERE ma.`id_customer` = '.$id_customer;
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
+2 -2
View File
@@ -362,7 +362,7 @@ class ReferralProgram extends Module
if (!Validate::isLoadedObject($discount))
return false;
if ($params['cart']->checkDiscountValidity($discount, $params['cart']->getDiscounts(), $params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS), $params['cart']->getProducts(), false, $this->context->shop->getID(), $this->context->shop->getGroupID())===false)
if ($params['cart']->checkDiscountValidity($discount, $params['cart']->getDiscounts(), $params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS), $params['cart']->getProducts(), false, $this->context) === false)
{
global $smarty;
$smarty->assign(array('discount_display' => Discount::display($discount->value, $discount->id_discount_type, new Currency($params['cookie']->id_currency)), 'discount' => $discount));
@@ -438,7 +438,7 @@ class ReferralProgram extends Module
return false;
$sponsor = new Customer();
if ($sponsor = $sponsor->getByEmail($sponsorEmail, NULL, $this->context->shop->getGroupID(), $this->context->shop->getID()))
if ($sponsor = $sponsor->getByEmail($sponsorEmail, NULL, $this->context))
{
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
@@ -130,7 +130,7 @@ class StatsBestCategories extends ModuleGrid
WHERE c.id_category IN (
SELECT s.id_category
FROM '._DB_PREFIX_.'shop s
WHERE s.id_shop IN ('.implode(', ', Shop::getListOfID($this->context)).')
WHERE s.id_shop IN ('.implode(', ', $this->context->shop->getListOfID()).')
)';
if ($result = Db::getInstance()->executeS($sql))
{
@@ -164,7 +164,7 @@ class StatsBestProducts extends ModuleGrid
AND dr.time_end BETWEEN '.$dateBetween.'
) AS totalPageViewed
FROM '._DB_PREFIX_.'product p
'.Shop::sqlAsso('product', 'p', true, $this->context).'
'.$this->context->shop->sqlAsso('product', 'p', true).'
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_.'order_detail od ON od.product_id = p.id_product
LEFT JOIN '._DB_PREFIX_.'orders o ON od.id_order = o.id_order
+1 -1
View File
@@ -147,7 +147,7 @@ class StatsCatalog extends Module
$this->_join = ' LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)';
$this->_where = ' AND cp.`id_category` = '.$id_category;
}
$this->_join .= Shop::sqlAsso('product', 'p', true, $this->context);
$this->_join .= $this->context->shop->sqlAsso('product', 'p', true);
$result1 = $this->getQuery1(true);
$total = $result1['total'];
+3 -3
View File
@@ -82,7 +82,7 @@ class StatsCheckUp extends Module
// Get languages
$sql = 'SELECT l.*
FROM '._DB_PREFIX_.'lang l'
.Shop::sqlAsso('lang', 'l', true, $this->context);
.$this->context->shop->sqlAsso('lang', 'l', true);
$languages = $db->ExecuteS($sql);
$arrayColors = array(
@@ -109,7 +109,7 @@ class StatsCheckUp extends Module
$sql = 'SELECT p.id_product, p.active, pl.name, (
SELECT COUNT(*)
FROM '._DB_PREFIX_.'image i
'.Shop::sqlAsso('image', 'i', true, $this->context).'
'.$this->context->shop->sqlAsso('image', 'i', true).'
WHERE i.id_product = p.id_product
) as nbImages, (
SELECT SUM(od.product_quantity)
@@ -125,7 +125,7 @@ class StatsCheckUp extends Module
), 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)$cookie->id_lang.')
'.Shop::sqlAsso('product', 'p', true, $this->context).'
'.$this->context->shop->sqlAsso('product', 'p', true).'
ORDER BY '.$orderBy;
$result = $db->ExecuteS($sql);
+1 -1
View File
@@ -512,7 +512,7 @@ class StatsForecast extends Module
$langValues = '';
$sql = 'SELECT l.id_lang, l.iso_code
FROM `'._DB_PREFIX_.'lang` l
'.Shop::sqlAsso('lang', 'l', true, $this->context).'
'.$this->context->shop->sqlAsso('lang', 'l', true).'
WHERE l.active = 1';
$languages = Db::getInstance()->ExecuteS($sql);
foreach ($languages as $language)
+1 -1
View File
@@ -103,7 +103,7 @@ class StatsProduct extends ModuleGraph
(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`
'.Shop::sqlAsso('product', 'p', true, $this->context).'
'.$this->context->shop->sqlAsso('product', 'p', true).'
'.(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).'
'.(Tools::getValue('id_category') ? 'AND cp.id_category = '.(int)(Tools::getValue('id_category')) : '').'
+1 -1
View File
@@ -75,7 +75,7 @@ class StatsStock extends Module
FROM '._DB_PREFIX_.'product_attribute pa WHERE p.id_product = pa.id_product
), p.wholesale_price * p.quantity) as stockvalue
FROM '._DB_PREFIX_.'product p
'.Shop::sqlAsso('product', 'p', true, $this->context).'
'.$this->context->shop->sqlAsso('product', 'p', true).'
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$cookie->id_lang.')
WHERE 1 = 1
'.$filter;