// Many improvements for Feature Detachable
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8648 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -36,7 +36,7 @@ class AdminPerformance extends AdminTab
|
||||
$settings = file_get_contents(dirname(__FILE__).'/../../config/settings.inc.php');
|
||||
if (!Tools::getValue('active'))
|
||||
$cache_active = 0;
|
||||
else
|
||||
else
|
||||
$cache_active = 1;
|
||||
if (!$caching_system = Tools::getValue('caching_system'))
|
||||
$this->_errors[] = Tools::displayError('Caching system is missing');
|
||||
@@ -52,7 +52,7 @@ class AdminPerformance extends AdminTab
|
||||
if (!($depth = Tools::getValue('ps_cache_fs_directory_depth')))
|
||||
$this->_errors[] = Tools::displayError('Please set a directory depth');
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
{
|
||||
CacheFS::deleteCacheDirectory();
|
||||
CacheFS::createCacheDirectories((int)$depth);
|
||||
Configuration::updateValue('PS_CACHEFS_DIRECTORY_DEPTH', (int)$depth);
|
||||
@@ -103,7 +103,7 @@ class AdminPerformance extends AdminTab
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
|
||||
|
||||
if (Tools::isSubmit('submitCiphering') AND Configuration::get('PS_CIPHER_ALGORITHM') != (int)Tools::getValue('PS_CIPHER_ALGORITHM'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -144,7 +144,7 @@ class AdminPerformance extends AdminTab
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
|
||||
if (Tools::isSubmit('submitCCC'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -204,7 +204,7 @@ class AdminPerformance extends AdminTab
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (!Combination::isActuallyUsed())
|
||||
if (!Combination::isCurrentlyUsed())
|
||||
Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', Tools::getValue('combination'));
|
||||
Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', Tools::getValue('feature'));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
@@ -222,10 +222,10 @@ class AdminPerformance extends AdminTab
|
||||
$warnings[] = $this->l('To use Memcached, you must install the Memcache PECL extension on your server.').' <a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';
|
||||
if(!is_writable(_PS_CACHEFS_DIRECTORY_))
|
||||
$warnings[] = $this->l('To use CacheFS the directory').' '.realpath(_PS_CACHEFS_DIRECTORY_).' '.$this->l('must be writable');
|
||||
|
||||
|
||||
if ($warnings)
|
||||
$this->displayWarning($warnings);
|
||||
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
showMemcached();
|
||||
@@ -252,12 +252,12 @@ class AdminPerformance extends AdminTab
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" style="margin-top:10px;">
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/prefs.gif" /> '.$this->l('Smarty').'</legend>
|
||||
|
||||
|
||||
<label>'.$this->l('Templates cache:').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="smarty_force_compile" id="smarty_force_compile_'._PS_SMARTY_NO_COMPILE_.'" value="'._PS_SMARTY_NO_COMPILE_.'" '.(Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_NO_COMPILE_ ? 'checked="checked"' : '').' /> <label class="t"> '.$this->l('Never compile cache').'</label>
|
||||
@@ -279,21 +279,21 @@ class AdminPerformance extends AdminTab
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" style="margin-top:10px;" id="featuresDetachables">
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/tab-plugins.gif" /> '.$this->l('Features detachables').'</legend>
|
||||
|
||||
|
||||
<p>'.$this->l('Some features can be disabled in order to improve performance.').'</p>
|
||||
|
||||
|
||||
<label>'.$this->l('Combination:').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="combination" id="combination_1" value="1" '.(Combination::isFeatureActive() ? 'checked="checked"' : '').' '.(Combination::isActuallyUsed() ? 'disabled="disabled"' : '').' /> <label class="t"><img src="../img/admin/enabled.gif" alt="" /> '.$this->l('Yes').'</label>
|
||||
<input type="radio" name="combination" id="combination_0" value="0" '.(!Combination::isFeatureActive() ? 'checked="checked"' : '').' '.(Combination::isActuallyUsed() ? 'disabled="disabled"' : '').' /> <label class="t"><img src="../img/admin/disabled.gif" alt="" /> '.$this->l('No').'</label>
|
||||
<input type="radio" name="combination" id="combination_1" value="1" '.(Combination::isFeatureActive() ? 'checked="checked"' : '').' '.(Combination::isCurrentlyUsed() ? 'disabled="disabled"' : '').' /> <label class="t"><img src="../img/admin/enabled.gif" alt="" /> '.$this->l('Yes').'</label>
|
||||
<input type="radio" name="combination" id="combination_0" value="0" '.(!Combination::isFeatureActive() ? 'checked="checked"' : '').' '.(Combination::isCurrentlyUsed() ? 'disabled="disabled"' : '').' /> <label class="t"><img src="../img/admin/disabled.gif" alt="" /> '.$this->l('No').'</label>
|
||||
';
|
||||
if (Combination::isActuallyUsed())
|
||||
$this->displayWarning($this->l('This feature can\'t be disabled beacause this is currently in use.'));
|
||||
if (Combination::isCurrentlyUsed())
|
||||
$this->displayWarning($this->l('This feature can\'t be disabled because this is currently in use.'));
|
||||
echo '
|
||||
<p>
|
||||
'.$this->l('These features are going to be disabled:').'
|
||||
@@ -304,7 +304,7 @@ class AdminPerformance extends AdminTab
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<label>'.$this->l('Feature:').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="feature" id="feature_1" value="1" '.(Feature::isFeatureActive() ? 'checked="checked"' : '').' /> <label class="t"><img src="../img/admin/enabled.gif" alt="" /> '.$this->l('Yes').'</label>
|
||||
@@ -324,7 +324,7 @@ class AdminPerformance extends AdminTab
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" style="margin-top:10px;">
|
||||
<fieldset>
|
||||
@@ -338,7 +338,7 @@ class AdminPerformance extends AdminTab
|
||||
<input type="radio" value="0" name="PS_CSS_THEME_CACHE" id="PS_CSS_THEME_CACHE_0" '.(Configuration::get('PS_CSS_THEME_CACHE') ? '' : 'checked="checked"').' />
|
||||
<label class="t" for="PS_CSS_THEME_CACHE_0">'.$this->l('Keep CSS as original').'</label>
|
||||
</div>
|
||||
|
||||
|
||||
<label>'.$this->l('Smart cache for JavaScript').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" value="1" name="PS_JS_THEME_CACHE" id="PS_JS_THEME_CACHE_1" '.(Configuration::get('PS_JS_THEME_CACHE') ? 'checked="checked"' : '').' />
|
||||
@@ -347,7 +347,7 @@ class AdminPerformance extends AdminTab
|
||||
<input type="radio" value="0" name="PS_JS_THEME_CACHE" id="PS_JS_THEME_CACHE_0" '.(Configuration::get('PS_JS_THEME_CACHE') ? '' : 'checked="checked"').' />
|
||||
<label class="t" for="PS_JS_THEME_CACHE_0">'.$this->l('Keep JavaScript as original').'</label>
|
||||
</div>
|
||||
|
||||
|
||||
<label>'.$this->l('Minify HTML').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" value="1" name="PS_HTML_THEME_COMPRESSION" id="PS_HTML_THEME_COMPRESSION_1" '.(Configuration::get('PS_HTML_THEME_COMPRESSION') ? 'checked="checked"' : '').' />
|
||||
@@ -356,7 +356,7 @@ class AdminPerformance extends AdminTab
|
||||
<input type="radio" value="0" name="PS_HTML_THEME_COMPRESSION" id="PS_HTML_THEME_COMPRESSION_0" '.(Configuration::get('PS_HTML_THEME_COMPRESSION') ? '' : 'checked="checked"').' />
|
||||
<label class="t" for="PS_HTML_THEME_COMPRESSION_0">'.$this->l('Keep HTML as original').'</label>
|
||||
</div>
|
||||
|
||||
|
||||
<label>'.$this->l('Compress inline JavaScript in HTML').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" value="1" name="PS_JS_HTML_THEME_COMPRESSION" id="PS_JS_HTML_THEME_COMPRESSION_1" '.(Configuration::get('PS_JS_HTML_THEME_COMPRESSION') ? 'checked="checked"' : '').' />
|
||||
@@ -365,7 +365,7 @@ class AdminPerformance extends AdminTab
|
||||
<input type="radio" value="0" name="PS_JS_HTML_THEME_COMPRESSION" id="PS_JS_HTML_THEME_COMPRESSION_0" '.(Configuration::get('PS_JS_HTML_THEME_COMPRESSION') ? '' : 'checked="checked"').' />
|
||||
<label class="t" for="PS_JS_HTML_THEME_COMPRESSION_0">'.$this->l('Keep inline JavaScript in HTML as original').'</label>
|
||||
</div>
|
||||
|
||||
|
||||
<label>'.$this->l('High risk HTML compression').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" value="1" name="PS_HIGH_HTML_THEME_COMPRESSION" id="PS_HIGH_HTML_THEME_COMPRESSION_1" '.(Configuration::get('PS_HIGH_HTML_THEME_COMPRESSION') ? 'checked="checked"' : '').' />
|
||||
@@ -374,13 +374,13 @@ class AdminPerformance extends AdminTab
|
||||
<input type="radio" value="0" name="PS_HIGH_HTML_THEME_COMPRESSION" id="PS_HIGH_HTML_THEME_COMPRESSION_0" '.(Configuration::get('PS_HIGH_HTML_THEME_COMPRESSION') ? '' : 'checked="checked"').' />
|
||||
<label class="t" for="PS_HIGH_HTML_THEME_COMPRESSION_0">'.$this->l('Keep W3C validation').'</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitCCC" class="button" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
|
||||
|
||||
echo '<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" style="margin-top:10px;">
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/subdomain.gif" /> '.$this->l('Media servers (used only with CCC)').'</legend>
|
||||
@@ -425,7 +425,7 @@ class AdminPerformance extends AdminTab
|
||||
</form>
|
||||
</fieldset>
|
||||
';
|
||||
|
||||
|
||||
$depth = Configuration::get('PS_CACHEFS_DIRECTORY_DEPTH');
|
||||
echo '<fieldset style="margin-top: 10px;">
|
||||
<legend><img src="../img/admin/computer_key.png" /> '.$this->l('Caching').'</legend>
|
||||
@@ -479,7 +479,7 @@ class AdminPerformance extends AdminTab
|
||||
</form>
|
||||
</div>';
|
||||
$servers = MCached::getMemcachedServers();
|
||||
if ($servers)
|
||||
if ($servers)
|
||||
{
|
||||
echo '<div class="margin-form">
|
||||
<table style="width: 320px;" cellspacing="0" cellpadding="0" class="table">
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -30,14 +30,14 @@ class AliasCore extends ObjectModel
|
||||
public $alias;
|
||||
public $search;
|
||||
public $active = true;
|
||||
|
||||
|
||||
protected $fieldsRequired = array('alias', 'search');
|
||||
protected $fieldsSize = array('alias' => 255, 'search' => 255);
|
||||
protected $fieldsValidate = array('search' => 'isValidSearch', 'alias' => 'isValidSearch', 'active' => 'isBool');
|
||||
|
||||
protected $table = 'alias';
|
||||
protected $identifier = 'id_alias';
|
||||
|
||||
|
||||
protected static $feature_active = null;
|
||||
|
||||
function __construct($id = NULL, $alias = NULL, $search = NULL, $id_lang = NULL)
|
||||
@@ -51,13 +51,13 @@ class AliasCore extends ObjectModel
|
||||
$this->alias = trim($alias);
|
||||
$this->search = trim($search);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT a.id_alias, a.search, a.alias
|
||||
FROM `'._DB_PREFIX_.'alias` a
|
||||
WHERE `alias` LIKE \''.pSQL($alias).'\' AND `active` = 1');
|
||||
|
||||
|
||||
if ($row)
|
||||
{
|
||||
$this->id = (int)($row['id_alias']);
|
||||
@@ -77,7 +77,7 @@ class AliasCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return '';
|
||||
|
||||
|
||||
$aliases = Db::getInstance()->ExecuteS('
|
||||
SELECT a.alias
|
||||
FROM `'._DB_PREFIX_.'alias` a
|
||||
@@ -86,17 +86,17 @@ class AliasCore extends ObjectModel
|
||||
$aliases = array_map('implode', $aliases);
|
||||
return implode(', ', $aliases);
|
||||
}
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
|
||||
|
||||
$fields['alias'] = pSQL($this->alias);
|
||||
$fields['search'] = pSQL($this->search);
|
||||
$fields['active'] = (int)($this->active);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is used or active
|
||||
* @since 1.5.0.1
|
||||
@@ -106,10 +106,10 @@ class AliasCore extends ObjectModel
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_alias`
|
||||
FROM `'._DB_PREFIX_.'alias`
|
||||
');
|
||||
return self::$feature_active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -36,7 +36,7 @@ class CombinationCore extends ObjectModel
|
||||
public $location;
|
||||
|
||||
public $ean13;
|
||||
|
||||
|
||||
public $upc;
|
||||
|
||||
public $wholesale_price;
|
||||
@@ -83,7 +83,7 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
protected $table = 'product_attribute';
|
||||
protected $identifier = 'id_product_attribute';
|
||||
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectNodeName' => 'combination',
|
||||
'objectsNodeName' => 'combinations',
|
||||
@@ -114,14 +114,14 @@ class CombinationCore extends ObjectModel
|
||||
$fields['available_date'] = pSQL($this->available_date);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!parent::delete() OR $this->deleteAssociations() === false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
if (
|
||||
@@ -132,7 +132,7 @@ class CombinationCore extends ObjectModel
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function setWsProductOptionValues($values)
|
||||
{
|
||||
if ($this->deleteAssociations())
|
||||
@@ -148,7 +148,7 @@ class CombinationCore extends ObjectModel
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function getWsProductOptionValues()
|
||||
{
|
||||
$result = Db::getInstance()->executeS('SELECT id_attribute AS id from `'._DB_PREFIX_.'product_attribute_combination` WHERE id_product_attribute = '.(int)$this->id);
|
||||
@@ -179,7 +179,7 @@ class CombinationCore extends ObjectModel
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is active
|
||||
* @since 1.5.0.1
|
||||
@@ -189,16 +189,16 @@ class CombinationCore extends ObjectModel
|
||||
{
|
||||
return Configuration::get('PS_COMBINATION_FEATURE_ACTIVE');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is in use
|
||||
* @since 1.5.0.1
|
||||
* @return bool
|
||||
*/
|
||||
public static function isActuallyUsed()
|
||||
public static function isCurrentlyUsed()
|
||||
{
|
||||
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
');
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ class CustomizationCore
|
||||
public static function isFeatureActive()
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_customization_field`
|
||||
FROM `'._DB_PREFIX_.'customization_field`
|
||||
') > 1);
|
||||
');
|
||||
return self::$feature_active;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+35
-35
@@ -28,7 +28,7 @@
|
||||
class DiscountCore extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
|
||||
|
||||
/** @var integer Customer id only if discount is reserved */
|
||||
public $id_customer;
|
||||
|
||||
@@ -130,7 +130,7 @@ class DiscountCore extends ObjectModel
|
||||
const PERCENT = 1;
|
||||
const AMOUNT = 2;
|
||||
const FREE_SHIPPING = 3;
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
@@ -227,7 +227,7 @@ class DiscountCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* This method allow to get the customer discount
|
||||
* @param int $id_lang
|
||||
* @param int $id_customer
|
||||
@@ -240,10 +240,10 @@ class DiscountCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
if (!$cart)
|
||||
$cart = Context::getContext()->cart;
|
||||
|
||||
|
||||
$sql = '
|
||||
SELECT d.*, dtl.`name` AS `type`, dl.`description`
|
||||
FROM `'._DB_PREFIX_.'discount` d
|
||||
@@ -252,28 +252,28 @@ class DiscountCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)($id_lang).')
|
||||
WHERE (d.`id_customer` = '.(int)$id_customer.'
|
||||
';
|
||||
|
||||
|
||||
// Group clause
|
||||
if (Group::isFeatureActive())
|
||||
$sql .= 'OR d.`id_group` IN (
|
||||
SELECT `id_group`
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
SELECT `id_group`
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
WHERE cg.`id_customer` = '.(int)$id_customer.'
|
||||
)';
|
||||
else
|
||||
$sql .= 'OR d.`id_group` = 1';
|
||||
|
||||
|
||||
if ($includeGenericOnes)
|
||||
$sql .= 'OR (d.`id_customer` = 0 AND d.`id_group` = 0)';
|
||||
|
||||
|
||||
$sql .= ')'; // close parenthsis openned befor d.`id_customer`
|
||||
|
||||
|
||||
if ($active)
|
||||
$sql .= ' AND d.`active` = 1';
|
||||
|
||||
|
||||
if ($hasStock)
|
||||
$sql .= ' AND d.`quantity` != 0';
|
||||
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
|
||||
foreach ($res as &$discount)
|
||||
@@ -290,7 +290,7 @@ class DiscountCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param int $id_customer
|
||||
* @return bool
|
||||
*/
|
||||
@@ -315,7 +315,7 @@ class DiscountCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return 0;
|
||||
|
||||
|
||||
if (!$currency)
|
||||
$currency = Context::getContext()->currency;
|
||||
if (!$shop)
|
||||
@@ -330,7 +330,7 @@ class DiscountCore extends ObjectModel
|
||||
|
||||
if ($this->usedByCustomer((int)$cart->id_customer) >= $this->quantity_per_user AND !$cart->OrderExists())
|
||||
return 0;
|
||||
|
||||
|
||||
$date_start = strtotime($this->date_from);
|
||||
$date_end = strtotime($this->date_to);
|
||||
if ((time() < $date_start OR time() > $date_end) AND !$cart->OrderExists()) return 0;
|
||||
@@ -407,7 +407,7 @@ class DiscountCore extends ObjectModel
|
||||
elseif (!is_array($categories) OR !sizeof($categories))
|
||||
return false;
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'discount_category`
|
||||
DELETE FROM `'._DB_PREFIX_.'discount_category`
|
||||
WHERE `id_discount`='.(int)$this->id);
|
||||
foreach($categories AS $category)
|
||||
{
|
||||
@@ -417,7 +417,7 @@ class DiscountCore extends ObjectModel
|
||||
WHERE `id_discount`='.(int)($this->id).' AND `id_category`='.(int)($category));
|
||||
if (Db::getInstance()->NumRows() == 0)
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`)
|
||||
INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`)
|
||||
VALUES('.(int)($this->id).','.(int)($category).')');
|
||||
}
|
||||
}
|
||||
@@ -428,9 +428,9 @@ class DiscountCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
return (bool)Db::getInstance()->getValue('
|
||||
SELECT `id_discount`
|
||||
FROM `'._DB_PREFIX_.'discount`
|
||||
WHERE `name` LIKE \''.pSQL($discountName).'\'
|
||||
SELECT `id_discount`
|
||||
FROM `'._DB_PREFIX_.'discount`
|
||||
WHERE `name` LIKE \''.pSQL($discountName).'\'
|
||||
AND `id_discount` != '.(int)$id_discount);
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ class DiscountCore extends ObjectModel
|
||||
$voucher->minimal = (float)($voucher->value);
|
||||
$voucher->active = 1;
|
||||
$voucher->cart_display = 1;
|
||||
|
||||
|
||||
$now = time();
|
||||
$voucher->date_from = date('Y-m-d H:i:s', $now);
|
||||
$voucher->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */
|
||||
@@ -496,7 +496,7 @@ class DiscountCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* This method allows to get the vouchers can be shown in order page
|
||||
* @param int $id_lang
|
||||
* @param int $id_customer
|
||||
@@ -506,7 +506,7 @@ class DiscountCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
$sql = '
|
||||
SELECT d.`name`, dl.`description`, d.`id_discount`
|
||||
FROM `'._DB_PREFIX_.'discount` d
|
||||
@@ -514,21 +514,21 @@ class DiscountCore extends ObjectModel
|
||||
WHERE d.`active` = 1
|
||||
AND d.`date_from` <= \''.pSQL(date('Y-m-d H:i:s')).'\' AND d.`date_to` >= \''.pSQL(date('Y-m-d H:i:s')).'\'
|
||||
AND dl.`id_lang` = '.(int)$id_lang.'
|
||||
AND d.`cart_display` = 1
|
||||
AND d.`cart_display` = 1
|
||||
AND d.`quantity` > 0
|
||||
AND (
|
||||
(d.`id_customer` = 0 AND d.`id_group` = 0)';
|
||||
|
||||
|
||||
if ($id_customer)
|
||||
{
|
||||
$sql .= ' OR (';
|
||||
// adding id_customer clause
|
||||
$sql .= 'd.`id_customer` = '.(int)$id_customer;
|
||||
if (Group::isFeatureActive())
|
||||
$sql .= '
|
||||
$sql .= '
|
||||
OR d.`id_group` IN (
|
||||
SELECT cg.`id_group`
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
SELECT cg.`id_group`
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
WHERE cg.`id_customer` = '.(int)$id_customer.'
|
||||
)';
|
||||
else
|
||||
@@ -537,7 +537,7 @@ class DiscountCore extends ObjectModel
|
||||
}
|
||||
else
|
||||
$sql .= ' OR d.`id_group` = 1';
|
||||
|
||||
|
||||
$sql .= ')'; // close parenthesis openned above
|
||||
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
@@ -571,7 +571,7 @@ class DiscountCore extends ObjectModel
|
||||
{
|
||||
return Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'discount` WHERE `id_discount` = '.(int)$id_discount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This metohd is allow to know if a feature is used or active
|
||||
* @since 1.5.0.1
|
||||
@@ -580,11 +580,11 @@ class DiscountCore extends ObjectModel
|
||||
public static function isFeatureActive()
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'discount`
|
||||
self::$feature_active = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_discount`
|
||||
FROM `'._DB_PREFIX_.'discount`
|
||||
WHERE `active` = 1
|
||||
') > 0);
|
||||
');
|
||||
return self::$feature_active;
|
||||
}
|
||||
}
|
||||
+16
-16
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -31,7 +31,7 @@ class GroupCore extends ObjectModel
|
||||
|
||||
/** @var string Lastname */
|
||||
public $name;
|
||||
|
||||
|
||||
/** @var string Reduction */
|
||||
public $reduction;
|
||||
|
||||
@@ -49,7 +49,7 @@ class GroupCore extends ObjectModel
|
||||
protected $fieldsRequired = array('price_display_method');
|
||||
protected $fieldsSize = array();
|
||||
protected $fieldsValidate = array('reduction' => 'isFloat', 'price_display_method' => 'isPriceDisplayMethod');
|
||||
|
||||
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
protected $fieldsSizeLang = array('name' => 32);
|
||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
||||
@@ -60,9 +60,9 @@ class GroupCore extends ObjectModel
|
||||
protected static $_cacheReduction = array();
|
||||
protected static $_groupPriceDisplayMethod = array();
|
||||
protected static $feature_active = null;
|
||||
|
||||
|
||||
protected $webserviceParameters = array();
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
@@ -75,14 +75,14 @@ class GroupCore extends ObjectModel
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
public function getTranslationsFieldsChild()
|
||||
{
|
||||
if (!$this->validateFieldsLang())
|
||||
return false;
|
||||
return $this->getTranslationsFields(array('name'));
|
||||
}
|
||||
|
||||
|
||||
public static function getGroups($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
@@ -91,7 +91,7 @@ class GroupCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($id_lang).')
|
||||
ORDER BY g.`id_group` ASC');
|
||||
}
|
||||
|
||||
|
||||
public function getCustomers($count = false, $start = 0, $limit = 0)
|
||||
{
|
||||
if ($count)
|
||||
@@ -99,18 +99,18 @@ class GroupCore extends ObjectModel
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
||||
WHERE cg.`id_group` = '.(int)$this->id.'
|
||||
WHERE cg.`id_group` = '.(int)$this->id.'
|
||||
AND c.`deleted` != 1');
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT cg.`id_customer`, c.*
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
||||
WHERE cg.`id_group` = '.(int)$this->id.'
|
||||
AND c.`deleted` != 1
|
||||
WHERE cg.`id_group` = '.(int)$this->id.'
|
||||
AND c.`deleted` != 1
|
||||
ORDER BY cg.`id_customer` ASC
|
||||
'.($limit > 0 ? 'LIMIT '.(int)$start.', '.(int)$limit : ''));
|
||||
}
|
||||
|
||||
|
||||
public static function getReduction($id_customer = NULL)
|
||||
{
|
||||
if (!isset(self::$_cacheReduction['customer'][(int)$id_customer]))
|
||||
@@ -168,7 +168,7 @@ class GroupCore extends ObjectModel
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is used or active
|
||||
* @since 1.5.0.1
|
||||
@@ -177,10 +177,10 @@ class GroupCore extends ObjectModel
|
||||
public static function isFeatureActive()
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_group`
|
||||
FROM `'._DB_PREFIX_.'group`
|
||||
') > 1);
|
||||
');
|
||||
return self::$feature_active;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -36,7 +36,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return false;
|
||||
|
||||
|
||||
if (!array_key_exists($id_product, self::$cacheIsPack))
|
||||
{
|
||||
$result = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'pack WHERE id_product_pack = '.(int)($id_product));
|
||||
@@ -49,7 +49,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return false;
|
||||
|
||||
|
||||
if (!array_key_exists($id_product, self::$cacheIsPacked))
|
||||
{
|
||||
$result = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'pack WHERE id_product_item = '.(int)($id_product));
|
||||
@@ -72,7 +72,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
if (array_key_exists($id_product, self::$cachePackItems))
|
||||
return self::$cachePackItems[$id_product];
|
||||
$result = Db::getInstance()->ExecuteS('SELECT id_product_item, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)($id_product));
|
||||
@@ -91,7 +91,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return true;
|
||||
|
||||
|
||||
$items = self::getItems((int)($id_product), Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($items AS $item)
|
||||
if ($item->quantity < $item->pack_quantity AND !$item->isAvailableWhenOutOfStock((int)($item->out_of_stock)))
|
||||
@@ -103,7 +103,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
$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
|
||||
@@ -132,7 +132,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
$packs = Db::getInstance()->getValue('
|
||||
SELECT GROUP_CONCAT(a.`id_product_pack`)
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
@@ -196,7 +196,7 @@ class PackCore extends Product
|
||||
// If return query result, a non-pack product will return false
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is used or active
|
||||
* @since 1.5.0.1
|
||||
@@ -206,7 +206,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_pack`
|
||||
FROM `'._DB_PREFIX_.'pack`
|
||||
');
|
||||
return self::$feature_active;
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -29,19 +29,19 @@ class ProductDownloadCore extends ObjectModel
|
||||
{
|
||||
/** @var integer Product id which download belongs */
|
||||
public $id_product;
|
||||
|
||||
|
||||
/** @var string DisplayFilename the name which appear */
|
||||
public $display_filename;
|
||||
|
||||
/** @var string PhysicallyFilename the name of the file on hard disk */
|
||||
public $physically_filename;
|
||||
|
||||
|
||||
/** @var string DateDeposit when the file is upload */
|
||||
public $date_deposit;
|
||||
|
||||
/** @var string DateExpiration deadline of the file */
|
||||
public $date_expiration;
|
||||
|
||||
|
||||
/** @var string NbDaysAccessible how many days the customer can access to file */
|
||||
public $nb_days_accessible;
|
||||
|
||||
@@ -79,9 +79,9 @@ class ProductDownloadCore extends ObjectModel
|
||||
|
||||
protected $table = 'product_download';
|
||||
protected $identifier = 'id_product_download';
|
||||
|
||||
|
||||
protected static $feature_active = null;
|
||||
|
||||
|
||||
/**
|
||||
* Build a virtual product
|
||||
*
|
||||
@@ -92,7 +92,7 @@ class ProductDownloadCore extends ObjectModel
|
||||
parent::__construct($id_product_download);
|
||||
// @TODO check if the file is present on hard drive
|
||||
}
|
||||
|
||||
|
||||
public function delete($deleteFile=false)
|
||||
{
|
||||
if ($deleteFile)
|
||||
@@ -103,7 +103,7 @@ class ProductDownloadCore extends ObjectModel
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
|
||||
|
||||
if (!$this->date_expiration)
|
||||
$this->date_expiration = '0000-00-00 00:00:00';
|
||||
|
||||
@@ -162,15 +162,15 @@ class ProductDownloadCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return false;
|
||||
|
||||
|
||||
if (array_key_exists($id_product, self::$_productIds))
|
||||
return self::$_productIds[$id_product];
|
||||
|
||||
|
||||
self::$_productIds[$id_product] = (int)Db::getInstance()->getValue('
|
||||
SELECT `id_product_download`
|
||||
FROM `'._DB_PREFIX_.'product_download`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
|
||||
|
||||
|
||||
return self::$_productIds[$id_product];
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ class ProductDownloadCore extends ObjectModel
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_product_download`
|
||||
FROM `'._DB_PREFIX_.'product_download`
|
||||
');
|
||||
return self::$feature_active;
|
||||
|
||||
+37
-37
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -29,19 +29,19 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
/** @var string Name */
|
||||
public $name;
|
||||
|
||||
|
||||
/** @var boolean Active Scene */
|
||||
public $active = true;
|
||||
|
||||
|
||||
/** @var array Zone for image map */
|
||||
public $zones = array();
|
||||
|
||||
|
||||
/** @var array list of category where this scene is available */
|
||||
public $categories = array();
|
||||
|
||||
|
||||
/** @var array Products */
|
||||
public $products;
|
||||
|
||||
|
||||
protected $table = 'scene';
|
||||
protected $identifier = 'id_scene';
|
||||
|
||||
@@ -50,27 +50,27 @@ class SceneCore extends ObjectModel
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
protected $fieldsSizeLang = array('name' => 100);
|
||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
||||
|
||||
|
||||
protected static $feature_active = null;
|
||||
|
||||
|
||||
public function __construct($id = NULL, $id_lang = NULL, $liteResult = true, $hideScenePosition = false)
|
||||
{
|
||||
parent::__construct((int)($id), (int)($id_lang));
|
||||
|
||||
|
||||
if (!$liteResult)
|
||||
$this->products = $this->getProducts(true, (int)($id_lang), false);
|
||||
$this->products = $this->getProducts(true, (int)($id_lang), false);
|
||||
if ($hideScenePosition)
|
||||
$this->name = Scene::hideScenePosition($this->name);
|
||||
$this->image_dir = _PS_SCENE_IMG_DIR_;
|
||||
}
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields['active'] = (int)($this->active);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check then return multilingual fields for database interaction
|
||||
*
|
||||
@@ -80,8 +80,8 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
$this->validateFieldsLang();
|
||||
return $this->getTranslationsFields(array('name'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function update($nullValues = false)
|
||||
{
|
||||
if (!$this->updateZoneProducts())
|
||||
@@ -90,17 +90,17 @@ class SceneCore extends ObjectModel
|
||||
return false;
|
||||
return parent::update($nullValues);
|
||||
}
|
||||
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
if (!empty($this->zones))
|
||||
$this->addZoneProducts($this->zones);
|
||||
if (!empty($this->categories))
|
||||
$this->addCategories($this->categories);
|
||||
|
||||
|
||||
return parent::add($autodate, $nullValues);
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->deleteZoneProducts();
|
||||
@@ -108,12 +108,12 @@ class SceneCore extends ObjectModel
|
||||
if (parent::delete())
|
||||
return $this->deleteImage();
|
||||
}
|
||||
|
||||
|
||||
public function deleteImage()
|
||||
{
|
||||
if (parent::deleteImage())
|
||||
{
|
||||
if (file_exists($this->image_dir.'thumbs/'.$this->id.'-thumb_scene.'.$this->image_format)
|
||||
if (file_exists($this->image_dir.'thumbs/'.$this->id.'-thumb_scene.'.$this->image_format)
|
||||
&& !unlink($this->image_dir.'thumbs/'.$this->id.'-thumb_scene.'.$this->image_format))
|
||||
return false;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class SceneCore extends ObjectModel
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function addCategories($categories)
|
||||
{
|
||||
$result = true;
|
||||
@@ -132,14 +132,14 @@ class SceneCore extends ObjectModel
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function deleteCategories()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'scene_category`
|
||||
DELETE FROM `'._DB_PREFIX_.'scene_category`
|
||||
WHERE `id_scene` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
|
||||
public function updateCategories()
|
||||
{
|
||||
if (!$this->deleteCategories())
|
||||
@@ -148,7 +148,7 @@ class SceneCore extends ObjectModel
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function addZoneProducts($zones)
|
||||
{
|
||||
$result = true;
|
||||
@@ -161,14 +161,14 @@ class SceneCore extends ObjectModel
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function deleteZoneProducts()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'scene_products`
|
||||
WHERE `id_scene` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
|
||||
public function updateZoneProducts()
|
||||
{
|
||||
if (!$this->deleteZoneProducts())
|
||||
@@ -177,7 +177,7 @@ class SceneCore extends ObjectModel
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all scenes of a category
|
||||
*
|
||||
@@ -187,7 +187,7 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
||||
@@ -202,13 +202,13 @@ class SceneCore extends ObjectModel
|
||||
.($onlyActive ? ' AND s.active = 1' : '').'
|
||||
ORDER BY sl.name ASC';
|
||||
$scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
|
||||
|
||||
if (!$liteResult AND $scenes)
|
||||
foreach($scenes AS &$scene)
|
||||
$scene = new Scene($scene['id_scene'], $id_lang, false, $hideScenePosition);
|
||||
return $scenes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all products of this scene
|
||||
*
|
||||
@@ -218,17 +218,17 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
||||
|
||||
|
||||
$products = Db::getInstance()->ExecuteS('
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'scene_products` s
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = s.id_product)
|
||||
WHERE s.id_scene = '.(int)$this->id.($onlyActive ? ' AND p.active = 1' : ''));
|
||||
|
||||
|
||||
if (!$liteResult AND $products)
|
||||
foreach ($products AS &$product)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ class SceneCore extends ObjectModel
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get categories where scene is indexed
|
||||
*
|
||||
@@ -254,7 +254,7 @@ class SceneCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'scene_category`
|
||||
WHERE `id_scene` = '.(int)($id_scene));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hide scene prefix used for position
|
||||
*
|
||||
@@ -265,7 +265,7 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
return preg_replace('/^[0-9]+\./', '', $name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is used or active
|
||||
* @since 1.5.0.1
|
||||
@@ -275,7 +275,7 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_scene`
|
||||
FROM `'._DB_PREFIX_.'scene`
|
||||
');
|
||||
return self::$feature_active;
|
||||
|
||||
@@ -68,9 +68,16 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
public static function getByProductId($id_product)
|
||||
{
|
||||
<<<<<<< .mine
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
=======
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` = '.(int)$id_product
|
||||
);
|
||||
>>>>>>> .r8644
|
||||
}
|
||||
|
||||
public static function getIdsByProductId($id_product)
|
||||
@@ -206,7 +213,11 @@ class SpecificPriceCore extends ObjectModel
|
||||
');
|
||||
|
||||
$targeted_prices = array();
|
||||
<<<<<<< .mine
|
||||
$last_quantity = NULL;
|
||||
=======
|
||||
$last_quantity = null;
|
||||
>>>>>>> .r8644
|
||||
|
||||
foreach($res as $specific_price)
|
||||
{
|
||||
@@ -297,7 +308,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_specific_price`
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
');
|
||||
return self::$feature_active;
|
||||
|
||||
@@ -74,7 +74,7 @@ $_LANGADM['AdminAttachments0071aa279bd1583754a544277740f047'] = 'Supprimer objet
|
||||
$_LANGADM['AdminAttachments4a21a191879a23aa2a27829300da95f5'] = 'Cette pièce jointe est utilisée par les produits suivants :';
|
||||
$_LANGADM['AdminAttributeGenerator233c543a23378c4ffd0e1efb17408510'] = 'Impact sur le prix :';
|
||||
$_LANGADM['AdminAttributeGenerator792467936100838046f749e63dadfbdb'] = 'Impact sur le poids :';
|
||||
$_LANGADM['AdminAttributeGenerator13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminAttributeGenerator13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a été désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminAttributeGenerator9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||
$_LANGADM['AdminAttributeGenerator42dc1497090b299a41c64d1389e6ca8c'] = 'HT :';
|
||||
$_LANGADM['AdminAttributeGenerator419cdd539861e743b872b2c959629a54'] = 'TTC :';
|
||||
@@ -87,7 +87,7 @@ $_LANGADM['AdminAttributeGenerator32b919d18cfaca89383f6000dcc9c031'] = 'Génére
|
||||
$_LANGADM['AdminAttributeGeneratorc0babe5601b3f91313d53267c3c7ec24'] = 'Revenir au produit';
|
||||
$_LANGADM['AdminAttributeGeneratorec211f7c20af43e742bf2570c3cb84f9'] = 'Ajouter';
|
||||
$_LANGADM['AdminAttributeGeneratorf2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
|
||||
$_LANGADM['AdminAttributes13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminAttributes13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a été désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminAttributes9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||
$_LANGADM['AdminAttributesf2bbdf9f72c085adc4d0404e370f0f4c'] = 'Attribut';
|
||||
$_LANGADM['AdminAttributes4e140ba723a03baa6948340bf90e2ef6'] = 'Nom :';
|
||||
@@ -107,7 +107,7 @@ $_LANGADM['AdminAttributes19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
||||
$_LANGADM['AdminAttributesGroups49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
||||
$_LANGADM['AdminAttributesGroups287234a1ff35a314b5b6bc4e5828e745'] = 'Attributs';
|
||||
$_LANGADM['AdminAttributesGroups630f6dc397fe74e52d5189e2c80f282b'] = 'Retour à la liste';
|
||||
$_LANGADM['AdminAttributesGroups13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminAttributesGroups13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a été désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminAttributesGroups9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||
$_LANGADM['AdminAttributesGroups8196c2d7a6dce8aea8acbeac4105ef81'] = 'Ajouter un groupe d\'attributs';
|
||||
$_LANGADM['AdminAttributesGroups88a306e559954dc8c8ae9eb55d62297f'] = 'Ajouter une déclinaison';
|
||||
@@ -891,7 +891,7 @@ $_LANGADM['AdminEmployees19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
||||
$_LANGADM['AdminFeatures49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
||||
$_LANGADM['AdminFeaturesc82a6100dace2b41087ba6cf99a5976a'] = 'Valeurs';
|
||||
$_LANGADM['AdminFeaturesea59bdc2e534a7c88b324959995c0cb2'] = 'Retour à la liste des caractéristiques';
|
||||
$_LANGADM['AdminFeatures13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminFeatures13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a été désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminFeatures9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||
$_LANGADM['AdminFeaturesd6ae681fcd58f1e1936ca97da36528ff'] = 'Ajouter une nouvelle caractéristique';
|
||||
$_LANGADM['AdminFeatures0c8a987e64c2d46886bf92e29c736bdc'] = 'Ajouter une nouvelle valeur de caractéristique';
|
||||
@@ -911,7 +911,7 @@ $_LANGADM['AdminFeatures6252c0f2c2ed83b7b06dfca86d4650bb'] = 'Caractères interd
|
||||
$_LANGADM['AdminFeatures817b35caca2afa11b6c1efc428315470'] = 'Groupe de boutiques associé';
|
||||
$_LANGADM['AdminFeatures38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
||||
$_LANGADM['AdminFeatures19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
||||
$_LANGADM['AdminFeaturesValues13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminFeaturesValues13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a été désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminFeaturesValues9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||
$_LANGADM['AdminFeaturesValues0c8a987e64c2d46886bf92e29c736bdc'] = 'Ajouter une nouvelle valeur de caractéristique';
|
||||
$_LANGADM['AdminFeaturesValuesacdb802bfc2b99b15d1782570285c427'] = 'Contenu :';
|
||||
@@ -1870,7 +1870,7 @@ $_LANGADM['AdminPerformance38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
||||
$_LANGADM['AdminPerformance41f69f170bf9a7ab1b5b5f7f0e177014'] = 'Fonctionnalités désactivables';
|
||||
$_LANGADM['AdminPerformancebb3656a5447418f8f2644f3ac91b5c6f'] = 'Plusieurs fonctionnalités peuvent être désactivée afin d\'optimiser les performances.';
|
||||
$_LANGADM['AdminPerformance8ed07686e8486f87c4e0d491b0949904'] = 'Déclinaison de produit:';
|
||||
$_LANGADM['AdminPerformancee1381172572be7b958e6fcc4c33f246a'] = 'Cette fonctionnalité ne peut être désactivée car elle est actuellement en cours d\'utilisation.';
|
||||
$_LANGADM['AdminPerformancecb49d4980d515d6b3297a366a3f6c769'] = 'Cette fonctionnalité ne peut-être désactivée car elle est actuellement utilisée';
|
||||
$_LANGADM['AdminPerformance17d7cd0c1cf06a808fe23302666ea48c'] = 'Ces fonctionnalités vont être désactivées:';
|
||||
$_LANGADM['AdminPerformanceca752c58a57df4ddb193ea9bd45baf4d'] = 'L\'onglet \"Déclinaisons\" lors de l\'édition d\'un produit';
|
||||
$_LANGADM['AdminPerformancef2bbdf9f72c085adc4d0404e370f0f4c'] = 'Attribut';
|
||||
@@ -2259,7 +2259,7 @@ $_LANGADM['AdminProductsc820e0c1d4ae16db218626f49e7916b1'] = 'Ko max.';
|
||||
$_LANGADM['AdminProductsc795dfff10a7c952f4c5438951e9ece9'] = 'Image de couverture';
|
||||
$_LANGADM['AdminProductsfc55a6e78b7d33b0241db646dc913ef9'] = 'Modifier cette déclinaison';
|
||||
$_LANGADM['AdminProducts7be66046997731ac05844f11ee4f6a76'] = 'Supprimer cette image';
|
||||
$_LANGADM['AdminProducts13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminProducts13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a été désactivée, vous pouvez l\'activer sur cette page:';
|
||||
$_LANGADM['AdminProducts9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||
$_LANGADM['AdminProducts6f39383b81d4999830ab6febe6279777'] = 'Ajouter ou modifier des déclinaisons de produit';
|
||||
$_LANGADM['AdminProducts3ea3291e42b4f5eae395f389ce9a88d5'] = 'Générateur de déclinaisons de produit';
|
||||
|
||||
Reference in New Issue
Block a user