Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
Fabio Chelly
2013-10-23 10:55:35 +02:00
13 changed files with 41 additions and 29 deletions
@@ -656,11 +656,11 @@
var id_product = Number(this.id_product);
var id_product_attribute = Number(this.id_product_attribute);
cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity;
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="' + formatCurrency(parseFloat(this.price.replace(',', '.')), currency_format, currency_sign, currency_blank) + '" /></td><td>';
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="' + formatCurrency(this.numeric_price, currency_format, currency_sign, currency_blank) + '" /></td><td>';
cart_content += (!this.id_customization ? '<div style="float:left;"><a href="#" class="increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><img src="../img/admin/up.gif" /></a><br /><a href="#" class="decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'"><img src="../img/admin/down.gif" /></a></div>' : '');
cart_content += (!this.id_customization ? '<div style="float:left;"><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" class="cart_quantity" size="2" value="'+this.cart_quantity+'" />' : '');
cart_content += (!this.id_customization ? '<a href="#" class="delete_product" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><img src="../img/admin/delete.gif" /></a></div>' : '');
cart_content += '</td><td>' + formatCurrency(parseFloat(this.total.replace(',', '.')), currency_format, currency_sign, currency_blank) + '</td></tr>';
cart_content += '</td><td>' + formatCurrency(this.numeric_total, currency_format, currency_sign, currency_blank) + '</td></tr>';
if (this.id_customization && this.id_customization != 0)
{
+14 -10
View File
@@ -128,32 +128,36 @@ class FeatureValueCore extends ObjectModel
return $tab['value'];
}
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null)
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null, $custom = false)
{
$id_feature_value = false;
if (!is_null($id_product) && $id_product)
{
$id_feature_value = Db::getInstance()->getValue('
SELECT `id_feature_value`
FROM '._DB_PREFIX_.'feature_product
WHERE `id_feature` = '.(int)$id_feature.'
AND `id_product` = '.(int)$id_product);
SELECT fp.`id_feature_value`
FROM '._DB_PREFIX_.'feature_product fp
INNER JOIN '._DB_PREFIX_.'feature_value fv USING (`id_feature_value`)
WHERE fp.`id_feature` = '.(int)$id_feature.'
AND fv.`custom` = '.(int)$custom.'
AND fp.`id_product` = '.(int)$id_product);
if ($id_feature_value && !is_null($id_lang) && $id_lang)
if ($custom && $id_feature_value && !is_null($id_lang) && $id_lang)
Db::getInstance()->execute('
UPDATE '._DB_PREFIX_.'feature_value_lang
SET `value` = \''.pSQL($value).'\'
WHERE `id_feature_value` = '.(int)$id_feature_value.'
AND `value` != \''.pSQL($value).'\'
AND `id_lang` = '.(int)$id_lang);
}
if (!$id_feature_value)
if (!$custom)
$id_feature_value = Db::getInstance()->getValue('
SELECT fv.`id_feature_value`
FROM '._DB_PREFIX_.'feature_value fv
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`)
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value` AND fvl.`id_lang` = '.(int)$id_lang.')
WHERE `value` = \''.pSQL($value).'\'
AND fv.`id_feature` = '.(int)$id_feature.'
AND fv.`custom` = 0
GROUP BY fv.`id_feature_value`');
if ($id_feature_value)
@@ -162,7 +166,7 @@ class FeatureValueCore extends ObjectModel
// Feature doesn't exist, create it
$feature_value = new FeatureValue();
$feature_value->id_feature = (int)$id_feature;
$feature_value->custom = 0;
$feature_value->custom = (bool)$custom;
foreach (Language::getLanguages() as $language)
$feature_value->value[$language['id_lang']] = $value;
$feature_value->add();
+1
View File
@@ -3590,6 +3590,7 @@ class ProductCore extends ObjectModel
if ($result3)
{
$result3['id_feature_value'] = $new_id_feature_value;
$result3['value'] = pSQL($result3['value']);
$return &= Db::getInstance()->insert('feature_value_lang', $result3);
}
}
@@ -551,6 +551,8 @@ class AdminCartsControllerCore extends AdminController
if (count($summary['products']))
foreach ($summary['products'] as &$product)
{
$product['numeric_price'] = $product['price'];
$product['numeric_total'] = $product['total'];
$product['price'] = str_replace($currency->sign, '', Tools::displayPrice($product['price'], $currency));
$product['total'] = str_replace($currency->sign, '', Tools::displayPrice($product['total'], $currency));
$product['image_link'] = $this->context->link->getImageLink($product['link_rewrite'], $product['id_image'], 'small_default');
+8 -9
View File
@@ -247,7 +247,7 @@ class AdminImportControllerCore extends AdminController
'delete_existing_images' => array(
'label' => $this->l('Delete existing images (0 = No, 1 = Yes)')
),
'features' => array('label' => $this->l('Feature(Name:Value:Position)')),
'features' => array('label' => $this->l('Feature(Name:Value:Position:Customized)')),
'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')),
'condition' => array('label' => $this->l('Condition')),
'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')),
@@ -472,9 +472,8 @@ class AdminImportControllerCore extends AdminController
}
$this->separator = Tools::substr(strval(trim(Tools::getValue('separator', ','))), 0, 1);
$this->multiple_value_separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator', ';'))), 0, 1);
$this->separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator : ';';
$this->multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : ',';
parent::__construct();
}
@@ -569,8 +568,8 @@ class AdminImportControllerCore extends AdminController
$this->context->cookie->entity_selected = (int)Tools::getValue('entity');
$this->context->cookie->iso_lang_selected = base64_encode(Tools::getValue('iso_lang'));
$this->context->cookie->separator_selected = base64_encode(Tools::getValue('separator'));
$this->context->cookie->multiple_value_separator_selected = base64_encode(Tools::getValue('multiple_value_separator'));
$this->context->cookie->separator_selected = base64_encode($this->separator);
$this->context->cookie->multiple_value_separator_selected = base64_encode($this->multiple_value_separator);
$this->context->cookie->csv_selected = base64_encode(Tools::getValue('csv'));
$this->tpl_view_vars = array(
@@ -1138,7 +1137,7 @@ class AdminImportControllerCore extends AdminController
else
$product = new Product();
if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product'))
if (isset($product->id) && $product->id && Product::existsInDatabase((int)$product->id, 'product'))
{
$product->loadStockData();
$category_data = Product::getProductCategories((int)$product->id);
@@ -1602,13 +1601,14 @@ class AdminImportControllerCore extends AdminController
$feature_name = isset($tab_feature[0]) ? trim($tab_feature[0]) : '';
$feature_value = isset($tab_feature[1]) ? trim($tab_feature[1]) : '';
$position = isset($tab_feature[2]) ? (int)$tab_feature[2] : false;
$custom = isset($tab_feature[3]) ? (int)$tab_feature[3] : false;
if(!empty($feature_name) && !empty($feature_value))
{
$id_feature = (int)Feature::addFeatureImport($feature_name, $position);
$id_product = null;
if (Tools::getValue('forceIDs') || Tools::getValue('match_ref'))
$id_product = (int)$product->id;
$id_feature_value = (int)FeatureValue::addFeatureValueImport($id_feature, $feature_value, $id_product, $id_lang);
$id_feature_value = (int)FeatureValue::addFeatureValueImport($id_feature, $feature_value, $id_product, $id_lang, $custom);
Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value);
}
}
@@ -1626,7 +1626,6 @@ class AdminImportControllerCore extends AdminController
StockAvailable::setQuantity((int)$product->id, 0, $product->quantity, $this->context->shop->id);
}
$this->closeCsvFile($handle);
}
@@ -1387,7 +1387,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
true,
$supply_order->id);
if (!$res)
if ($res)
StockAvailable::synchronize($supply_order_detail->id_product);
else
$this->errors[] = Tools::displayError($this->l('Something went wrong when adding products to the warehouse.'));
$location = Warehouse::getProductLocation($supply_order_detail->id_product,
@@ -1221,6 +1221,8 @@ class AdminTranslationsControllerCore extends AdminController
// Set the path of selected theme
if ($this->theme_selected)
define('_PS_THEME_SELECTED_DIR_', _PS_ROOT_DIR_.'/themes/'.$this->theme_selected.'/');
else
define('_PS_THEME_SELECTED_DIR_', '');
// Get type of translation
if (($type = Tools::getValue('type')) && !is_array($type))
+1 -1
View File
@@ -73,7 +73,7 @@ function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
if (currencyFormat == 4)
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
if (currencyFormat == 5)
return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign);
return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.'));
return price;
}
+3 -1
View File
@@ -88,7 +88,9 @@ class LoyaltyModule extends ObjectModel
$currentContext = Context::getContext();
$context = clone $currentContext;
$context->cart = $cart;
$context->customer = new Customer($context->cart->id_customer);
// if customer is logged we do not recreate it
if(!$context->customer->isLogged(true))
$context->customer = new Customer($context->cart->id_customer);
$context->language = new Language($context->cart->id_lang);
$context->shop = new Shop($context->cart->id_shop);
$context->currency = new Currency($context->cart->id_currency, null, $context->shop->id);
+2 -2
View File
@@ -151,7 +151,7 @@
<td style="text-align: right; width: 10%">
{if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
-{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
{else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
{elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
-{$order_detail.reduction_percent}%
{else}
--
@@ -289,4 +289,4 @@
</table>
{/if}
</div>
</div>
+1 -1
View File
@@ -147,7 +147,7 @@
<td style="text-align: right; width: 10%">
{if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
-{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
{else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
{elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
-{$order_detail.reduction_percent}%
{else}
--
+1 -1
View File
@@ -95,7 +95,7 @@ function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
if (currencyFormat == 4)
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
if (currencyFormat == 5)
return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign);
return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.'));
return price;
}
+1 -1
View File
@@ -51,7 +51,7 @@
{if $invoice AND $invoiceAllowed}
<li>
<img src="{$img_dir}icon/pdf.gif" alt="" class="icon" />
<a href="{$link->getPageLink('pdf-invoice', true)}?id_order={$order->id|intval}{if $is_guest}&secure_key={$order->secure_key}{/if}" data-ajax="false">{l s='Download your invoice as a PDF file.'}</li>
<a href="{$link->getPageLink('pdf-invoice', true)}?id_order={$order->id|intval}{if $is_guest}&secure_key={$order->secure_key}{/if}" data-ajax="false">{l s='Download your invoice as a PDF file.'}
</li>
{/if}
{if $order->recyclable}