Merge branch 'release' into development

This commit is contained in:
Francois Gaillard
2013-03-07 18:11:34 +01:00
23 changed files with 162 additions and 81 deletions
@@ -39,13 +39,13 @@
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
name="latitude"
id="latitude"
value="{$fields_value[$input.name]|htmlentities}" /> /
value="{$fields_value[$input.name]|escape:'htmlall'}" /> /
<input type="text"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
name="longitude"
id="longitude"
value="{$fields_value['longitude']|htmlentities}" />
value="{$fields_value['longitude']|escape:'htmlall'}" />
{else}
{$smarty.block.parent}
{/if}
@@ -82,7 +82,7 @@
{foreach $fields_value.days as $k => $value}
<tr style="color: #7F7F7F; font-size: 0.85em;">
<td>{$value}</td>
<td><input type="text" size="25" name="hours_{$k}" value="{if isset($fields_value.hours[$k-1])}{$fields_value.hours[$k-1]|htmlentities}{/if}" /><br /></td>
<td><input type="text" size="25" name="hours_{$k}" value="{if isset($fields_value.hours[$k-1])}{$fields_value.hours[$k-1]|escape:'htmlall'}{/if}" /><br /></td>
</tr>
{/foreach}
</table>
+3 -1
View File
@@ -131,6 +131,7 @@ class Autoload
if ((file_exists($filename) && !is_writable($filename)) || !is_writable(dirname($filename)))
{
header('HTTP/1.1 503 temporarily overloaded');
// Cannot use PrestaShopException in this context
die('/cache/class_index.php is not writable, please give write permissions (chmod 666) on this file.');
}
else
@@ -154,7 +155,8 @@ class Autoload
if (!$integrity_is_ok)
{
file_put_contents($filename, '<?php return array(); ?>');
throw new PrestaShopException('Your file '.$filename.' is corrupted. Please remove this file, a new one will be regenerated automatically');
// Cannot use PrestaShopException in this context
die('Your file '.$filename.' is corrupted. Please remove this file, a new one will be regenerated automatically');
}
}
+1 -1
View File
@@ -292,7 +292,7 @@ class CartCore extends ObjectModel
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_invoice')
$address_id = (int)$cart->id_address_invoice;
else
$address_id = (int)$product->id_address_delivery; // Get delivery address of the product from the cart
$address_id = (int)$product['id_address_delivery']; // Get delivery address of the product from the cart
if (!Address::addressExists($address_id))
$address_id = null;
+11 -11
View File
@@ -65,7 +65,7 @@ class MailCore
'PS_MAIL_SMTP_PORT',
'PS_MAIL_METHOD',
'PS_MAIL_TYPE'
));
), null, null, $id_shop);
// Returns immediatly if emails are deactivated
if ($configuration['PS_MAIL_METHOD'] == 3)
@@ -183,7 +183,7 @@ class MailCore
if (!$connection)
return false;
$swift = new Swift($connection, Configuration::get('PS_MAIL_DOMAIN'));
$swift = new Swift($connection, Configuration::get('PS_MAIL_DOMAIN', null, null, $id_shop));
/* Get templates content */
$iso = Language::getIsoById((int)$id_lang);
if (!$iso)
@@ -197,13 +197,13 @@ class MailCore
$override_mail = false;
// get templatePath
if (preg_match('#'.__PS_BASE_URI__.'modules/#', $template_path) && preg_match('#modules/([a-z0-9_-]+)/#ui', $template_path, $res))
if (preg_match('#'.__PS_BASE_URI__.'modules/#', str_replace(DIRECTORY_SEPARATOR, '/', $template_path)) && preg_match('#modules/([a-z0-9_-]+)/#ui', str_replace(DIRECTORY_SEPARATOR, '/',$template_path), $res))
$module_name = $res[1];
if ($module_name !== false && (file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.txt') ||
file_exists($theme_path.'modules/'.$module_name.'/mails/'.$template.'.html')))
$template_path = $theme_path.'modules/'.$module_name.'/mails/';
else if (file_exists($theme_path.'mails/'.$template.'.txt') || file_exists($theme_path.'mails/'.$template.'.html'))
elseif (file_exists($theme_path.'mails/'.$template.'.txt') || file_exists($theme_path.'mails/'.$template.'.html'))
{
$template_path = $theme_path.'mails/';
$override_mail = true;
@@ -229,19 +229,19 @@ class MailCore
include_once(_PS_MAIL_DIR_.$iso.'/lang.php');
/* Create mail and attach differents parts */
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME').'] '.$subject);
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
/* Set Message-ID - getmypid() is blocked on some hosting */
$message->setId(Mail::generateId());
$message->headers->setEncoding('Q');
if (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))
$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL');
if (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $id_shop)))
$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $id_shop);
else
{
if (file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO')))
$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO');
if (file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO', null, null, $id_shop)))
$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO', null, null, $id_shop);
else
$template_vars['{shop_logo}'] = '';
}
@@ -250,12 +250,12 @@ class MailCore
if (isset($logo))
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo)));
$template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME'));
$template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME', null, null, $id_shop));
$template_vars['{shop_url}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'index.php';
$template_vars['{my_account_url}'] = Context::getContext()->link->getPageLink('my-account', true, Context::getContext()->language->id);
$template_vars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink('guest-tracking', true, Context::getContext()->language->id);
$template_vars['{history_url}'] = Context::getContext()->link->getPageLink('history', true, Context::getContext()->language->id);
$template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR'));
$template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR', null, null, $id_shop));
$swift->attachPlugin(new Swift_Plugin_Decorator(array($to_plugin => $template_vars)), 'decorator');
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT)
$message->attach(new Swift_Message_Part($template_txt, 'text/plain', '8bit', 'utf-8'));
+1 -1
View File
@@ -148,7 +148,7 @@ class NotificationCore
return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'employee`
SET `id_last_'.bqSQL($type).'` = (
SELECT MAX(`id_'.$type.'`)
SELECT IFNULL(MAX(`id_'.$type.'`), 0)
FROM `'._DB_PREFIX_.(($type == 'order') ? bqSQL($type).'s' : bqSQL($type)).'`
)
WHERE `id_employee` = '.(int)$cookie->id_employee);
+20 -1
View File
@@ -4737,7 +4737,8 @@ class ProductCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la
ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\'
AND pa.`id_product` = '.(int)$id_product);
AND pa.`id_product` = '.(int)$id_product.'
AND pac.`id_product_attribute` = '.(int)$id_product_attribute);
if (!empty($nb_custom_values))
{
@@ -4780,6 +4781,7 @@ class ProductCore extends ObjectModel
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
WHERE pa.`id_product` = '.(int)$id_product.'
AND pac.id_product_attribute = '.(int)$id_product_attribute.'
AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')');
$result = array_merge($values_not_custom, $result);
}
@@ -5213,6 +5215,23 @@ class ProductCore extends ObjectModel
);
}
public static function getIdTaxRulesGroupMostUsed()
{
return Db::getInstance()->getValue('
SELECT id_tax_rules_group
FROM (
SELECT COUNT(*) n, product_shop.id_tax_rules_group
FROM '._DB_PREFIX_.'product p
'.Shop::addSqlAssociation('product', 'p').'
JOIN '._DB_PREFIX_.'tax_rules_group trg ON (product_shop.id_tax_rules_group = trg.id_tax_rules_group)
WHERE trg.active = 1
GROUP BY product_shop.id_tax_rules_group
ORDER BY n DESC
LIMIT 1
) most_used'
);
}
/**
* For a given ean13 reference, returns the corresponding id
*
+3 -3
View File
@@ -1201,11 +1201,11 @@ class AdminControllerCore extends Controller
$this->context->smarty->assign('conf', $this->_conf[(int)$conf]);
$notifications_type = array('errors', 'warnings', 'informations', 'confirmations');
foreach($notifications_type as $type)
foreach($notifications_type as $type)
if ($this->json)
$this->context->smarty->assign($type, Tools::jsonEncode($this->$type));
$this->context->smarty->assign($type, Tools::jsonEncode(array_unique($this->$type)));
else
$this->context->smarty->assign($type, $this->$type);
$this->context->smarty->assign($type, array_unique($this->$type));
if ($this->json)
$this->context->smarty->assign('page', Tools::jsonEncode($page));
+1
View File
@@ -330,6 +330,7 @@ class FrontControllerCore extends Controller
'shop_name' => Configuration::get('PS_SHOP_NAME'),
'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
'use_taxes' => (int)Configuration::get('PS_TAX'),
'show_taxes' => (int)(Configuration::get('PS_TAX_DISPLAY') == 1 && (int)Configuration::get('PS_TAX')),
'display_tax_label' => (bool)$display_tax_label,
'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
+1 -6
View File
@@ -51,12 +51,7 @@ class PrestaShopExceptionCore extends Exception
</style>';
echo '<div id="psException">';
echo '<h2>['.get_class($this).']</h2>';
printf(
'<p><b>%s</b><br /><i>at line </i><b>%d</b><i> in file </i><b>%s</b></p>',
Tools::safeOutput($this->getMessage()),
$this->getLine(),
ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $this->getFile()), '/')
);
echo $this->getExentedMessage();
$this->displayFileDebug($this->getFile(), $this->getLine());
+1 -1
View File
@@ -54,7 +54,7 @@ class PDFCore
public function render($display = true)
{
$render = false;
$this->pdf_renderer->setFontForLang('fr');
$this->pdf_renderer->setFontForLang(Context::getContext()->language->iso_code);
foreach ($this->objects as $object)
{
$template = $this->getTemplateObject($object);
+4 -3
View File
@@ -39,7 +39,7 @@ class PDFGeneratorCore extends TCPDF
public $content;
public $font;
public $font_by_lang = array('jp' => 'cid0jp');
public $font_by_lang = array('ja' => 'cid0jp', 'ru' => 'freeserif', 'el' => 'freeserif', 'vn' => 'dejavusans', 'pl' => 'dejavusans');
public function __construct($use_cache = false)
@@ -93,11 +93,12 @@ class PDFGeneratorCore extends TCPDF
public function setFontForLang($iso_lang)
{
$this->font = PDFGenerator::DEFAULT_FONT;
$this->setHeaderFont(array(PDFGenerator::DEFAULT_FONT, '', PDF_FONT_SIZE_MAIN));
$this->setFooterFont(array(PDFGenerator::DEFAULT_FONT, '', PDF_FONT_SIZE_MAIN));
if (array_key_exists($iso_lang, $this->font_by_lang))
$this->font = $this->font_by_lang[$iso_lang];
$this->setHeaderFont(array($this->font, '', PDF_FONT_SIZE_MAIN));
$this->setFooterFont(array($this->font, '', PDF_FONT_SIZE_MAIN));
$this->setFont($this->font);
}
+4 -1
View File
@@ -943,7 +943,10 @@ class ShopCore extends ObjectModel
public static function addSqlRestrictionOnLang($alias = null, $id_shop = null)
{
if (is_null($id_shop))
$id_shop = Shop::getContextShopID();
$id_shop = (int)Context::getContext()->shop->id;
if (!$id_shop)
$id_shop = (int)Configuration::get('PS_SHOP_DEFAULT');
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$id_shop.' ';
}
+9 -7
View File
@@ -141,13 +141,6 @@ else
$context->cookie = $cookie;
/* if the language stored in the cookie is not available language, use default language */
if (isset($cookie->id_lang) && $cookie->id_lang)
$language = new Language($cookie->id_lang);
if (!isset($language) || !Validate::isLoadedObject($language))
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
$context->language = $language;
/* Create employee if in BO, customer else */
if (defined('_PS_ADMIN_DIR_'))
{
@@ -158,10 +151,19 @@ if (defined('_PS_ADMIN_DIR_'))
if ($employee->id_profile != _PS_ADMIN_PROFILE_)
Shop::cacheShops(true);
$language = new Language($employee->id_lang);
$context->language = $language;
$cookie->id_lang = (int)$employee->id_lang;
}
else
{
/* if the language stored in the cookie is not available language, use default language */
if (isset($cookie->id_lang) && $cookie->id_lang)
$language = new Language($cookie->id_lang);
if (!isset($language) || !Validate::isLoadedObject($language))
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
$context->language = $language;
if (isset($cookie->id_customer) && (int)$cookie->id_customer)
{
$customer = new Customer($cookie->id_customer);
+8 -8
View File
@@ -68,7 +68,14 @@ class AdminCmsControllerCore extends AdminController
public function renderForm()
{
if (!$this->loadObject(true))
return;
if (Validate::isLoadedObject($this->object))
$this->display = 'edit';
else
$this->display = 'add';
$this->toolbar_btn['save-and-preview'] = array(
'href' => '#',
'desc' => $this->l('Save and preview')
@@ -79,14 +86,7 @@ class AdminCmsControllerCore extends AdminController
'desc' => $this->l('Save and stay'),
);
$this->initToolbar();
if (!$this->loadObject(true))
return;
if (Validate::isLoadedObject($this->object))
$this->display = 'edit';
else
$this->display = 'add';
$categories = CMSCategory::getCategories($this->context->language->id, false);
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
+66 -21
View File
@@ -239,23 +239,62 @@ class AdminCurrenciesControllerCore extends AdminController
return parent::renderForm();
}
protected function checkDeletion($object)
{
if (Validate::isLoadedObject($object))
{
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
$this->errors[] = $this->l('You cannot delete the default currency');
else
return true;
}
else
$this->errors[] = Tools::displayError('An error occurred while deleting object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return false;
}
protected function checkDisableStatus($object)
{
if (Validate::isLoadedObject($object))
{
if ($object->active && $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
$this->errors[] = $this->l('You cannot disable the default currency');
else
return true;
}
else
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return false;
}
/**
* @see AdminController::processDelete()
*/
public function processDelete()
{
if (Validate::isLoadedObject($object = $this->loadObject()))
$object = $this->loadObject();
if (!$this->checkDeletion($object))
return false;
return parent::processDelete();
}
protected function processBulkDelete()
{
if (is_array($this->boxes) && !empty($this->boxes))
{
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
$this->errors[] = $this->l('You cannot delete the default currency');
else if ($object->delete())
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
else
$this->errors[] = Tools::displayError('An error occurred during deletion.');
foreach ($this->boxes as $id_currency)
{
$object = new Currency((int)$id_currency);
if (!$this->checkDeletion($object))
return false;
}
}
else
$this->errors[] = Tools::displayError('An error occurred while deleting object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return parent::processBulkDelete();
}
/**
@@ -263,19 +302,25 @@ class AdminCurrenciesControllerCore extends AdminController
*/
public function processStatus()
{
if (Validate::isLoadedObject($object = $this->loadObject()))
$object = $this->loadObject();
if (!$this->checkDisableStatus($object))
return false;
return parent::processStatus();
}
protected function processBulkDisableSelection()
{
if (is_array($this->boxes) && !empty($this->boxes))
{
if ($object->active && $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
$this->errors[] = $this->l('You cannot disable the default currency');
else if ($object->toggleStatus())
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category =
(int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token);
else
$this->errors[] = Tools::displayError('An error occurred while updating status.');
foreach ($this->boxes as $id_currency)
{
$object = new Currency((int)$id_currency);
if (!$this->checkDisableStatus($object))
return false;
}
}
else
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
return parent::processBulkDisableSelection();
}
/**
+1 -1
View File
@@ -218,7 +218,7 @@ class AdminEmailsControllerCore extends AdminController
$smtpChecked = (trim(Tools::getValue('mailMethod')) == 'smtp');
$smtpServer = Tools::getValue('smtpSrv');
$content = urldecode(Tools::getValue('testMsg'));
$content = utf8_encode(html_entity_decode($content));
$content = html_entity_decode($content);
$subject = urldecode(Tools::getValue('testSubject'));
$type = 'text/html';
$to = Tools::getValue('testEmail');
+9 -5
View File
@@ -169,7 +169,7 @@ class AdminHomeControllerCore extends AdminController
return;
$shop = Context::getContext()->shop;
if ($_SERVER['HTTP_HOST'] != $shop->domain && $_SERVER['HTTP_HOST'] != $shop->domain_ssl)
if ($_SERVER['HTTP_HOST'] != $shop->domain && $_SERVER['HTTP_HOST'] != $shop->domain_ssl && Tools::getValue('ajax') == false)
$this->displayWarning($this->l('You are currently connected under the following domain name:').' <span style="color: #CC0000;">'.$_SERVER['HTTP_HOST'].'</span><br />'.
$this->l('This is different from the main shop domain name set in the "Multistore" page under the "Advanced Parameters" menu:').' <span style="color: #CC0000;">'.$shop->domain.'</span><br />
<a href="index.php?controller=AdminMeta&token='.Tools::getAdminTokenLite('AdminMeta').'#conf_id_domain">'.
@@ -542,8 +542,12 @@ class AdminHomeControllerCore extends AdminController
{
// Cache the logo
if (!file_exists('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png'))
@copy(htmlentities((string)$partner->logo), '../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png');
{
$logo = @Tools::file_get_contents(htmlentities((string)$partner->logo));
if (sizeof($logo) > 0)
file_put_contents('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png', $logo);
}
// Check if module is not already installed and configured
$display = 0;
if (file_exists('../config/xml/default_country_modules_list.xml') && filesize('../config/xml/default_country_modules_list.xml') > 10)
@@ -619,7 +623,7 @@ class AdminHomeControllerCore extends AdminController
$firstname = $employee->firstname;
$lastname = $employee->lastname;
$email = $employee->email;
$return = @file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country='.strtoupper($isoCountry).'&iso_lang='.strtolower($isoUser).'&host='.urlencode($_SERVER['HTTP_HOST']).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&partner='.htmlentities(Tools::getValue('module')).'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&email='.urlencode($email).'&firstname='.urlencode($firstname).'&lastname='.urlencode($lastname).'&type=home');
$return = @Tools::file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country='.strtoupper($isoCountry).'&iso_lang='.strtolower($isoUser).'&host='.urlencode($_SERVER['HTTP_HOST']).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&partner='.htmlentities(Tools::getValue('module')).'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&email='.urlencode($email).'&firstname='.urlencode($firstname).'&lastname='.urlencode($lastname).'&type=home');
die($return);
}
@@ -632,7 +636,7 @@ class AdminHomeControllerCore extends AdminController
$isoUser = Context::getContext()->language->iso_code;
$isoCountry = Context::getContext()->country->iso_code;
$content = @file_get_contents($protocol.'://api.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&ps_version='.urlencode(_PS_VERSION_), false, $stream_context);
$content = @Tools::file_get_contents($protocol.'://api.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&ps_version='.urlencode(_PS_VERSION_), false, $stream_context);
if (!$content)
return ''; // NOK
@@ -2876,13 +2876,16 @@ class AdminProductsControllerCore extends AdminController
'countries' => $countries,
'groups' => $groups,
'combinations' => $combinations,
'product' => $product,
'multi_shop' => Shop::isFeatureActive(),
'link' => new Link()
));
}
else
{
$this->displayWarning($this->l('You must save this product before adding specific pricing'));
$product->id_tax_rules_group = (int)Product::getIdTaxRulesGroupMostUsed();
$data->assign('ecotax_tax_excl', 0);
}
// prices part
$data->assign(array(
@@ -2893,7 +2896,6 @@ class AdminProductsControllerCore extends AdminController
'ecotaxTaxRate' => Tax::getProductEcotaxRate(),
'tax_exclude_taxe_option' => Tax::excludeTaxeOption(),
'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX'),
'ecotax_tax_excl' => 0
));
$product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context);
+3 -3
View File
@@ -320,7 +320,7 @@ class ProductControllerCore extends FrontController
$product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false);
$address = new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$this->context->smarty->assign(array(
'quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax),
'quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax, $ecotax_tax_amount),
'ecotax_tax_inc' => $ecotax_tax_amount,
'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2),
'ecotaxTax_rate' => $ecotax_rate,
@@ -590,14 +590,14 @@ class ProductControllerCore extends FrontController
$this->context->smarty->assign('customizationFormTarget', $customization_form_target);
}
protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate)
protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate, $ecotax_amount)
{
foreach ($specific_prices as $key => &$row)
{
$row['quantity'] = &$row['from_quantity'];
if ($row['price'] >= 0) // The price may be directly set
{
$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100));
$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100)) + (float)$ecotax_amount;
if ($row['reduction_type'] == 'amount')
$cur_price -= (Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100));
else
+1
View File
@@ -741,6 +741,7 @@ function showErrorMessage(msg, delay)
$(document).ready(function()
{
$('select.chosen').each(function(k, item){
$(item).val($(this).find('option[selected=selected]').val());
$(item).chosen();
if ($(item).hasClass('no-search'))
$(item).next().find('.chzn-search').hide();
+1 -1
View File
@@ -588,7 +588,7 @@ function updateCartSummary(json)
current_price = formatCurrency(product_list[i].price_wt, currencyFormat, currencySign, currencyBlank);
if (reduction && typeof(initial_price) !== 'undefined')
{
if (initial_price !== '' && initial_price > current_price)
if (initial_price !== '' && product_list[i].price_without_quantity_discount > product_list[i].price)
initial_price_text = '<span style="text-decoration:line-through;">'+initial_price+'</span><br />';
}
+1 -1
View File
@@ -166,7 +166,7 @@
{displayPrice price=$total_discounts_negative}
</td>
</tr>
{if $use_taxes}
{if $use_taxes && $show_taxes}
<tr class="cart_total_price">
<td colspan="5">{l s='Total (tax excl.):'}</td>
<td colspan="2" class="price" id="total_price_without_tax">{displayPrice price=$total_price_without_tax}</td>
File diff suppressed because one or more lines are too long