diff --git a/classes/CartRule.php b/classes/CartRule.php index 5fd5e0eb3..b0f7fd4a5 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -219,7 +219,6 @@ class CartRuleCore extends ObjectModel cr.`id_customer` = '.(int)$id_customer.' '.($includeGeneric ? 'OR cr.`id_customer` = 0' : '').' ) - AND highlight = 1 '.($active ? 'AND cr.`active` = 1' : '').' '.($inStock ? 'AND cr.`quantity` > 0' : '')); diff --git a/classes/Customer.php b/classes/Customer.php index b05a0e042..ef3ab32df 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -233,7 +233,7 @@ class CustomerCore extends ObjectModel if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) $this->newsletter_date_add = date('Y-m-d H:i:s'); - if (Context::getContext()->controller->controller_type == 'admin') + if (isset(Context::getContext()->controller) && Context::getContext()->controller->controller_type == 'admin') $this->updateGroup($this->groupBox); if ($this->deleted) diff --git a/classes/Pack.php b/classes/Pack.php index c06b9c003..204dcad09 100644 --- a/classes/Pack.php +++ b/classes/Pack.php @@ -142,8 +142,8 @@ class PackCore extends Product AND a.`id_product_pack` = '.(int)$id_product; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - foreach ($result as &$row) - $row = Product::getTaxesInformations($row); + foreach ($result as &$line) + $line = Product::getTaxesInformations($line); if (!$full) return $result; diff --git a/classes/Tools.php b/classes/Tools.php index f49b44acb..8ec0b5ac0 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -110,7 +110,7 @@ class ToolsCore } /** - * Redirect url wich allready PS_BASE_URI + * Redirect URLs already containing PS_BASE_URI * * @param string $url Desired URL */ @@ -968,15 +968,20 @@ class ToolsCore */ public static function str2url($str) { + static $allow_accented_chars = null; + + if ($allow_accented_chars === null) + $allow_accented_chars = Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); + if (function_exists('mb_strtolower')) $str = mb_strtolower($str, 'utf-8'); $str = trim($str); - if (!function_exists('mb_strtolower') || !Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')) + if (!function_exists('mb_strtolower') || !$allow_accented_chars) $str = Tools::replaceAccentedChars($str); // Remove all non-whitelist chars. - if (Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')) + if ($allow_accented_chars) $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str); else $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str); diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index dcc1e27d7..8a99921a5 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -113,8 +113,18 @@ class AdminCartsControllerCore extends AdminController /* Display order information */ $id_order = (int)Order::getOrderByCartId($cart->id); $order = new Order($id_order); - - if ($order->getTaxCalculationMethod() == PS_TAX_EXC) + if (Validate::isLoadedObject($order)) + { + $tax_calculation_method = $order->getTaxCalculationMethod(); + $id_shop = (int)$order->id_shop; + } + else + { + $id_shop = (int)$cart->id_shop; + $tax_calculation_method = Group::getPriceDisplayMethod(Group::getCurrent()->id); + } + + if ($tax_calculation_method == PS_TAX_EXC) { $total_products = $summary['total_products']; $total_discounts = $summary['total_discounts_tax_exc']; @@ -132,7 +142,7 @@ class AdminCartsControllerCore extends AdminController } foreach ($products as $k => &$product) { - if ($order->getTaxCalculationMethod() == PS_TAX_EXC) + if ($tax_calculation_method == PS_TAX_EXC) { $product['product_price'] = $product['price']; $product['product_total'] = $product['total']; @@ -153,7 +163,7 @@ class AdminCartsControllerCore extends AdminController WHERE id_product = '.(int)$product['id_product'].' AND cover = 1'); $product_obj = new Product($product['id_product']); - $product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int)$order->id_shop); + $product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int)$id_shop); $image_product = new Image($image['id_image']); $product['image'] = (isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$image_product->getExistingImgPath().'.jpg', 'product_mini_'.(int)$product['id_product'].(isset($product['id_product_attribute']) ? '_'.(int)$product['id_product_attribute'] : '').'.jpg', 45, 'jpg') : '--'); diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 78a846db9..9efcf582c 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -329,7 +329,7 @@ class ParentOrderControllerCore extends FrontController $cart_cart_rules = $this->context->cart->getCartRules(); foreach ($available_cart_rules as $key => $available_cart_rule) { - if (strpos($available_cart_rule['code'], 'BO_ORDER_') === 0) + if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], 'BO_ORDER_') === 0) { unset($available_cart_rules[$key]); continue; diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 9f4cd0826..4d8e0c105 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -353,7 +353,7 @@ class MailAlerts extends Module '{delivery_postal_code}' => $delivery->postcode, '{delivery_country}' => $delivery->country, '{delivery_state}' => $delivery->id_state ? $delivery_state->name : '', - '{delivery_phone}' => $delivery->phone, + '{delivery_phone}' => $delivery->phone ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_firstname}' => $invoice->firstname, @@ -364,7 +364,7 @@ class MailAlerts extends Module '{invoice_postal_code}' => $invoice->postcode, '{invoice_country}' => $invoice->country, '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', - '{invoice_phone}' => $invoice->phone, + '{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => sprintf('%06d', $order->id), '{shop_name}' => Configuration::get('PS_SHOP_NAME'), diff --git a/override/classes/_Tools.php b/override/classes/_Tools.php index 771d7d736..065b3eb23 100755 --- a/override/classes/_Tools.php +++ b/override/classes/_Tools.php @@ -77,7 +77,7 @@ class Tools extends ToolsCore /** - * Redirect url wich allready PS_BASE_URI after 5 sec + * Redirect URLs already containing PS_BASE_URI after 5s * * @param string $url Desired URL */ diff --git a/themes/default/discount.tpl b/themes/default/discount.tpl index 790541978..3e4abef8c 100644 --- a/themes/default/discount.tpl +++ b/themes/default/discount.tpl @@ -50,7 +50,7 @@ {if $discountDetail.id_discount_type == 1} {$discountDetail.value|escape:'htmlall':'UTF-8'}% {elseif $discountDetail.id_discount_type == 2} - {convertPrice price=$discountDetail.value} + {convertPrice price=$discountDetail.value} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) {elseif $discountDetail.id_discount_type == 3} {l s='Free shipping'} {else} @@ -76,9 +76,6 @@ {/foreach} -
- *{l s='Tax included'} -
{else}{l s='You do not have any vouchers.'}
{/if}