[+] Project : adding Features detachables in order to improve performance
// clean code
This commit is contained in:
1 parent
a4491c9897
commit
230bebc7c7
51 files changed
+1081
-419
No files matched your search
@@ -99,7 +99,7 @@ class AdminAttributeGenerator extends AdminTab
|
|||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
static private function displayAndReturnAttributeJs()
|
private static function displayAndReturnAttributeJs()
|
||||||
{
|
{
|
||||||
$attributes = Attribute::getAttributes($this->context->language->id, true);
|
$attributes = Attribute::getAttributes($this->context->language->id, true);
|
||||||
$attributeJs = array();
|
$attributeJs = array();
|
||||||
@@ -142,7 +142,7 @@ class AdminAttributeGenerator extends AdminTab
|
|||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
static private function setAttributesImpacts($id_product, $tab)
|
private static function setAttributesImpacts($id_product, $tab)
|
||||||
{
|
{
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
foreach ($tab AS $group)
|
foreach ($tab AS $group)
|
||||||
@@ -155,7 +155,7 @@ class AdminAttributeGenerator extends AdminTab
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static private function getAttributesImpacts($id_product)
|
private static function getAttributesImpacts($id_product)
|
||||||
{
|
{
|
||||||
$tab = array();
|
$tab = array();
|
||||||
$result = Db::getInstance()->ExecuteS(
|
$result = Db::getInstance()->ExecuteS(
|
||||||
@@ -216,6 +216,12 @@ class AdminAttributeGenerator extends AdminTab
|
|||||||
|
|
||||||
public function displayForm($isMainTab = true)
|
public function displayForm($isMainTab = true)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parent::displayForm();
|
parent::displayForm();
|
||||||
|
|
||||||
$jsAttributes = self::displayAndReturnAttributeJs();
|
$jsAttributes = self::displayAndReturnAttributeJs();
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ class AdminAttributes extends AdminTab
|
|||||||
*/
|
*/
|
||||||
public function displayForm($token = NULL)
|
public function displayForm($token = NULL)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parent::displayForm();
|
parent::displayForm();
|
||||||
|
|
||||||
if (!($obj = $this->loadObject(true)))
|
if (!($obj = $this->loadObject(true)))
|
||||||
@@ -127,6 +133,9 @@ class AdminAttributes extends AdminTab
|
|||||||
*/
|
*/
|
||||||
public function postProcess($token = NULL)
|
public function postProcess($token = NULL)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
|
|
||||||
if (Tools::getValue('submitDel'.$this->table))
|
if (Tools::getValue('submitDel'.$this->table))
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['delete'] === '1')
|
if ($this->tabAccess['delete'] === '1')
|
||||||
|
|||||||
@@ -50,20 +50,26 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
|
|
||||||
public function display()
|
public function display()
|
||||||
{
|
{
|
||||||
if ((isset($_POST['submitAddattribute']) AND sizeof($this->adminAttributes->_errors))
|
if (Combination::isFeatureActive())
|
||||||
OR isset($_GET['updateattribute']) OR isset($_GET['addattribute']))
|
|
||||||
{
|
{
|
||||||
$this->adminAttributes->displayForm($this->token);
|
if ((isset($_POST['submitAddattribute']) AND sizeof($this->adminAttributes->_errors))
|
||||||
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
OR isset($_GET['updateattribute']) OR isset($_GET['addattribute']))
|
||||||
|
{
|
||||||
|
$this->adminAttributes->displayForm($this->token);
|
||||||
|
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parent::display();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
parent::display();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
|
|
||||||
$this->adminAttributes->tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, $this->id);
|
$this->adminAttributes->tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, $this->id);
|
||||||
$this->adminAttributes->postProcess($this->token);
|
$this->adminAttributes->postProcess($this->token);
|
||||||
|
|
||||||
@@ -166,6 +172,12 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
|
|
||||||
public function displayForm($isMainTab = true)
|
public function displayForm($isMainTab = true)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parent::displayForm();
|
parent::displayForm();
|
||||||
|
|
||||||
if (!($obj = $this->loadObject(true)))
|
if (!($obj = $this->loadObject(true)))
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class AdminCarts extends AdminTab
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">';
|
<td colspan="2">';
|
||||||
foreach ($customization['datas'] AS $type => $datas)
|
foreach ($customization['datas'] AS $type => $datas)
|
||||||
if ($type == _CUSTOMIZE_FILE_)
|
if ($type == Product::CUSTOMIZE_FILE)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
||||||
@@ -291,7 +291,7 @@ class AdminCarts extends AdminTab
|
|||||||
</li>';
|
</li>';
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
elseif ($type == _CUSTOMIZE_TEXTFIELD_)
|
elseif ($type == Product::CUSTOMIZE_TEXTFIELD)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ class AdminDiscounts extends AdminTab
|
|||||||
$this->edit = true;
|
$this->edit = true;
|
||||||
$this->delete = true;
|
$this->delete = true;
|
||||||
$this->_select = 'dtl.`name` AS discount_type,
|
$this->_select = 'dtl.`name` AS discount_type,
|
||||||
IF(a.id_discount_type = 1, CONCAT(a.value, " %"),
|
IF(a.id_discount_type = '.(int)Discount::PERCENT.', CONCAT(a.value, " %"),
|
||||||
IF(a.id_discount_type = 2, CONCAT(a.value, " ", c.sign),
|
IF(a.id_discount_type = '.(int)Discount::AMOUNT.', CONCAT(a.value, " ", c.sign),
|
||||||
"--")) as strvalue';
|
"--")) as strvalue';
|
||||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'currency` c ON (c.`id_currency` = a.`id_currency`)
|
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'currency` c ON (c.`id_currency` = a.`id_currency`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON (dt.`id_discount_type` = a.`id_discount_type`)
|
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON (dt.`id_discount_type` = a.`id_discount_type`)
|
||||||
@@ -91,9 +91,9 @@ class AdminDiscounts extends AdminTab
|
|||||||
{
|
{
|
||||||
if (Tools::getValue('id_discount_type') == 0)
|
if (Tools::getValue('id_discount_type') == 0)
|
||||||
$this->_errors[] = Tools::displayError('Please set a type for this voucher.');
|
$this->_errors[] = Tools::displayError('Please set a type for this voucher.');
|
||||||
if (Tools::getValue('id_discount_type') == 2 AND Tools::getValue('id_currency') == 0)
|
if (Tools::getValue('id_discount_type') == Discount::AMOUNT AND Tools::getValue('id_currency') == 0)
|
||||||
$this->_errors[] = Tools::displayError('Please set a currency for this voucher.');
|
$this->_errors[] = Tools::displayError('Please set a currency for this voucher.');
|
||||||
if ((Tools::getValue('id_discount_type') == 1 || Tools::getValue('id_discount_type') == 2) && !Tools::getValue('value'))
|
if ((Tools::getValue('id_discount_type') == Discount::PERCENT || Tools::getValue('id_discount_type') == 2) && !Tools::getValue('value'))
|
||||||
$this->_errors[] = Tools::displayError('Please set a amount for this voucher.');
|
$this->_errors[] = Tools::displayError('Please set a amount for this voucher.');
|
||||||
if (!Validate::isBool_Id(Tools::getValue('id_target')))
|
if (!Validate::isBool_Id(Tools::getValue('id_target')))
|
||||||
$this->_errors[] = Tools::displayError('Invalid customer or group ID field');
|
$this->_errors[] = Tools::displayError('Invalid customer or group ID field');
|
||||||
@@ -227,13 +227,13 @@ class AdminDiscounts extends AdminTab
|
|||||||
{
|
{
|
||||||
if ($("#id_discount_type").val() == 0)
|
if ($("#id_discount_type").val() == 0)
|
||||||
$("#value-div").css("display", "none");
|
$("#value-div").css("display", "none");
|
||||||
else if ($("#id_discount_type").val() == 1)
|
else if ($("#id_discount_type").val() == '.Discount::PERCENT.')
|
||||||
{
|
{
|
||||||
$("#value-div").css("display", "block");
|
$("#value-div").css("display", "block");
|
||||||
$("#percent-span").css("display", "block");
|
$("#percent-span").css("display", "block");
|
||||||
$("#id_currency").css("display", "none");
|
$("#id_currency").css("display", "none");
|
||||||
}
|
}
|
||||||
else if ($("#id_discount_type").val() == 2)
|
else if ($("#id_discount_type").val() == '.Discount::AMOUNT.')
|
||||||
{
|
{
|
||||||
$("#value-div").css("display", "block");
|
$("#value-div").css("display", "block");
|
||||||
$("#percent-span").css("display", "none");
|
$("#percent-span").css("display", "none");
|
||||||
@@ -241,9 +241,9 @@ class AdminDiscounts extends AdminTab
|
|||||||
$(\'#behavior_not_exhausted\').show();
|
$(\'#behavior_not_exhausted\').show();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ($("#id_discount_type").val() == 3)
|
else if ($("#id_discount_type").val() == '.Discount::FREE_SHIPPING.')
|
||||||
$("#value-div").css("display", "none");
|
$("#value-div").css("display", "none");
|
||||||
if ($(\'#id_discount_type\').val() != 2)
|
if ($(\'#id_discount_type\').val() != '.Discount::AMOUNT.')
|
||||||
$(\'#behavior_not_exhausted\').hide();
|
$(\'#behavior_not_exhausted\').hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,16 +47,19 @@ class AdminFeatures extends AdminTab
|
|||||||
|
|
||||||
public function display()
|
public function display()
|
||||||
{
|
{
|
||||||
if ((isset($_POST['submitAddfeature_value']) AND sizeof($this->adminFeaturesValues->_errors))
|
if (Feature::isFeatureActive())
|
||||||
OR isset($_GET['updatefeature_value']) OR isset($_GET['addfeature_value']))
|
|
||||||
{
|
{
|
||||||
$this->adminFeaturesValues->displayForm($this->token);
|
if ((isset($_POST['submitAddfeature_value']) AND sizeof($this->adminFeaturesValues->_errors))
|
||||||
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" alt="" /> '.$this->l('Back to the features list').'</a><br />';
|
OR isset($_GET['updatefeature_value']) OR isset($_GET['addfeature_value']))
|
||||||
|
{
|
||||||
|
$this->adminFeaturesValues->displayForm($this->token);
|
||||||
|
echo '<br /><br /><a href="'.self::$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" alt="" /> '.$this->l('Back to the features list').'</a><br />';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parent::display();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
parent::display();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Report to AdminTab::displayList() for more details */
|
/* Report to AdminTab::displayList() for more details */
|
||||||
@@ -131,6 +134,12 @@ class AdminFeatures extends AdminTab
|
|||||||
|
|
||||||
public function displayForm($isMainTab = true)
|
public function displayForm($isMainTab = true)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').'<a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parent::displayForm();
|
parent::displayForm();
|
||||||
|
|
||||||
if (!($obj = $this->loadObject(true)))
|
if (!($obj = $this->loadObject(true)))
|
||||||
@@ -177,6 +186,9 @@ class AdminFeatures extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return ;
|
||||||
|
|
||||||
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
|
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
|
||||||
$this->adminFeaturesValues->postProcess($this->token);
|
$this->adminFeaturesValues->postProcess($this->token);
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ class AdminFeaturesValues extends AdminTab
|
|||||||
*/
|
*/
|
||||||
public function displayForm($isMainTab = true)
|
public function displayForm($isMainTab = true)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parent::displayForm();
|
parent::displayForm();
|
||||||
|
|
||||||
if (!($obj = $this->loadObject(true)))
|
if (!($obj = $this->loadObject(true)))
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ class AdminOrders extends AdminTab
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">';
|
<td colspan="2">';
|
||||||
foreach ($customization['datas'] AS $type => $datas)
|
foreach ($customization['datas'] AS $type => $datas)
|
||||||
if ($type == _CUSTOMIZE_FILE_)
|
if ($type == Product::CUSTOMIZE_FILE)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
||||||
@@ -401,7 +401,7 @@ class AdminOrders extends AdminTab
|
|||||||
</li>';
|
</li>';
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
elseif ($type == _CUSTOMIZE_TEXTFIELD_)
|
elseif ($type == Product::CUSTOMIZE_TEXTFIELD)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
||||||
@@ -472,7 +472,8 @@ class AdminOrders extends AdminTab
|
|||||||
$history = $order->getHistory($this->context->language->id);
|
$history = $order->getHistory($this->context->language->id);
|
||||||
$products = $order->getProducts();
|
$products = $order->getProducts();
|
||||||
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
||||||
Product::addCustomizationPrice($products, $customizedDatas);
|
if ($customizedDatas)
|
||||||
|
Product::addCustomizationPrice($products, $customizedDatas);
|
||||||
$discounts = $order->getDiscounts();
|
$discounts = $order->getDiscounts();
|
||||||
$messages = Message::getMessagesByOrderId($order->id, true);
|
$messages = Message::getMessagesByOrderId($order->id, true);
|
||||||
$states = OrderState::getOrderStates($this->context->language->id);
|
$states = OrderState::getOrderStates($this->context->language->id);
|
||||||
@@ -770,7 +771,9 @@ class AdminOrders extends AdminTab
|
|||||||
}
|
}
|
||||||
// Customization display
|
// Customization display
|
||||||
$this->displayCustomizedDatas($customizedDatas, $product, $currency, $image, $tokenCatalog, $k);
|
$this->displayCustomizedDatas($customizedDatas, $product, $currency, $image, $tokenCatalog, $k);
|
||||||
|
|
||||||
|
if (!isset($product['customizationQuantityTotal']))
|
||||||
|
$product['customizationQuantityTotal'] = 0;
|
||||||
// Normal display
|
// Normal display
|
||||||
if ($product['product_quantity'] > $product['customizationQuantityTotal'])
|
if ($product['product_quantity'] > $product['customizationQuantityTotal'])
|
||||||
{
|
{
|
||||||
@@ -787,7 +790,7 @@ class AdminOrders extends AdminTab
|
|||||||
.($product['product_supplier_reference'] ? $this->l('Ref Supplier:').' '.$product['product_supplier_reference'] : '')
|
.($product['product_supplier_reference'] ? $this->l('Ref Supplier:').' '.$product['product_supplier_reference'] : '')
|
||||||
.'</a></td>
|
.'</a></td>
|
||||||
<td align="center">'.Tools::displayPrice($product_price, $currency, false).'</td>
|
<td align="center">'.Tools::displayPrice($product_price, $currency, false).'</td>
|
||||||
<td align="center" class="productQuantity" '.($quantity > 1 ? 'style="font-weight:700;font-size:1.1em;color:red"' : '').'>'.(int)$quantity.'</td>
|
<td align="center" class="productQuantity" '.($product['product_quantity'] > 1 ? 'style="font-weight:700;font-size:1.1em;color:red"' : '').'>'.(int)$product['product_quantity'].'</td>
|
||||||
'.($order->hasBeenPaid() ? '<td align="center" class="productQuantity">'.(int)($product['product_quantity_refunded']).'</td>' : '').'
|
'.($order->hasBeenPaid() ? '<td align="center" class="productQuantity">'.(int)($product['product_quantity_refunded']).'</td>' : '').'
|
||||||
'.($order->hasBeenDelivered() ? '<td align="center" class="productQuantity">'.(int)($product['product_quantity_return']).'</td>' : '').'
|
'.($order->hasBeenDelivered() ? '<td align="center" class="productQuantity">'.(int)($product['product_quantity_return']).'</td>' : '').'
|
||||||
<td align="center" class="productQuantity">'.$productObj->getStock($product['product_attribute_id']).'</td>
|
<td align="center" class="productQuantity">'.$productObj->getStock($product['product_attribute_id']).'</td>
|
||||||
|
|||||||
@@ -200,6 +200,18 @@ class AdminPerformance extends AdminTab
|
|||||||
else
|
else
|
||||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
}
|
}
|
||||||
|
if (Tools::isSubmit('submitFeaturesDetachables'))
|
||||||
|
{
|
||||||
|
if ($this->tabAccess['edit'] === '1')
|
||||||
|
{
|
||||||
|
if (!Combination::isActuallyUsed())
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
|
}
|
||||||
return parent::postProcess();
|
return parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,6 +280,51 @@ class AdminPerformance extends AdminTab
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</form>';
|
</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>
|
||||||
|
';
|
||||||
|
if (Combination::isActuallyUsed())
|
||||||
|
$this->displayWarning($this->l('This feature can\'t be disabled beacause this is currently in use.'));
|
||||||
|
echo '
|
||||||
|
<p>
|
||||||
|
'.$this->l('These features are going to be disabled:').'
|
||||||
|
<ul>
|
||||||
|
<li>'.$this->l('Combinations tab on product page').'</li>
|
||||||
|
<li>'.$this->l('Attribute').'</li>
|
||||||
|
<li>'.$this->l('Group of attribute').'</li>
|
||||||
|
</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>
|
||||||
|
<input type="radio" name="feature" id="feature_0" value="0" '.(!Feature::isFeatureActive() ? 'checked="checked"' : '').' /> <label class="t"><img src="../img/admin/disabled.gif" alt="" /> '.$this->l('No').'</label>
|
||||||
|
<p>
|
||||||
|
'.$this->l('These features are going to be disabled:').'
|
||||||
|
<ul>
|
||||||
|
<li>'.$this->l('Features tab on product page').'</li>
|
||||||
|
<li>'.$this->l('Feature').'</li>
|
||||||
|
<li>'.$this->l('Feature value').'</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="margin-form">
|
||||||
|
<input type="submit" value="'.$this->l(' Save ').'" name="submitFeaturesDetachables" class="button" />
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" style="margin-top:10px;">
|
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post" style="margin-top:10px;">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|||||||
@@ -191,7 +191,6 @@ class AdminProducts extends AdminTab
|
|||||||
{
|
{
|
||||||
if ($this->tabAccess['add'] === '1')
|
if ($this->tabAccess['add'] === '1')
|
||||||
{
|
{
|
||||||
|
|
||||||
$languages = Language::getLanguages(false);
|
$languages = Language::getLanguages(false);
|
||||||
$is_attachment_name_valid = false;
|
$is_attachment_name_valid = false;
|
||||||
foreach ($languages AS $language)
|
foreach ($languages AS $language)
|
||||||
@@ -268,7 +267,7 @@ class AdminProducts extends AdminTab
|
|||||||
{
|
{
|
||||||
if ($this->tabAccess['edit'] === '1')
|
if ($this->tabAccess['edit'] === '1')
|
||||||
if ($id = (int)(Tools::getValue($this->identifier)))
|
if ($id = (int)(Tools::getValue($this->identifier)))
|
||||||
if (Attachment::attachToProduct($id, $_POST['attachments']))
|
if (Attachment::attachToProduct($id, Tools::getValue('attachments')))
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)$id.(isset($_POST['id_category']) ? '&id_category='.(int)$_POST['id_category'] : '').'&conf=4&add'.$this->table.'&tabs=6&token='.($token ? $token : $this->token));
|
Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)$id.(isset($_POST['id_category']) ? '&id_category='.(int)$_POST['id_category'] : '').'&conf=4&add'.$this->table.'&tabs=6&token='.($token ? $token : $this->token));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,6 +480,8 @@ class AdminProducts extends AdminTab
|
|||||||
/* Product attributes management */
|
/* Product attributes management */
|
||||||
elseif (Tools::isSubmit('submitProductAttribute'))
|
elseif (Tools::isSubmit('submitProductAttribute'))
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||||
{
|
{
|
||||||
if (!isset($_POST['attribute_price']) OR $_POST['attribute_price'] == NULL)
|
if (!isset($_POST['attribute_price']) OR $_POST['attribute_price'] == NULL)
|
||||||
@@ -573,6 +574,8 @@ class AdminProducts extends AdminTab
|
|||||||
}
|
}
|
||||||
elseif (Tools::isSubmit('deleteProductAttribute'))
|
elseif (Tools::isSubmit('deleteProductAttribute'))
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
if ($this->tabAccess['delete'] === '1')
|
if ($this->tabAccess['delete'] === '1')
|
||||||
{
|
{
|
||||||
if (($id_product = (int)(Tools::getValue('id_product'))) AND Validate::isUnsignedId($id_product) AND Validate::isLoadedObject($product = new Product($id_product)))
|
if (($id_product = (int)(Tools::getValue('id_product'))) AND Validate::isUnsignedId($id_product) AND Validate::isLoadedObject($product = new Product($id_product)))
|
||||||
@@ -598,6 +601,8 @@ class AdminProducts extends AdminTab
|
|||||||
}
|
}
|
||||||
elseif (Tools::isSubmit('deleteAllProductAttributes'))
|
elseif (Tools::isSubmit('deleteAllProductAttributes'))
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
if ($this->tabAccess['delete'] === '1')
|
if ($this->tabAccess['delete'] === '1')
|
||||||
{
|
{
|
||||||
if (($id_product = (int)(Tools::getValue('id_product'))) AND Validate::isUnsignedId($id_product) AND Validate::isLoadedObject($product = new Product($id_product)))
|
if (($id_product = (int)(Tools::getValue('id_product'))) AND Validate::isUnsignedId($id_product) AND Validate::isLoadedObject($product = new Product($id_product)))
|
||||||
@@ -619,6 +624,8 @@ class AdminProducts extends AdminTab
|
|||||||
}
|
}
|
||||||
elseif (Tools::isSubmit('defaultProductAttribute'))
|
elseif (Tools::isSubmit('defaultProductAttribute'))
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||||
{
|
{
|
||||||
$product->deleteDefaultAttributes();
|
$product->deleteDefaultAttributes();
|
||||||
@@ -632,6 +639,8 @@ class AdminProducts extends AdminTab
|
|||||||
/* Product features management */
|
/* Product features management */
|
||||||
elseif (Tools::isSubmit('submitProductFeature'))
|
elseif (Tools::isSubmit('submitProductFeature'))
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return;
|
||||||
if ($this->tabAccess['edit'] === '1')
|
if ($this->tabAccess['edit'] === '1')
|
||||||
{
|
{
|
||||||
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||||
@@ -1561,12 +1570,13 @@ class AdminProducts extends AdminTab
|
|||||||
/* Tabs */
|
/* Tabs */
|
||||||
$this->displayFormInformations($obj, $currency);
|
$this->displayFormInformations($obj, $currency);
|
||||||
$this->displayFormImages($obj, $this->token);
|
$this->displayFormImages($obj, $this->token);
|
||||||
$countAttributes = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id);
|
if (Combination::isFeatureActive())
|
||||||
|
$countAttributes = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id);
|
||||||
$countAttachments = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'product_attachment WHERE id_product = '.(int)$obj->id);
|
$countAttachments = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'product_attachment WHERE id_product = '.(int)$obj->id);
|
||||||
if ($obj->id)
|
if ($obj->id)
|
||||||
echo '
|
echo '
|
||||||
<div class="tab-page" id="step3"><h4 class="tab">3. '.$this->l('Prices').'</h4></div>
|
<div class="tab-page" id="step3"><h4 class="tab">3. '.$this->l('Prices').'</h4></div>
|
||||||
<div class="tab-page" id="step4"><h4 class="tab">4. '.$this->l('Combinations').' ('.$countAttributes.')</h4></div>
|
<div class="tab-page" id="step4"><h4 class="tab">4. '.$this->l('Combinations').(isset($countAttributes) ? ' ('.$countAttributes.')' : '').'</h4></div>
|
||||||
<div class="tab-page" id="step5"><h4 class="tab">5. '.$this->l('Features').'</h4></div>
|
<div class="tab-page" id="step5"><h4 class="tab">5. '.$this->l('Features').'</h4></div>
|
||||||
<div class="tab-page" id="step6"><h4 class="tab">6. '.$this->l('Customization').'</h4></div>
|
<div class="tab-page" id="step6"><h4 class="tab">6. '.$this->l('Customization').'</h4></div>
|
||||||
<div class="tab-page" id="step7"><h4 class="tab">7. '.$this->l('Attachments').' ('.$countAttachments.')</h4></div>';
|
<div class="tab-page" id="step7"><h4 class="tab">7. '.$this->l('Attachments').' ('.$countAttachments.')</h4></div>';
|
||||||
@@ -1898,18 +1908,18 @@ class AdminProducts extends AdminTab
|
|||||||
private function _getCustomizationFieldIds($labels, $alreadyGenerated, $obj)
|
private function _getCustomizationFieldIds($labels, $alreadyGenerated, $obj)
|
||||||
{
|
{
|
||||||
$customizableFieldIds = array();
|
$customizableFieldIds = array();
|
||||||
if (isset($labels[_CUSTOMIZE_FILE_]))
|
if (isset($labels[Product::CUSTOMIZE_FILE]))
|
||||||
foreach ($labels[_CUSTOMIZE_FILE_] AS $id_customization_field => $label)
|
foreach ($labels[Product::CUSTOMIZE_FILE] AS $id_customization_field => $label)
|
||||||
$customizableFieldIds[] = 'label_'._CUSTOMIZE_FILE_.'_'.(int)($id_customization_field);
|
$customizableFieldIds[] = 'label_'.Product::CUSTOMIZE_FILE.'_'.(int)($id_customization_field);
|
||||||
if (isset($labels[_CUSTOMIZE_TEXTFIELD_]))
|
if (isset($labels[Product::CUSTOMIZE_TEXTFIELD]))
|
||||||
foreach ($labels[_CUSTOMIZE_TEXTFIELD_] AS $id_customization_field => $label)
|
foreach ($labels[Product::CUSTOMIZE_TEXTFIELD] AS $id_customization_field => $label)
|
||||||
$customizableFieldIds[] = 'label_'._CUSTOMIZE_TEXTFIELD_.'_'.(int)($id_customization_field);
|
$customizableFieldIds[] = 'label_'.Product::CUSTOMIZE_TEXTFIELD.'_'.(int)($id_customization_field);
|
||||||
$j = 0;
|
$j = 0;
|
||||||
for ($i = $alreadyGenerated[_CUSTOMIZE_FILE_]; $i < (int)($this->getFieldValue($obj, 'uploadable_files')); $i++)
|
for ($i = $alreadyGenerated[Product::CUSTOMIZE_FILE]; $i < (int)($this->getFieldValue($obj, 'uploadable_files')); $i++)
|
||||||
$customizableFieldIds[] = 'newLabel_'._CUSTOMIZE_FILE_.'_'.$j++;
|
$customizableFieldIds[] = 'newLabel_'.Product::CUSTOMIZE_FILE.'_'.$j++;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
for ($i = $alreadyGenerated[_CUSTOMIZE_TEXTFIELD_]; $i < (int)($this->getFieldValue($obj, 'text_fields')); $i++)
|
for ($i = $alreadyGenerated[Product::CUSTOMIZE_TEXTFIELD]; $i < (int)($this->getFieldValue($obj, 'text_fields')); $i++)
|
||||||
$customizableFieldIds[] = 'newLabel_'._CUSTOMIZE_TEXTFIELD_.'_'.$j++;
|
$customizableFieldIds[] = 'newLabel_'.Product::CUSTOMIZE_TEXTFIELD.'_'.$j++;
|
||||||
return implode('¤', $customizableFieldIds);
|
return implode('¤', $customizableFieldIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1937,7 +1947,7 @@ class AdminProducts extends AdminTab
|
|||||||
private function _displayLabelFields(&$obj, &$labels, $languages, $defaultLanguage, $type)
|
private function _displayLabelFields(&$obj, &$labels, $languages, $defaultLanguage, $type)
|
||||||
{
|
{
|
||||||
$type = (int)($type);
|
$type = (int)($type);
|
||||||
$labelGenerated = array(_CUSTOMIZE_FILE_ => (isset($labels[_CUSTOMIZE_FILE_]) ? count($labels[_CUSTOMIZE_FILE_]) : 0), _CUSTOMIZE_TEXTFIELD_ => (isset($labels[_CUSTOMIZE_TEXTFIELD_]) ? count($labels[_CUSTOMIZE_TEXTFIELD_]) : 0));
|
$labelGenerated = array(Product::CUSTOMIZE_FILE => (isset($labels[Product::CUSTOMIZE_FILE]) ? count($labels[Product::CUSTOMIZE_FILE]) : 0), Product::CUSTOMIZE_TEXTFIELD => (isset($labels[Product::CUSTOMIZE_TEXTFIELD]) ? count($labels[Product::CUSTOMIZE_TEXTFIELD]) : 0));
|
||||||
|
|
||||||
$fieldIds = $this->_getCustomizationFieldIds($labels, $labelGenerated, $obj);
|
$fieldIds = $this->_getCustomizationFieldIds($labels, $labelGenerated, $obj);
|
||||||
if (isset($labels[$type]))
|
if (isset($labels[$type]))
|
||||||
@@ -1989,7 +1999,7 @@ class AdminProducts extends AdminTab
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width:150px" valign="top">'.$this->l('Files fields:').'</td>
|
<td style="width:150px" valign="top">'.$this->l('Files fields:').'</td>
|
||||||
<td>';
|
<td>';
|
||||||
$this->_displayLabelFields($obj, $labels, $languages, $defaultLanguage, _CUSTOMIZE_FILE_);
|
$this->_displayLabelFields($obj, $labels, $languages, $defaultLanguage, Product::CUSTOMIZE_FILE);
|
||||||
echo '
|
echo '
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
@@ -2002,7 +2012,7 @@ class AdminProducts extends AdminTab
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width:150px" valign="top">'.$this->l('Text fields:').'</td>
|
<td style="width:150px" valign="top">'.$this->l('Text fields:').'</td>
|
||||||
<td>';
|
<td>';
|
||||||
$this->_displayLabelFields($obj, $labels, $languages, $defaultLanguage, _CUSTOMIZE_TEXTFIELD_);
|
$this->_displayLabelFields($obj, $labels, $languages, $defaultLanguage, Product::CUSTOMIZE_TEXTFIELD);
|
||||||
echo '
|
echo '
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
@@ -3170,9 +3180,14 @@ class AdminProducts extends AdminTab
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayFormAttributes($obj, $languages, $defaultLanguage)
|
public function displayFormAttributes($obj, $languages, $defaultLanguage)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$attributeJs = array();
|
$attributeJs = array();
|
||||||
$attributes = Attribute::getAttributes($this->context->language->id, true);
|
$attributes = Attribute::getAttributes($this->context->language->id, true);
|
||||||
foreach ($attributes AS $k => $attribute)
|
foreach ($attributes AS $k => $attribute)
|
||||||
@@ -3181,11 +3196,10 @@ class AdminProducts extends AdminTab
|
|||||||
$attributes_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
|
$attributes_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
|
||||||
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||||
|
|
||||||
|
|
||||||
$images = Image::getImages($this->context->language->id, $obj->id);
|
$images = Image::getImages($this->context->language->id, $obj->id);
|
||||||
if ($obj->id)
|
if ($obj->id)
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(\'#id_mvt_reason\').change(function(){
|
$(\'#id_mvt_reason\').change(function(){
|
||||||
@@ -3500,8 +3514,14 @@ class AdminProducts extends AdminTab
|
|||||||
echo '<b>'.$this->l('You must save this product before adding combinations').'.</b>';
|
echo '<b>'.$this->l('You must save this product before adding combinations').'.</b>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayFormFeatures($obj)
|
public function displayFormFeatures($obj)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
{
|
||||||
|
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parent::displayForm();
|
parent::displayForm();
|
||||||
|
|
||||||
if ($obj->id)
|
if ($obj->id)
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ class AdminReturn extends AdminTab
|
|||||||
{
|
{
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<td colspan="4">';
|
<td colspan="4">';
|
||||||
if ($type == _CUSTOMIZE_FILE_)
|
if ($type == Product::CUSTOMIZE_FILE)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
||||||
@@ -245,7 +245,7 @@ class AdminReturn extends AdminTab
|
|||||||
</li>';
|
</li>';
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
elseif ($type == _CUSTOMIZE_TEXTFIELD_)
|
elseif ($type == Product::CUSTOMIZE_TEXTFIELD)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
||||||
|
|||||||
+40
-12
@@ -37,6 +37,8 @@ class AliasCore extends ObjectModel
|
|||||||
|
|
||||||
protected $table = 'alias';
|
protected $table = 'alias';
|
||||||
protected $identifier = 'id_alias';
|
protected $identifier = 'id_alias';
|
||||||
|
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
function __construct($id = NULL, $alias = NULL, $search = NULL, $id_lang = NULL)
|
function __construct($id = NULL, $alias = NULL, $search = NULL, $id_lang = NULL)
|
||||||
{
|
{
|
||||||
@@ -44,27 +46,38 @@ class AliasCore extends ObjectModel
|
|||||||
parent::__construct($id);
|
parent::__construct($id);
|
||||||
elseif ($alias AND Validate::isValidSearch($alias))
|
elseif ($alias AND Validate::isValidSearch($alias))
|
||||||
{
|
{
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
if (!self::isFeatureActive())
|
||||||
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']);
|
|
||||||
$this->search = $search ? trim($search) : $row['search'];
|
|
||||||
$this->alias = $row['alias'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$this->alias = trim($alias);
|
$this->alias = trim($alias);
|
||||||
$this->search = trim($search);
|
$this->search = trim($search);
|
||||||
}
|
}
|
||||||
|
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']);
|
||||||
|
$this->search = $search ? trim($search) : $row['search'];
|
||||||
|
$this->alias = $row['alias'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->alias = trim($alias);
|
||||||
|
$this->search = trim($search);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAliases()
|
public function getAliases()
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return '';
|
||||||
|
|
||||||
$aliases = Db::getInstance()->ExecuteS('
|
$aliases = Db::getInstance()->ExecuteS('
|
||||||
SELECT a.alias
|
SELECT a.alias
|
||||||
FROM `'._DB_PREFIX_.'alias` a
|
FROM `'._DB_PREFIX_.'alias` a
|
||||||
@@ -83,5 +96,20 @@ class AliasCore extends ObjectModel
|
|||||||
$fields['active'] = (int)($this->active);
|
$fields['active'] = (int)($this->active);
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'alias`
|
||||||
|
');
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +100,8 @@ class AttributeCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getAttributes($id_lang, $notNull = false)
|
public static function getAttributes($id_lang, $notNull = false)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->ExecuteS('
|
||||||
SELECT ag.*, agl.*, a.`id_attribute`, al.`name`, agl.`name` AS `attribute_group`
|
SELECT ag.*, agl.*, a.`id_attribute`, al.`name`, agl.`name` AS `attribute_group`
|
||||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||||
@@ -158,7 +160,7 @@ class AttributeCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @deprecated since 1.5.0
|
* @deprecated since 1.5.0
|
||||||
* @param array &$arr
|
* @param array &$arr
|
||||||
* return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function updateQtyProduct(&$arr)
|
public static function updateQtyProduct(&$arr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getAttributes($id_lang, $id_attribute_group)
|
public static function getAttributes($id_lang, $id_attribute_group)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->ExecuteS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'attribute` a
|
FROM `'._DB_PREFIX_.'attribute` a
|
||||||
@@ -139,6 +141,8 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getAttributesGroups($id_lang)
|
public static function getAttributesGroups($id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->ExecuteS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||||
@@ -154,7 +158,8 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
public function deleteSelection($selection)
|
public function deleteSelection($selection)
|
||||||
{
|
{
|
||||||
/* Also delete Attributes */
|
/* Also delete Attributes */
|
||||||
foreach ($selection AS $value) {
|
foreach ($selection AS $value)
|
||||||
|
{
|
||||||
$obj = new AttributeGroup($value);
|
$obj = new AttributeGroup($value);
|
||||||
if (!$obj->delete())
|
if (!$obj->delete())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+152
-95
@@ -254,6 +254,10 @@ class CartCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getDiscounts($lite = false, $refresh = false)
|
public function getDiscounts($lite = false, $refresh = false)
|
||||||
{
|
{
|
||||||
|
// if discounts are never used
|
||||||
|
if (!Discount::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
if (!$this->id)
|
if (!$this->id)
|
||||||
return array();
|
return array();
|
||||||
if (!$lite AND !$refresh AND isset(self::$_discounts[$this->id]))
|
if (!$lite AND !$refresh AND isset(self::$_discounts[$this->id]))
|
||||||
@@ -307,12 +311,13 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
public function getDiscountsCustomer($id_discount)
|
public function getDiscountsCustomer($id_discount)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
if (!Discount::isFeatureActive())
|
||||||
SELECT `id_discount`
|
return 0;
|
||||||
FROM `'._DB_PREFIX_.'cart_discount`
|
|
||||||
WHERE `id_discount` = '.(int)($id_discount).' AND `id_cart` = '.(int)($this->id));
|
|
||||||
|
|
||||||
return Db::getInstance()->NumRows();
|
return Db::getInstance()->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'cart_discount`
|
||||||
|
WHERE `id_discount` = '.(int)($id_discount).' AND `id_cart` = '.(int)($this->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastProduct()
|
public function getLastProduct()
|
||||||
@@ -353,37 +358,60 @@ class CartCore extends ObjectModel
|
|||||||
if (!$id_country)
|
if (!$id_country)
|
||||||
$id_country = Context::getContext()->country->id;
|
$id_country = Context::getContext()->country->id;
|
||||||
|
|
||||||
$sql = 'SELECT cp.`id_product_attribute`, cp.`id_product`, cu.`id_customization`, cp.`quantity` AS cart_quantity, cp.id_shop, cu.`quantity` AS customization_quantity, pl.`name`,
|
// Build query
|
||||||
|
$sql = array();
|
||||||
|
// Build SELECT
|
||||||
|
$sql['select'] = 'SELECT cp.`id_product_attribute`, cp.`id_product`, cp.`quantity` AS cart_quantity, cp.id_shop, pl.`name`,
|
||||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, p.`id_product`, p.`id_category_default`, p.`id_supplier`, p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`,
|
pl.`description_short`, pl.`available_now`, pl.`available_later`, p.`id_product`, p.`id_category_default`, p.`id_supplier`, p.`id_manufacturer`, p.`on_sale`, p.`ecotax`, p.`additional_shipping_cost`, p.`available_for_order`,
|
||||||
p.`price`, p.`weight`, p.`width`, p.`height`, p.`depth`, p.`out_of_stock`, p.`active`, p.`date_add`, p.`date_upd`, IFNULL(pa.`minimal_quantity`, p.`minimal_quantity`) as minimal_quantity,
|
p.`price`, p.`weight`, p.`width`, p.`height`, p.`depth`, p.`out_of_stock`, p.`active`, p.`date_add`, p.`date_upd`,
|
||||||
t.`id_tax`, tl.`name` AS tax, t.`rate`, pa.`price` AS price_attribute, stock.quantity,
|
t.`id_tax`, tl.`name` AS tax, t.`rate`, stock.quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category, CONCAT(cp.`id_product`, cp.`id_product_attribute`) AS unique_id';
|
||||||
pa.`ecotax` AS ecotax_attr, pl.`link_rewrite`, cl.`link_rewrite` AS category, CONCAT(cp.`id_product`, cp.`id_product_attribute`) AS unique_id,
|
// Build FROM
|
||||||
IF (IFNULL(pa.`reference`, \'\') = \'\', p.`reference`, pa.`reference`) AS reference,
|
$sql['from'] = 'FROM `'._DB_PREFIX_.'cart_product` cp';
|
||||||
IF (IFNULL(pa.`supplier_reference`, \'\') = \'\', p.`supplier_reference`, pa.`supplier_reference`) AS supplier_reference,
|
// Build JOIN
|
||||||
(p.`weight`+ pa.`weight`) weight_attribute,
|
$sql['join'] = 'LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
||||||
IF (IFNULL(pa.`ean13`, \'\') = \'\', p.`ean13`, pa.`ean13`) AS ean13, IF (IFNULL(pa.`upc`, \'\') = \'\', p.`upc`, pa.`upc`) AS upc,
|
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').')
|
||||||
pai.`id_image` as pai_id_image
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
AND tr.`id_country` = '.(int)$id_country.'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
AND tr.`id_state` = 0
|
||||||
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').')
|
AND tr.`zipcode_from` = 0)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = cp.`id_product_attribute`)
|
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$this->id_lang.')
|
||||||
AND tr.`id_country` = '.(int)$id_country.'
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->sqlLang('cl').')
|
||||||
AND tr.`id_state` = 0
|
'.Product::sqlStock('cp', 'cp');
|
||||||
AND tr.`zipcode_from` = 0)
|
// Build WHERE clauses
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
$sql['where'] = '
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$this->id_lang.')
|
WHERE cp.`id_cart` = '.(int)$this->id.'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customization` cu ON (p.`id_product` = cu.`id_product`)
|
'.($id_product ? ' AND cp.`id_product` = '.(int)$id_product : '').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` pai ON (pai.`id_product_attribute` = pa.`id_product_attribute`)
|
AND p.`id_product` IS NOT NULL';
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->sqlLang('cl').')
|
// Build GROUP BY
|
||||||
'.Product::sqlStock('cp', 'cp').'
|
$sql['groupby'] = 'GROUP BY unique_id';
|
||||||
WHERE cp.`id_cart` = '.(int)$this->id.'
|
// Build ORDER BY
|
||||||
'.($id_product ? ' AND cp.`id_product` = '.(int)$id_product : '').'
|
$sql['orderby'] = 'ORDER BY cp.date_add ASC';
|
||||||
AND p.`id_product` IS NOT NULL
|
|
||||||
GROUP BY unique_id
|
if (Customization::isFeatureActive())
|
||||||
ORDER BY cp.date_add ASC';
|
{
|
||||||
|
$sql['select'] .= ', cu.`id_customization`, cu.`quantity` AS customization_quantity';
|
||||||
|
$sql['join'] .= 'LEFT JOIN `'._DB_PREFIX_.'customization` cu ON (p.`id_product` = cu.`id_product`)';
|
||||||
|
}
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
if (Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$sql['select'] .= ', pa.`price` AS price_attribute, pa.`ecotax` AS ecotax_attr,
|
||||||
|
IF (IFNULL(pa.`reference`, \'\') = \'\', p.`reference`, pa.`reference`) AS reference,
|
||||||
|
IF (IFNULL(pa.`supplier_reference`, \'\') = \'\', p.`supplier_reference`, pa.`supplier_reference`) AS supplier_reference,
|
||||||
|
(p.`weight`+ pa.`weight`) weight_attribute,
|
||||||
|
IF (IFNULL(pa.`ean13`, \'\') = \'\', p.`ean13`, pa.`ean13`) AS ean13, IF (IFNULL(pa.`upc`, \'\') = \'\', p.`upc`, pa.`upc`) AS upc,
|
||||||
|
pai.`id_image` as pai_id_image, IFNULL(pa.`minimal_quantity`, p.`minimal_quantity`) as minimal_quantity, pa.`ecotax` AS ecotax_attr';
|
||||||
|
$sql['join'] .= '
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = cp.`id_product_attribute`)
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` pai ON (pai.`id_product_attribute` = pa.`id_product_attribute`)
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$sql['select'] .= ', p.`reference` AS reference, p.`supplier_reference` AS supplier_reference,
|
||||||
|
p.`ean13`, p.`upc` AS upc, p.`minimal_quantity` AS minimal_quantity';
|
||||||
|
|
||||||
|
$result = Db::getInstance()->ExecuteS(Tools::buildQuery($sql));
|
||||||
// Reset the cache before the following return, or else an empty cart will add dozens of queries
|
// Reset the cache before the following return, or else an empty cart will add dozens of queries
|
||||||
|
|
||||||
$productsIds = array();
|
$productsIds = array();
|
||||||
@@ -408,9 +436,7 @@ class CartCore extends ObjectModel
|
|||||||
// for compatibility with 1.2 themes
|
// for compatibility with 1.2 themes
|
||||||
$row['quantity'] = (int)($row['cart_quantity']);
|
$row['quantity'] = (int)($row['cart_quantity']);
|
||||||
if (isset($row['id_product_attribute']) AND (int)$row['id_product_attribute'])
|
if (isset($row['id_product_attribute']) AND (int)$row['id_product_attribute'])
|
||||||
{
|
|
||||||
$row['weight'] = $row['weight_attribute'];
|
$row['weight'] = $row['weight_attribute'];
|
||||||
}
|
|
||||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||||
{
|
{
|
||||||
$row['price'] = Product::getPriceStatic((int)$row['id_product'], false, isset($row['id_product_attribute']) ? (int)($row['id_product_attribute']) : NULL, 2, NULL, false, true, (int)($row['cart_quantity']), false, ((int)($this->id_customer) ? (int)($this->id_customer) : NULL), (int)($this->id), ((int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL), $specificPriceOutput); // Here taxes are computed only once the quantity has been applied to the product price
|
$row['price'] = Product::getPriceStatic((int)$row['id_product'], false, isset($row['id_product_attribute']) ? (int)($row['id_product_attribute']) : NULL, 2, NULL, false, true, (int)($row['cart_quantity']), false, ((int)($this->id_customer) ? (int)($this->id_customer) : NULL), (int)($this->id), ((int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL), $specificPriceOutput); // Here taxes are computed only once the quantity has been applied to the product price
|
||||||
@@ -464,6 +490,8 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
public static function cacheSomeAttributesLists($ipaList, $id_lang)
|
public static function cacheSomeAttributesLists($ipaList, $id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return;
|
||||||
$paImplode = array();
|
$paImplode = array();
|
||||||
foreach ($ipaList as $id_product_attribute)
|
foreach ($ipaList as $id_product_attribute)
|
||||||
if ((int)$id_product_attribute AND !array_key_exists($id_product_attribute.'-'.$id_lang, self::$_attributesLists))
|
if ((int)$id_product_attribute AND !array_key_exists($id_product_attribute.'-'.$id_lang, self::$_attributesLists))
|
||||||
@@ -532,7 +560,7 @@ class CartCore extends ObjectModel
|
|||||||
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'cart_discount', array('id_discount' => (int)($id_discount), 'id_cart' => (int)($this->id)), 'INSERT');
|
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'cart_discount', array('id_discount' => (int)($id_discount), 'id_cart' => (int)($this->id)), 'INSERT');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function containsProduct($id_product, $id_product_attribute, $id_customization)
|
public function containsProduct($id_product, $id_product_attribute = 0, $id_customization = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->getRow('
|
return Db::getInstance()->getRow('
|
||||||
SELECT cp.`quantity`
|
SELECT cp.`quantity`
|
||||||
@@ -550,7 +578,7 @@ class CartCore extends ObjectModel
|
|||||||
* @param integer $id_product_attribute Attribute ID if needed
|
* @param integer $id_product_attribute Attribute ID if needed
|
||||||
* @param string $operator Indicate if quantity must be increased or decreased
|
* @param string $operator Indicate if quantity must be increased or decreased
|
||||||
*/
|
*/
|
||||||
public function updateQty($quantity, $id_product, $id_product_attribute = NULL, $id_customization = false, $operator = 'up', Shop $shop = null)
|
public function updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false, $operator = 'up', Shop $shop = null)
|
||||||
{
|
{
|
||||||
if (!$shop)
|
if (!$shop)
|
||||||
$shop = Context::getContext()->shop;
|
$shop = Context::getContext()->shop;
|
||||||
@@ -581,7 +609,6 @@ class CartCore extends ObjectModel
|
|||||||
$result = $this->containsProduct($id_product, $id_product_attribute, (int)$id_customization);
|
$result = $this->containsProduct($id_product, $id_product_attribute, (int)$id_customization);
|
||||||
|
|
||||||
/* Update quantity if product already exist */
|
/* Update quantity if product already exist */
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($operator == 'up')
|
if ($operator == 'up')
|
||||||
@@ -740,7 +767,7 @@ class CartCore extends ObjectModel
|
|||||||
WHERE id_customization = '.(int)$customization['id_customization'].'
|
WHERE id_customization = '.(int)$customization['id_customization'].'
|
||||||
AND type = '.(int)$customization['type'].'
|
AND type = '.(int)$customization['type'].'
|
||||||
AND `index` = '.(int)$customization['index']);
|
AND `index` = '.(int)$customization['index']);
|
||||||
if ($type == _CUSTOMIZE_FILE_)
|
if ($type == Product::CUSTOMIZE_FILE)
|
||||||
{
|
{
|
||||||
@unlink(_PS_UPLOAD_DIR_.$customization['value']);
|
@unlink(_PS_UPLOAD_DIR_.$customization['value']);
|
||||||
@unlink(_PS_UPLOAD_DIR_.$customization['value'].'_small');
|
@unlink(_PS_UPLOAD_DIR_.$customization['value'].'_small');
|
||||||
@@ -749,7 +776,8 @@ class CartCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$id_customization = $exising_customization[0]['id_customization'];
|
$id_customization = $exising_customization[0]['id_customization'];
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'customization` (`id_cart`, `id_product`, `id_product_attribute`, `quantity`) VALUES ('.(int)($this->id).', '.(int)($id_product).', '.(int)($id_product_attribute).', '.(int)($quantity).')');
|
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'customization` (`id_cart`, `id_product`, `id_product_attribute`, `quantity`) VALUES ('.(int)($this->id).', '.(int)($id_product).', '.(int)($id_product_attribute).', '.(int)($quantity).')');
|
||||||
$id_customization = Db::getInstance()->Insert_ID();
|
$id_customization = Db::getInstance()->Insert_ID();
|
||||||
@@ -819,12 +847,23 @@ class CartCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get customization quantity */
|
/* Get customization quantity */
|
||||||
if (($result = Db::getInstance()->getRow('SELECT SUM(`quantity`) AS \'quantity\' FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($this->id).' AND `id_product` = '.(int)($id_product).' AND `id_product_attribute` = '.(int)($id_product_attribute))) === false)
|
if (($result = Db::getInstance()->getRow('
|
||||||
|
SELECT SUM(`quantity`) AS \'quantity\'
|
||||||
|
FROM `'._DB_PREFIX_.'customization`
|
||||||
|
WHERE `id_cart` = '.(int)$this->id.'
|
||||||
|
AND `id_product` = '.(int)$id_product.'
|
||||||
|
AND `id_product_attribute` = '.(int)$id_product_attribute)
|
||||||
|
) === false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* If the product still possesses customization it does not have to be deleted */
|
/* If the product still possesses customization it does not have to be deleted */
|
||||||
if (Db::getInstance()->NumRows() AND (int)($result['quantity']))
|
if (Db::getInstance()->NumRows() AND (int)($result['quantity']))
|
||||||
return Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cart_product` SET `quantity` = '.(int)($result['quantity']).' WHERE `id_cart` = '.(int)($this->id).' AND `id_product` = '.(int)($id_product).($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : ''));
|
return Db::getInstance()->Execute('
|
||||||
|
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||||
|
SET `quantity` = '.(int)($result['quantity']).'
|
||||||
|
WHERE `id_cart` = '.(int)($this->id).'
|
||||||
|
AND `id_product` = '.(int)($id_product).
|
||||||
|
($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : ''));
|
||||||
|
|
||||||
/* Product deletion */
|
/* Product deletion */
|
||||||
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($id_product).($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : '').' AND `id_cart` = '.(int)($this->id)))
|
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($id_product).($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : '').' AND `id_cart` = '.(int)($this->id)))
|
||||||
@@ -922,6 +961,9 @@ class CartCore extends ObjectModel
|
|||||||
if (!in_array($type, array(Cart::ONLY_PRODUCTS, Cart::ONLY_DISCOUNTS, Cart::BOTH, Cart::BOTH_WITHOUT_SHIPPING, Cart::ONLY_SHIPPING, Cart::ONLY_WRAPPING, Cart::ONLY_PRODUCTS_WITHOUT_SHIPPING)))
|
if (!in_array($type, array(Cart::ONLY_PRODUCTS, Cart::ONLY_DISCOUNTS, Cart::BOTH, Cart::BOTH_WITHOUT_SHIPPING, Cart::ONLY_SHIPPING, Cart::ONLY_WRAPPING, Cart::ONLY_PRODUCTS_WITHOUT_SHIPPING)))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
|
// if discounts are never used
|
||||||
|
if ($type == Cart::ONLY_DISCOUNTS && !Discount::isFeatureActive())
|
||||||
|
return 0;
|
||||||
// no shipping cost if is a cart with only virtuals products
|
// no shipping cost if is a cart with only virtuals products
|
||||||
$virtual = $this->isVirtualCart();
|
$virtual = $this->isVirtualCart();
|
||||||
if ($virtual AND $type == Cart::ONLY_SHIPPING)
|
if ($virtual AND $type == Cart::ONLY_SHIPPING)
|
||||||
@@ -940,7 +982,6 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Here taxes are computed only once the quantity has been applied to the product price
|
// Here taxes are computed only once the quantity has been applied to the product price
|
||||||
$price = Product::getPriceStatic((int)$product['id_product'], false, (int)$product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity'], false, (int)$this->id_customer ? (int)$this->id_customer : NULL, (int)$this->id, ($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
$price = Product::getPriceStatic((int)$product['id_product'], false, (int)$product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity'], false, (int)$this->id_customer ? (int)$this->id_customer : NULL, (int)$this->id, ($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||||
|
|
||||||
@@ -981,45 +1022,48 @@ class CartCore extends ObjectModel
|
|||||||
if ($type != Cart::ONLY_PRODUCTS)
|
if ($type != Cart::ONLY_PRODUCTS)
|
||||||
{
|
{
|
||||||
$discounts = array();
|
$discounts = array();
|
||||||
/* Firstly get all discounts, looking for a free shipping one (in order to substract shipping fees to the total amount) */
|
if (Discount::isFeatureActive())
|
||||||
if ($discountIds = $this->getDiscounts(true))
|
|
||||||
{
|
{
|
||||||
foreach ($discountIds AS $id_discount)
|
/* Firstly get all discounts, looking for a free shipping one (in order to substract shipping fees to the total amount) */
|
||||||
|
if ($discountIds = $this->getDiscounts(true))
|
||||||
{
|
{
|
||||||
$discount = new Discount((int)($id_discount['id_discount']));
|
foreach ($discountIds AS $id_discount)
|
||||||
if (Validate::isLoadedObject($discount))
|
|
||||||
{
|
{
|
||||||
$discounts[] = $discount;
|
$discount = new Discount((int)($id_discount['id_discount']));
|
||||||
if ($discount->id_discount_type == 3)
|
if (Validate::isLoadedObject($discount))
|
||||||
foreach($products AS $product)
|
{
|
||||||
{
|
$discounts[] = $discount;
|
||||||
$categories = Discount::getCategories($discount->id);
|
if ($discount->id_discount_type == Discount::FREE_SHIPPING)
|
||||||
if (count($categories) AND Product::idIsOnCategoryId($product['id_product'], $categories))
|
foreach($products AS $product)
|
||||||
{
|
{
|
||||||
if($type == Cart::ONLY_DISCOUNTS)
|
$categories = Discount::getCategories($discount->id);
|
||||||
$order_total -= $shipping_fees;
|
if (count($categories) AND Product::idIsOnCategoryId($product['id_product'], $categories))
|
||||||
$shipping_fees = 0;
|
{
|
||||||
break;
|
if($type == Cart::ONLY_DISCOUNTS)
|
||||||
|
$order_total -= $shipping_fees;
|
||||||
|
$shipping_fees = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Secondly applying all vouchers to the correct amount */
|
||||||
|
$shrunk = false;
|
||||||
|
foreach ($discounts AS $discount)
|
||||||
|
if ($discount->id_discount_type != Discount::FREE_SHIPPING)
|
||||||
|
{
|
||||||
|
$order_total -= Tools::ps_round((float)($discount->getValue(sizeof($discounts), $order_total_products, $shipping_fees, $this->id, (int)($withTaxes))), 2);
|
||||||
|
if ($discount->id_discount_type == Discount::AMOUNT)
|
||||||
|
if (in_array($discount->behavior_not_exhausted, array(1,2)))
|
||||||
|
$shrunk = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$order_total_discount = 0;
|
||||||
|
if ($shrunk AND $order_total < (-$wrapping_fees - $order_total_products - $shipping_fees))
|
||||||
|
$order_total_discount = -$wrapping_fees - $order_total_products - $shipping_fees;
|
||||||
|
else
|
||||||
|
$order_total_discount = $order_total;
|
||||||
}
|
}
|
||||||
/* Secondly applying all vouchers to the correct amount */
|
|
||||||
$shrunk = false;
|
|
||||||
foreach ($discounts AS $discount)
|
|
||||||
if ($discount->id_discount_type != 3)
|
|
||||||
{
|
|
||||||
$order_total -= Tools::ps_round((float)($discount->getValue(sizeof($discounts), $order_total_products, $shipping_fees, $this->id, (int)($withTaxes))), 2);
|
|
||||||
if ($discount->id_discount_type == 2)
|
|
||||||
if (in_array($discount->behavior_not_exhausted, array(1,2)))
|
|
||||||
$shrunk = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$order_total_discount = 0;
|
|
||||||
if ($shrunk AND $order_total < (-$wrapping_fees - $order_total_products - $shipping_fees))
|
|
||||||
$order_total_discount = -$wrapping_fees - $order_total_products - $shipping_fees;
|
|
||||||
else
|
|
||||||
$order_total_discount = $order_total;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1048,10 +1092,13 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
// Checking discounts in cart
|
// Checking discounts in cart
|
||||||
$products = $this->getProducts();
|
$products = $this->getProducts();
|
||||||
$discounts = $this->getDiscounts(true);
|
if (Discount::isFeatureActive())
|
||||||
|
$discounts = $this->getDiscounts(true);
|
||||||
|
else
|
||||||
|
$discounts = null;
|
||||||
if ($discounts)
|
if ($discounts)
|
||||||
foreach ($discounts AS $id_discount)
|
foreach ($discounts AS $id_discount)
|
||||||
if ($id_discount['id_discount_type'] == 3)
|
if ($id_discount['id_discount_type'] == Discount::FREE_SHIPPING)
|
||||||
{
|
{
|
||||||
if ($id_discount['minimal'] > 0)
|
if ($id_discount['minimal'] > 0)
|
||||||
{
|
{
|
||||||
@@ -1281,20 +1328,25 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!isset(self::$_totalWeight[$this->id]))
|
if (!isset(self::$_totalWeight[$this->id]))
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->getRow('
|
if (Combination::isFeatureActive())
|
||||||
SELECT SUM((p.`weight` + pa.`weight`) * cp.`quantity`) as nb
|
$weight_product_with_attribute = Db::getInstance()->getValue('
|
||||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
SELECT SUM((p.`weight` + pa.`weight`) * cp.`quantity`) as nb
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
|
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON cp.`id_product_attribute` = pa.`id_product_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON (cp.`id_product` = p.`id_product`)
|
||||||
WHERE (cp.`id_product_attribute` IS NOT NULL AND cp.`id_product_attribute` != 0)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (cp.`id_product_attribute` = pa.`id_product_attribute`)
|
||||||
AND cp.`id_cart` = '.(int)($this->id));
|
WHERE (cp.`id_product_attribute` IS NOT NULL AND cp.`id_product_attribute` != 0)
|
||||||
$result2 = Db::getInstance()->getRow('
|
AND cp.`id_cart` = '.(int)($this->id));
|
||||||
|
else
|
||||||
|
$weight_product_with_attribute = 0;
|
||||||
|
|
||||||
|
$weight_product_without_attribute = Db::getInstance()->getValue('
|
||||||
SELECT SUM(p.`weight` * cp.`quantity`) as nb
|
SELECT SUM(p.`weight` * cp.`quantity`) as nb
|
||||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON (cp.`id_product` = p.`id_product`)
|
||||||
WHERE (cp.`id_product_attribute` IS NULL OR cp.`id_product_attribute` = 0)
|
WHERE (cp.`id_product_attribute` IS NULL OR cp.`id_product_attribute` = 0)
|
||||||
AND cp.`id_cart` = '.(int)($this->id));
|
AND cp.`id_cart` = '.(int)($this->id));
|
||||||
self::$_totalWeight[$this->id] = round((float)($result['nb']) + (float)($result2['nb']), 3);
|
|
||||||
|
self::$_totalWeight[$this->id] = round((float)$weight_product_with_attribute + (float)$weight_product_without_attribute, 3);
|
||||||
}
|
}
|
||||||
return self::$_totalWeight[$this->id];
|
return self::$_totalWeight[$this->id];
|
||||||
}
|
}
|
||||||
@@ -1317,7 +1369,7 @@ class CartCore extends ObjectModel
|
|||||||
return Tools::displayError('This voucher has already been used or is disabled.');
|
return Tools::displayError('This voucher has already been used or is disabled.');
|
||||||
if (!$discountObj->quantity)
|
if (!$discountObj->quantity)
|
||||||
return Tools::displayError('This voucher has expired (usage limit attained).');
|
return Tools::displayError('This voucher has expired (usage limit attained).');
|
||||||
if ($discountObj->id_discount_type == 2 AND $this->id_currency != $discountObj->id_currency)
|
if ($discountObj->id_discount_type == Discount::AMOUNT AND $this->id_currency != $discountObj->id_currency)
|
||||||
return Tools::displayError('This voucher can only be used in the following currency:').'
|
return Tools::displayError('This voucher can only be used in the following currency:').'
|
||||||
'.Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `name` FROM `'._DB_PREFIX_.'currency` WHERE id_currency = '.(int)$discountObj->id_currency);
|
'.Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `name` FROM `'._DB_PREFIX_.'currency` WHERE id_currency = '.(int)$discountObj->id_currency);
|
||||||
if ($checkCartDiscount
|
if ($checkCartDiscount
|
||||||
@@ -1412,7 +1464,7 @@ class CartCore extends ObjectModel
|
|||||||
$discounts = $this->getDiscounts();
|
$discounts = $this->getDiscounts();
|
||||||
$total_free_ship = $free_ship - ($this->getOrderTotal(true, Cart::ONLY_PRODUCTS) + $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
|
$total_free_ship = $free_ship - ($this->getOrderTotal(true, Cart::ONLY_PRODUCTS) + $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
|
||||||
foreach ($discounts as $discount)
|
foreach ($discounts as $discount)
|
||||||
if ($discount['id_discount_type'] == 3)
|
if ($discount['id_discount_type'] == Discount::FREE_SHIPPING)
|
||||||
{
|
{
|
||||||
$total_free_ship = 0;
|
$total_free_ship = 0;
|
||||||
break;
|
break;
|
||||||
@@ -1473,6 +1525,9 @@ class CartCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function isVirtualCart()
|
public function isVirtualCart()
|
||||||
{
|
{
|
||||||
|
if (!ProductDownload::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!isset(self::$_isVirtualCart[$this->id]))
|
if (!isset(self::$_isVirtualCart[$this->id]))
|
||||||
{
|
{
|
||||||
$products = $this->getProducts();
|
$products = $this->getProducts();
|
||||||
@@ -1575,14 +1630,16 @@ class CartCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getProductCustomization($id_product, $type = null, $not_in_cart = false)
|
public function getProductCustomization($id_product, $type = null, $not_in_cart = false)
|
||||||
{
|
{
|
||||||
|
if (!Customization::isFeatureActive())
|
||||||
|
return array();
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->ExecuteS('
|
||||||
SELECT cu.id_customization, cd.index, cd.value, cd.type, cu.in_cart, cu.quantity FROM `'._DB_PREFIX_.'customization` cu
|
SELECT cu.id_customization, cd.index, cd.value, cd.type, cu.in_cart, cu.quantity
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd
|
FROM `'._DB_PREFIX_.'customization` cu
|
||||||
ON cu.`id_customization` = cd.`id_customization`
|
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd ON (cu.`id_customization` = cd.`id_customization`)
|
||||||
WHERE cu.id_cart = '.(int)$this->id.'
|
WHERE cu.id_cart = '.(int)$this->id.'
|
||||||
AND cu.id_product = '.(int)$id_product.
|
AND cu.id_product = '.(int)$id_product.
|
||||||
($type === _CUSTOMIZE_FILE_ ? ' AND type = '.(int)_CUSTOMIZE_FILE_ : '').
|
($type === Product::CUSTOMIZE_FILE ? ' AND type = '.(int)Product::CUSTOMIZE_FILE : '').
|
||||||
($type === _CUSTOMIZE_TEXTFIELD_ ? ' AND type = '.(int)_CUSTOMIZE_TEXTFIELD_ : '').
|
($type === Product::CUSTOMIZE_TEXTFIELD ? ' AND type = '.(int)Product::CUSTOMIZE_TEXTFIELD : '').
|
||||||
($not_in_cart ? ' AND in_cart = 0' : '')
|
($not_in_cart ? ' AND in_cart = 0' : '')
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -562,10 +562,8 @@ class CategoryCore extends ObjectModel
|
|||||||
$sql .= ' LIMIT 0, '.(int)($randomNumberProducts);
|
$sql .= ' LIMIT 0, '.(int)($randomNumberProducts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$sql .= ' ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
$sql .= ' ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||||
}
|
|
||||||
|
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||||
if ($orderBy == 'orderprice')
|
if ($orderBy == 'orderprice')
|
||||||
|
|||||||
+24
-1
@@ -158,7 +158,7 @@ class CombinationCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||||
WHERE `id_product_attribute` = '.(int)($this->id).'
|
WHERE `id_product_attribute` = '.(int)($this->id).'
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setWsImages($values)
|
public function setWsImages($values)
|
||||||
{
|
{
|
||||||
@@ -175,6 +175,29 @@ class CombinationCore extends ObjectModel
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `ps_product_attribute`
|
||||||
|
');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -481,6 +481,9 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getGroupsStatic($id_customer)
|
public static function getGroupsStatic($id_customer)
|
||||||
{
|
{
|
||||||
|
if (!Group::isFeatureActive())
|
||||||
|
return array(1);
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->ExecuteS('
|
||||||
SELECT cg.`id_group`
|
SELECT cg.`id_group`
|
||||||
@@ -511,6 +514,9 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getDefaultGroupId($id_customer)
|
public static function getDefaultGroupId($id_customer)
|
||||||
{
|
{
|
||||||
|
if (!Group::isFeatureActive())
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (!isset(self::$_defaultGroupId[(int)($id_customer)]))
|
if (!isset(self::$_defaultGroupId[(int)($id_customer)]))
|
||||||
self::$_defaultGroupId[(int)($id_customer)] = Db::getInstance()->getValue('SELECT `id_default_group` FROM `'._DB_PREFIX_.'customer` WHERE `id_customer` = '.(int)$id_customer);
|
self::$_defaultGroupId[(int)($id_customer)] = Db::getInstance()->getValue('SELECT `id_default_group` FROM `'._DB_PREFIX_.'customer` WHERE `id_customer` = '.(int)$id_customer);
|
||||||
return self::$_defaultGroupId[(int)($id_customer)];
|
return self::$_defaultGroupId[(int)($id_customer)];
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
class CustomizationCore
|
class CustomizationCore
|
||||||
{
|
{
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
public static function getReturnedCustomizations($id_order)
|
public static function getReturnedCustomizations($id_order)
|
||||||
{
|
{
|
||||||
@@ -94,9 +95,7 @@ class CustomizationCore
|
|||||||
WHERE `id_customization` IN ('.$in_values.')');
|
WHERE `id_customization` IN ('.$in_values.')');
|
||||||
|
|
||||||
foreach($results as $row)
|
foreach($results as $row)
|
||||||
{
|
|
||||||
$quantities[$row['id_customization']] = $row;
|
$quantities[$row['id_customization']] = $row;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $quantities;
|
return $quantities;
|
||||||
@@ -114,12 +113,25 @@ class CustomizationCore
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach($results as $row)
|
foreach($results as $row)
|
||||||
{
|
|
||||||
$quantity[$row['id_product']][$row['product_attribute_id']] = $row['quantity'];
|
$quantity[$row['id_product']][$row['product_attribute_id']] = $row['quantity'];
|
||||||
}
|
|
||||||
|
|
||||||
return $quantity;
|
return $quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'customization_field`
|
||||||
|
') > 1);
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+141
-40
@@ -101,6 +101,7 @@ class DiscountCore extends ObjectModel
|
|||||||
protected $table = 'discount';
|
protected $table = 'discount';
|
||||||
protected $identifier = 'id_discount';
|
protected $identifier = 'id_discount';
|
||||||
|
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
protected $webserviceParameters = array(
|
protected $webserviceParameters = array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
@@ -126,8 +127,10 @@ class DiscountCore extends ObjectModel
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const PERCENT = 1;
|
||||||
|
const AMOUNT = 2;
|
||||||
|
const FREE_SHIPPING = 3;
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
{
|
{
|
||||||
$this->validateFields();
|
$this->validateFields();
|
||||||
@@ -211,38 +214,67 @@ class DiscountCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getIdByName($discountName)
|
public static function getIdByName($discountName)
|
||||||
{
|
{
|
||||||
if (!Validate::isDiscountName($discountName))
|
if (!self::isFeatureActive())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!Validate::isDiscountName($discountName))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT `id_discount`
|
SELECT `id_discount`
|
||||||
FROM `'._DB_PREFIX_.'discount`
|
FROM `'._DB_PREFIX_.'discount`
|
||||||
WHERE `name` = \''.pSQL($discountName).'\'');
|
WHERE `name` = \''.pSQL($discountName).'\'');
|
||||||
return isset($result['id_discount']) ? $result['id_discount'] : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return customer discounts
|
*
|
||||||
*
|
* This method allow to get the customer discount
|
||||||
* @param integer $id_lang Language ID
|
* @param int $id_lang
|
||||||
* @param boolean $id_customer Customer ID
|
* @param int $id_customer
|
||||||
* @return array Discounts
|
* @param bool $active
|
||||||
*/
|
* @param bool $includeGenericOnes include the discount available for all customers
|
||||||
static public function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $stock = false, Cart $cart = null)
|
* @param bool $hasStock
|
||||||
|
* @param Cart $cart
|
||||||
|
*/
|
||||||
|
public static function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $hasStock = false, Cart $cart = null)
|
||||||
{
|
{
|
||||||
if (!$cart)
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
|
if (!$cart)
|
||||||
$cart = Context::getContext()->cart;
|
$cart = Context::getContext()->cart;
|
||||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
|
||||||
|
$sql = '
|
||||||
SELECT d.*, dtl.`name` AS `type`, dl.`description`
|
SELECT d.*, dtl.`name` AS `type`, dl.`description`
|
||||||
FROM `'._DB_PREFIX_.'discount` d
|
FROM `'._DB_PREFIX_.'discount` d
|
||||||
LEFT JOIN `'._DB_PREFIX_.'discount_lang` dl ON (d.`id_discount` = dl.`id_discount` AND dl.`id_lang` = '.(int)($id_lang).')
|
LEFT JOIN `'._DB_PREFIX_.'discount_lang` dl ON (d.`id_discount` = dl.`id_discount` AND dl.`id_lang` = '.(int)($id_lang).')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON dt.`id_discount_type` = d.`id_discount_type`
|
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON dt.`id_discount_type` = d.`id_discount_type`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)($id_lang).')
|
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 (`id_customer` = '.(int)($id_customer).'
|
WHERE (d.`id_customer` = '.(int)$id_customer.'
|
||||||
OR `id_group` IN (SELECT `id_group` FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)($id_customer).')'.
|
';
|
||||||
($includeGenericOnes ? ' OR (`id_customer` = 0 AND `id_group` = 0)' : '').')
|
|
||||||
'.($active ? ' AND d.`active` = 1' : '').'
|
// Group clause
|
||||||
'.($stock ? ' AND d.`quantity` != 0' : ''));
|
if (Group::isFeatureActive())
|
||||||
|
$sql .= 'OR d.`id_group` IN (
|
||||||
|
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)
|
foreach ($res as &$discount)
|
||||||
if ($discount['quantity_per_user'])
|
if ($discount['quantity_per_user'])
|
||||||
@@ -257,14 +289,19 @@ class DiscountCore extends ObjectModel
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param int $id_customer
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function usedByCustomer($id_customer)
|
public function usedByCustomer($id_customer)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(*)
|
return (bool)Db::getInstance()->getValue('
|
||||||
FROM `'._DB_PREFIX_.'order_discount` od
|
SELECT COUNT(*)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`)
|
FROM `'._DB_PREFIX_.'order_discount` od
|
||||||
WHERE od.`id_discount` = '.(int)$this->id.'
|
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`)
|
||||||
AND o.`id_customer` = '.(int)$id_customer;
|
WHERE od.`id_discount` = '.(int)$this->id.'
|
||||||
return Db::getInstance()->getValue($sql);
|
AND o.`id_customer` = '.(int)$id_customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -276,6 +313,9 @@ class DiscountCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getValue($nb_discounts = 0, $order_total_products = 0, $shipping_fees = 0, $idCart = false, $useTax = true, Currency $currency = null, Shop $shop = null)
|
public function getValue($nb_discounts = 0, $order_total_products = 0, $shipping_fees = 0, $idCart = false, $useTax = true, Currency $currency = null, Shop $shop = null)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!$currency)
|
if (!$currency)
|
||||||
$currency = Context::getContext()->currency;
|
$currency = Context::getContext()->currency;
|
||||||
if (!$shop)
|
if (!$shop)
|
||||||
@@ -308,7 +348,7 @@ class DiscountCore extends ObjectModel
|
|||||||
switch ($this->id_discount_type)
|
switch ($this->id_discount_type)
|
||||||
{
|
{
|
||||||
/* Relative value (% of the order total) */
|
/* Relative value (% of the order total) */
|
||||||
case 1:
|
case Discount::PERCENT:
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
$percentage = $this->value / 100;
|
$percentage = $this->value / 100;
|
||||||
foreach ($products AS $product)
|
foreach ($products AS $product)
|
||||||
@@ -318,7 +358,7 @@ class DiscountCore extends ObjectModel
|
|||||||
return $amount;
|
return $amount;
|
||||||
|
|
||||||
/* Absolute value */
|
/* Absolute value */
|
||||||
case 2:
|
case Discount::AMOUNT:
|
||||||
// An "absolute" voucher is available in one currency only
|
// An "absolute" voucher is available in one currency only
|
||||||
$currency = ((int)$cart->id_currency ? Currency::getCurrencyInstance($cart->id_currency) : $currency);
|
$currency = ((int)$cart->id_currency ? Currency::getCurrencyInstance($cart->id_currency) : $currency);
|
||||||
if ($this->id_currency != $currency->id)
|
if ($this->id_currency != $currency->id)
|
||||||
@@ -337,7 +377,7 @@ class DiscountCore extends ObjectModel
|
|||||||
return $value;
|
return $value;
|
||||||
|
|
||||||
/* Free shipping (does not return a value but a special code) */
|
/* Free shipping (does not return a value but a special code) */
|
||||||
case 3:
|
case Discount::FREE_SHIPPING:
|
||||||
return '!';
|
return '!';
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -366,7 +406,9 @@ class DiscountCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
elseif (!is_array($categories) OR !sizeof($categories))
|
elseif (!is_array($categories) OR !sizeof($categories))
|
||||||
return false;
|
return false;
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount_category` WHERE `id_discount`='.(int)($this->id));
|
Db::getInstance()->Execute('
|
||||||
|
DELETE FROM `'._DB_PREFIX_.'discount_category`
|
||||||
|
WHERE `id_discount`='.(int)$this->id);
|
||||||
foreach($categories AS $category)
|
foreach($categories AS $category)
|
||||||
{
|
{
|
||||||
Db::getInstance()->ExecuteS('
|
Db::getInstance()->ExecuteS('
|
||||||
@@ -374,13 +416,22 @@ class DiscountCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'discount_category`
|
FROM `'._DB_PREFIX_.'discount_category`
|
||||||
WHERE `id_discount`='.(int)($this->id).' AND `id_category`='.(int)($category));
|
WHERE `id_discount`='.(int)($this->id).' AND `id_category`='.(int)($category));
|
||||||
if (Db::getInstance()->NumRows() == 0)
|
if (Db::getInstance()->NumRows() == 0)
|
||||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`) VALUES('.(int)($this->id).','.(int)($category).')');
|
Db::getInstance()->Execute('
|
||||||
|
INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`)
|
||||||
|
VALUES('.(int)($this->id).','.(int)($category).')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function discountExists($discountName, $id_discount = 0)
|
public static function discountExists($discountName, $id_discount = 0)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->getRow('SELECT `id_discount` FROM '._DB_PREFIX_.'discount WHERE `name` LIKE \''.pSQL($discountName).'\' AND `id_discount` != '.(int)($id_discount));
|
if (!self::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (bool)Db::getInstance()->getValue('
|
||||||
|
SELECT `id_discount`
|
||||||
|
FROM `'._DB_PREFIX_.'discount`
|
||||||
|
WHERE `name` LIKE \''.pSQL($discountName).'\'
|
||||||
|
AND `id_discount` != '.(int)$id_discount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createOrderDiscount($order, $productList, $qtyList, $name, $shipping_cost = false, $id_category = 0, $subcategory = 0)
|
public static function createOrderDiscount($order, $productList, $qtyList, $name, $shipping_cost = false, $id_category = 0, $subcategory = 0)
|
||||||
@@ -394,9 +445,9 @@ class DiscountCore extends ObjectModel
|
|||||||
$total_tmp = $total;
|
$total_tmp = $total;
|
||||||
foreach ($discounts as $discount)
|
foreach ($discounts as $discount)
|
||||||
{
|
{
|
||||||
if ($discount['id_discount_type'] == 1)
|
if ($discount['id_discount_type'] == Discount::PERCENT)
|
||||||
$total -= $total_tmp * ($discount['value'] / 100);
|
$total -= $total_tmp * ($discount['value'] / 100);
|
||||||
elseif ($discount['id_discount_type'] == 2)
|
elseif ($discount['id_discount_type'] == Discount::AMOUNT)
|
||||||
$total -= ($discount['value'] * ($total_tmp / $order->total_products_wt));
|
$total -= ($discount['value'] * ($total_tmp / $order->total_products_wt));
|
||||||
}
|
}
|
||||||
if ($shipping_cost)
|
if ($shipping_cost)
|
||||||
@@ -404,7 +455,7 @@ class DiscountCore extends ObjectModel
|
|||||||
|
|
||||||
// create discount
|
// create discount
|
||||||
$voucher = new Discount();
|
$voucher = new Discount();
|
||||||
$voucher->id_discount_type = 2;
|
$voucher->id_discount_type = Discount::AMOUNT;
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
$voucher->description[$language['id_lang']] = strval($name).(int)($order->id);
|
$voucher->description[$language['id_lang']] = strval($name).(int)($order->id);
|
||||||
$voucher->value = (float)($total);
|
$voucher->value = (float)($total);
|
||||||
@@ -444,18 +495,52 @@ class DiscountCore extends ObjectModel
|
|||||||
return ''; // return a string because it's a display method
|
return ''; // return a string because it's a display method
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getVouchersToCartDisplay($id_lang, $id_customer)
|
/**
|
||||||
|
*
|
||||||
|
* This method allows to get the vouchers can be shown in order page
|
||||||
|
* @param int $id_lang
|
||||||
|
* @param int $id_customer
|
||||||
|
* @return array contains discount
|
||||||
|
*/
|
||||||
|
public static function getVouchersToCartDisplay($id_lang, $id_customer = 0)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
|
$sql = '
|
||||||
SELECT d.`name`, dl.`description`, d.`id_discount`
|
SELECT d.`name`, dl.`description`, d.`id_discount`
|
||||||
FROM `'._DB_PREFIX_.'discount` d
|
FROM `'._DB_PREFIX_.'discount` d
|
||||||
LEFT JOIN `'._DB_PREFIX_.'discount_lang` dl ON (d.`id_discount` = dl.`id_discount`)
|
LEFT JOIN `'._DB_PREFIX_.'discount_lang` dl ON (d.`id_discount` = dl.`id_discount`)
|
||||||
WHERE d.`active` = 1
|
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 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 dl.`id_lang` = '.(int)$id_lang.'
|
||||||
AND d.`cart_display` = 1 AND d.`quantity` > 0
|
AND d.`cart_display` = 1
|
||||||
AND ((d.`id_customer` = 0 AND d.`id_group` = 0) '.($id_customer ? 'OR (d.`id_customer` = '.$id_customer.'
|
AND d.`quantity` > 0
|
||||||
OR d.`id_group` IN (SELECT `id_group` FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)($id_customer).')))' : 'OR d.`id_group` = 1)'));
|
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 .= '
|
||||||
|
OR d.`id_group` IN (
|
||||||
|
SELECT cg.`id_group`
|
||||||
|
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||||
|
WHERE cg.`id_customer` = '.(int)$id_customer.'
|
||||||
|
)';
|
||||||
|
else
|
||||||
|
$sql .= ' OR d.`id_group` = 1';
|
||||||
|
$sql .= ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$sql .= ' OR d.`id_group` = 1';
|
||||||
|
|
||||||
|
$sql .= ')'; // close parenthesis openned above
|
||||||
|
|
||||||
|
return Db::getInstance()->ExecuteS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteByIdCustomer($id_customer)
|
public static function deleteByIdCustomer($id_customer)
|
||||||
@@ -486,4 +571,20 @@ class DiscountCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
return Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'discount` WHERE `id_discount` = '.(int)$id_discount);
|
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
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
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`
|
||||||
|
WHERE `active` = 1
|
||||||
|
') > 1);
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -428,10 +428,8 @@ class DispatcherCore
|
|||||||
$controller_files = scandir(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'controllers');
|
$controller_files = scandir(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'controllers');
|
||||||
$controllers = array();
|
$controllers = array();
|
||||||
foreach ($controller_files as $controller_filename)
|
foreach ($controller_files as $controller_filename)
|
||||||
{
|
|
||||||
if (substr($controller_filename, -14, 14) == 'Controller.php')
|
if (substr($controller_filename, -14, 14) == 'Controller.php')
|
||||||
$controllers[strtolower(substr($controller_filename, 0, -14))] = basename($controller_filename, '.php');
|
$controllers[strtolower(substr($controller_filename, 0, -14))] = basename($controller_filename, '.php');
|
||||||
}
|
|
||||||
|
|
||||||
// add default controller
|
// add default controller
|
||||||
$controllers['index'] = 'IndexController';
|
$controllers['index'] = 'IndexController';
|
||||||
|
|||||||
@@ -187,6 +187,9 @@ class FeatureCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getFeaturesForComparison($list_ids_product, $id_lang)
|
public static function getFeaturesForComparison($list_ids_product, $id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
$ids = '';
|
$ids = '';
|
||||||
foreach($list_ids_product as $id)
|
foreach($list_ids_product as $id)
|
||||||
$ids .= (int)($id).',';
|
$ids .= (int)($id).',';
|
||||||
@@ -206,5 +209,15 @@ class FeatureCore extends ObjectModel
|
|||||||
GROUP BY f.`id_feature`
|
GROUP BY f.`id_feature`
|
||||||
ORDER BY nb DESC');
|
ORDER BY nb DESC');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This metohd is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
return Configuration::get('PS_FEATURE_FEATURE_ACTIVE');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,6 +637,9 @@ class FrontControllerCore
|
|||||||
|
|
||||||
public static function getCurrentCustomerGroups()
|
public static function getCurrentCustomerGroups()
|
||||||
{
|
{
|
||||||
|
if (!Group::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
if (!$context->customer->id)
|
if (!$context->customer->id)
|
||||||
return array();
|
return array();
|
||||||
|
|||||||
+18
-2
@@ -59,6 +59,7 @@ class GroupCore extends ObjectModel
|
|||||||
|
|
||||||
protected static $_cacheReduction = array();
|
protected static $_cacheReduction = array();
|
||||||
protected static $_groupPriceDisplayMethod = array();
|
protected static $_groupPriceDisplayMethod = array();
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
protected $webserviceParameters = array();
|
protected $webserviceParameters = array();
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@ class GroupCore extends ObjectModel
|
|||||||
self::$_cacheReduction['group'][$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
self::$_cacheReduction['group'][$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT `reduction`
|
SELECT `reduction`
|
||||||
FROM `'._DB_PREFIX_.'group`
|
FROM `'._DB_PREFIX_.'group`
|
||||||
WHERE `id_group` = '.$id_group);
|
WHERE `id_group` = '.(int)$id_group);
|
||||||
}
|
}
|
||||||
return self::$_cacheReduction['group'][$id_group];
|
return self::$_cacheReduction['group'][$id_group];
|
||||||
}
|
}
|
||||||
@@ -138,7 +139,7 @@ class GroupCore extends ObjectModel
|
|||||||
self::$_groupPriceDisplayMethod[$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
self::$_groupPriceDisplayMethod[$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT `price_display_method`
|
SELECT `price_display_method`
|
||||||
FROM `'._DB_PREFIX_.'group`
|
FROM `'._DB_PREFIX_.'group`
|
||||||
WHERE `id_group` = '.(int)($id_group));
|
WHERE `id_group` = '.(int)$id_group);
|
||||||
return self::$_groupPriceDisplayMethod[$id_group];
|
return self::$_groupPriceDisplayMethod[$id_group];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +168,21 @@ class GroupCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'group`
|
||||||
|
') > 1);
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,9 +118,9 @@ class OrderSlipCore extends ObjectModel
|
|||||||
$realProductPrice = $resTab[$key]['product_price'];
|
$realProductPrice = $resTab[$key]['product_price'];
|
||||||
foreach ($discounts as $discount)
|
foreach ($discounts as $discount)
|
||||||
{
|
{
|
||||||
if ($discount['id_discount_type'] == 1)
|
if ($discount['id_discount_type'] == Discount::PERCENT)
|
||||||
$resTab[$key]['product_price'] -= $realProductPrice * ($discount['value'] / 100);
|
$resTab[$key]['product_price'] -= $realProductPrice * ($discount['value'] / 100);
|
||||||
elseif ($discount['id_discount_type'] == 2)
|
elseif ($discount['id_discount_type'] == Discount::AMOUNT)
|
||||||
$resTab[$key]['product_price'] -= (($discount['value'] * ($product['product_price_wt'] / $order->total_products_wt)) / (1.00 + ($product['tax_rate'] / 100)));
|
$resTab[$key]['product_price'] -= (($discount['value'] * ($product['product_price_wt'] / $order->total_products_wt)) / (1.00 + ($product['tax_rate'] / 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -787,11 +787,11 @@ class PDFCore extends PDF_PageGroupCore
|
|||||||
$customizationGroup = $customizedData['datas'];
|
$customizationGroup = $customizedData['datas'];
|
||||||
$nb_images = 0;
|
$nb_images = 0;
|
||||||
|
|
||||||
if (array_key_exists(_CUSTOMIZE_FILE_, $customizationGroup))
|
if (array_key_exists(Product::CUSTOMIZE_FILE, $customizationGroup))
|
||||||
$nb_images = sizeof($customizationGroup[_CUSTOMIZE_FILE_]);
|
$nb_images = sizeof($customizationGroup[Product::CUSTOMIZE_FILE]);
|
||||||
|
|
||||||
if (array_key_exists(_CUSTOMIZE_TEXTFIELD_, $customizationGroup))
|
if (array_key_exists(Product::CUSTOMIZE_TEXTFIELD, $customizationGroup))
|
||||||
foreach($customizationGroup[_CUSTOMIZE_TEXTFIELD_] as $customization)
|
foreach($customizationGroup[Product::CUSTOMIZE_TEXTFIELD] as $customization)
|
||||||
if(!empty($customization['name'])) $custoLabel .= '- '.$customization['name'].': '.$customization['value']."\n";
|
if(!empty($customization['name'])) $custoLabel .= '- '.$customization['name'].': '.$customization['value']."\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ class PackCore extends Product
|
|||||||
protected static $cachePackItems = array();
|
protected static $cachePackItems = array();
|
||||||
protected static $cacheIsPack = array();
|
protected static $cacheIsPack = array();
|
||||||
protected static $cacheIsPacked = array();
|
protected static $cacheIsPacked = array();
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
public static function isPack($id_product)
|
public static function isPack($id_product)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!array_key_exists($id_product, self::$cacheIsPack))
|
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));
|
$result = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'pack WHERE id_product_pack = '.(int)($id_product));
|
||||||
@@ -43,6 +47,9 @@ class PackCore extends Product
|
|||||||
|
|
||||||
public static function isPacked($id_product)
|
public static function isPacked($id_product)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!array_key_exists($id_product, self::$cacheIsPacked))
|
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));
|
$result = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'pack WHERE id_product_item = '.(int)($id_product));
|
||||||
@@ -63,6 +70,9 @@ class PackCore extends Product
|
|||||||
|
|
||||||
public static function getItems($id_product, $id_lang)
|
public static function getItems($id_product, $id_lang)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
if (array_key_exists($id_product, self::$cachePackItems))
|
if (array_key_exists($id_product, self::$cachePackItems))
|
||||||
return self::$cachePackItems[$id_product];
|
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));
|
$result = Db::getInstance()->ExecuteS('SELECT id_product_item, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)($id_product));
|
||||||
@@ -79,6 +89,9 @@ class PackCore extends Product
|
|||||||
|
|
||||||
public static function isInStock($id_product)
|
public static function isInStock($id_product)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return true;
|
||||||
|
|
||||||
$items = self::getItems((int)($id_product), Configuration::get('PS_LANG_DEFAULT'));
|
$items = self::getItems((int)($id_product), Configuration::get('PS_LANG_DEFAULT'));
|
||||||
foreach ($items AS $item)
|
foreach ($items AS $item)
|
||||||
if ($item->quantity < $item->pack_quantity AND !$item->isAvailableWhenOutOfStock((int)($item->out_of_stock)))
|
if ($item->quantity < $item->pack_quantity AND !$item->isAvailableWhenOutOfStock((int)($item->out_of_stock)))
|
||||||
@@ -88,6 +101,9 @@ class PackCore extends Product
|
|||||||
|
|
||||||
public static function getItemTable($id_product, $id_lang, $full = false)
|
public static function getItemTable($id_product, $id_lang, $full = false)
|
||||||
{
|
{
|
||||||
|
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
|
$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
|
FROM `'._DB_PREFIX_.'pack` a
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||||
@@ -114,6 +130,9 @@ class PackCore extends Product
|
|||||||
|
|
||||||
public static function getPacksTable($id_product, $id_lang, $full = false, $limit = NULL)
|
public static function getPacksTable($id_product, $id_lang, $full = false, $limit = NULL)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
$packs = Db::getInstance()->getValue('
|
$packs = Db::getInstance()->getValue('
|
||||||
SELECT GROUP_CONCAT(a.`id_product_pack`)
|
SELECT GROUP_CONCAT(a.`id_product_pack`)
|
||||||
FROM `'._DB_PREFIX_.'pack` a
|
FROM `'._DB_PREFIX_.'pack` a
|
||||||
@@ -177,5 +196,20 @@ class PackCore extends Product
|
|||||||
// If return query result, a non-pack product will return false
|
// If return query result, a non-pack product will return false
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'pack`
|
||||||
|
');
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,12 +256,12 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$customizationText = '';
|
$customizationText = '';
|
||||||
foreach ($customizedDatas[$product['id_product']][$product['id_product_attribute']] AS $customization)
|
foreach ($customizedDatas[$product['id_product']][$product['id_product_attribute']] AS $customization)
|
||||||
{
|
{
|
||||||
if (isset($customization['datas'][_CUSTOMIZE_TEXTFIELD_]))
|
if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD]))
|
||||||
foreach ($customization['datas'][_CUSTOMIZE_TEXTFIELD_] AS $text)
|
foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] AS $text)
|
||||||
$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';
|
$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';
|
||||||
|
|
||||||
if (isset($customization['datas'][_CUSTOMIZE_FILE_]))
|
if (isset($customization['datas'][Product::CUSTOMIZE_FILE]))
|
||||||
$customizationText .= sizeof($customization['datas'][_CUSTOMIZE_FILE_]) .' '. Tools::displayError('image(s)').'<br />';
|
$customizationText .= sizeof($customization['datas'][Product::CUSTOMIZE_FILE]) .' '. Tools::displayError('image(s)').'<br />';
|
||||||
|
|
||||||
$customizationText .= '---<br />';
|
$customizationText .= '---<br />';
|
||||||
}
|
}
|
||||||
@@ -301,13 +301,13 @@ abstract class PaymentModuleCore extends Module
|
|||||||
{
|
{
|
||||||
$objDiscount = new Discount((int)$discount['id_discount']);
|
$objDiscount = new Discount((int)$discount['id_discount']);
|
||||||
$value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $order->total_shipping, $cart->id);
|
$value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $order->total_shipping, $cart->id);
|
||||||
if ($objDiscount->id_discount_type == 2 AND in_array($objDiscount->behavior_not_exhausted, array(1,2)))
|
if ($objDiscount->id_discount_type == Discount::AMOUNT AND in_array($objDiscount->behavior_not_exhausted, array(1,2)))
|
||||||
$shrunk = true;
|
$shrunk = true;
|
||||||
|
|
||||||
if ($shrunk AND ($total_discount_value + $value) > ($order->total_products_wt + $order->total_shipping + $order->total_wrapping))
|
if ($shrunk AND ($total_discount_value + $value) > ($order->total_products_wt + $order->total_shipping + $order->total_wrapping))
|
||||||
{
|
{
|
||||||
$amount_to_add = ($order->total_products_wt + $order->total_shipping + $order->total_wrapping) - $total_discount_value;
|
$amount_to_add = ($order->total_products_wt + $order->total_shipping + $order->total_wrapping) - $total_discount_value;
|
||||||
if ($objDiscount->id_discount_type == 2 AND $objDiscount->behavior_not_exhausted == 2)
|
if ($objDiscount->id_discount_type == Discount::AMOUNT AND $objDiscount->behavior_not_exhausted == 2)
|
||||||
{
|
{
|
||||||
$voucher = new Discount();
|
$voucher = new Discount();
|
||||||
foreach ($objDiscount AS $key => $discountValue)
|
foreach ($objDiscount AS $key => $discountValue)
|
||||||
|
|||||||
+201
-122
@@ -25,7 +25,13 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 1.5.0.1
|
||||||
|
*/
|
||||||
define('_CUSTOMIZE_FILE_', 0);
|
define('_CUSTOMIZE_FILE_', 0);
|
||||||
|
/**
|
||||||
|
* @deprecated 1.5.0.1
|
||||||
|
*/
|
||||||
define('_CUSTOMIZE_TEXTFIELD_', 1);
|
define('_CUSTOMIZE_TEXTFIELD_', 1);
|
||||||
|
|
||||||
class ProductCore extends ObjectModel
|
class ProductCore extends ObjectModel
|
||||||
@@ -298,6 +304,9 @@ class ProductCore extends ObjectModel
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const CUSTOMIZE_FILE = 0;
|
||||||
|
const CUSTOMIZE_TEXTFIELD = 1;
|
||||||
|
|
||||||
public function __construct($id_product = NULL, $full = false, $id_lang = NULL, $id_shop = NULL, Context $context = NULL)
|
public function __construct($id_product = NULL, $full = false, $id_lang = NULL, $id_shop = NULL, Context $context = NULL)
|
||||||
{
|
{
|
||||||
parent::__construct($id_product, $id_lang, $id_shop);
|
parent::__construct($id_product, $id_lang, $id_shop);
|
||||||
@@ -503,12 +512,15 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getDefaultAttribute($id_product, $minimumQuantity = 0)
|
public static function getDefaultAttribute($id_product, $minimumQuantity = 0)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return 0;
|
||||||
|
|
||||||
$sql = 'SELECT pa.id_product_attribute
|
$sql = 'SELECT pa.id_product_attribute
|
||||||
FROM '._DB_PREFIX_.'product_attribute pa'
|
FROM '._DB_PREFIX_.'product_attribute pa'
|
||||||
.($minimumQuantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
.($minimumQuantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
||||||
' WHERE pa.default_on = 1 '
|
' WHERE pa.default_on = 1 '
|
||||||
.($minimumQuantity > 0 ? ' AND stock.quantity >= '.(int)$minimumQuantity : '').
|
.($minimumQuantity > 0 ? ' AND stock.quantity >= '.(int)$minimumQuantity : '').
|
||||||
' AND pa.id_product = '.(int)$id_product;
|
' AND pa.id_product = '.(int)$id_product;
|
||||||
$result = Db::getInstance()->getValue($sql);
|
$result = Db::getInstance()->getValue($sql);
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@@ -517,7 +529,7 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'product_attribute pa'
|
FROM '._DB_PREFIX_.'product_attribute pa'
|
||||||
.($minimumQuantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
.($minimumQuantity > 0 ? Product::sqlStock('pa', 'pa') : '').
|
||||||
' WHERE pa.id_product = '.(int)$id_product
|
' WHERE pa.id_product = '.(int)$id_product
|
||||||
.($minimumQuantity > 0 ? ' AND stock.quantity >= '.(int)$minimumQuantity : '');
|
.($minimumQuantity > 0 ? ' AND stock.quantity >= '.(int)$minimumQuantity : '');
|
||||||
$result = Db::getInstance()->getValue($sql);
|
$result = Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +538,7 @@ class ProductCore extends ObjectModel
|
|||||||
$sql = 'SELECT id_product_attribute
|
$sql = 'SELECT id_product_attribute
|
||||||
FROM '._DB_PREFIX_.'product_attribute
|
FROM '._DB_PREFIX_.'product_attribute
|
||||||
WHERE `default_on` = 1
|
WHERE `default_on` = 1
|
||||||
AND id_product = '.(int)$id_product;
|
AND id_product = '.(int)$id_product;
|
||||||
$result = Db::getInstance()->getValue($sql);
|
$result = Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,10 +766,10 @@ class ProductCore extends ObjectModel
|
|||||||
$status = true;
|
$status = true;
|
||||||
if ($result)
|
if ($result)
|
||||||
foreach($result as $row)
|
foreach($result as $row)
|
||||||
{
|
{
|
||||||
$image = new Image($row['id_image']);
|
$image = new Image($row['id_image']);
|
||||||
$status &= $image->delete();
|
$status &= $image->delete();
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,6 +855,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function productAttributeExists($attributesList, $currentProductAttribute = false)
|
public function productAttributeExists($attributesList, $currentProductAttribute = false)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return false;
|
||||||
$result = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pac.`id_product_attribute`
|
$result = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pac.`id_product_attribute`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||||
@@ -1117,8 +1131,10 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteAttachments()
|
public function deleteAttachments()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'product_attachment WHERE id_product = '.(int)($this->id));
|
return Db::getInstance()->Execute('
|
||||||
}
|
DELETE FROM `'._DB_PREFIX_.'product_attachment`
|
||||||
|
WHERE `id_product` = '.(int)$this->id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete product customizations
|
* Delete product customizations
|
||||||
@@ -1275,6 +1291,8 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getAttributeCombinaisons($id_lang)
|
public function getAttributeCombinaisons($id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return array();
|
||||||
$sql = 'SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name, a.`id_attribute`, pa.`unit_price_impact`, stock.quantity
|
$sql = 'SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name, a.`id_attribute`, pa.`unit_price_impact`, stock.quantity
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||||
@@ -1290,6 +1308,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getCombinationImages($id_lang)
|
public function getCombinationImages($id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return false;
|
||||||
if (!$productAttributes = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id)))
|
if (!$productAttributes = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id)))
|
||||||
return false;
|
return false;
|
||||||
$ids = array();
|
$ids = array();
|
||||||
@@ -1315,6 +1335,8 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function hasAttributes()
|
public function hasAttributes()
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return 0;
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT COUNT(`id_product_attribute`)
|
SELECT COUNT(`id_product_attribute`)
|
||||||
FROM `'._DB_PREFIX_.'product_attribute`
|
FROM `'._DB_PREFIX_.'product_attribute`
|
||||||
@@ -1354,41 +1376,53 @@ class ProductCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->sqlAsso('product', 'p').'
|
||||||
WHERE `active` = 1
|
WHERE `active` = 1
|
||||||
AND 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
|
|
||||||
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`)
|
|
||||||
WHERE cg.`id_group` '.$sqlGroups.'
|
|
||||||
)';
|
|
||||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
|
||||||
i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name, 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, pa.id_product_attribute
|
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->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.')
|
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
|
||||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
|
||||||
AND tr.`id_state` = 0)
|
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
|
||||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
|
||||||
WHERE p.`active` = 1
|
|
||||||
AND 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
|
AND 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
|
||||||
AND p.`id_product` IN (
|
AND p.`id_product` IN (
|
||||||
SELECT cp.`id_product`
|
SELECT cp.`id_product`
|
||||||
FROM `'._DB_PREFIX_.'category_group` cg
|
FROM `'._DB_PREFIX_.'category_group` cg
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||||
WHERE cg.`id_group` '.$sqlGroups.'
|
WHERE cg.`id_group` '.$sqlGroups.'
|
||||||
)
|
)';
|
||||||
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)($nbProducts);
|
}
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
|
||||||
|
$sql = array();
|
||||||
|
$sql['select'] = '
|
||||||
|
SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
||||||
|
i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name, 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
|
||||||
|
';
|
||||||
|
$sql['from'] = 'FROM `'._DB_PREFIX_.'product` p';
|
||||||
|
$sql['join'] = $context->shop->sqlAsso('product', 'p').'
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$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 (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->country->id.'
|
||||||
|
AND tr.`id_state` = 0)
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||||
|
';
|
||||||
|
$sql['where'] = '
|
||||||
|
WHERE p.`active` = 1
|
||||||
|
AND 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
|
||||||
|
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`)
|
||||||
|
WHERE cg.`id_group` '.$sqlGroups.'
|
||||||
|
)
|
||||||
|
';
|
||||||
|
$sql['orderby'] = 'ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay);
|
||||||
|
$sql['limit'] = 'LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)($nbProducts);
|
||||||
|
|
||||||
|
if (Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$sql['select'] .= ', pa.id_product_attribute';
|
||||||
|
$sql['join'] .= 'LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND `default_on` = 1)';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(Tools::buildQuery($sql));
|
||||||
|
|
||||||
if ($orderBy == 'price')
|
if ($orderBy == 'price')
|
||||||
Tools::orderbyPrice($result, $orderWay);
|
Tools::orderbyPrice($result, $orderWay);
|
||||||
@@ -1404,7 +1438,7 @@ class ProductCore extends ObjectModel
|
|||||||
return Product::getProductsProperties((int)$id_lang, $result);
|
return Product::getProductsProperties((int)$id_lang, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected function _getProductIdByDate($beginning, $ending, Context $context = null)
|
protected static function _getProductIdByDate($beginning, $ending, Context $context = null)
|
||||||
{
|
{
|
||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
@@ -1692,10 +1726,10 @@ class ProductCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'cart_product`
|
FROM `'._DB_PREFIX_.'cart_product`
|
||||||
WHERE `id_product` = '.(int)($id_product).'
|
WHERE `id_product` = '.(int)($id_product).'
|
||||||
AND `id_cart` = '.(int)($id_cart).' '.$condition
|
AND `id_cart` = '.(int)($id_cart).' '.$condition
|
||||||
);
|
);
|
||||||
|
|
||||||
$cart_quantity = self::$_cart_quantity[$cache_name];
|
$cart_quantity = self::$_cart_quantity[$cache_name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity;
|
$quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity;
|
||||||
$id_currency = (int)(Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT'));
|
$id_currency = (int)(Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||||
@@ -1773,14 +1807,25 @@ class ProductCore extends ObjectModel
|
|||||||
// fetch price & attribute price
|
// fetch price & attribute price
|
||||||
$cacheId2 = $id_product.'-'.$id_product_attribute;
|
$cacheId2 = $id_product.'-'.$id_product_attribute;
|
||||||
if (!isset(self::$_pricesLevel2[$cacheId2]))
|
if (!isset(self::$_pricesLevel2[$cacheId2]))
|
||||||
self::$_pricesLevel2[$cacheId2] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
{
|
||||||
SELECT p.`price`,
|
$sql = array();
|
||||||
'.($id_product_attribute ? 'pa.`price`' : 'IFNULL((SELECT pa.price FROM `'._DB_PREFIX_.'product_attribute` pa WHERE id_product = '.(int)($id_product).' AND default_on = 1), 0)').' AS attribute_price,
|
$sql['select'] = 'SELECT p.`price`, p.`ecotax`';
|
||||||
p.`ecotax`
|
$sql['from'] = 'FROM `'._DB_PREFIX_.'product` p';
|
||||||
'.($id_product_attribute ? ', pa.`ecotax` AS attribute_ecotax' : '').'
|
$sql['where'] = 'WHERE p.`id_product` = '.(int)($id_product);
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
|
||||||
'.($id_product_attribute ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.`id_product_attribute` = '.(int)($id_product_attribute) : '').'
|
if (Combination::isFeatureActive())
|
||||||
WHERE p.`id_product` = '.(int)($id_product));
|
{
|
||||||
|
if ($id_product_attribute)
|
||||||
|
{
|
||||||
|
$sql['select'] .= ', pa.`price` AS attribute_price';
|
||||||
|
$sql['join'] = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = '.(int)($id_product_attribute).')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$sql['select'] .= ', IFNULL((SELECT pa.price FROM `'._DB_PREFIX_.'product_attribute` pa WHERE id_product = '.(int)($id_product).' AND default_on = 1), 0) AS attribute_price';
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$_pricesLevel2[$cacheId2] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(Tools::buildQuery($sql));
|
||||||
|
}
|
||||||
$result = self::$_pricesLevel2[$cacheId2];
|
$result = self::$_pricesLevel2[$cacheId2];
|
||||||
|
|
||||||
$price = (float)(!$specific_price OR $specific_price['price'] == 0) ? $result['price'] : $specific_price['price'];
|
$price = (float)(!$specific_price OR $specific_price['price'] == 0) ? $result['price'] : $specific_price['price'];
|
||||||
@@ -1851,9 +1896,9 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
// reinit the tax manager for ecotax handling
|
// reinit the tax manager for ecotax handling
|
||||||
$tax_manager = TaxManagerFactory::getManager(
|
$tax_manager = TaxManagerFactory::getManager(
|
||||||
$address,
|
$address,
|
||||||
(int)Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID')
|
(int)Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID')
|
||||||
);
|
);
|
||||||
$ecotax_tax_calculator = $tax_manager->getTaxCalculator();
|
$ecotax_tax_calculator = $tax_manager->getTaxCalculator();
|
||||||
$price += $ecotax_tax_calculator->addTaxes($ecotax);
|
$price += $ecotax_tax_calculator->addTaxes($ecotax);
|
||||||
}
|
}
|
||||||
@@ -1912,6 +1957,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getIdProductAttributeMostExpensive()
|
public function getIdProductAttributeMostExpensive()
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return 0;
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT `id_product_attribute`
|
SELECT `id_product_attribute`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute`
|
FROM `'._DB_PREFIX_.'product_attribute`
|
||||||
@@ -1926,25 +1973,6 @@ class ProductCore extends ObjectModel
|
|||||||
return self::getPriceStatic((int)($this->id), !$notax, $id_product_attribute, 6, NULL, false, false);
|
return self::getPriceStatic((int)($this->id), !$notax, $id_product_attribute, 6, NULL, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get product price for display
|
|
||||||
* Also display currency sign and reduction
|
|
||||||
*
|
|
||||||
* @deprecated as of 1.4.2
|
|
||||||
* @param array $params Product price, reduction...
|
|
||||||
* @param object $smarty Smarty object
|
|
||||||
* @return string Product price fully formated in customer currency
|
|
||||||
*/
|
|
||||||
static function productPrice($params, &$smarty)
|
|
||||||
{
|
|
||||||
Tools::displayAsDeprecated();
|
|
||||||
$ret = '';
|
|
||||||
if (isset($params['p']['reduction']) AND $params['p']['reduction'])
|
|
||||||
$ret .= '<span class="discounted">'.Tools::displayPrice($params['p']['price_without_reduction'], $smarty->ps_currency).'</span><br />';
|
|
||||||
$ret .= Tools::displayPrice($params['p']['price'], $smarty->ps_currency);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display price with right format and currency
|
* Display price with right format and currency
|
||||||
*
|
*
|
||||||
@@ -2130,8 +2158,8 @@ class ProductCore extends ObjectModel
|
|||||||
$sql = 'SELECT quantity
|
$sql = 'SELECT quantity
|
||||||
FROM '._DB_PREFIX_.'stock
|
FROM '._DB_PREFIX_.'stock
|
||||||
WHERE id_product = '.$this->id.'
|
WHERE id_product = '.$this->id.'
|
||||||
AND id_product_attribute = '.(int)$id_product_attribute
|
AND id_product_attribute = '.(int)$id_product_attribute.
|
||||||
.$context->shop->sqlRestriction(Shop::SHARE_STOCK);
|
$context->shop->sqlRestriction(Shop::SHARE_STOCK);
|
||||||
|
|
||||||
self::$cacheStock[$this->id][$id_product_attribute] = (int)Db::getInstance()->getValue($sql);
|
self::$cacheStock[$this->id][$id_product_attribute] = (int)Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
@@ -2251,6 +2279,8 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getAttributesGroups($id_lang)
|
public function getAttributesGroups($id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Combination::isFeatureActive())
|
||||||
|
return array();
|
||||||
$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,
|
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name,
|
||||||
a.`color` AS attribute_color, pa.`id_product_attribute`, stock.quantity, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`, pa.`minimal_quantity`
|
a.`color` AS attribute_color, pa.`id_product_attribute`, stock.quantity, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`, pa.`minimal_quantity`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
@@ -2402,6 +2432,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getFeaturesStatic($id_product)
|
public static function getFeaturesStatic($id_product)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return array();
|
||||||
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
||||||
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT id_feature, id_product, id_feature_value
|
SELECT id_feature, id_product, id_feature_value
|
||||||
@@ -2412,6 +2444,9 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function cacheProductsFeatures($productIds)
|
public static function cacheProductsFeatures($productIds)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return;
|
||||||
|
|
||||||
$productImplode = array();
|
$productImplode = array();
|
||||||
foreach ($productIds as $id_product)
|
foreach ($productIds as $id_product)
|
||||||
if ((int)$id_product AND !array_key_exists($id_product, self::$_cacheFeatures))
|
if ((int)$id_product AND !array_key_exists($id_product, self::$_cacheFeatures))
|
||||||
@@ -2433,6 +2468,9 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function cacheFrontFeatures($productIds, $id_lang)
|
public static function cacheFrontFeatures($productIds, $id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return;
|
||||||
|
|
||||||
$productImplode = array();
|
$productImplode = array();
|
||||||
foreach ($productIds as $id_product)
|
foreach ($productIds as $id_product)
|
||||||
if ((int)$id_product AND !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures))
|
if ((int)$id_product AND !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures))
|
||||||
@@ -2467,21 +2505,33 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
|
|
||||||
$sql = 'SELECT p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.quantity
|
$sql = array();
|
||||||
FROM `'._DB_PREFIX_.'category_product` cp
|
$sql['select'] = 'SELECT p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`';
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
$sql['from'] = 'FROM `'._DB_PREFIX_.'category_product` cp';
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
$sql['join'] = '
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
'.$context->shop->sqlAsso('product', 'p').'
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||||
|
';
|
||||||
|
$sql['where'] = '
|
||||||
|
WHERE pl.`name` LIKE \'%'.pSQL($query).'%\'
|
||||||
|
OR p.`reference` LIKE \'%'.pSQL($query).'%\'
|
||||||
|
OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\'';
|
||||||
|
$sql['groupby'] = 'GROUP BY `id_product`';
|
||||||
|
$sql['orderby'] = 'ORDER BY pl.`name` ASC';
|
||||||
|
|
||||||
|
if (Combination::isFeatureActive())
|
||||||
|
{
|
||||||
|
$sql['join'] .= '
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.`id_product` = p.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.`id_product` = p.`id_product`
|
||||||
'.Product::sqlStock('p', 'pa', false, $context->shop).'
|
'.Product::sqlStock('p', 'pa', false, $context->shop);
|
||||||
WHERE pl.`name` LIKE \'%'.pSQL($query).'%\'
|
$sql['where'] .= 'OR pa.`reference` LIKE \'%'.pSQL($query).'%\'';
|
||||||
OR p.`reference` LIKE \'%'.pSQL($query).'%\'
|
}
|
||||||
OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\'
|
else
|
||||||
OR pa.`reference` LIKE \'%'.pSQL($query).'%\'
|
$sql['join'] .= Product::sqlStock('p', null, false, $context->shop);
|
||||||
GROUP BY `id_product`
|
|
||||||
ORDER BY pl.`name` ASC';
|
$result = Db::getInstance()->ExecuteS(Tools::buildQuery($sql));
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
@@ -2540,7 +2590,7 @@ class ProductCore extends ObjectModel
|
|||||||
/**
|
/**
|
||||||
* Get product attribute image associations
|
* Get product attribute image associations
|
||||||
* @param integer $id_product_attribute
|
* @param integer $id_product_attribute
|
||||||
* @return boolean
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function _getAttributeImageAssociations($id_product_attribute)
|
public static function _getAttributeImageAssociations($id_product_attribute)
|
||||||
{
|
{
|
||||||
@@ -2645,8 +2695,11 @@ class ProductCore extends ObjectModel
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected function _getCustomizationFieldsNLabels($productId)
|
protected static function _getCustomizationFieldsNLabels($productId)
|
||||||
{
|
{
|
||||||
|
if (!Customization::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
$customizations = array();
|
$customizations = array();
|
||||||
if (($customizations['fields'] = Db::getInstance()->ExecuteS('
|
if (($customizations['fields'] = Db::getInstance()->ExecuteS('
|
||||||
SELECT `id_customization_field`, `type`, `required`
|
SELECT `id_customization_field`, `type`, `required`
|
||||||
@@ -2747,12 +2800,12 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
// Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it: consider adding it in order to avoid unnecessary queries
|
// Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it: consider adding it in order to avoid unnecessary queries
|
||||||
$row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
|
$row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
|
||||||
if ((!isset($row['id_product_attribute']) OR !$row['id_product_attribute'])
|
if (Combination::isFeatureActive() AND (!isset($row['id_product_attribute']) OR !$row['id_product_attribute'])
|
||||||
AND ((isset($row['cache_default_attribute']) AND ($ipa_default = $row['cache_default_attribute']) !== NULL)
|
AND ((isset($row['cache_default_attribute']) AND ($ipa_default = $row['cache_default_attribute']) !== NULL)
|
||||||
OR ($ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])))
|
OR ($ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])))
|
||||||
)
|
)
|
||||||
$row['id_product_attribute'] = $ipa_default;
|
$row['id_product_attribute'] = $ipa_default;
|
||||||
if (!isset($row['id_product_attribute']))
|
if (!Combination::isFeatureActive() OR !isset($row['id_product_attribute']))
|
||||||
$row['id_product_attribute'] = 0;
|
$row['id_product_attribute'] = 0;
|
||||||
|
|
||||||
// Tax
|
// Tax
|
||||||
@@ -2820,6 +2873,8 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getFrontFeaturesStatic($id_lang, $id_product)
|
public static function getFrontFeaturesStatic($id_lang, $id_product)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return array();
|
||||||
if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
|
if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
|
||||||
{
|
{
|
||||||
self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
@@ -2858,6 +2913,9 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getAllCustomizedDatas($id_cart, $id_lang = null, $only_in_cart = true)
|
public static function getAllCustomizedDatas($id_cart, $id_lang = null, $only_in_cart = true)
|
||||||
{
|
{
|
||||||
|
if (!Customization::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
// No need to query if there isn't any real cart!
|
// No need to query if there isn't any real cart!
|
||||||
if (!$id_cart)
|
if (!$id_cart)
|
||||||
return false;
|
return false;
|
||||||
@@ -2889,6 +2947,9 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function addCustomizationPrice(&$products, &$customizedDatas)
|
public static function addCustomizationPrice(&$products, &$customizedDatas)
|
||||||
{
|
{
|
||||||
|
if (!Customization::isFeatureActive())
|
||||||
|
return;
|
||||||
|
|
||||||
foreach ($products AS &$productUpdate)
|
foreach ($products AS &$productUpdate)
|
||||||
{
|
{
|
||||||
$customizationQuantity = 0;
|
$customizationQuantity = 0;
|
||||||
@@ -2936,26 +2997,26 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
protected function _deleteOldLabels()
|
protected function _deleteOldLabels()
|
||||||
{
|
{
|
||||||
$max = array(_CUSTOMIZE_FILE_ => (int)(Tools::getValue('uploadable_files')), _CUSTOMIZE_TEXTFIELD_ => (int)(Tools::getValue('text_fields')));
|
$max = array(Product::CUSTOMIZE_FILE => (int)(Tools::getValue('uploadable_files')), Product::CUSTOMIZE_TEXTFIELD => (int)(Tools::getValue('text_fields')));
|
||||||
/* Get customization field ids */
|
/* Get customization field ids */
|
||||||
if (($result = Db::getInstance()->ExecuteS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' ORDER BY `id_customization_field`')) === false)
|
if (($result = Db::getInstance()->ExecuteS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' ORDER BY `id_customization_field`')) === false)
|
||||||
return false;
|
return false;
|
||||||
if (empty($result))
|
if (empty($result))
|
||||||
return true;
|
return true;
|
||||||
$customizationFields = array(_CUSTOMIZE_FILE_ => array(), _CUSTOMIZE_TEXTFIELD_ => array());
|
$customizationFields = array(Product::CUSTOMIZE_FILE => array(), Product::CUSTOMIZE_TEXTFIELD => array());
|
||||||
foreach ($result AS $row)
|
foreach ($result AS $row)
|
||||||
$customizationFields[(int)($row['type'])][] = (int)($row['id_customization_field']);
|
$customizationFields[(int)($row['type'])][] = (int)($row['id_customization_field']);
|
||||||
$extraFile = count($customizationFields[_CUSTOMIZE_FILE_]) - $max[_CUSTOMIZE_FILE_];
|
$extraFile = count($customizationFields[Product::CUSTOMIZE_FILE]) - $max[Product::CUSTOMIZE_FILE];
|
||||||
$extraText = count($customizationFields[_CUSTOMIZE_TEXTFIELD_]) - $max[_CUSTOMIZE_TEXTFIELD_];
|
$extraText = count($customizationFields[Product::CUSTOMIZE_TEXTFIELD]) - $max[Product::CUSTOMIZE_TEXTFIELD];
|
||||||
|
|
||||||
/* If too much inside the database, deletion */
|
/* If too much inside the database, deletion */
|
||||||
if ($extraFile > 0 AND count($customizationFields[_CUSTOMIZE_FILE_]) - $extraFile >= 0 AND
|
if ($extraFile > 0 AND count($customizationFields[Product::CUSTOMIZE_FILE]) - $extraFile >= 0 AND
|
||||||
(!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' AND `type` = '._CUSTOMIZE_FILE_.' AND `id_customization_field` >= '.(int)($customizationFields[_CUSTOMIZE_FILE_][count($customizationFields[_CUSTOMIZE_FILE_]) - $extraFile]))
|
(!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' AND `type` = '.Product::CUSTOMIZE_FILE.' AND `id_customization_field` >= '.(int)($customizationFields[Product::CUSTOMIZE_FILE][count($customizationFields[Product::CUSTOMIZE_FILE]) - $extraFile]))
|
||||||
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang` WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang` WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($extraText > 0 AND count($customizationFields[_CUSTOMIZE_TEXTFIELD_]) - $extraText >= 0 AND
|
if ($extraText > 0 AND count($customizationFields[Product::CUSTOMIZE_TEXTFIELD]) - $extraText >= 0 AND
|
||||||
(!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' AND `type` = '._CUSTOMIZE_TEXTFIELD_.' AND `id_customization_field` >= '.(int)($customizationFields[_CUSTOMIZE_TEXTFIELD_][count($customizationFields[_CUSTOMIZE_TEXTFIELD_]) - $extraText]))
|
(!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' AND `type` = '.Product::CUSTOMIZE_TEXTFIELD.' AND `id_customization_field` >= '.(int)($customizationFields[Product::CUSTOMIZE_TEXTFIELD][count($customizationFields[Product::CUSTOMIZE_TEXTFIELD]) - $extraText]))
|
||||||
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang` WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang` WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
@@ -2982,11 +3043,11 @@ class ProductCore extends ObjectModel
|
|||||||
$languages = Language::getLanguages();
|
$languages = Language::getLanguages();
|
||||||
if ((int)($uploadableFiles) > 0)
|
if ((int)($uploadableFiles) > 0)
|
||||||
for ($i = 0; $i < (int)($uploadableFiles); $i++)
|
for ($i = 0; $i < (int)($uploadableFiles); $i++)
|
||||||
if (!$this->_createLabel($languages, _CUSTOMIZE_FILE_))
|
if (!$this->_createLabel($languages, Product::CUSTOMIZE_FILE))
|
||||||
return false;
|
return false;
|
||||||
if ((int)($textFields) > 0)
|
if ((int)($textFields) > 0)
|
||||||
for ($i = 0; $i < (int)($textFields); $i++)
|
for ($i = 0; $i < (int)($textFields); $i++)
|
||||||
if (!$this->_createLabel($languages, _CUSTOMIZE_TEXTFIELD_))
|
if (!$this->_createLabel($languages, Product::CUSTOMIZE_TEXTFIELD))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3021,6 +3082,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getCustomizationFields($id_lang = false)
|
public function getCustomizationFields($id_lang = false)
|
||||||
{
|
{
|
||||||
|
if (!Customization::isFeatureActive())
|
||||||
|
return false;
|
||||||
if (!$result = Db::getInstance()->ExecuteS('
|
if (!$result = Db::getInstance()->ExecuteS('
|
||||||
SELECT cf.`id_customization_field`, cf.`type`, cf.`required`, cfl.`name`, cfl.`id_lang`
|
SELECT cf.`id_customization_field`, cf.`type`, cf.`required`, cfl.`name`, cfl.`id_lang`
|
||||||
FROM `'._DB_PREFIX_.'customization_field` cf
|
FROM `'._DB_PREFIX_.'customization_field` cf
|
||||||
@@ -3038,16 +3101,30 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getCustomizationFieldIds()
|
public function getCustomizationFieldIds()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id));
|
if (!Customization::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
return Db::getInstance()->ExecuteS('
|
||||||
|
SELECT `id_customization_field`, `type`
|
||||||
|
FROM `'._DB_PREFIX_.'customization_field`
|
||||||
|
WHERE `id_product` = '.(int)($this->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredCustomizableFields()
|
public function getRequiredCustomizableFields()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' AND `required` = 1');
|
if (!Customization::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
return Db::getInstance()->ExecuteS('
|
||||||
|
SELECT `id_customization_field`, `type`
|
||||||
|
FROM `'._DB_PREFIX_.'customization_field`
|
||||||
|
WHERE `id_product` = '.(int)($this->id).'
|
||||||
|
AND `required` = 1'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAllRequiredCustomizableFields(Context $context = null)
|
public function hasAllRequiredCustomizableFields(Context $context = null)
|
||||||
{
|
{
|
||||||
|
if (!Customization::isFeatureActive())
|
||||||
|
return true;
|
||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
|
|
||||||
@@ -3158,28 +3235,30 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getStockMvts($id_lang)
|
public function getStockMvts($id_lang)
|
||||||
{
|
{
|
||||||
$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
|
return Db::getInstance()->ExecuteS('
|
||||||
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
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
|
||||||
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').')
|
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||||
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_.'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_.'employee` e ON (e.id_employee = sm.id_employee)
|
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_.'product_attribute_combination` pac ON (pac.id_product_attribute = sm.id_product_attribute)
|
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = sm.id_employee)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = sm.id_product_attribute)
|
||||||
WHERE sm.id_product='.(int)$this->id.'
|
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = '.(int)$id_lang.')
|
||||||
GROUP BY sm.id_stock_mvt';
|
WHERE sm.id_product='.(int)$this->id.'
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
GROUP BY sm.id_stock_mvt
|
||||||
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUrlRewriteInformations($id_product)
|
public static function getUrlRewriteInformations($id_product)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (pl.`id_lang` = l.`id_lang`)
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = pl.`id_lang`'.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (pl.`id_lang` = l.`id_lang`)
|
||||||
WHERE p.`id_product` = '.(int)$id_product. '
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = pl.`id_lang`'.Context::getContext()->shop->sqlLang('cl').')
|
||||||
AND l.`active` = 1';
|
WHERE p.`id_product` = '.(int)$id_product. '
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
AND l.`active` = 1
|
||||||
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getIdTaxRulesGroupByIdProduct($id_product)
|
public static function getIdTaxRulesGroupByIdProduct($id_product)
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
protected $table = 'product_download';
|
protected $table = 'product_download';
|
||||||
protected $identifier = 'id_product_download';
|
protected $identifier = 'id_product_download';
|
||||||
|
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a virtual product
|
* Build a virtual product
|
||||||
*
|
*
|
||||||
@@ -158,6 +160,9 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getIdFromIdProduct($id_product)
|
public static function getIdFromIdProduct($id_product)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (array_key_exists($id_product, self::$_productIds))
|
if (array_key_exists($id_product, self::$_productIds))
|
||||||
return self::$_productIds[$id_product];
|
return self::$_productIds[$id_product];
|
||||||
|
|
||||||
@@ -206,7 +211,7 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
* @param string $hash hash code in table order detail (optionnal)
|
* @param string $hash hash code in table order detail (optionnal)
|
||||||
* @return string Html all the code for print a link to the file
|
* @return string Html all the code for print a link to the file
|
||||||
*/
|
*/
|
||||||
public function getTextLink($admin=true, $hash=false)
|
public function getTextLink($admin = true, $hash = false)
|
||||||
{
|
{
|
||||||
$key = $this->physically_filename . '-' . ($hash ? $hash : 'orderdetail');
|
$key = $this->physically_filename . '-' . ($hash ? $hash : 'orderdetail');
|
||||||
$link = ($admin) ? 'get-file-admin.php?' : Tools::getHttpHost(true, true).'index.php?controller=get-file&';
|
$link = ($admin) ? 'get-file-admin.php?' : Tools::getHttpHost(true, true).'index.php?controller=get-file&';
|
||||||
@@ -268,6 +273,21 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
|
');
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+24
-1
@@ -51,6 +51,8 @@ class SceneCore extends ObjectModel
|
|||||||
protected $fieldsSizeLang = array('name' => 100);
|
protected $fieldsSizeLang = array('name' => 100);
|
||||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
||||||
|
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
public function __construct($id = NULL, $id_lang = NULL, $liteResult = true, $hideScenePosition = false)
|
public function __construct($id = NULL, $id_lang = NULL, $liteResult = true, $hideScenePosition = false)
|
||||||
{
|
{
|
||||||
parent::__construct((int)($id), (int)($id_lang));
|
parent::__construct((int)($id), (int)($id_lang));
|
||||||
@@ -181,8 +183,11 @@ class SceneCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @return array Products
|
* @return array Products
|
||||||
*/
|
*/
|
||||||
static public function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true, Context $context = null)
|
public static function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true, Context $context = null)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
||||||
@@ -211,6 +216,9 @@ class SceneCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true, Context $context = null)
|
public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true, Context $context = null)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
||||||
@@ -257,6 +265,21 @@ class SceneCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
return preg_replace('/^[0-9]+\./', '', $name);
|
return preg_replace('/^[0-9]+\./', '', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'scene`
|
||||||
|
');
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -307,6 +307,9 @@ class SearchCore
|
|||||||
|
|
||||||
public static function getAttributes($db, $id_product, $id_lang)
|
public static function getAttributes($db, $id_product, $id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Cobmination::isFeatureActive())
|
||||||
|
return '';
|
||||||
|
|
||||||
$attributes = '';
|
$attributes = '';
|
||||||
$attributesArray = $db->ExecuteS('
|
$attributesArray = $db->ExecuteS('
|
||||||
SELECT al.name FROM '._DB_PREFIX_.'product_attribute pa
|
SELECT al.name FROM '._DB_PREFIX_.'product_attribute pa
|
||||||
@@ -320,6 +323,9 @@ class SearchCore
|
|||||||
|
|
||||||
public static function getFeatures($db, $id_product, $id_lang)
|
public static function getFeatures($db, $id_product, $id_lang)
|
||||||
{
|
{
|
||||||
|
if (!Feature::isFeatureActive())
|
||||||
|
return '';
|
||||||
|
|
||||||
$features = '';
|
$features = '';
|
||||||
$featuresArray = $db->ExecuteS('
|
$featuresArray = $db->ExecuteS('
|
||||||
SELECT fvl.value FROM '._DB_PREFIX_.'feature_product fp
|
SELECT fvl.value FROM '._DB_PREFIX_.'feature_product fp
|
||||||
|
|||||||
+43
-11
@@ -47,6 +47,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
protected static $_specificPriceCache = array();
|
protected static $_specificPriceCache = array();
|
||||||
protected static $_cache_priorities = array();
|
protected static $_cache_priorities = array();
|
||||||
|
protected static $feature_active = null;
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
{
|
{
|
||||||
@@ -67,16 +68,18 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getByProductId($id_product)
|
public static function getByProductId($id_product)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT * FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` = '.(int)($id_product)
|
SELECT *
|
||||||
);
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
|
WHERE `id_product` = '.(int)$id_product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getIdsByProductId($id_product)
|
public static function getIdsByProductId($id_product)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT `id_specific_price` FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` = '.(int)$id_product.'
|
SELECT `id_specific_price`
|
||||||
');
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
|
WHERE `id_product` = '.(int)$id_product);
|
||||||
}
|
}
|
||||||
|
|
||||||
// score generation for quantity discount
|
// score generation for quantity discount
|
||||||
@@ -96,10 +99,12 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getPriority($id_product)
|
public static function getPriority($id_product)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES');
|
||||||
|
|
||||||
if (!isset(self::$_cache_priorities[(int)$id_product]))
|
if (!isset(self::$_cache_priorities[(int)$id_product]))
|
||||||
{
|
{
|
||||||
self::$_cache_priorities[(int)$id_product] = Db::getInstance()->getValue('
|
self::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT `priority`
|
SELECT `priority`
|
||||||
FROM `'._DB_PREFIX_.'specific_price_priority`
|
FROM `'._DB_PREFIX_.'specific_price_priority`
|
||||||
WHERE `id_product` = '.(int)$id_product);
|
WHERE `id_product` = '.(int)$id_product);
|
||||||
@@ -114,6 +119,9 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity)
|
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The date is not taken into account for the cache, but this is for the better because it keeps the consistency for the whole script.
|
** The date is not taken into account for the cache, but this is for the better because it keeps the consistency for the whole script.
|
||||||
** The price must not change between the top and the bottom of the page
|
** The price must not change between the top and the bottom of the page
|
||||||
@@ -123,7 +131,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
if (!array_key_exists($key, self::$_specificPriceCache))
|
if (!array_key_exists($key, self::$_specificPriceCache))
|
||||||
{
|
{
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
self::$_specificPriceCache[$key] = Db::getInstance()->getRow('
|
self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT *, '.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
SELECT *, '.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
WHERE `id_product` IN (0, '.(int)$id_product.')
|
WHERE `id_product` IN (0, '.(int)$id_product.')
|
||||||
@@ -176,8 +184,11 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group)
|
public static function getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
$res = Db::getInstance()->ExecuteS('
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT *,
|
SELECT *,
|
||||||
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
@@ -215,8 +226,11 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getQuantityDiscount($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity)
|
public static function getQuantityDiscount($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity)
|
||||||
{
|
{
|
||||||
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
return Db::getInstance()->getRow('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT *,
|
SELECT *,
|
||||||
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
@@ -238,7 +252,10 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getProductIdByDate($id_shop, $id_currency, $id_country, $id_group, $beginning, $ending)
|
public static function getProductIdByDate($id_shop, $id_currency, $id_country, $id_group, $beginning, $ending)
|
||||||
{
|
{
|
||||||
$resource = Db::getInstance()->ExecuteS('
|
if (!self::isFeatureActive())
|
||||||
|
return array();
|
||||||
|
|
||||||
|
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT `id_product`
|
SELECT `id_product`
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
WHERE `id_shop` IN(0, '.(int)($id_shop).') AND
|
WHERE `id_shop` IN(0, '.(int)($id_shop).') AND
|
||||||
@@ -271,5 +288,20 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
$this->id_product = (int)($id_product);
|
$this->id_product = (int)($id_product);
|
||||||
return $this->add();
|
return $this->add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is allow to know if a feature is used or active
|
||||||
|
* @since 1.5.0.1
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isFeatureActive()
|
||||||
|
{
|
||||||
|
if (self::$feature_active === null)
|
||||||
|
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
|
');
|
||||||
|
return self::$feature_active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+42
-7
@@ -657,12 +657,10 @@ class ToolsCore
|
|||||||
elseif ($id_category = self::getValue('id_category'))
|
elseif ($id_category = self::getValue('id_category'))
|
||||||
{
|
{
|
||||||
$page_number = self::getValue('p');
|
$page_number = self::getValue('p');
|
||||||
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
FROM `'._DB_PREFIX_.'category_lang`
|
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
||||||
WHERE id_lang = '.(int)$id_lang.'
|
FROM `'._DB_PREFIX_.'category_lang` cl
|
||||||
AND id_category = '.(int)$id_category
|
WHERE cl.`id_lang` = '.(int)($id_lang).' AND cl.`id_category` = '.(int)$id_category.Context::getContext()->shop->sqlLang('cl'));
|
||||||
.Context::getContext()->shop->sqlLang();
|
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
if (empty($row['meta_description']))
|
if (empty($row['meta_description']))
|
||||||
@@ -2065,12 +2063,49 @@ FileETag INode MTime Size
|
|||||||
return 1024 * 1024 * 1024 * (int)$memory_limit;
|
return 1024 * 1024 * 1024 * (int)$memory_limit;
|
||||||
|
|
||||||
return $memory_limit;
|
return $memory_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return bool true if the server use 64bit arch
|
||||||
|
*/
|
||||||
public static function isX86_64arch()
|
public static function isX86_64arch()
|
||||||
{
|
{
|
||||||
return (PHP_INT_MAX == '9223372036854775807');
|
return (PHP_INT_MAX == '9223372036854775807');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array SQL query in array
|
||||||
|
* @return string SQL query
|
||||||
|
*/
|
||||||
|
public static function buildQuery(array $sql)
|
||||||
|
{
|
||||||
|
if (!isset($sql['select']))
|
||||||
|
$sql['select'] = 'SELECT *';
|
||||||
|
|
||||||
|
$req = $sql['select']."\n";
|
||||||
|
$req .= $sql['from']."\n";
|
||||||
|
|
||||||
|
if (isset($sql['join']))
|
||||||
|
$req .= $sql['join']."\n";
|
||||||
|
|
||||||
|
if (isset($sql['where']))
|
||||||
|
$req .= $sql['where']."\n";
|
||||||
|
|
||||||
|
if (isset($sql['groupby']))
|
||||||
|
$req .= $sql['groupby']."\n";
|
||||||
|
|
||||||
|
if (isset($sql['having']))
|
||||||
|
$req .= $sql['having']."\n";
|
||||||
|
|
||||||
|
if (isset($sql['orderby']))
|
||||||
|
$req .= $sql['orderby']."\n";
|
||||||
|
|
||||||
|
if (isset($sql['limit']))
|
||||||
|
$req .= $sql['limit']."\n";
|
||||||
|
|
||||||
|
return $req;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ class ValidateCore
|
|||||||
|
|
||||||
public static function isUnixName($data)
|
public static function isUnixName($data)
|
||||||
{
|
{
|
||||||
return preg_match('/^[a-z0-9_-]+$/ui', $data);
|
return preg_match('/^[a-z0-9\._-]+$/ui', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isTablePrefix($data)
|
public static function isTablePrefix($data)
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ smartyRegisterFunction($smarty, 'function', 'd', 'smartyDieObject'); // unused
|
|||||||
smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate');
|
smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate');
|
||||||
|
|
||||||
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
|
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
|
||||||
smartyRegisterFunction($smarty, 'function', 'productPrice', array('Product', 'productPrice')); // unused
|
|
||||||
smartyRegisterFunction($smarty, 'function', 'convertPrice', array('Product', 'convertPrice'));
|
smartyRegisterFunction($smarty, 'function', 'convertPrice', array('Product', 'convertPrice'));
|
||||||
smartyRegisterFunction($smarty, 'function', 'convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency'));
|
smartyRegisterFunction($smarty, 'function', 'convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency'));
|
||||||
smartyRegisterFunction($smarty, 'function', 'displayWtPrice', array('Product', 'displayWtPrice'));
|
smartyRegisterFunction($smarty, 'function', 'displayWtPrice', array('Product', 'displayWtPrice'));
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class CartControllerCore extends FrontController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$discount['cumulable_reduction'] && ($discount['id_discount_type'] != 1 || !$hasUndiscountedProduct))
|
if (!$discount['cumulable_reduction'] && ($discount['id_discount_type'] != Discount::PERCENT || !$hasUndiscountedProduct))
|
||||||
if (Tools::getValue('ajax') == 'true')
|
if (Tools::getValue('ajax') == 'true')
|
||||||
die('{"hasError" : true, "errors" : ["'.Tools::displayError('Cannot add this product because current voucher does not allow additional discounts.').'"]}');
|
die('{"hasError" : true, "errors" : ["'.Tools::displayError('Cannot add this product because current voucher does not allow additional discounts.').'"]}');
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -103,20 +103,24 @@ class CategoryControllerCore extends FrontController
|
|||||||
$rewrited_url = $this->context->link->getCategoryLink((int)$this->category->id, $this->category->link_rewrite);
|
$rewrited_url = $this->context->link->getCategoryLink((int)$this->category->id, $this->category->link_rewrite);
|
||||||
|
|
||||||
/* Scenes (could be externalised to another controler if you need them */
|
/* Scenes (could be externalised to another controler if you need them */
|
||||||
$this->context->smarty->assign('scenes', Scene::getScenes($this->category->id, $this->context->language->id, true, false));
|
$scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
|
||||||
|
$this->context->smarty->assign('scenes', $scenes);
|
||||||
|
|
||||||
/* Scenes images formats */
|
/* Scenes images formats */
|
||||||
if ($sceneImageTypes = ImageType::getImagesTypes('scenes'))
|
if (sizeof($scenes))
|
||||||
{
|
{
|
||||||
foreach ($sceneImageTypes AS $sceneImageType)
|
if ($sceneImageTypes = ImageType::getImagesTypes('scenes'))
|
||||||
{
|
{
|
||||||
if ($sceneImageType['name'] == 'thumb_scene')
|
foreach ($sceneImageTypes AS $sceneImageType)
|
||||||
$thumbSceneImageType = $sceneImageType;
|
{
|
||||||
elseif ($sceneImageType['name'] == 'large_scene')
|
if ($sceneImageType['name'] == 'thumb_scene')
|
||||||
$largeSceneImageType = $sceneImageType;
|
$thumbSceneImageType = $sceneImageType;
|
||||||
|
elseif ($sceneImageType['name'] == 'large_scene')
|
||||||
|
$largeSceneImageType = $sceneImageType;
|
||||||
|
}
|
||||||
|
$this->context->smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
|
||||||
|
$this->context->smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
|
|
||||||
$this->context->smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->category->description = Tools::nl2br($this->category->description);
|
$this->category->description = Tools::nl2br($this->category->description);
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ class GuestTrackingControllerCore extends FrontController
|
|||||||
'deliveryState' => (Validate::isLoadedObject($addressDelivery) AND $addressDelivery->id_state) ? new State((int)($addressDelivery->id_state)) : false,
|
'deliveryState' => (Validate::isLoadedObject($addressDelivery) AND $addressDelivery->id_state) ? new State((int)($addressDelivery->id_state)) : false,
|
||||||
'is_guest' => true,
|
'is_guest' => true,
|
||||||
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
|
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
|
||||||
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
|
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||||
'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_,
|
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
|
||||||
'use_tax' => Configuration::get('PS_TAX'),
|
'use_tax' => Configuration::get('PS_TAX'),
|
||||||
'customizedDatas' => $customizedDatas,
|
'customizedDatas' => $customizedDatas,
|
||||||
'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues,
|
'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues,
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
'deliveryState' => (Validate::isLoadedObject($addressDelivery) AND $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
|
'deliveryState' => (Validate::isLoadedObject($addressDelivery) AND $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
|
||||||
'is_guest' => false,
|
'is_guest' => false,
|
||||||
'messages' => Message::getMessagesByOrderId((int)($order->id)),
|
'messages' => Message::getMessagesByOrderId((int)($order->id)),
|
||||||
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
|
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||||
'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_,
|
'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_,
|
||||||
'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'),
|
'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'),
|
||||||
'use_tax' => Configuration::get('PS_TAX'),
|
'use_tax' => Configuration::get('PS_TAX'),
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
global $isVirtualCart;
|
global $isVirtualCart;
|
||||||
parent::preProcess();
|
parent::preProcess();
|
||||||
|
|
||||||
// Redirect to the good order process
|
// Redirect to the good order process
|
||||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 AND Dispatcher::getInstance()->getController() != 'order')
|
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 AND Dispatcher::getInstance()->getController() != 'order')
|
||||||
Tools::redirect('index.php?controller=order');
|
Tools::redirect('index.php?controller=order');
|
||||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 AND Dispatcher::getInstance()->getController() != 'order-opc')
|
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 AND Dispatcher::getInstance()->getController() != 'orderopc')
|
||||||
{
|
{
|
||||||
if (isset($_GET['step']) AND $_GET['step'] == 3)
|
if (isset($_GET['step']) AND $_GET['step'] == 3)
|
||||||
Tools::redirect('index.php?controller=order-opc&isPaymentStep=true');
|
Tools::redirect('index.php?controller=order-opc&isPaymentStep=true');
|
||||||
@@ -88,7 +88,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
|
|
||||||
if ($this->nbProducts)
|
if ($this->nbProducts)
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('submitAddDiscount') AND Tools::getValue('discount_name'))
|
if (Tools::isSubmit('submitAddDiscount') && Tools::getValue('discount_name') && Discount::isFeatureActive())
|
||||||
{
|
{
|
||||||
$discountName = Tools::getValue('discount_name');
|
$discountName = Tools::getValue('discount_name');
|
||||||
if (!Validate::isDiscountName($discountName))
|
if (!Validate::isDiscountName($discountName))
|
||||||
@@ -114,7 +114,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'discount_name' => Tools::safeOutput($discountName)
|
'discount_name' => Tools::safeOutput($discountName)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
elseif (isset($_GET['deleteDiscount']) AND Validate::isUnsignedId($_GET['deleteDiscount']))
|
elseif (isset($_GET['deleteDiscount']) && Validate::isUnsignedId($_GET['deleteDiscount']) && Discount::isFeatureActive())
|
||||||
{
|
{
|
||||||
$this->context->cart->deleteDiscount((int)($_GET['deleteDiscount']));
|
$this->context->cart->deleteDiscount((int)($_GET['deleteDiscount']));
|
||||||
Tools::redirect('index.php?controller=order-opc');
|
Tools::redirect('index.php?controller=order-opc');
|
||||||
@@ -235,23 +235,26 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
$customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
|
$customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
|
||||||
|
|
||||||
// override customization tax rate with real tax (tax rules)
|
// override customization tax rate with real tax (tax rules)
|
||||||
foreach($summary['products'] AS &$productUpdate)
|
if ($customizedDatas)
|
||||||
{
|
{
|
||||||
$productId = (int)(isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']);
|
foreach($summary['products'] AS &$productUpdate)
|
||||||
$productAttributeId = (int)(isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']);
|
{
|
||||||
|
$productId = (int)(isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']);
|
||||||
|
$productAttributeId = (int)(isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']);
|
||||||
|
|
||||||
|
if (isset($customizedDatas[$productId][$productAttributeId]))
|
||||||
|
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($customizedDatas[$productId][$productAttributeId]))
|
Product::addCustomizationPrice($summary['products'], $customizedDatas);
|
||||||
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Product::addCustomizationPrice($summary['products'], $customizedDatas);
|
|
||||||
|
|
||||||
if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency($this->context->cart->id_currency)))
|
if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency($this->context->cart->id_currency)))
|
||||||
{
|
{
|
||||||
$discounts = $this->context->cart->getDiscounts();
|
$discounts = $this->context->cart->getDiscounts();
|
||||||
$total_free_ship = $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
|
$total_free_ship = $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
|
||||||
foreach ($discounts as $discount)
|
foreach ($discounts as $discount)
|
||||||
if ($discount['id_discount_type'] == 3)
|
if ($discount['id_discount_type'] == Discount::FREE_SHIPPING)
|
||||||
{
|
{
|
||||||
$total_free_ship = 0;
|
$total_free_ship = 0;
|
||||||
break;
|
break;
|
||||||
@@ -271,8 +274,8 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING),
|
'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING),
|
||||||
'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING),
|
'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING),
|
||||||
'customizedDatas' => $customizedDatas,
|
'customizedDatas' => $customizedDatas,
|
||||||
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
|
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||||
'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_,
|
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
|
||||||
'lastProductAdded' => $this->context->cart->getLastProduct(),
|
'lastProductAdded' => $this->context->cart->getLastProduct(),
|
||||||
'displayVouchers' => Discount::getVouchersToCartDisplay($this->context->language->id, (isset($this->context->customer->id) ? $this->context->customer->id : 0)),
|
'displayVouchers' => Discount::getVouchersToCartDisplay($this->context->language->id, (isset($this->context->customer->id) ? $this->context->customer->id : 0)),
|
||||||
'currencySign' => $this->context->currency->sign,
|
'currencySign' => $this->context->currency->sign,
|
||||||
|
|||||||
@@ -127,12 +127,12 @@ class ProductControllerCore extends FrontController
|
|||||||
elseif (isset($_GET['deletePicture']) AND !$this->context->cart->deletePictureToProduct($this->product->id, Tools::getValue('deletePicture')))
|
elseif (isset($_GET['deletePicture']) AND !$this->context->cart->deletePictureToProduct($this->product->id, Tools::getValue('deletePicture')))
|
||||||
$this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
|
$this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
|
||||||
|
|
||||||
$files = $this->context->cart->getProductCustomization($this->product->id, _CUSTOMIZE_FILE_, true);
|
$files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true);
|
||||||
$pictures = array();
|
$pictures = array();
|
||||||
foreach($files as $file)
|
foreach($files as $file)
|
||||||
$pictures['pictures_'.$this->product->id.'_'.$file['index']] = $file['value'];
|
$pictures['pictures_'.$this->product->id.'_'.$file['index']] = $file['value'];
|
||||||
|
|
||||||
$texts = $this->context->cart->getProductCustomization($this->product->id, _CUSTOMIZE_TEXTFIELD_, true);
|
$texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true);
|
||||||
$textFields = array();
|
$textFields = array();
|
||||||
foreach ($texts as $textField)
|
foreach ($texts as $textField)
|
||||||
$textFields['textFields_'.$this->product->id.'_'.$textField['index']] = str_replace('<br />', "\n", $textField['value']);
|
$textFields['textFields_'.$this->product->id.'_'.$textField['index']] = str_replace('<br />', "\n", $textField['value']);
|
||||||
@@ -375,7 +375,7 @@ class ProductControllerCore extends FrontController
|
|||||||
return false;
|
return false;
|
||||||
$authorizedFileFields = array();
|
$authorizedFileFields = array();
|
||||||
foreach ($fieldIds AS $fieldId)
|
foreach ($fieldIds AS $fieldId)
|
||||||
if ($fieldId['type'] == _CUSTOMIZE_FILE_)
|
if ($fieldId['type'] == Product::CUSTOMIZE_FILE)
|
||||||
$authorizedFileFields[(int)($fieldId['id_customization_field'])] = 'file'.(int)($fieldId['id_customization_field']);
|
$authorizedFileFields[(int)($fieldId['id_customization_field'])] = 'file'.(int)($fieldId['id_customization_field']);
|
||||||
$indexes = array_flip($authorizedFileFields);
|
$indexes = array_flip($authorizedFileFields);
|
||||||
foreach ($_FILES AS $fieldName => $file)
|
foreach ($_FILES AS $fieldName => $file)
|
||||||
@@ -398,7 +398,7 @@ class ProductControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Store customization in database
|
// Store customization in database
|
||||||
$cart->addPictureToProduct($this->product->id, $indexes[$fieldName], _CUSTOMIZE_FILE_, $fileName);
|
$cart->addPictureToProduct($this->product->id, $indexes[$fieldName], Product::CUSTOMIZE_FILE, $fileName);
|
||||||
}
|
}
|
||||||
unlink($tmpName);
|
unlink($tmpName);
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ class ProductControllerCore extends FrontController
|
|||||||
return false;
|
return false;
|
||||||
$authorizedTextFields = array();
|
$authorizedTextFields = array();
|
||||||
foreach ($fieldIds AS $fieldId)
|
foreach ($fieldIds AS $fieldId)
|
||||||
if ($fieldId['type'] == _CUSTOMIZE_TEXTFIELD_)
|
if ($fieldId['type'] == Product::CUSTOMIZE_TEXTFIELD)
|
||||||
$authorizedTextFields[(int)($fieldId['id_customization_field'])] = 'textField'.(int)($fieldId['id_customization_field']);
|
$authorizedTextFields[(int)($fieldId['id_customization_field'])] = 'textField'.(int)($fieldId['id_customization_field']);
|
||||||
$indexes = array_flip($authorizedTextFields);
|
$indexes = array_flip($authorizedTextFields);
|
||||||
foreach ($_POST AS $fieldName => $value)
|
foreach ($_POST AS $fieldName => $value)
|
||||||
@@ -420,7 +420,7 @@ class ProductControllerCore extends FrontController
|
|||||||
if (!Validate::isMessage($value))
|
if (!Validate::isMessage($value))
|
||||||
$this->errors[] = Tools::displayError('Invalid message');
|
$this->errors[] = Tools::displayError('Invalid message');
|
||||||
else
|
else
|
||||||
$cart->addTextFieldToProduct($this->product->id, $indexes[$fieldName], _CUSTOMIZE_TEXTFIELD_, $value);
|
$cart->addTextFieldToProduct($this->product->id, $indexes[$fieldName], Product::CUSTOMIZE_TEXTFIELD, $value);
|
||||||
}
|
}
|
||||||
elseif (in_array($fieldName, $authorizedTextFields) AND empty($value))
|
elseif (in_array($fieldName, $authorizedTextFields) AND empty($value))
|
||||||
$cart->deleteCustomizationToProduct((int)($this->product->id), $indexes[$fieldName]);
|
$cart->deleteCustomizationToProduct((int)($this->product->id), $indexes[$fieldName]);
|
||||||
|
|||||||
@@ -206,7 +206,9 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
|
|||||||
(135, 'PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW()),
|
(135, 'PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW()),
|
||||||
(136, 'PS_SHOW_NEW_ORDERS', '1', NOW(), NOW()),
|
(136, 'PS_SHOW_NEW_ORDERS', '1', NOW(), NOW()),
|
||||||
(137, 'PS_SHOW_NEW_CUSTOMERS', '1', NOW(), NOW()),
|
(137, 'PS_SHOW_NEW_CUSTOMERS', '1', NOW(), NOW()),
|
||||||
(138, 'PS_SHOW_NEW_MESSAGES', '1', NOW(), NOW());
|
(138, 'PS_SHOW_NEW_MESSAGES', '1', NOW(), NOW()),
|
||||||
|
(139, 'PS_FEATURE_FEATURE_ACTIVE', '1', NOW(), NOW()),
|
||||||
|
(140, 'PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW());
|
||||||
|
|
||||||
INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES
|
INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES
|
||||||
(36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()),
|
(36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()),
|
||||||
|
|||||||
@@ -65,3 +65,9 @@ ALTER TABLE `PREFIX_employee`
|
|||||||
ADD `id_last_message` tinyint(1) unsigned NOT NULL default '0',
|
ADD `id_last_message` tinyint(1) unsigned NOT NULL default '0',
|
||||||
ADD `id_last_customer` tinyint(1) unsigned NOT NULL default '0';
|
ADD `id_last_customer` tinyint(1) unsigned NOT NULL default '0';
|
||||||
|
|
||||||
|
INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES
|
||||||
|
('PS_SHOW_NEW_ORDERS', '1', NOW(), NOW()),
|
||||||
|
('PS_SHOW_NEW_CUSTOMERS', '1', NOW(), NOW()),
|
||||||
|
('PS_SHOW_NEW_MESSAGES', '1', NOW(), NOW()),
|
||||||
|
('PS_FEATURE_FEATURE_ACTIVE', '1', NOW(), NOW()),
|
||||||
|
('PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW());
|
||||||
@@ -83,8 +83,8 @@ class BlockCart extends Module
|
|||||||
$smarty->assign(array(
|
$smarty->assign(array(
|
||||||
'products' => $products,
|
'products' => $products,
|
||||||
'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)),
|
'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)),
|
||||||
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
|
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||||
'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_,
|
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
|
||||||
'discounts' => $params['cart']->getDiscounts(false, Tools::isSubmit('id_product')),
|
'discounts' => $params['cart']->getDiscounts(false, Tools::isSubmit('id_product')),
|
||||||
'nb_total_products' => (int)($nbTotalProducts),
|
'nb_total_products' => (int)($nbTotalProducts),
|
||||||
'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_SHIPPING), $currency),
|
'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_SHIPPING), $currency),
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ class Followup extends Module
|
|||||||
private function createDiscount($id_email_type, $amount, $id_customer, $dateValidity, $description)
|
private function createDiscount($id_email_type, $amount, $id_customer, $dateValidity, $description)
|
||||||
{
|
{
|
||||||
$discount = new Discount();
|
$discount = new Discount();
|
||||||
$discount->id_discount_type = 1;
|
$discount->id_discount_type = Discount::PERCENT;
|
||||||
$discount->value = (float)($amount);
|
$discount->value = (float)($amount);
|
||||||
$discount->id_customer = (int)($id_customer);
|
$discount->id_customer = (int)($id_customer);
|
||||||
$discount->date_to = $dateValidity;
|
$discount->date_to = $dateValidity;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ if (Tools::getValue('transform-points') == 'true' AND $customerPoints > 0)
|
|||||||
/* Voucher creation and affectation to the customer */
|
/* Voucher creation and affectation to the customer */
|
||||||
$voucher = new Discount();
|
$voucher = new Discount();
|
||||||
$voucher->name = $voucherCode;
|
$voucher->name = $voucherCode;
|
||||||
$voucher->id_discount_type = 2; // Discount on order (amount)
|
$voucher->id_discount_type = Discount::AMOUNT; // Discount on order (amount)
|
||||||
$voucher->id_customer = (int)($cookie->id_customer);
|
$voucher->id_customer = (int)($cookie->id_customer);
|
||||||
$voucher->id_currency = (int)($cookie->id_currency);
|
$voucher->id_currency = (int)($cookie->id_currency);
|
||||||
$voucher->value = LoyaltyModule::getVoucherValue((int)$customerPoints);
|
$voucher->value = LoyaltyModule::getVoucherValue((int)$customerPoints);
|
||||||
|
|||||||
@@ -148,12 +148,12 @@ class MailAlerts extends Module
|
|||||||
|
|
||||||
foreach ($customizedDatas[$product['product_id']][$product['product_attribute_id']] AS $customization)
|
foreach ($customizedDatas[$product['product_id']][$product['product_attribute_id']] AS $customization)
|
||||||
{
|
{
|
||||||
if (isset($customization['datas'][_CUSTOMIZE_TEXTFIELD_]))
|
if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD]))
|
||||||
foreach ($customization['datas'][_CUSTOMIZE_TEXTFIELD_] AS $text)
|
foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] AS $text)
|
||||||
$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';
|
$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';
|
||||||
|
|
||||||
if (isset($customization['datas'][_CUSTOMIZE_FILE_]))
|
if (isset($customization['datas'][Product::CUSTOMIZE_FILE]))
|
||||||
$customizationText .= sizeof($customization['datas'][_CUSTOMIZE_FILE_]) .' '. Tools::displayError('image(s)').'<br />';
|
$customizationText .= sizeof($customization['datas'][Product::CUSTOMIZE_FILE]) .' '. Tools::displayError('image(s)').'<br />';
|
||||||
|
|
||||||
$customizationText .= '---<br />';
|
$customizationText .= '---<br />';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ class ReferralProgramModule extends ObjectModel
|
|||||||
$discount->id_discount_type = (int)$configurations['REFERRAL_DISCOUNT_TYPE'];
|
$discount->id_discount_type = (int)$configurations['REFERRAL_DISCOUNT_TYPE'];
|
||||||
|
|
||||||
/* % */
|
/* % */
|
||||||
if ($configurations['REFERRAL_DISCOUNT_TYPE'] == 1)
|
if ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::PERCENT)
|
||||||
$discount->value = (float)$configurations['REFERRAL_PERCENTAGE'];
|
$discount->value = (float)$configurations['REFERRAL_PERCENTAGE'];
|
||||||
/* Fixed amount */
|
/* Fixed amount */
|
||||||
elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == 2 AND isset($configurations['REFERRAL_DISCOUNT_VALUE_'.(int)($id_currency)]))
|
elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::AMOUNT AND isset($configurations['REFERRAL_DISCOUNT_VALUE_'.(int)($id_currency)]))
|
||||||
$discount->value = (float)$configurations['REFERRAL_DISCOUNT_VALUE_'.(int)($id_currency)];
|
$discount->value = (float)$configurations['REFERRAL_DISCOUNT_VALUE_'.(int)($id_currency)];
|
||||||
/* Unknown or value undefined for this currency (configure your module correctly) */
|
/* Unknown or value undefined for this currency (configure your module correctly) */
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ XML;
|
|||||||
$discount = $product->addChild('discount');
|
$discount = $product->addChild('discount');
|
||||||
$discount->addChild('discount-quantity', intval($quantityDiscount['quantity']));
|
$discount->addChild('discount-quantity', intval($quantityDiscount['quantity']));
|
||||||
$discount->addChild('discount-value', floatval($quantityDiscount['value']));
|
$discount->addChild('discount-value', floatval($quantityDiscount['value']));
|
||||||
$discount->addChild('discount-type', ($quantityDiscount['id_discount_type'] == 1 ? $defaultCurrencyIsoCode : '%'));
|
$discount->addChild('discount-type', ($quantityDiscount['id_discount_type'] == Discount::PERCENT ? $defaultCurrencyIsoCode : '%'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ $_LANGADM['AdminAttachments0071aa279bd1583754a544277740f047'] = 'Supprimer objet
|
|||||||
$_LANGADM['AdminAttachments4a21a191879a23aa2a27829300da95f5'] = 'Cette pièce jointe est utilisée par les produits suivants :';
|
$_LANGADM['AdminAttachments4a21a191879a23aa2a27829300da95f5'] = 'Cette pièce jointe est utilisée par les produits suivants :';
|
||||||
$_LANGADM['AdminAttributeGenerator233c543a23378c4ffd0e1efb17408510'] = 'Impact sur le prix :';
|
$_LANGADM['AdminAttributeGenerator233c543a23378c4ffd0e1efb17408510'] = 'Impact sur le prix :';
|
||||||
$_LANGADM['AdminAttributeGenerator792467936100838046f749e63dadfbdb'] = 'Impact sur le poids :';
|
$_LANGADM['AdminAttributeGenerator792467936100838046f749e63dadfbdb'] = 'Impact sur le poids :';
|
||||||
|
$_LANGADM['AdminAttributeGenerator13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||||
|
$_LANGADM['AdminAttributeGenerator9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||||
$_LANGADM['AdminAttributeGenerator42dc1497090b299a41c64d1389e6ca8c'] = 'HT :';
|
$_LANGADM['AdminAttributeGenerator42dc1497090b299a41c64d1389e6ca8c'] = 'HT :';
|
||||||
$_LANGADM['AdminAttributeGenerator419cdd539861e743b872b2c959629a54'] = 'TTC :';
|
$_LANGADM['AdminAttributeGenerator419cdd539861e743b872b2c959629a54'] = 'TTC :';
|
||||||
$_LANGADM['AdminAttributeGenerator18c17dae7b84c21b38873e823af2bcfe'] = 'produit(s) créé(s) avec succès.';
|
$_LANGADM['AdminAttributeGenerator18c17dae7b84c21b38873e823af2bcfe'] = 'produit(s) créé(s) avec succès.';
|
||||||
@@ -85,6 +87,8 @@ $_LANGADM['AdminAttributeGenerator32b919d18cfaca89383f6000dcc9c031'] = 'Génére
|
|||||||
$_LANGADM['AdminAttributeGeneratorc0babe5601b3f91313d53267c3c7ec24'] = 'Revenir au produit';
|
$_LANGADM['AdminAttributeGeneratorc0babe5601b3f91313d53267c3c7ec24'] = 'Revenir au produit';
|
||||||
$_LANGADM['AdminAttributeGeneratorec211f7c20af43e742bf2570c3cb84f9'] = 'Ajouter';
|
$_LANGADM['AdminAttributeGeneratorec211f7c20af43e742bf2570c3cb84f9'] = 'Ajouter';
|
||||||
$_LANGADM['AdminAttributeGeneratorf2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
|
$_LANGADM['AdminAttributeGeneratorf2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
|
||||||
|
$_LANGADM['AdminAttributes13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||||
|
$_LANGADM['AdminAttributes9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||||
$_LANGADM['AdminAttributesf2bbdf9f72c085adc4d0404e370f0f4c'] = 'Attribut';
|
$_LANGADM['AdminAttributesf2bbdf9f72c085adc4d0404e370f0f4c'] = 'Attribut';
|
||||||
$_LANGADM['AdminAttributes4e140ba723a03baa6948340bf90e2ef6'] = 'Nom :';
|
$_LANGADM['AdminAttributes4e140ba723a03baa6948340bf90e2ef6'] = 'Nom :';
|
||||||
$_LANGADM['AdminAttributes6252c0f2c2ed83b7b06dfca86d4650bb'] = 'Caractères interdits :';
|
$_LANGADM['AdminAttributes6252c0f2c2ed83b7b06dfca86d4650bb'] = 'Caractères interdits :';
|
||||||
@@ -103,6 +107,8 @@ $_LANGADM['AdminAttributes19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
|||||||
$_LANGADM['AdminAttributesGroups49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
$_LANGADM['AdminAttributesGroups49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
||||||
$_LANGADM['AdminAttributesGroups287234a1ff35a314b5b6bc4e5828e745'] = 'Attributs';
|
$_LANGADM['AdminAttributesGroups287234a1ff35a314b5b6bc4e5828e745'] = 'Attributs';
|
||||||
$_LANGADM['AdminAttributesGroups630f6dc397fe74e52d5189e2c80f282b'] = 'Retour à la liste';
|
$_LANGADM['AdminAttributesGroups630f6dc397fe74e52d5189e2c80f282b'] = 'Retour à la liste';
|
||||||
|
$_LANGADM['AdminAttributesGroups13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||||
|
$_LANGADM['AdminAttributesGroups9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||||
$_LANGADM['AdminAttributesGroups8196c2d7a6dce8aea8acbeac4105ef81'] = 'Ajouter un groupe d\'attributs';
|
$_LANGADM['AdminAttributesGroups8196c2d7a6dce8aea8acbeac4105ef81'] = 'Ajouter un groupe d\'attributs';
|
||||||
$_LANGADM['AdminAttributesGroups88a306e559954dc8c8ae9eb55d62297f'] = 'Ajouter une déclinaison';
|
$_LANGADM['AdminAttributesGroups88a306e559954dc8c8ae9eb55d62297f'] = 'Ajouter une déclinaison';
|
||||||
$_LANGADM['AdminAttributesGroupsb63e3071db26cee88d595c4573f8f34e'] = 'Cliquez sur le nom du groupe pour voir ses attributs. Cliquez à nouveau pour les masquer.';
|
$_LANGADM['AdminAttributesGroupsb63e3071db26cee88d595c4573f8f34e'] = 'Cliquez sur le nom du groupe pour voir ses attributs. Cliquez à nouveau pour les masquer.';
|
||||||
@@ -363,6 +369,10 @@ $_LANGADM['AdminCategories6637b53a5820cef0817b7f2a2553bfc8'] = 'Affichée :';
|
|||||||
$_LANGADM['AdminCategories00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
|
$_LANGADM['AdminCategories00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
|
||||||
$_LANGADM['AdminCategoriesb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
|
$_LANGADM['AdminCategoriesb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
|
||||||
$_LANGADM['AdminCategories66f2dd0c775eff24ac95c38347bcaf9a'] = 'Catégorie parente :';
|
$_LANGADM['AdminCategories66f2dd0c775eff24ac95c38347bcaf9a'] = 'Catégorie parente :';
|
||||||
|
$_LANGADM['AdminCategories8cf04a9734132302f96da8e113e80ce5'] = 'Accueil';
|
||||||
|
$_LANGADM['AdminCategoriesef7de3f485174ff47f061ad27d83d0ee'] = 'sélectionnée(s)';
|
||||||
|
$_LANGADM['AdminCategoriesb56c3bda503a8dc4be356edb0cc31793'] = 'Replier tout';
|
||||||
|
$_LANGADM['AdminCategories5ffd7a335dd836b3373f5ec570a58bdc'] = 'Etendre tout';
|
||||||
$_LANGADM['AdminCategoriesd0042a700e9bdf79689d63ee6846dc0e'] = 'Description :';
|
$_LANGADM['AdminCategoriesd0042a700e9bdf79689d63ee6846dc0e'] = 'Description :';
|
||||||
$_LANGADM['AdminCategories461900b74731e07320ca79366df3e809'] = 'Image :';
|
$_LANGADM['AdminCategories461900b74731e07320ca79366df3e809'] = 'Image :';
|
||||||
$_LANGADM['AdminCategoriesf0eaa209893a6bb5512c9876037b82be'] = 'Charger le logo de la catégorie à partir de votre ordinateur';
|
$_LANGADM['AdminCategoriesf0eaa209893a6bb5512c9876037b82be'] = 'Charger le logo de la catégorie à partir de votre ordinateur';
|
||||||
@@ -791,6 +801,8 @@ $_LANGADM['AdminDiscounts153d0acf0df787b54f7302940a72d280'] = 'Quantité totale
|
|||||||
$_LANGADM['AdminDiscounts9b07d8d7f793121a9a69500562f7e25d'] = 'Quantité par personne :';
|
$_LANGADM['AdminDiscounts9b07d8d7f793121a9a69500562f7e25d'] = 'Quantité par personne :';
|
||||||
$_LANGADM['AdminDiscounts05be82dd4fff82f72167941221540c9f'] = 'Nombre d\'utilisation maximum par un même utilisateur';
|
$_LANGADM['AdminDiscounts05be82dd4fff82f72167941221540c9f'] = 'Nombre d\'utilisation maximum par un même utilisateur';
|
||||||
$_LANGADM['AdminDiscounts9f6e99bdd4184b83dc478d0ab1b4cbf7'] = 'Montant minimum d\'achat';
|
$_LANGADM['AdminDiscounts9f6e99bdd4184b83dc478d0ab1b4cbf7'] = 'Montant minimum d\'achat';
|
||||||
|
$_LANGADM['AdminDiscounts887ee91702c962a70b87cbef07bbcaec'] = 'HT';
|
||||||
|
$_LANGADM['AdminDiscountse2e79605fc9450ec17957cf0e910f5c6'] = 'TTC';
|
||||||
$_LANGADM['AdminDiscounts4f5e701d9688498a831fe5d2c8b14062'] = '0 si non applicable';
|
$_LANGADM['AdminDiscounts4f5e701d9688498a831fe5d2c8b14062'] = '0 si non applicable';
|
||||||
$_LANGADM['AdminDiscountsd7f9e940c5055ccbcdb08849e1eb47df'] = 'Cumulable avec d\'autres bons de réduction';
|
$_LANGADM['AdminDiscountsd7f9e940c5055ccbcdb08849e1eb47df'] = 'Cumulable avec d\'autres bons de réduction';
|
||||||
$_LANGADM['AdminDiscounts5ee348002fb5ec8e0abee8d46d279c75'] = 'Cumulable avec les promotions';
|
$_LANGADM['AdminDiscounts5ee348002fb5ec8e0abee8d46d279c75'] = 'Cumulable avec les promotions';
|
||||||
@@ -884,6 +896,8 @@ $_LANGADM['AdminEmployees19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
|||||||
$_LANGADM['AdminFeatures49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
$_LANGADM['AdminFeatures49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
||||||
$_LANGADM['AdminFeaturesc82a6100dace2b41087ba6cf99a5976a'] = 'Valeurs';
|
$_LANGADM['AdminFeaturesc82a6100dace2b41087ba6cf99a5976a'] = 'Valeurs';
|
||||||
$_LANGADM['AdminFeaturesea59bdc2e534a7c88b324959995c0cb2'] = 'Retour à la liste des caractéristiques';
|
$_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['AdminFeatures9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||||
$_LANGADM['AdminFeaturesd6ae681fcd58f1e1936ca97da36528ff'] = 'Ajouter une nouvelle caractéristique';
|
$_LANGADM['AdminFeaturesd6ae681fcd58f1e1936ca97da36528ff'] = 'Ajouter une nouvelle caractéristique';
|
||||||
$_LANGADM['AdminFeatures0c8a987e64c2d46886bf92e29c736bdc'] = 'Ajouter une nouvelle valeur de caractéristique';
|
$_LANGADM['AdminFeatures0c8a987e64c2d46886bf92e29c736bdc'] = 'Ajouter une nouvelle valeur de caractéristique';
|
||||||
$_LANGADM['AdminFeatures1e0f6215dd017b783915dc1b422aeaab'] = 'Cliquez sur le nom d\'une caractéristique afin de voir les valeurs ensuite cliquez de nouveau si vous souhaitez les cacher.';
|
$_LANGADM['AdminFeatures1e0f6215dd017b783915dc1b422aeaab'] = 'Cliquez sur le nom d\'une caractéristique afin de voir les valeurs ensuite cliquez de nouveau si vous souhaitez les cacher.';
|
||||||
@@ -902,6 +916,8 @@ $_LANGADM['AdminFeatures6252c0f2c2ed83b7b06dfca86d4650bb'] = 'Caractères interd
|
|||||||
$_LANGADM['AdminFeatures817b35caca2afa11b6c1efc428315470'] = 'Groupe de boutiques associé';
|
$_LANGADM['AdminFeatures817b35caca2afa11b6c1efc428315470'] = 'Groupe de boutiques associé';
|
||||||
$_LANGADM['AdminFeatures38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
$_LANGADM['AdminFeatures38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
||||||
$_LANGADM['AdminFeatures19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
$_LANGADM['AdminFeatures19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
||||||
|
$_LANGADM['AdminFeaturesValues13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||||
|
$_LANGADM['AdminFeaturesValues9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||||
$_LANGADM['AdminFeaturesValues0c8a987e64c2d46886bf92e29c736bdc'] = 'Ajouter une nouvelle valeur de caractéristique';
|
$_LANGADM['AdminFeaturesValues0c8a987e64c2d46886bf92e29c736bdc'] = 'Ajouter une nouvelle valeur de caractéristique';
|
||||||
$_LANGADM['AdminFeaturesValuesacdb802bfc2b99b15d1782570285c427'] = 'Contenu :';
|
$_LANGADM['AdminFeaturesValuesacdb802bfc2b99b15d1782570285c427'] = 'Contenu :';
|
||||||
$_LANGADM['AdminFeaturesValues6252c0f2c2ed83b7b06dfca86d4650bb'] = 'Caractères interdits :';
|
$_LANGADM['AdminFeaturesValues6252c0f2c2ed83b7b06dfca86d4650bb'] = 'Caractères interdits :';
|
||||||
@@ -1623,6 +1639,8 @@ $_LANGADM['AdminModulesPositions9ee91b01130064edd60d330a3888d17e'] = 'Fichiers p
|
|||||||
$_LANGADM['AdminModulesPositions8a6617dfa35ce54642fc61fd53935a91'] = 'Merci de taper chaque nom de fichier séparé par une virgule';
|
$_LANGADM['AdminModulesPositions8a6617dfa35ce54642fc61fd53935a91'] = 'Merci de taper chaque nom de fichier séparé par une virgule';
|
||||||
$_LANGADM['AdminModulesPositionsc9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
|
$_LANGADM['AdminModulesPositionsc9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
|
||||||
$_LANGADM['AdminModulesPositions19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
$_LANGADM['AdminModulesPositions19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
|
||||||
|
$_LANGADM['AdminModulesPositionsec211f7c20af43e742bf2570c3cb84f9'] = 'Ajouter';
|
||||||
|
$_LANGADM['AdminModulesPositions1063e38cb53d94d386f21227fcd84717'] = 'Supprimer';
|
||||||
$_LANGADM['AdminOrderMessageb718adec73e04ce3ec720dd11a06a308'] = 'ID';
|
$_LANGADM['AdminOrderMessageb718adec73e04ce3ec720dd11a06a308'] = 'ID';
|
||||||
$_LANGADM['AdminOrderMessage49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
$_LANGADM['AdminOrderMessage49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
||||||
$_LANGADM['AdminOrderMessage4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message';
|
$_LANGADM['AdminOrderMessage4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message';
|
||||||
@@ -1848,6 +1866,18 @@ $_LANGADM['AdminPerformance93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
|
|||||||
$_LANGADM['AdminPerformancebafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
|
$_LANGADM['AdminPerformancebafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
|
||||||
$_LANGADM['AdminPerformance0d6bf1934cab1de045b189eed03c3d42'] = 'Devrait être activé sauf pour les tests et debug.';
|
$_LANGADM['AdminPerformance0d6bf1934cab1de045b189eed03c3d42'] = 'Devrait être activé sauf pour les tests et debug.';
|
||||||
$_LANGADM['AdminPerformance38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
$_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['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';
|
||||||
|
$_LANGADM['AdminPerformance765647690a434de97cda4a20aca21d2e'] = 'Groupe d\'attribut';
|
||||||
|
$_LANGADM['AdminPerformanceb07e7131a6007b2a1a765bdd0e1e4894'] = 'Caractéristique:';
|
||||||
|
$_LANGADM['AdminPerformanceb3a0f0a71a06c4cb37e4aeb9fc6b0235'] = 'L\'onglet \"Caractéristique\" lors de l\'édition d\'un produit';
|
||||||
|
$_LANGADM['AdminPerformance21021ea0e52be8e9c599f4dff41e5be0'] = 'Caractéristique';
|
||||||
|
$_LANGADM['AdminPerformance6c3205f235918451faca3dcd6e63d760'] = 'Valeur de caractéristique';
|
||||||
$_LANGADM['AdminPerformancef4efdd180586cba038b52f2471e4075d'] = 'CCC (Concaténation, Compression et mise en Cache)';
|
$_LANGADM['AdminPerformancef4efdd180586cba038b52f2471e4075d'] = 'CCC (Concaténation, Compression et mise en Cache)';
|
||||||
$_LANGADM['AdminPerformanceecffc19cb5ada347980c0fd06ca337f4'] = 'CCC vous permet de réduire le temps de chargement de vos pages en Front Office. Avec ces fonctionnalités, vous allez gagner en performances sans modifier le code source de votre Front Office. Soyez sûr que votre thème est compatible avec PrestaShop 1.4+. Dans le cas contraire, CCC peut causer des problèmes.';
|
$_LANGADM['AdminPerformanceecffc19cb5ada347980c0fd06ca337f4'] = 'CCC vous permet de réduire le temps de chargement de vos pages en Front Office. Avec ces fonctionnalités, vous allez gagner en performances sans modifier le code source de votre Front Office. Soyez sûr que votre thème est compatible avec PrestaShop 1.4+. Dans le cas contraire, CCC peut causer des problèmes.';
|
||||||
$_LANGADM['AdminPerformancec7ceaefb9d7fd3731ae2a28abad2cb95'] = '\"Smart cache\" pour les feuilles de style';
|
$_LANGADM['AdminPerformancec7ceaefb9d7fd3731ae2a28abad2cb95'] = '\"Smart cache\" pour les feuilles de style';
|
||||||
@@ -2232,6 +2262,8 @@ $_LANGADM['AdminProductsc795dfff10a7c952f4c5438951e9ece9'] = 'Image de couvertur
|
|||||||
$_LANGADM['AdminProducts640768b710007698d5bffb4d1de56d67'] = 'Modifier cette image';
|
$_LANGADM['AdminProducts640768b710007698d5bffb4d1de56d67'] = 'Modifier cette image';
|
||||||
$_LANGADM['AdminProducts7be66046997731ac05844f11ee4f6a76'] = 'Supprimer cette image';
|
$_LANGADM['AdminProducts7be66046997731ac05844f11ee4f6a76'] = 'Supprimer cette image';
|
||||||
$_LANGADM['AdminProductsfc55a6e78b7d33b0241db646dc913ef9'] = 'Modifier cette déclinaison';
|
$_LANGADM['AdminProductsfc55a6e78b7d33b0241db646dc913ef9'] = 'Modifier cette déclinaison';
|
||||||
|
$_LANGADM['AdminProducts13cdf2d0d1b996ad3a141e297c62ea6b'] = 'Cette fonctionnalité a était désactivée, vous pouvez l\'activer sur cette page:';
|
||||||
|
$_LANGADM['AdminProducts9a63ec735f057c1366284bda67eee7de'] = 'Performances';
|
||||||
$_LANGADM['AdminProducts6f39383b81d4999830ab6febe6279777'] = 'Ajouter ou modifier des déclinaisons de produit';
|
$_LANGADM['AdminProducts6f39383b81d4999830ab6febe6279777'] = 'Ajouter ou modifier des déclinaisons de produit';
|
||||||
$_LANGADM['AdminProducts3ea3291e42b4f5eae395f389ce9a88d5'] = 'Générateur de déclinaisons de produit';
|
$_LANGADM['AdminProducts3ea3291e42b4f5eae395f389ce9a88d5'] = 'Générateur de déclinaisons de produit';
|
||||||
$_LANGADM['AdminProducts1aa4c641d6920ddb97a2562f8ec53853'] = 'Groupe :';
|
$_LANGADM['AdminProducts1aa4c641d6920ddb97a2562f8ec53853'] = 'Groupe :';
|
||||||
|
|||||||
Reference in new issue
Block a user