fix conflicts
@ -14,8 +14,8 @@ class NewOrder
|
||||
'order_policy' => 'manual',
|
||||
'picking_policy' => 'direct',
|
||||
'pricelist_id' => 1, // Euro
|
||||
'warehouse_id' => 7, // Roykin
|
||||
'origin' => 'Roykin Prestashop',
|
||||
'warehouse_id' => 7, // Roykin/Levest
|
||||
'origin' => 'Levest Prestashop',
|
||||
);
|
||||
|
||||
private $line = array(
|
||||
|
@ -160,11 +160,6 @@ class Erporder extends Module
|
||||
|
||||
$order_id = $newOrder->create('sale.order', $newOrder->order);
|
||||
|
||||
if ($invoice_adress->id_country != 8) {
|
||||
// mail('simonet@antadis.com', 'Roykin LOG - alert commande', json_encode($newOrder->order));
|
||||
// mail('thibault@antadis.com', 'Roykin LOG - alert commande', json_encode($newOrder->order));
|
||||
}
|
||||
|
||||
if (!empty($order_id['faultCode'])) {
|
||||
$a = array_merge($order_id, $newOrder->order);
|
||||
ErpTools::logError($a, 'insert into sale.order');
|
||||
|
@ -263,4 +263,228 @@ class Cart extends CartCore
|
||||
|
||||
return $this->_products;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return useful informations for cart
|
||||
*
|
||||
* @return array Cart details
|
||||
*/
|
||||
public function getSummaryDetails($id_lang = null, $refresh = false)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (!$id_lang) {
|
||||
$id_lang = $context->language->id;
|
||||
}
|
||||
|
||||
$delivery = new Address((int)$this->id_address_delivery);
|
||||
$invoice = new Address((int)$this->id_address_invoice);
|
||||
|
||||
// New layout system with personalization fields
|
||||
$formatted_addresses = array(
|
||||
'delivery' => AddressFormat::getFormattedLayoutData($delivery),
|
||||
'invoice' => AddressFormat::getFormattedLayoutData($invoice)
|
||||
);
|
||||
|
||||
$base_total_tax_inc = $this->getOrderTotal(true);
|
||||
$base_total_tax_exc = $this->getOrderTotal(false);
|
||||
|
||||
$total_tax = $base_total_tax_inc - $base_total_tax_exc;
|
||||
|
||||
if ($total_tax < 0) {
|
||||
$total_tax = 0;
|
||||
}
|
||||
|
||||
$currency = new Currency($this->id_currency);
|
||||
|
||||
$products = $this->getProducts($refresh);
|
||||
|
||||
$nbTotalProducts = 0;
|
||||
$nbTotalBottles = 0;
|
||||
foreach ($products as $key => &$product) {
|
||||
$product['price_without_quantity_discount'] = Product::getPriceStatic(
|
||||
$product['id_product'],
|
||||
!Product::getTaxCalculationMethod(),
|
||||
$product['id_product_attribute'],
|
||||
6,
|
||||
null,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
if ($product['reduction_type'] == 'amount') {
|
||||
$reduction = (!Product::getTaxCalculationMethod() ? (float)$product['price_wt'] : (float)$product['price']) - (float)$product['price_without_quantity_discount'];
|
||||
$product['reduction_formatted'] = Tools::displayPrice($reduction);
|
||||
}
|
||||
|
||||
if (!$product['online_only']) {
|
||||
$nbTotalProducts += (int)$product['cart_quantity'];
|
||||
$nbTotalBottles += (int)$product['cart_quantity'] * (int)$product['nb_per_box'];
|
||||
}
|
||||
}
|
||||
unset($product);
|
||||
|
||||
$gift_products = array();
|
||||
$cart_rules = $this->getCartRules();
|
||||
$total_shipping = $this->getTotalShippingCost();
|
||||
$total_shipping_tax_exc = $this->getTotalShippingCost(null, false);
|
||||
$total_products_wt = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS);
|
||||
$total_products = $this->getOrderTotal(false, Cart::ONLY_PRODUCTS);
|
||||
$total_discounts = $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS);
|
||||
$total_discounts_tax_exc = $this->getOrderTotal(false, Cart::ONLY_DISCOUNTS);
|
||||
|
||||
// The cart content is altered for display
|
||||
foreach ($cart_rules as &$cart_rule) {
|
||||
// If the cart rule is automatic (wihtout any code) and include free shipping, it should not be displayed as a cart rule but only set the shipping cost to 0
|
||||
if ($cart_rule['free_shipping'] && (empty($cart_rule['code']) || preg_match('/^'.CartRule::BO_ORDER_CODE_PREFIX.'[0-9]+/', $cart_rule['code']))) {
|
||||
|
||||
$cart_rule['value_real'] -= $total_shipping;
|
||||
$cart_rule['value_tax_exc'] -= $total_shipping_tax_exc;
|
||||
$cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$cart_rule['value_tax_exc'] = Tools::ps_round($cart_rule['value_tax_exc'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
if ($total_discounts > $cart_rule['value_real']) {
|
||||
$total_discounts -= $total_shipping;
|
||||
}
|
||||
if ($total_discounts_tax_exc > $cart_rule['value_tax_exc']) {
|
||||
$total_discounts_tax_exc -= $total_shipping_tax_exc;
|
||||
}
|
||||
|
||||
// Update total shipping
|
||||
$total_shipping = 0;
|
||||
$total_shipping_tax_exc = 0;
|
||||
}
|
||||
|
||||
if ($cart_rule['gift_product']) {
|
||||
foreach ($products as $key => &$product) {
|
||||
if (empty($product['gift']) && $product['id_product'] == $cart_rule['gift_product'] && $product['id_product_attribute'] == $cart_rule['gift_product_attribute']) {
|
||||
// Update total products
|
||||
$total_products_wt = Tools::ps_round($total_products_wt - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$total_products = Tools::ps_round($total_products - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
// Update total discounts
|
||||
$total_discounts = Tools::ps_round($total_discounts - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$total_discounts_tax_exc = Tools::ps_round($total_discounts_tax_exc - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
// Update cart rule value
|
||||
$cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'] - $product['price_wt'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$cart_rule['value_tax_exc'] = Tools::ps_round($cart_rule['value_tax_exc'] - $product['price'], (int)$context->currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
// Update product quantity
|
||||
$product['total_wt'] = Tools::ps_round($product['total_wt'] - $product['price_wt'], (int)$currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$product['total'] = Tools::ps_round($product['total'] - $product['price'], (int)$currency->decimals * _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$product['cart_quantity']--;
|
||||
|
||||
if (!$product['cart_quantity']) {
|
||||
unset($products[$key]);
|
||||
}
|
||||
|
||||
// Add a new product line
|
||||
$gift_product = $product;
|
||||
$gift_product['cart_quantity'] = 1;
|
||||
$gift_product['price'] = 0;
|
||||
$gift_product['price_wt'] = 0;
|
||||
$gift_product['total_wt'] = 0;
|
||||
$gift_product['total'] = 0;
|
||||
$gift_product['gift'] = true;
|
||||
$gift_products[] = $gift_product;
|
||||
|
||||
break; // One gift product per cart rule
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($cart_rules as $key => &$cart_rule) {
|
||||
if (((float)$cart_rule['value_real'] == 0 && (int)$cart_rule['free_shipping'] == 0)) {
|
||||
unset($cart_rules[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// antadis 13161 group products by brands, and get their brand
|
||||
$brands_summary = self::getBrandSummaryWithProducts($products, $context);
|
||||
// antadis 13161 end
|
||||
|
||||
$summary = array(
|
||||
'nbTotalProducts' => $nbTotalProducts,
|
||||
'nbTotalBottles' => $nbTotalBottles,
|
||||
'delivery' => $delivery,
|
||||
'delivery_state' => State::getNameById($delivery->id_state),
|
||||
'invoice' => $invoice,
|
||||
'invoice_state' => State::getNameById($invoice->id_state),
|
||||
'formattedAddresses' => $formatted_addresses,
|
||||
'products' => array_values($products),
|
||||
'gift_products' => $gift_products,
|
||||
'discounts' => array_values($cart_rules),
|
||||
'is_virtual_cart' => (int)$this->isVirtualCart(),
|
||||
'total_discounts' => $total_discounts,
|
||||
'total_discounts_tax_exc' => $total_discounts_tax_exc,
|
||||
'total_wrapping' => $this->getOrderTotal(true, Cart::ONLY_WRAPPING),
|
||||
'total_wrapping_tax_exc' => $this->getOrderTotal(false, Cart::ONLY_WRAPPING),
|
||||
'total_shipping' => $total_shipping,
|
||||
'total_shipping_tax_exc' => $total_shipping_tax_exc,
|
||||
'total_products_wt' => $total_products_wt,
|
||||
'total_products' => $total_products,
|
||||
'total_price' => $base_total_tax_inc,
|
||||
'total_tax' => $total_tax,
|
||||
'total_price_without_tax' => $base_total_tax_exc,
|
||||
'is_multi_address_delivery' => $this->isMultiAddressDelivery() || ((int)Tools::getValue('multi-shipping') == 1),
|
||||
'free_ship' =>!$total_shipping && !count($this->getDeliveryAddressesWithoutCarriers(true, $errors)),
|
||||
'carrier' => new Carrier($this->id_carrier, $id_lang),
|
||||
// antadis 13161 override : add 'brands'
|
||||
'brands' => $brands_summary['category_brands'],
|
||||
'products_per_brand' => $brands_summary['products_per_brand'],
|
||||
// antadis 13161 end override
|
||||
);
|
||||
|
||||
$hook = Hook::exec('actionCartSummary', $summary, null, true);
|
||||
if (is_array($hook)) {
|
||||
$summary = array_merge($summary, array_shift($hook));
|
||||
}
|
||||
|
||||
return $summary;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array products : list of associative arrays. Those products must at least contain the key 'id_category_default'
|
||||
* @param Context context
|
||||
* @return array with keys :
|
||||
*
|
||||
* - category_brands : list of arrays containing only the brands of given product
|
||||
* array(id_category => array('id_category' => '..', 'name' => '...'), id_category => array())
|
||||
*
|
||||
* - products_per_brand : list of arrays containing the given products but indexed by brands
|
||||
* array(id_category => array($product 1, $product 2), ...)
|
||||
*/
|
||||
public static function getBrandSummaryWithProducts(array &$products, $context)
|
||||
{
|
||||
$products_per_brand = array();
|
||||
$category_brands = array();
|
||||
|
||||
if (is_array($products)) {
|
||||
$brand_ids_for_category_ids = Category::getBrandIdsForCategoryIds(array_column($products, 'id_category_default'), $context);
|
||||
$category_brands = Category::getBrands($brand_ids_for_category_ids, $context);
|
||||
|
||||
foreach ($category_brands as $id_brand => $brands) {
|
||||
$products_per_brand[$id_brand] = array();
|
||||
}
|
||||
|
||||
foreach ($products as $product) {
|
||||
if (isset($brand_ids_for_category_ids[$product['id_category_default']])) {
|
||||
$id_brand = $brand_ids_for_category_ids[$product['id_category_default']];
|
||||
$products_per_brand[$id_brand][] = $product;
|
||||
}
|
||||
else {
|
||||
if (!isset($category_brands['other'])) {
|
||||
$category_brands['other'] = array('id_category' => 'other', 'name' => '');
|
||||
}
|
||||
$products_per_brand['other'][] = $product;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'category_brands' => $category_brands,
|
||||
'products_per_brand' => $products_per_brand,
|
||||
);
|
||||
}
|
||||
}
|
@ -2,26 +2,176 @@
|
||||
|
||||
class Category extends CategoryCore
|
||||
{
|
||||
const CATEGORY_HOME = 2;
|
||||
const CATEGORY_COLLECTION = 3;
|
||||
const CATEGORY_COLLECTION_ALL = 8;
|
||||
const CATEGORY_SAVEUR = 12;
|
||||
const CATEGORY_SAVEUR_ALL = 27;
|
||||
const CATEGORY_PLV = 71;
|
||||
const CATEGORY_PLV_ALL = 72;
|
||||
const CATEGORY_TPDBELGE = 75;
|
||||
const CATEGORY_TPDBELGE_ALL = 76;
|
||||
const CATEGORY_LEVEL_BRANDS = 3;
|
||||
|
||||
public static function getCategoriesTree($id_parent, $currentDepth = 0, $depth = 3, $context = null)
|
||||
const CATEGORY_HOME = 2;
|
||||
|
||||
const CATEGORY_BRAND_ROYKIN = 59;
|
||||
const CATEGORY_RANGE_COLLECTION = 3;
|
||||
const CATEGORY_RANGE_ORIGINAL = 8;
|
||||
const CATEGORY_RANGE_SAVEUR = 12;
|
||||
const CATEGORY_RANGE_SAVEUR_TABACS = 27;
|
||||
|
||||
private static $default_sub_category_ids = array();
|
||||
|
||||
public $images = array('logos' => '', 'bkg' => '');
|
||||
|
||||
public function __construct($id_category = null, $id_lang = null, $id_shop = null)
|
||||
{
|
||||
if(!$context)
|
||||
ObjectModel::__construct($id_category, $id_lang, $id_shop);
|
||||
|
||||
$this->image_dir = _PS_CAT_IMG_DIR_;
|
||||
|
||||
if ($this->id) {
|
||||
$path = 'logos/'.$this->id;
|
||||
if (file_exists($this->image_dir.$path.'.jpg')) {
|
||||
$this->images['logos'] = $path.'.jpg';
|
||||
}
|
||||
elseif (file_exists($this->image_dir.$path.'.png')) {
|
||||
$this->images['logos'] = $path.'.png';
|
||||
}
|
||||
|
||||
$path = 'bkg/'.$this->id;
|
||||
if (file_exists($this->image_dir.$path.'.jpg')) {
|
||||
$this->images['bkg'] = $path.'.jpg';
|
||||
}
|
||||
elseif (file_exists($this->image_dir.$path.'.png')) {
|
||||
$this->images['bkg'] = $path.'.png';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function getDefault($context = null)
|
||||
{
|
||||
return self::CATEGORY_BRAND_ROYKIN;
|
||||
}
|
||||
|
||||
public static function getDefaultSubCategory($id_category, $on_notfound_use_firstsubcategory = false, $context = null)
|
||||
{
|
||||
/*
|
||||
if (empty(self::$default_sub_category_ids)) {
|
||||
self::$default_sub_category_ids = array(
|
||||
self::CATEGORY_HOME => self::CATEGORY_BRAND_ROYKIN,
|
||||
self::CATEGORY_BRAND_ROYKIN => self::CATEGORY_RANGE_ORIGINAL
|
||||
);
|
||||
}
|
||||
|
||||
if (isset(self::$default_sub_category_ids[$id_category])) {
|
||||
return self::$default_sub_category_ids[$id_category];
|
||||
}
|
||||
*/
|
||||
if ($on_notfound_use_firstsubcategory) {
|
||||
return self::getFirstSubCategory($id_category, $context);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function getFirstSubCategory($id_category, $context = null)
|
||||
{
|
||||
if(!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
|
||||
if($currentDepth >= $depth)
|
||||
$id_sub_category = Db::getInstance()->getValue(
|
||||
'SELECT c.`id_category`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON cs.`id_category` = c.`id_category`
|
||||
WHERE c.`id_parent` = '.(int)$id_category.'
|
||||
AND c.`active` = 1
|
||||
AND cs.`id_shop` = '.(int)$context->shop->id.'
|
||||
ORDER BY cs.`position` ASC'
|
||||
);
|
||||
|
||||
if (empty($id_sub_category)) {
|
||||
$id_sub_category = -1;
|
||||
}
|
||||
|
||||
return $id_sub_category;
|
||||
}
|
||||
|
||||
public static function getBrands($only_category_ids = null, $context = null)
|
||||
{
|
||||
return false;
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT DISTINCT c.`id_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = c.`id_category`
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON cs.`id_category` = c.`id_category`
|
||||
WHERE c.`active` = 1
|
||||
AND c.`level_depth` = '.(int)self::CATEGORY_LEVEL_BRANDS.'
|
||||
AND cl.`id_lang` = '.$context->language->id.'
|
||||
AND cs.`id_shop` = '.$context->shop->id.'
|
||||
AND cl.`id_shop` = '.$context->shop->id;
|
||||
|
||||
if (is_array($only_category_ids) && !empty($only_category_ids)) {
|
||||
$query .= ' AND c.`id_category` IN ('.implode(',', array_map('pSQL', $only_category_ids)).')';
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY c.`level_depth`, cs.`position` ASC';
|
||||
|
||||
$brands = array();
|
||||
foreach(Db::getInstance()->executeS($query) as $r) {
|
||||
$brands[$r['id_category']] = $r;
|
||||
}
|
||||
|
||||
return $brands;
|
||||
}
|
||||
|
||||
public static function getBrandIdsForCategoryIds(array $category_ids, $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
|
||||
$all_categories = array();
|
||||
foreach (Db::getInstance()->executeS('
|
||||
SELECT DISTINCT c.`id_category`, c.`id_parent`, c.`level_depth`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON cs.`id_category` = c.`id_category`
|
||||
WHERE c.`level_depth` >= '.(int)self::CATEGORY_LEVEL_BRANDS.'
|
||||
AND cs.`id_shop` = '.(int)$context->shop->id.'
|
||||
ORDER BY c.`id_category` ASC
|
||||
') as $r) {
|
||||
$all_categories[$r['id_category']] = array($r['level_depth'], $r['id_parent']);
|
||||
}
|
||||
|
||||
$brand_ids_for_category_ids = array();
|
||||
|
||||
foreach ($category_ids as $id_category) {
|
||||
$found = false;
|
||||
$id_current_category = $id_category;
|
||||
while (!$found) {
|
||||
if ($all_categories[$id_current_category][0] == self::CATEGORY_LEVEL_BRANDS) {
|
||||
$brand_ids_for_category_ids[$id_category] = $id_current_category;
|
||||
$found = true;
|
||||
}
|
||||
elseif (isset($all_categories[$id_current_category])){
|
||||
$id_current_category = $all_categories[$id_current_category][1];
|
||||
}
|
||||
else {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $brand_ids_for_category_ids;
|
||||
}
|
||||
|
||||
|
||||
public static function getCategoriesTree($id_parent, $currentDepth = 0, $depth = 3, $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
|
||||
if ($currentDepth >= $depth) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$query = '
|
||||
@ -39,9 +189,8 @@ class Category extends CategoryCore
|
||||
|
||||
$categories = Db::getInstance()->executeS($query);
|
||||
|
||||
if(!$categories)
|
||||
{
|
||||
return false;
|
||||
if (!$categories) {
|
||||
return array();
|
||||
}
|
||||
|
||||
foreach($categories as $key => $category)
|
||||
@ -60,4 +209,52 @@ class Category extends CategoryCore
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
public function getImageLogo()
|
||||
{
|
||||
if (empty($this->images['logos'])) {
|
||||
return '';
|
||||
}
|
||||
return _THEME_CAT_DIR_.$this->images['logos'];
|
||||
}
|
||||
|
||||
public function getImageBackground()
|
||||
{
|
||||
if (empty($this->images['bkg'])) {
|
||||
return '';
|
||||
}
|
||||
return _THEME_CAT_DIR_.$this->images['bkg'];
|
||||
}
|
||||
|
||||
public function deleteSpecificImage($folder, $thumb_image_type)
|
||||
{
|
||||
if (!$this->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (preg_match('/[a-z]+/i', $folder)!==1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->images[$folder])) {
|
||||
if (file_exists($this->image_dir.$this->images[$folder]) && !unlink($this->image_dir.$this->images[$folder])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.$this->getThumbnailFilename($folder, $thumb_image_type))
|
||||
&& !unlink(_PS_TMP_IMG_DIR_.$this->getThumbnailFilename($folder, $thumb_image_type))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getThumbnailFilename($folder, $thumb_image_type)
|
||||
{
|
||||
$thumb = self::$definition['table'].'_'.strtr($folder, array('/' => '', '.'=>'')).'_'.(int)$this->id.'.'.strtr($thumb_image_type, array('/' => '', '.'=>''));
|
||||
return $thumb;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -305,8 +305,8 @@ class Mail extends MailCore
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$id_lang = Context::getContext()->cookie->id_lang;
|
||||
|
||||
$template_vars['{header_img}'] = 'http://pro.roykin.fr/themes/roykin/mails/header-mail.jpg';
|
||||
$template_vars['{footer_img}'] = 'http://pro.roykin.fr/themes/roykin/mails/footer-mail.jpg';
|
||||
$template_vars['{header_img}'] = Tools::getHttpHost(true).'/themes/roykin/mails/header-mail_levest.jpg';
|
||||
$template_vars['{footer_img}'] = Tools::getHttpHost(true).'/themes/roykin/mails/footer-mail_levest.jpg';
|
||||
|
||||
$template_vars['{box-border-color}'] = '#bfa56d';
|
||||
$template_vars['{box-bg-color}'] = '#ffffff';
|
||||
|
758
override/classes/PaymentModule.php
Normal file
@ -0,0 +1,758 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
abstract class PaymentModule extends PaymentModuleCore
|
||||
{
|
||||
/**
|
||||
* Validate an order in database
|
||||
* Function called from a payment module
|
||||
*
|
||||
* @param int $id_cart
|
||||
* @param int $id_order_state
|
||||
* @param float $amount_paid Amount really paid by customer (in the default currency)
|
||||
* @param string $payment_method Payment method (eg. 'Credit card')
|
||||
* @param null $message Message to attach to order
|
||||
* @param array $extra_vars
|
||||
* @param null $currency_special
|
||||
* @param bool $dont_touch_amount
|
||||
* @param bool $secure_key
|
||||
* @param Shop $shop
|
||||
*
|
||||
* @return bool
|
||||
* @throws PrestaShopException
|
||||
*/
|
||||
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
|
||||
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
|
||||
$secure_key = false, Shop $shop = null)
|
||||
{
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Function called', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
if (!isset($this->context)) {
|
||||
$this->context = Context::getContext();
|
||||
}
|
||||
$this->context->cart = new Cart((int)$id_cart);
|
||||
$this->context->customer = new Customer((int)$this->context->cart->id_customer);
|
||||
// The tax cart is loaded before the customer so re-cache the tax calculation method
|
||||
$this->context->cart->setTaxCalculationMethod();
|
||||
|
||||
$this->context->language = new Language((int)$this->context->cart->id_lang);
|
||||
$this->context->shop = ($shop ? $shop : new Shop((int)$this->context->cart->id_shop));
|
||||
ShopUrl::resetMainDomainCache();
|
||||
$id_currency = $currency_special ? (int)$currency_special : (int)$this->context->cart->id_currency;
|
||||
$this->context->currency = new Currency((int)$id_currency, null, (int)$this->context->shop->id);
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
|
||||
$context_country = $this->context->country;
|
||||
}
|
||||
|
||||
$order_status = new OrderState((int)$id_order_state, (int)$this->context->language->id);
|
||||
if (!Validate::isLoadedObject($order_status)) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order Status cannot be loaded', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('Can\'t load Order status');
|
||||
}
|
||||
|
||||
if (!$this->active) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Module is not active', 3, null, 'Cart', (int)$id_cart, true);
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
// Does order already exists ?
|
||||
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false) {
|
||||
if ($secure_key !== false && $secure_key != $this->context->cart->secure_key) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Secure key does not match', 3, null, 'Cart', (int)$id_cart, true);
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
// For each package, generate an order
|
||||
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||
$package_list = $this->context->cart->getPackageList();
|
||||
$cart_delivery_option = $this->context->cart->getDeliveryOption();
|
||||
|
||||
// If some delivery options are not defined, or not valid, use the first valid option
|
||||
foreach ($delivery_option_list as $id_address => $package) {
|
||||
if (!isset($cart_delivery_option[$id_address]) || !array_key_exists($cart_delivery_option[$id_address], $package)) {
|
||||
foreach ($package as $key => $val) {
|
||||
$cart_delivery_option[$id_address] = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$order_list = array();
|
||||
$order_detail_list = array();
|
||||
|
||||
do {
|
||||
$reference = Order::generateReference();
|
||||
} while (Order::getByReference($reference)->count());
|
||||
|
||||
$this->currentOrderReference = $reference;
|
||||
|
||||
$order_creation_failed = false;
|
||||
$cart_total_paid = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH), 2);
|
||||
|
||||
foreach ($cart_delivery_option as $id_address => $key_carriers) {
|
||||
foreach ($delivery_option_list[$id_address][$key_carriers]['carrier_list'] as $id_carrier => $data) {
|
||||
foreach ($data['package_list'] as $id_package) {
|
||||
// Rewrite the id_warehouse
|
||||
$package_list[$id_address][$id_package]['id_warehouse'] = (int)$this->context->cart->getPackageIdWarehouse($package_list[$id_address][$id_package], (int)$id_carrier);
|
||||
$package_list[$id_address][$id_package]['id_carrier'] = $id_carrier;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Make sure CartRule caches are empty
|
||||
CartRule::cleanCache();
|
||||
$cart_rules = $this->context->cart->getCartRules();
|
||||
foreach ($cart_rules as $cart_rule) {
|
||||
if (($rule = new CartRule((int)$cart_rule['obj']->id)) && Validate::isLoadedObject($rule)) {
|
||||
if ($error = $rule->checkValidity($this->context, true, true)) {
|
||||
$this->context->cart->removeCartRule((int)$rule->id);
|
||||
if (isset($this->context->cookie) && isset($this->context->cookie->id_customer) && $this->context->cookie->id_customer && !empty($rule->code)) {
|
||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
|
||||
Tools::redirect('index.php?controller=order-opc&submitAddDiscount=1&discount_name='.urlencode($rule->code));
|
||||
}
|
||||
Tools::redirect('index.php?controller=order&submitAddDiscount=1&discount_name='.urlencode($rule->code));
|
||||
} else {
|
||||
$rule_name = isset($rule->name[(int)$this->context->cart->id_lang]) ? $rule->name[(int)$this->context->cart->id_lang] : $rule->code;
|
||||
$error = sprintf(Tools::displayError('CartRule ID %1s (%2s) used in this cart is not valid and has been withdrawn from cart'), (int)$rule->id, $rule_name);
|
||||
PrestaShopLogger::addLog($error, 3, '0000002', 'Cart', (int)$this->context->cart->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($package_list as $id_address => $packageByAddress) {
|
||||
foreach ($packageByAddress as $id_package => $package) {
|
||||
/** @var Order $order */
|
||||
$order = new Order();
|
||||
$order->product_list = $package['product_list'];
|
||||
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
|
||||
$address = new Address((int)$id_address);
|
||||
$this->context->country = new Country((int)$address->id_country, (int)$this->context->cart->id_lang);
|
||||
if (!$this->context->country->active) {
|
||||
throw new PrestaShopException('The delivery address country is not active.');
|
||||
}
|
||||
}
|
||||
|
||||
$carrier = null;
|
||||
if (!$this->context->cart->isVirtualCart() && isset($package['id_carrier'])) {
|
||||
$carrier = new Carrier((int)$package['id_carrier'], (int)$this->context->cart->id_lang);
|
||||
$order->id_carrier = (int)$carrier->id;
|
||||
$id_carrier = (int)$carrier->id;
|
||||
} else {
|
||||
$order->id_carrier = 0;
|
||||
$id_carrier = 0;
|
||||
}
|
||||
|
||||
$order->id_customer = (int)$this->context->cart->id_customer;
|
||||
$order->id_address_invoice = (int)$this->context->cart->id_address_invoice;
|
||||
$order->id_address_delivery = (int)$id_address;
|
||||
$order->id_currency = $this->context->currency->id;
|
||||
$order->id_lang = (int)$this->context->cart->id_lang;
|
||||
$order->id_cart = (int)$this->context->cart->id;
|
||||
$order->reference = $reference;
|
||||
$order->id_shop = (int)$this->context->shop->id;
|
||||
$order->id_shop_group = (int)$this->context->shop->id_shop_group;
|
||||
|
||||
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($this->context->customer->secure_key));
|
||||
$order->payment = $payment_method;
|
||||
if (isset($this->name)) {
|
||||
$order->module = $this->name;
|
||||
}
|
||||
$order->recyclable = $this->context->cart->recyclable;
|
||||
$order->gift = (int)$this->context->cart->gift;
|
||||
$order->gift_message = $this->context->cart->gift_message;
|
||||
$order->mobile_theme = $this->context->cart->mobile_theme;
|
||||
$order->conversion_rate = $this->context->currency->conversion_rate;
|
||||
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, 2) : $amount_paid;
|
||||
$order->total_paid_real = 0;
|
||||
|
||||
$order->total_products = (float)$this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
|
||||
$order->total_products_wt = (float)$this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
|
||||
$order->total_discounts_tax_excl = (float)abs($this->context->cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS, $order->product_list, $id_carrier));
|
||||
$order->total_discounts_tax_incl = (float)abs($this->context->cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS, $order->product_list, $id_carrier));
|
||||
$order->total_discounts = $order->total_discounts_tax_incl;
|
||||
|
||||
$order->total_shipping_tax_excl = (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, false, null, $order->product_list);
|
||||
$order->total_shipping_tax_incl = (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, true, null, $order->product_list);
|
||||
$order->total_shipping = $order->total_shipping_tax_incl;
|
||||
|
||||
if (!is_null($carrier) && Validate::isLoadedObject($carrier)) {
|
||||
$order->carrier_tax_rate = $carrier->getTaxesRate(new Address((int)$this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
}
|
||||
|
||||
$order->total_wrapping_tax_excl = (float)abs($this->context->cart->getOrderTotal(false, Cart::ONLY_WRAPPING, $order->product_list, $id_carrier));
|
||||
$order->total_wrapping_tax_incl = (float)abs($this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $order->product_list, $id_carrier));
|
||||
$order->total_wrapping = $order->total_wrapping_tax_incl;
|
||||
|
||||
$order->total_paid_tax_excl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(false, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_incl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid = $order->total_paid_tax_incl;
|
||||
$order->round_mode = Configuration::get('PS_PRICE_ROUND_MODE');
|
||||
$order->round_type = Configuration::get('PS_ROUND_TYPE');
|
||||
|
||||
$order->invoice_date = '0000-00-00 00:00:00';
|
||||
$order->delivery_date = '0000-00-00 00:00:00';
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
// Creating order
|
||||
$result = $order->add();
|
||||
|
||||
if (!$result) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order cannot be created', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('Can\'t save Order');
|
||||
}
|
||||
|
||||
// Amount paid by customer is not the right one -> Status = payment error
|
||||
// We don't use the following condition to avoid the float precision issues : http://www.php.net/manual/en/language.types.float.php
|
||||
// if ($order->total_paid != $order->total_paid_real)
|
||||
// We use number_format in order to compare two string
|
||||
if ($order_status->logable && number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_)) {
|
||||
$id_order_state = Configuration::get('PS_OS_ERROR');
|
||||
}
|
||||
|
||||
$order_list[] = $order;
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - OrderDetail is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
// Insert new Order detail list using cart for the current order
|
||||
$order_detail = new OrderDetail(null, null, $this->context);
|
||||
$order_detail->createList($order, $this->context->cart, $id_order_state, $order->product_list, 0, true, $package_list[$id_address][$id_package]['id_warehouse']);
|
||||
$order_detail_list[] = $order_detail;
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - OrderCarrier is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
// Adding an entry in order_carrier table
|
||||
if (!is_null($carrier)) {
|
||||
$order_carrier = new OrderCarrier();
|
||||
$order_carrier->id_order = (int)$order->id;
|
||||
$order_carrier->id_carrier = (int)$id_carrier;
|
||||
$order_carrier->weight = (float)$order->getTotalWeight();
|
||||
$order_carrier->shipping_cost_tax_excl = (float)$order->total_shipping_tax_excl;
|
||||
$order_carrier->shipping_cost_tax_incl = (float)$order->total_shipping_tax_incl;
|
||||
$order_carrier->add();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The country can only change if the address used for the calculation is the delivery address, and if multi-shipping is activated
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
|
||||
$this->context->country = $context_country;
|
||||
}
|
||||
|
||||
if (!$this->context->country->active) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Country is not active', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('The order address country is not active.');
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Payment is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
// Register Payment only if the order status validate the order
|
||||
if ($order_status->logable) {
|
||||
// $order is the last order loop in the foreach
|
||||
// The method addOrderPayment of the class Order make a create a paymentOrder
|
||||
// linked to the order reference and not to the order id
|
||||
if (isset($extra_vars['transaction_id'])) {
|
||||
$transaction_id = $extra_vars['transaction_id'];
|
||||
} else {
|
||||
$transaction_id = null;
|
||||
}
|
||||
|
||||
if (!$order->addOrderPayment($amount_paid, null, $transaction_id)) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Order Payment', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('Can\'t save Order Payment');
|
||||
}
|
||||
}
|
||||
|
||||
// Next !
|
||||
$only_one_gift = false;
|
||||
$cart_rule_used = array();
|
||||
$products = $this->context->cart->getProducts();
|
||||
|
||||
// Make sure CartRule caches are empty
|
||||
CartRule::cleanCache();
|
||||
foreach ($order_detail_list as $key => $order_detail) {
|
||||
/** @var OrderDetail $order_detail */
|
||||
|
||||
$order = $order_list[$key];
|
||||
if (!$order_creation_failed && isset($order->id)) {
|
||||
if (!$secure_key) {
|
||||
$message .= '<br />'.Tools::displayError('Warning: the secure key is empty, check your payment account before validation');
|
||||
}
|
||||
// Optional message to attach to this order
|
||||
if (isset($message) & !empty($message)) {
|
||||
$msg = new Message();
|
||||
$message = strip_tags($message, '<br>');
|
||||
if (Validate::isCleanHtml($message)) {
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Message is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
$msg->message = $message;
|
||||
$msg->id_cart = (int)$id_cart;
|
||||
$msg->id_customer = (int)($order->id_customer);
|
||||
$msg->id_order = (int)$order->id;
|
||||
$msg->private = 1;
|
||||
$msg->add();
|
||||
}
|
||||
}
|
||||
|
||||
// Insert new Order detail list using cart for the current order
|
||||
//$orderDetail = new OrderDetail(null, null, $this->context);
|
||||
//$orderDetail->createList($order, $this->context->cart, $id_order_state);
|
||||
|
||||
// Construct order detail table for the email
|
||||
$products_list = '';
|
||||
$virtual_product = true;
|
||||
|
||||
$product_var_tpl_list = array();
|
||||
foreach ($order->product_list as $product) {
|
||||
$price = Product::getPriceStatic((int)$product['id_product'], false, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$price_wt = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
$product_price = Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt;
|
||||
|
||||
$product_var_tpl = array(
|
||||
'reference' => $product['reference'],
|
||||
'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''),
|
||||
'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false),
|
||||
'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false),
|
||||
'quantity' => $product['quantity'],
|
||||
'customization' => array(),
|
||||
// antadis 13161 required to sort products by brands in email
|
||||
'id_category_default' => $product['id_category_default'],
|
||||
// antadis 13161 end
|
||||
|
||||
);
|
||||
|
||||
$customized_datas = Product::getAllCustomizedDatas((int)$order->id_cart);
|
||||
if (isset($customized_datas[$product['id_product']][$product['id_product_attribute']])) {
|
||||
$product_var_tpl['customization'] = array();
|
||||
foreach ($customized_datas[$product['id_product']][$product['id_product_attribute']][$order->id_address_delivery] as $customization) {
|
||||
$customization_text = '';
|
||||
if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD])) {
|
||||
foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] as $text) {
|
||||
$customization_text .= $text['name'].': '.$text['value'].'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($customization['datas'][Product::CUSTOMIZE_FILE])) {
|
||||
$customization_text .= sprintf(Tools::displayError('%d image(s)'), count($customization['datas'][Product::CUSTOMIZE_FILE])).'<br />';
|
||||
}
|
||||
|
||||
$customization_quantity = (int)$product['customization_quantity'];
|
||||
|
||||
$product_var_tpl['customization'][] = array(
|
||||
'customization_text' => $customization_text,
|
||||
'customization_quantity' => $customization_quantity,
|
||||
'quantity' => Tools::displayPrice($customization_quantity * $product_price, $this->context->currency, false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$product_var_tpl_list[] = $product_var_tpl;
|
||||
// Check if is not a virutal product for the displaying of shipping
|
||||
if (!$product['is_virtual']) {
|
||||
$virtual_product &= false;
|
||||
}
|
||||
} // end foreach ($products)
|
||||
|
||||
$product_list_txt = '';
|
||||
$product_list_html = '';
|
||||
if (count($product_var_tpl_list) > 0) {
|
||||
$product_list_txt = $this->getEmailTemplateContent('order_conf_product_list.txt', Mail::TYPE_TEXT, $product_var_tpl_list);
|
||||
$product_list_html = $this->getEmailTemplateContent('order_conf_product_list.tpl', Mail::TYPE_HTML, $product_var_tpl_list);
|
||||
}
|
||||
|
||||
$cart_rules_list = array();
|
||||
$total_reduction_value_ti = 0;
|
||||
$total_reduction_value_tex = 0;
|
||||
foreach ($cart_rules as $cart_rule) {
|
||||
$package = array('id_carrier' => $order->id_carrier, 'id_address' => $order->id_address_delivery, 'products' => $order->product_list);
|
||||
$values = array(
|
||||
'tax_incl' => $cart_rule['obj']->getContextualValue(true, $this->context, CartRule::FILTER_ACTION_ALL_NOCAP, $package),
|
||||
'tax_excl' => $cart_rule['obj']->getContextualValue(false, $this->context, CartRule::FILTER_ACTION_ALL_NOCAP, $package)
|
||||
);
|
||||
|
||||
// If the reduction is not applicable to this order, then continue with the next one
|
||||
if (!$values['tax_excl']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// IF
|
||||
// This is not multi-shipping
|
||||
// The value of the voucher is greater than the total of the order
|
||||
// Partial use is allowed
|
||||
// This is an "amount" reduction, not a reduction in % or a gift
|
||||
// THEN
|
||||
// The voucher is cloned with a new value corresponding to the remainder
|
||||
if (count($order_list) == 1 && $values['tax_incl'] > ($order->total_products_wt - $total_reduction_value_ti) && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0) {
|
||||
// Create a new voucher from the original
|
||||
$voucher = new CartRule((int)$cart_rule['obj']->id); // We need to instantiate the CartRule without lang parameter to allow saving it
|
||||
unset($voucher->id);
|
||||
|
||||
// Set a new voucher code
|
||||
$voucher->code = empty($voucher->code) ? substr(md5($order->id.'-'.$order->id_customer.'-'.$cart_rule['obj']->id), 0, 16) : $voucher->code.'-2';
|
||||
if (preg_match('/\-([0-9]{1,2})\-([0-9]{1,2})$/', $voucher->code, $matches) && $matches[1] == $matches[2]) {
|
||||
$voucher->code = preg_replace('/'.$matches[0].'$/', '-'.(intval($matches[1]) + 1), $voucher->code);
|
||||
}
|
||||
|
||||
// Set the new voucher value
|
||||
if ($voucher->reduction_tax) {
|
||||
$voucher->reduction_amount = ($total_reduction_value_ti + $values['tax_incl']) - $order->total_products_wt;
|
||||
|
||||
// Add total shipping amout only if reduction amount > total shipping
|
||||
if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_incl) {
|
||||
$voucher->reduction_amount -= $order->total_shipping_tax_incl;
|
||||
}
|
||||
} else {
|
||||
$voucher->reduction_amount = ($total_reduction_value_tex + $values['tax_excl']) - $order->total_products;
|
||||
|
||||
// Add total shipping amout only if reduction amount > total shipping
|
||||
if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_excl) {
|
||||
$voucher->reduction_amount -= $order->total_shipping_tax_excl;
|
||||
}
|
||||
}
|
||||
if ($voucher->reduction_amount <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->context->customer->isGuest()) {
|
||||
$voucher->id_customer = 0;
|
||||
} else {
|
||||
$voucher->id_customer = $order->id_customer;
|
||||
}
|
||||
|
||||
$voucher->quantity = 1;
|
||||
$voucher->reduction_currency = $order->id_currency;
|
||||
$voucher->quantity_per_user = 1;
|
||||
$voucher->free_shipping = 0;
|
||||
if ($voucher->add()) {
|
||||
// If the voucher has conditions, they are now copied to the new voucher
|
||||
CartRule::copyConditions($cart_rule['obj']->id, $voucher->id);
|
||||
|
||||
$params = array(
|
||||
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
|
||||
'{voucher_num}' => $voucher->code,
|
||||
'{firstname}' => $this->context->customer->firstname,
|
||||
'{lastname}' => $this->context->customer->lastname,
|
||||
'{id_order}' => $order->reference,
|
||||
'{order_name}' => $order->getUniqReference()
|
||||
);
|
||||
Mail::Send(
|
||||
(int)$order->id_lang,
|
||||
'voucher',
|
||||
sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference),
|
||||
$params,
|
||||
$this->context->customer->email,
|
||||
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
$values['tax_incl'] = $order->total_products_wt - $total_reduction_value_ti;
|
||||
$values['tax_excl'] = $order->total_products - $total_reduction_value_tex;
|
||||
}
|
||||
$total_reduction_value_ti += $values['tax_incl'];
|
||||
$total_reduction_value_tex += $values['tax_excl'];
|
||||
|
||||
$order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values, 0, $cart_rule['obj']->free_shipping);
|
||||
|
||||
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && !in_array($cart_rule['obj']->id, $cart_rule_used)) {
|
||||
$cart_rule_used[] = $cart_rule['obj']->id;
|
||||
|
||||
// Create a new instance of Cart Rule without id_lang, in order to update its quantity
|
||||
$cart_rule_to_update = new CartRule((int)$cart_rule['obj']->id);
|
||||
$cart_rule_to_update->quantity = max(0, $cart_rule_to_update->quantity - 1);
|
||||
$cart_rule_to_update->update();
|
||||
}
|
||||
|
||||
$cart_rules_list[] = array(
|
||||
'voucher_name' => $cart_rule['obj']->name,
|
||||
'voucher_reduction' => ($values['tax_incl'] != 0.00 ? '-' : '').Tools::displayPrice($values['tax_incl'], $this->context->currency, false)
|
||||
);
|
||||
}
|
||||
|
||||
$cart_rules_list_txt = '';
|
||||
$cart_rules_list_html = '';
|
||||
if (count($cart_rules_list) > 0) {
|
||||
$cart_rules_list_txt = $this->getEmailTemplateContent('order_conf_cart_rules.txt', Mail::TYPE_TEXT, $cart_rules_list);
|
||||
$cart_rules_list_html = $this->getEmailTemplateContent('order_conf_cart_rules.tpl', Mail::TYPE_HTML, $cart_rules_list);
|
||||
}
|
||||
|
||||
// Specify order id for message
|
||||
$old_message = Message::getMessageByCartId((int)$this->context->cart->id);
|
||||
if ($old_message && !$old_message['private']) {
|
||||
$update_message = new Message((int)$old_message['id_message']);
|
||||
$update_message->id_order = (int)$order->id;
|
||||
$update_message->update();
|
||||
|
||||
// Add this message in the customer thread
|
||||
$customer_thread = new CustomerThread();
|
||||
$customer_thread->id_contact = 0;
|
||||
$customer_thread->id_customer = (int)$order->id_customer;
|
||||
$customer_thread->id_shop = (int)$this->context->shop->id;
|
||||
$customer_thread->id_order = (int)$order->id;
|
||||
$customer_thread->id_lang = (int)$this->context->language->id;
|
||||
$customer_thread->email = $this->context->customer->email;
|
||||
$customer_thread->status = 'open';
|
||||
$customer_thread->token = Tools::passwdGen(12);
|
||||
$customer_thread->add();
|
||||
|
||||
$customer_message = new CustomerMessage();
|
||||
$customer_message->id_customer_thread = $customer_thread->id;
|
||||
$customer_message->id_employee = 0;
|
||||
$customer_message->message = $update_message->message;
|
||||
$customer_message->private = 0;
|
||||
|
||||
if (!$customer_message->add()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while saving message');
|
||||
}
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Hook validateOrder is about to be called', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
// Hook validate order
|
||||
Hook::exec('actionValidateOrder', array(
|
||||
'cart' => $this->context->cart,
|
||||
'order' => $order,
|
||||
'customer' => $this->context->customer,
|
||||
'currency' => $this->context->currency,
|
||||
'orderStatus' => $order_status
|
||||
));
|
||||
|
||||
foreach ($this->context->cart->getProducts() as $product) {
|
||||
if ($order_status->logable) {
|
||||
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
|
||||
}
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order Status is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
// Set the order status
|
||||
$new_history = new OrderHistory();
|
||||
$new_history->id_order = (int)$order->id;
|
||||
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
|
||||
$new_history->addWithemail(true, $extra_vars);
|
||||
|
||||
// Switch to back order if needed
|
||||
if (Configuration::get('PS_STOCK_MANAGEMENT') && ($order_detail->getStockState() || $order_detail->product_quantity_in_stock <= 0)) {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)$order->id;
|
||||
$history->changeIdOrderState(Configuration::get($order->valid ? 'PS_OS_OUTOFSTOCK_PAID' : 'PS_OS_OUTOFSTOCK_UNPAID'), $order, true);
|
||||
$history->addWithemail();
|
||||
}
|
||||
|
||||
unset($order_detail);
|
||||
|
||||
// Order is reloaded because the status just changed
|
||||
$order = new Order((int)$order->id);
|
||||
|
||||
// Send an e-mail to customer (one order = one email)
|
||||
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) {
|
||||
$invoice = new Address((int)$order->id_address_invoice);
|
||||
$delivery = new Address((int)$order->id_address_delivery);
|
||||
$delivery_state = $delivery->id_state ? new State((int)$delivery->id_state) : false;
|
||||
$invoice_state = $invoice->id_state ? new State((int)$invoice->id_state) : false;
|
||||
|
||||
$data = array(
|
||||
'{firstname}' => $this->context->customer->firstname,
|
||||
'{lastname}' => $this->context->customer->lastname,
|
||||
'{email}' => $this->context->customer->email,
|
||||
'{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"),
|
||||
'{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"),
|
||||
'{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array(
|
||||
'firstname' => '<span style="font-weight:bold;">%s</span>',
|
||||
'lastname' => '<span style="font-weight:bold;">%s</span>'
|
||||
)),
|
||||
'{invoice_block_html}' => $this->_getFormatedAddress($invoice, '<br />', array(
|
||||
'firstname' => '<span style="font-weight:bold;">%s</span>',
|
||||
'lastname' => '<span style="font-weight:bold;">%s</span>'
|
||||
)),
|
||||
'{delivery_company}' => $delivery->company,
|
||||
'{delivery_firstname}' => $delivery->firstname,
|
||||
'{delivery_lastname}' => $delivery->lastname,
|
||||
'{delivery_address1}' => $delivery->address1,
|
||||
'{delivery_address2}' => $delivery->address2,
|
||||
'{delivery_city}' => $delivery->city,
|
||||
'{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_mobile,
|
||||
'{delivery_other}' => $delivery->other,
|
||||
'{invoice_company}' => $invoice->company,
|
||||
'{invoice_vat_number}' => $invoice->vat_number,
|
||||
'{invoice_firstname}' => $invoice->firstname,
|
||||
'{invoice_lastname}' => $invoice->lastname,
|
||||
'{invoice_address2}' => $invoice->address2,
|
||||
'{invoice_address1}' => $invoice->address1,
|
||||
'{invoice_city}' => $invoice->city,
|
||||
'{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_mobile,
|
||||
'{invoice_other}' => $invoice->other,
|
||||
'{order_name}' => $order->getUniqReference(),
|
||||
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), null, 1),
|
||||
'{carrier}' => ($virtual_product || !isset($carrier->name)) ? Tools::displayError('No carrier') : $carrier->name,
|
||||
'{payment}' => Tools::substr($order->payment, 0, 32),
|
||||
'{products}' => $product_list_html,
|
||||
'{products_txt}' => $product_list_txt,
|
||||
'{discounts}' => $cart_rules_list_html,
|
||||
'{discounts_txt}' => $cart_rules_list_txt,
|
||||
'{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false),
|
||||
'{total_products}' => Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $order->total_products : $order->total_products_wt, $this->context->currency, false),
|
||||
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false),
|
||||
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false),
|
||||
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false),
|
||||
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false));
|
||||
|
||||
if (is_array($extra_vars)) {
|
||||
$data = array_merge($data, $extra_vars);
|
||||
}
|
||||
|
||||
// Join PDF invoice
|
||||
if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number) {
|
||||
$order_invoice_list = $order->getInvoicesCollection();
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
|
||||
$pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty);
|
||||
$file_attachement['content'] = $pdf->render(false);
|
||||
$file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf';
|
||||
$file_attachement['mime'] = 'application/pdf';
|
||||
} else {
|
||||
$file_attachement = null;
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Mail is about to be sent', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
if (Validate::isEmail($this->context->customer->email)) {
|
||||
Mail::Send(
|
||||
(int)$order->id_lang,
|
||||
'order_conf',
|
||||
Mail::l('Order confirmation', (int)$order->id_lang),
|
||||
$data,
|
||||
$this->context->customer->email,
|
||||
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||
null,
|
||||
null,
|
||||
$file_attachement,
|
||||
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// updates stock in shops
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
|
||||
$product_list = $order->getProducts();
|
||||
foreach ($product_list as $product) {
|
||||
// if the available quantities depends on the physical stock
|
||||
if (StockAvailable::dependsOnStock($product['product_id'])) {
|
||||
// synchronizes
|
||||
StockAvailable::synchronize($product['product_id'], $order->id_shop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$order->updateOrderDetailTax();
|
||||
} else {
|
||||
$error = Tools::displayError('Order creation failed');
|
||||
PrestaShopLogger::addLog($error, 4, '0000002', 'Cart', intval($order->id_cart));
|
||||
die($error);
|
||||
}
|
||||
} // End foreach $order_detail_list
|
||||
|
||||
// Use the last order as currentOrder
|
||||
if (isset($order) && $order->id) {
|
||||
$this->currentOrder = (int)$order->id;
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - End of validateOrder', 1, null, 'Cart', (int)$id_cart, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
$error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
|
||||
PrestaShopLogger::addLog($error, 4, '0000001', 'Cart', intval($this->context->cart->id));
|
||||
die($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the content of $template_name inside the folder current_theme/mails/current_iso_lang/ if found, otherwise in mails/current_iso_lang
|
||||
*
|
||||
* @param string $template_name template name with extension
|
||||
* @param int $mail_type Mail::TYPE_HTML or Mail::TYPE_TXT
|
||||
* @param array $var list send to smarty (antadis 13161 - with id_category_default if list is product list)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getEmailTemplateContent($template_name, $mail_type, $var)
|
||||
{
|
||||
$email_configuration = Configuration::get('PS_MAIL_TYPE');
|
||||
if ($email_configuration != $mail_type && $email_configuration != Mail::TYPE_BOTH) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$theme_template_path = _PS_THEME_DIR_.'mails'.DIRECTORY_SEPARATOR.$this->context->language->iso_code.DIRECTORY_SEPARATOR.$template_name;
|
||||
$default_mail_template_path = _PS_MAIL_DIR_.$this->context->language->iso_code.DIRECTORY_SEPARATOR.$template_name;
|
||||
|
||||
if (Tools::file_exists_cache($theme_template_path)) {
|
||||
$default_mail_template_path = $theme_template_path;
|
||||
}
|
||||
|
||||
if (Tools::file_exists_cache($default_mail_template_path)) {
|
||||
|
||||
// antadis 13161 present products by brands in email
|
||||
if (preg_match('/^order_conf_product_list/', $template_name)===1) {
|
||||
$brands_summary = Cart::getBrandSummaryWithProducts($var, $this->context);
|
||||
$this->context->smarty->assign('category_brands', $brands_summary['category_brands']);
|
||||
$this->context->smarty->assign('products_per_brand', $brands_summary['products_per_brand']);
|
||||
}
|
||||
// antadis 13161 end
|
||||
else {
|
||||
$this->context->smarty->assign('list', $var);
|
||||
}
|
||||
return $this->context->smarty->fetch($default_mail_template_path);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
@ -23,13 +23,13 @@ class FrontController extends FrontControllerCore
|
||||
$nb_customer_not_in_default_group = Db::getInstance()->getValue($sql);
|
||||
if ($nb_customer_not_in_default_group!==FALSE && $nb_customer_not_in_default_group>0) {
|
||||
error_log(
|
||||
'roykin check : '.$nb_customer_not_in_default_group.' customers are not associated with default group id : '.$id_customer_group,
|
||||
'check : '.$nb_customer_not_in_default_group.' customers are not associated with default group id : '.$id_customer_group,
|
||||
0
|
||||
);
|
||||
error_log(
|
||||
'roykin check : '.$nb_customer_not_in_default_group.' customers are not associated with default group id : '.$id_customer_group,
|
||||
'check : '.$nb_customer_not_in_default_group.' customers are not associated with default group id : '.$id_customer_group,
|
||||
1,
|
||||
'figaro+roykincheck@antadis.fr'
|
||||
'figaro+levestcheck@antadis.fr'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
class AdminCategoriesController extends AdminCategoriesControllerCore
|
||||
{
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$this->initToolbar();
|
||||
@ -25,10 +24,13 @@ class AdminCategoriesController extends AdminCategoriesControllerCore
|
||||
return;
|
||||
}
|
||||
|
||||
$image = _PS_CAT_IMG_DIR_.'banners/'.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true, true);
|
||||
// $image = _PS_CAT_IMG_DIR_.'banners/'.$obj->id.'.jpg';
|
||||
// $image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true, true);
|
||||
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
// $image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$image_logo = $this->loadImage($obj, 'logos');
|
||||
$image_bkg = $this->loadImage($obj, 'bkg');
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
@ -94,12 +96,21 @@ class AdminCategoriesController extends AdminCategoriesControllerCore
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Bannière'),
|
||||
'name' => 'banner',
|
||||
'label' => $this->l('Logo menu'),
|
||||
'name' => 'logo',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1&folder=banners',
|
||||
'hint' => $this->l('Upload a category image from your computer.'),
|
||||
'image' => $image_logo['thumb'] ? $image_logo['thumb'] : false,
|
||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1&folder=logos',
|
||||
'hint' => $this->l('Upload a logo JPEG image from your computer.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Logo gauche (bloc produits)'),
|
||||
'name' => 'bkg',
|
||||
'display_image' => true,
|
||||
'image' => $image_bkg['thumb'] ? $image_bkg['thumb'] : false,
|
||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1&folder=bkg',
|
||||
'hint' => $this->l('Upload a background JPEG image from your computer.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
@ -219,44 +230,104 @@ class AdminCategoriesController extends AdminCategoriesControllerCore
|
||||
return AdminController::renderForm();
|
||||
}
|
||||
|
||||
public function postProcess() {
|
||||
|
||||
parent::postProcess();
|
||||
|
||||
$images = array('banner' => 'banners');
|
||||
|
||||
foreach($images as $imageName => $folder)
|
||||
{
|
||||
if(isset($_FILES[$imageName]) && !empty($_FILES[$imageName]['tmp_name']))
|
||||
protected function postImage($id)
|
||||
{
|
||||
ini_set('memory_limit', '512M');
|
||||
|
||||
$images = array(
|
||||
'logo' => array(
|
||||
'folder' => 'logos',
|
||||
'w' => 80,
|
||||
'h' => 80
|
||||
),
|
||||
'bkg' => array(
|
||||
'folder' => 'bkg',
|
||||
'w' => 150,
|
||||
'h' => 150
|
||||
)
|
||||
);
|
||||
|
||||
$obj = $this->loadObject(TRUE);
|
||||
|
||||
foreach($images as $imageName => $infos){
|
||||
if(isset($_FILES[$imageName]) && !empty($_FILES[$imageName]['tmp_name'])){
|
||||
|
||||
if ($error = ImageManager::validateUpload($_FILES[$imageName])) {
|
||||
$this->errors[] = $error;
|
||||
}
|
||||
else {
|
||||
|
||||
$fileTemp = $_FILES[$imageName]['tmp_name'];
|
||||
$fileParts = pathinfo($_FILES[$imageName]['name']);
|
||||
$ext = strtolower($fileParts['extension']);
|
||||
|
||||
if($fileParts['extension'] == 'jpg')
|
||||
{
|
||||
if(!is_dir(_PS_CAT_IMG_DIR_.$folder))
|
||||
mkdir(_PS_CAT_IMG_DIR_.$folder, 0775);
|
||||
if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png') {
|
||||
|
||||
$res = move_uploaded_file($fileTemp, _PS_CAT_IMG_DIR_.$folder.'/'.$obj->id.'.jpg');
|
||||
if(!$res)
|
||||
{
|
||||
$this->errors[] = sprintf(Tools::displayError('An error occured during upload of file %s'), $obj->id.'.jpg');
|
||||
$ext = ($ext=='png') ? 'png' : 'jpg';
|
||||
|
||||
if(!is_dir(_PS_CAT_IMG_DIR_.$infos['folder'])) {
|
||||
mkdir(_PS_CAT_IMG_DIR_.$infos['folder'], 0775);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->confirmations[] = sprintf($this->l('File %s has been uploaded'), $obj->id.'.jpg');
|
||||
|
||||
$target_path = _PS_CAT_IMG_DIR_.$infos['folder'].'/'.$obj->id.'.'.$ext;
|
||||
|
||||
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($fileTemp, $tmpName)) {
|
||||
$this->errors[] = Tools::displayError('An error occurred during the image upload process.');
|
||||
}
|
||||
elseif (!ImageManager::resize($tmpName, $target_path, $infos['w'], $infos['h'], $ext)) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying the image.');
|
||||
}
|
||||
else {
|
||||
$this->confirmations[] = sprintf($this->l('File %s has been uploaded'), $fileParts['basename']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[] = sprintf(Tools::displayError('File %s have not good extension, only .jpg or .png'), $obj->id.'.jpg');
|
||||
else {
|
||||
$this->errors[] = sprintf($this->l('File %s have not good extension, only .jpg or .png'), $fileParts['basename']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !count($this->errors) ? true : false;
|
||||
}
|
||||
|
||||
protected function loadImage($obj, $folder)
|
||||
{
|
||||
$image_basename_path = _PS_CAT_IMG_DIR_.$folder.'/'.$obj->id;
|
||||
|
||||
$image = array(
|
||||
'path' => $image_basename_path.'.jpg',
|
||||
'thumb' => '',
|
||||
'size' => 0
|
||||
);
|
||||
|
||||
if (!file_exists($image['path'])) {
|
||||
$image['path'] = $image_basename_path.'.png';
|
||||
}
|
||||
if (!file_exists($image['path'])) {
|
||||
$image['path'] = '';
|
||||
return $image;
|
||||
}
|
||||
|
||||
$image['thumb'] = ImageManager::thumbnail($image['path'], $obj->getThumbnailFilename($folder, $this->imageType), 350, $this->imageType, true, true);
|
||||
$image['size'] = filesize($image['path']);
|
||||
return $image;
|
||||
}
|
||||
|
||||
public function processDeleteImage()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
if ($object->deleteSpecificImage(Tools::getValue('folder'), $this->imageType)) {
|
||||
$redirect = self::$currentIndex.'&add'.$this->table.'&'.$this->identifier.'='.Tools::getValue($this->identifier).'&conf=7&token='.$this->token;
|
||||
if (!$this->ajax) {
|
||||
$this->redirect_after = $redirect;
|
||||
} else {
|
||||
$this->content = 'ok';
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->errors[] = Tools::displayError('An error occurred while attempting to delete the image. (cannot load object).');
|
||||
return $object;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class AddressController extends AddressControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class AddressesController extends AddressesControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ class AuthController extends AuthControllerCore
|
||||
CartRule::autoAddToCart($this->context);
|
||||
|
||||
if (!$this->ajax) {
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,12 @@
|
||||
|
||||
class CategoryController extends CategoryControllerCore
|
||||
{
|
||||
const MENU_FIRST_LEVEL = 2; // equals to category.level_depth (we don't start at the "home" level, but just below)
|
||||
const MENU_SECOND_LEVEL = 3;
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if(Tools::getIsset('emptyCart'))
|
||||
if (Tools::getIsset('emptyCart'))
|
||||
{
|
||||
$cart = Context::getContext()->cart;
|
||||
$products = $cart->getProducts();
|
||||
@ -15,21 +17,19 @@ class CategoryController extends CategoryControllerCore
|
||||
Tools::redirect($this->context->link->getCategoryLink($this->category->id));
|
||||
}
|
||||
|
||||
if($this->category->id == Category::CATEGORY_COLLECTION)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
$id_category_level_2 = -1;
|
||||
$id_category_level_3 = -1;
|
||||
|
||||
if ($this->category->level_depth == self::MENU_FIRST_LEVEL) {
|
||||
$id_category_level_2 = Category::getDefaultSubCategory($this->category->id, true);
|
||||
}
|
||||
elseif ($this->category->id == Category::CATEGORY_SAVEUR)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_SAVEUR_ALL));
|
||||
|
||||
if ($this->category->level_depth == self::MENU_SECOND_LEVEL || $id_category_level_2 != -1) {
|
||||
$id_category_level_3 = Category::getDefaultSubCategory($this->category->id);
|
||||
}
|
||||
elseif ($this->category->id == Category::CATEGORY_PLV)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_PLV_ALL));
|
||||
}
|
||||
elseif ($this->category->id == Category::CATEGORY_TPDBELGE)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_TPDBELGE_ALL));
|
||||
|
||||
if ($id_category_level_2 != -1 || $id_category_level_3 != -1) {
|
||||
Tools::redirect($this->context->link->getCategoryLink(($id_category_level_3 != -1)?$id_category_level_3:$id_category_level_2));
|
||||
}
|
||||
|
||||
$this->category->hasBanner = file_exists(_PS_CAT_IMG_DIR_ . 'banners/' . $this->category->id_category . '.jpg');
|
||||
@ -38,42 +38,67 @@ class CategoryController extends CategoryControllerCore
|
||||
|
||||
protected function assignSubcategories()
|
||||
{
|
||||
$parent = new Category($this->category->id_parent);
|
||||
$id_selected = array();
|
||||
|
||||
$families = Category::getCategoriesTree(Category::CATEGORY_HOME, 0, 3);
|
||||
|
||||
// Si on est sur une catégorie enfant direct des familles
|
||||
if(in_array($this->category->id_parent, array(Category::CATEGORY_COLLECTION, Category::CATEGORY_SAVEUR, Category::CATEGORY_PLV, Category::CATEGORY_TPDBELGE))) {
|
||||
$categoriesTree = Category::getCategoriesTree($this->category->id_parent, 0, 2);
|
||||
$children = Category::getCategoriesTree($this->category->id_category, 0, 1);
|
||||
|
||||
foreach($families as $key => $category)
|
||||
{
|
||||
$families[$key]['active'] = $category['id_category'] == $this->category->id_parent;
|
||||
// case : the current category is in the first menu level
|
||||
if ($this->category->level_depth == self::MENU_FIRST_LEVEL) {
|
||||
$id_selected['level_1'] = $this->category->id_category;
|
||||
$id_selected['level_2'] = Category::getDefaultSubCategory($this->category->id_category, false);
|
||||
$id_selected['level_3'] = -1;
|
||||
}
|
||||
// case : the current category is a the second menu level
|
||||
elseif ($parent->level_depth == self::MENU_FIRST_LEVEL) {
|
||||
$id_selected['level_1'] = $parent->id_category;
|
||||
$id_selected['level_2'] = $this->category->id_category;
|
||||
$id_selected['level_3'] = Category::getDefaultSubCategory($this->category->id_category, false);
|
||||
}
|
||||
// case : the current category is in the menu level > second level
|
||||
else {
|
||||
$id_selected['level_1'] = $parent->id_parent;
|
||||
$id_selected['level_2'] = $parent->id_category;
|
||||
$id_selected['level_3'] = $this->category->id_category;
|
||||
}
|
||||
|
||||
// Sinon si on est sur un sous-enfant (tabacs, menthe, autres...). On remonte d'un niveau avant de générer l'arbo
|
||||
else
|
||||
{
|
||||
$categoryParent = new Category($this->category->id_parent);
|
||||
$categoriesTree = Category::getCategoriesTree($categoryParent->id_parent, 0, 2);
|
||||
$children = Category::getCategoriesTree($categoryParent->id_category, 0, 1);
|
||||
$menu = array(
|
||||
'level_1' => Category::getCategoriesTree(Category::CATEGORY_HOME, 0, 1),
|
||||
'level_2' => Category::getCategoriesTree($id_selected['level_1'], 0, 1),
|
||||
'level_3' => Category::getCategoriesTree($id_selected['level_2'], 0, 1),
|
||||
);
|
||||
|
||||
foreach($families as $key => $category)
|
||||
{
|
||||
$families[$key]['active'] = $category['id_category'] == $categoryParent->id_parent;
|
||||
}
|
||||
$menu_logo = '';
|
||||
$page_background = '';
|
||||
|
||||
foreach ($menu as $level => $menu_items) {
|
||||
foreach($menu_items as $i => $category) {
|
||||
if ($category['id_category'] == $id_selected[$level]) {
|
||||
$menu[$level][$i]['active'] = true;
|
||||
|
||||
$cat = new Category($category['id_category']);
|
||||
|
||||
$path = $cat->getImageLogo();
|
||||
if (!empty($path)) {
|
||||
$menu_logo = $path;
|
||||
}
|
||||
|
||||
foreach($categoriesTree as $key => $category)
|
||||
{
|
||||
$categoriesTree[$key]['active'] = $category['id_category'] == $this->category->id_parent;
|
||||
$path = $cat->getImageBackground();
|
||||
if (!empty($path)) {
|
||||
$page_background = $path;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$menu[$level][$i]['active'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'families' => $families,
|
||||
'children' => $children,
|
||||
'categoriesTree' => $categoriesTree
|
||||
));
|
||||
'menu_logo' => $menu_logo,
|
||||
'page_background' => $page_background,
|
||||
'families' => $menu['level_1'],
|
||||
'categoriesTree' => $menu['level_2'],
|
||||
'children' => $menu['level_3'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class ContactController extends ContactControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class DiscountController extends DiscountControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
<?php
|
||||
|
||||
class IdentityController extends IdentityControllerCore
|
||||
@ -7,7 +8,7 @@ class IdentityController extends IdentityControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ class IndexController extends IndexControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class MyAccountController extends MyAccountControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ class OrderConfirmationController extends OrderConfirmationControllerCore
|
||||
'order' => $order,
|
||||
'recap' => true,
|
||||
'products' => $summary['products'],
|
||||
'brands' => $summary['brands'],
|
||||
'products_per_brand' => $summary['products_per_brand'],
|
||||
'delivery' => $summary['delivery'],
|
||||
'invoice' => $summary['invoice'],
|
||||
'discounts' => $summary['discounts'],
|
||||
|
221
override/controllers/front/OrderDetailController.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class OrderDetailControllerCore extends FrontController
|
||||
{
|
||||
/**
|
||||
* Start forms process
|
||||
* @see FrontController::postProcess()
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitMessage')) {
|
||||
$idOrder = (int)Tools::getValue('id_order');
|
||||
$msgText = Tools::getValue('msgText');
|
||||
|
||||
if (!$idOrder || !Validate::isUnsignedId($idOrder)) {
|
||||
$this->errors[] = Tools::displayError('The order is no longer valid.');
|
||||
} elseif (empty($msgText)) {
|
||||
$this->errors[] = Tools::displayError('The message cannot be blank.');
|
||||
} elseif (!Validate::isMessage($msgText)) {
|
||||
$this->errors[] = Tools::displayError('This message is invalid (HTML is not allowed).');
|
||||
}
|
||||
if (!count($this->errors)) {
|
||||
$order = new Order($idOrder);
|
||||
if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
|
||||
//check if a thread already exist
|
||||
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($this->context->customer->email, $order->id);
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$cm = new CustomerMessage();
|
||||
if (!$id_customer_thread) {
|
||||
$ct = new CustomerThread();
|
||||
$ct->id_contact = 0;
|
||||
$ct->id_customer = (int)$order->id_customer;
|
||||
$ct->id_shop = (int)$this->context->shop->id;
|
||||
if ($id_product && $order->orderContainProduct($id_product)) {
|
||||
$ct->id_product = $id_product;
|
||||
}
|
||||
$ct->id_order = (int)$order->id;
|
||||
$ct->id_lang = (int)$this->context->language->id;
|
||||
$ct->email = $this->context->customer->email;
|
||||
$ct->status = 'open';
|
||||
$ct->token = Tools::passwdGen(12);
|
||||
$ct->add();
|
||||
} else {
|
||||
$ct = new CustomerThread((int)$id_customer_thread);
|
||||
$ct->status = 'open';
|
||||
$ct->update();
|
||||
}
|
||||
|
||||
$cm->id_customer_thread = $ct->id;
|
||||
$cm->message = $msgText;
|
||||
$cm->ip_address = (int)ip2long($_SERVER['REMOTE_ADDR']);
|
||||
$cm->add();
|
||||
|
||||
if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) {
|
||||
$to = strval(Configuration::get('PS_SHOP_EMAIL'));
|
||||
} else {
|
||||
$to = new Contact((int)Configuration::get('PS_MAIL_EMAIL_MESSAGE'));
|
||||
$to = strval($to->email);
|
||||
}
|
||||
$toName = strval(Configuration::get('PS_SHOP_NAME'));
|
||||
$customer = $this->context->customer;
|
||||
|
||||
$product = new Product($id_product);
|
||||
$product_name = '';
|
||||
if (Validate::isLoadedObject($product) && isset($product->name[(int)$this->context->language->id])) {
|
||||
$product_name = $product->name[(int)$this->context->language->id];
|
||||
}
|
||||
|
||||
if (Validate::isLoadedObject($customer)) {
|
||||
Mail::Send($this->context->language->id, 'order_customer_comment', Mail::l('Message from a customer'),
|
||||
array(
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{email}' => $customer->email,
|
||||
'{id_order}' => (int)$order->id,
|
||||
'{order_name}' => $order->getUniqReference(),
|
||||
'{message}' => Tools::nl2br($msgText),
|
||||
'{product_name}' => $product_name
|
||||
),
|
||||
$to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname);
|
||||
}
|
||||
|
||||
if (Tools::getValue('ajax') != 'true') {
|
||||
Tools::redirect('index.php?controller=order-detail&id_order='.(int)$idOrder);
|
||||
}
|
||||
|
||||
$this->context->smarty->assign('message_confirmation', true);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Order not found');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function displayAjax()
|
||||
{
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign template vars related to page content
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!($id_order = (int)Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) {
|
||||
$this->errors[] = Tools::displayError('Order ID required');
|
||||
} else {
|
||||
$order = new Order($id_order);
|
||||
if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
|
||||
$id_order_state = (int)$order->getCurrentState();
|
||||
$carrier = new Carrier((int)$order->id_carrier, (int)$order->id_lang);
|
||||
$addressInvoice = new Address((int)$order->id_address_invoice);
|
||||
$addressDelivery = new Address((int)$order->id_address_delivery);
|
||||
|
||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
|
||||
|
||||
$invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
|
||||
$deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
|
||||
|
||||
if ($order->total_discounts > 0) {
|
||||
$this->context->smarty->assign('total_old', (float)$order->total_paid - $order->total_discounts);
|
||||
}
|
||||
$products = $order->getProducts();
|
||||
|
||||
/* DEPRECATED: customizedDatas @since 1.5 */
|
||||
$customizedDatas = Product::getAllCustomizedDatas((int)$order->id_cart);
|
||||
Product::addCustomizationPrice($products, $customizedDatas);
|
||||
|
||||
OrderReturn::addReturnedQuantity($products, $order->id);
|
||||
$order_status = new OrderState((int)$id_order_state, (int)$order->id_lang);
|
||||
|
||||
$customer = new Customer($order->id_customer);
|
||||
|
||||
// antadis 13161 group products by brands, and get their brand
|
||||
$brands_summary = Cart::getBrandSummaryWithProducts($products, $this->context);
|
||||
// antadis 13161 end
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'shop_name' => strval(Configuration::get('PS_SHOP_NAME')),
|
||||
'order' => $order,
|
||||
'return_allowed' => (int)$order->isReturnable(),
|
||||
'currency' => new Currency($order->id_currency),
|
||||
'order_state' => (int)$id_order_state,
|
||||
'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'),
|
||||
'invoice' => (OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection())),
|
||||
'logable' => (bool)$order_status->logable,
|
||||
'order_history' => $order->getHistory($this->context->language->id, false, true),
|
||||
'products' => $products,
|
||||
'discounts' => $order->getCartRules(),
|
||||
'carrier' => $carrier,
|
||||
'address_invoice' => $addressInvoice,
|
||||
'invoiceState' => (Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state) ? new State($addressInvoice->id_state) : false,
|
||||
'address_delivery' => $addressDelivery,
|
||||
'inv_adr_fields' => $inv_adr_fields,
|
||||
'dlv_adr_fields' => $dlv_adr_fields,
|
||||
'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues,
|
||||
'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues,
|
||||
'deliveryState' => (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
|
||||
'is_guest' => false,
|
||||
'messages' => CustomerMessage::getMessagesByOrderId((int)$order->id, false),
|
||||
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
|
||||
'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'),
|
||||
'use_tax' => Configuration::get('PS_TAX'),
|
||||
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
|
||||
/* DEPRECATED: customizedDatas @since 1.5 */
|
||||
'customizedDatas' => $customizedDatas,
|
||||
/* DEPRECATED: customizedDatas @since 1.5 */
|
||||
'reorderingAllowed' => !(bool)Configuration::get('PS_DISALLOW_HISTORY_REORDERING'),
|
||||
// antadis 13161 start
|
||||
'products_per_brand' => $brands_summary['products_per_brand'],
|
||||
'brands' => $brands_summary['category_brands'],
|
||||
// antadis 13161 end
|
||||
));
|
||||
|
||||
if ($carrier->url && $order->shipping_number) {
|
||||
$this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
|
||||
}
|
||||
$this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order)));
|
||||
Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order));
|
||||
|
||||
unset($carrier, $addressInvoice, $addressDelivery);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('This order cannot be found.');
|
||||
}
|
||||
unset($order);
|
||||
}
|
||||
|
||||
$this->setTemplate(_PS_THEME_DIR_.'order-detail.tpl');
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ class OrderFollowController extends OrderFollowControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ class OrderSlipController extends OrderSlipControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ class SearchController extends SearchControllerCore
|
||||
parent::initContent();
|
||||
|
||||
$families = Category::getCategoriesTree(Category::CATEGORY_HOME, 0, 1);
|
||||
$categoriesTree = Category::getCategoriesTree(Category::CATEGORY_COLLECTION, 0, 1);
|
||||
$cat = new Category(Category::getDefaultSubCategory(Category::CATEGORY_HOME, false));
|
||||
|
||||
$categoriesTree = Category::getCategoriesTree($cat->id_parent, 0, 1);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'families' => $families,
|
||||
|
@ -7,7 +7,7 @@ class SitemapController extends SitemapControllerCore
|
||||
parent::initContent();
|
||||
if($this->context->customer->logged)
|
||||
{
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::CATEGORY_COLLECTION_ALL));
|
||||
Tools::redirect($this->context->link->getCategoryLink(Category::getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
{capture name=path}
|
||||
{if !isset($email_create)}{l s='Espace professionnel Roykin'}{else}
|
||||
<a href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Espace professionnel Roykin'}">{l s='Espace professionnel Roykin'}</a>
|
||||
{if !isset($email_create)}{l s='Espace professionnel'}{else}
|
||||
<a href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Espace professionnel'}">{l s='Espace professionnel'}</a>
|
||||
{l s='Create your account'}
|
||||
{/if}
|
||||
{/capture}
|
||||
|
||||
{capture name=title}{if !isset($email_create)}{l s='Espace professionnel Roykin'}{else}{l s='Create an account'}{/if}{/capture}
|
||||
{capture name=title}{if !isset($email_create)}{l s='Espace professionnel'}{else}{l s='Create an account'}{/if}{/capture}
|
||||
|
||||
{assign var='stateExist' value=false}
|
||||
{assign var="postCodeExist" value=false}
|
||||
|
@ -6,8 +6,8 @@
|
||||
<main>
|
||||
<section>
|
||||
{include file="$tpl_dir./page-heading.tpl" category=$category type='category'}
|
||||
|
||||
<nav>
|
||||
{*
|
||||
<ul id="family">
|
||||
{foreach from=$families item=family}
|
||||
<li{if $family.active} class="active"{/if}>
|
||||
@ -15,10 +15,17 @@
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
*}
|
||||
<div class="children-ctn">
|
||||
<div class="ctn-fluid">
|
||||
<div class="children{if empty($menu_logo)} no-brand-img{/if}">
|
||||
{if !empty($menu_logo)}
|
||||
<img class="brand-logo" src="{$menu_logo}" alt="" />
|
||||
{/if}
|
||||
<ul id="children-categories">
|
||||
{foreach from=$categoriesTree item=child}
|
||||
{if $child.id_category != 2}
|
||||
<li{if $child.id_category == $category->id || $child.active} class="active"{/if}>
|
||||
<li {if $child.id_category == $category->id || $child.active} class="active"{/if}>
|
||||
<a href="{$child.link}">{$child.name}</a>
|
||||
</li>
|
||||
{/if}
|
||||
@ -27,15 +34,18 @@
|
||||
{hook h="displaySearch"}
|
||||
</li>
|
||||
</ul>
|
||||
{if $children}
|
||||
{if isset($children) && $children|@count>0}
|
||||
<ul id="subchildren-categories">
|
||||
{foreach from=$children item=child}
|
||||
<li{if $child.id_category == $category->id} class="active"{/if}>
|
||||
<li {if $child.id_category == $category->id || $child.active} class="active"{/if}>
|
||||
<a href="{$child.link}">{$child.name}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
@ -44,8 +54,12 @@
|
||||
</div>
|
||||
|
||||
<div class="ctn">
|
||||
|
||||
{if $products}
|
||||
<div class="products-list">
|
||||
{if isset($page_background) && !empty($page_background)}
|
||||
<img class="bg-img" src="{$page_background}" alt="" />
|
||||
{/if}
|
||||
<div class="row">
|
||||
{include file="./product-list.tpl" products=$products nbProduct=3}
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@ body#index main, body#password main { background: #000 }
|
||||
#header #header-cart {
|
||||
}
|
||||
#header #header-cart .shopping-cart {
|
||||
background: url('../img/cart.png') no-repeat left top;
|
||||
background: url('../img/cart_levest.png') no-repeat left top;
|
||||
float: right;
|
||||
height: 120px;
|
||||
padding: 25px 0 0 81px;
|
||||
@ -125,15 +125,32 @@ body#index main, body#password main { background: #000 }
|
||||
#search main nav #family li.active a, #search main nav #family li a:hover,
|
||||
#category main nav #family li.active a, #category main nav #family li a:hover { color: #fff; }
|
||||
|
||||
#search main nav #children-categories,
|
||||
#category main nav #children-categories {
|
||||
.children-ctn {
|
||||
background: #202020;
|
||||
box-shadow: 0 -5px 5px 0px rgba(0, 0, 0, 0.5);
|
||||
padding: 22px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
.children-ctn .brand-logo {
|
||||
height: auto;
|
||||
left: 30px;
|
||||
position: absolute;
|
||||
max-width: 80px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
-moz-transform: translateY(-50%);
|
||||
-webkit-transform: translateY(-50%);
|
||||
z-index: 10;
|
||||
}
|
||||
#search main nav #children-categories,
|
||||
#category main nav #children-categories {
|
||||
padding: 22px;
|
||||
position: relative;
|
||||
padding-left: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
#search main nav .no-brand-img #children-categories,
|
||||
#category main nav .no-brand-img #children-categories { padding-left: 22px; }
|
||||
#search main nav #children-categories li,
|
||||
#category main nav #children-categories li {
|
||||
display: inline-block;
|
||||
@ -146,7 +163,7 @@ body#index main, body#password main { background: #000 }
|
||||
display: block;
|
||||
font-family: 'ITCAvantGarde';
|
||||
font-size: 14px;
|
||||
margin: 0 5px;
|
||||
margin: 5px;
|
||||
padding: 12px 20px;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
@ -198,12 +215,15 @@ body#index main, body#password main { background: #000 }
|
||||
#search main nav #subchildren-categories,
|
||||
#category main nav #subchildren-categories {
|
||||
background: #202020;
|
||||
display: none;
|
||||
padding: 0 15px 22px 15px;
|
||||
display: block;
|
||||
padding: 0 15px 22px 100px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
#search main nav .no-brand-img #subchildren-categories,
|
||||
#category main nav .no-brand-img #subchildren-categories { padding-left: 15px }
|
||||
|
||||
#search main nav #subchildren-categories:before,
|
||||
#category main nav #subchildren-categories:before {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
@ -213,7 +233,7 @@ body#index main, body#password main { background: #000 }
|
||||
height: 1px;
|
||||
margin: 0 0 0 -225px;
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
top: -11px;
|
||||
width: 450px;
|
||||
}
|
||||
#search main nav #subchildren-categories li,
|
||||
@ -222,13 +242,13 @@ body#index main, body#password main { background: #000 }
|
||||
}
|
||||
#search main nav #subchildren-categories li a,
|
||||
#category main nav #subchildren-categories li a {
|
||||
background: #3c3c3c;
|
||||
background: #101010;
|
||||
border-radius: 2px;
|
||||
color: #fff;
|
||||
display: block;
|
||||
font-family: 'ITCAvantGarde';
|
||||
font-size: 13px;
|
||||
margin: 0 5px;
|
||||
margin: 5px;
|
||||
padding: 8px 16px;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
@ -243,7 +263,7 @@ body#index main, body#password main { background: #000 }
|
||||
color: #202020;
|
||||
}
|
||||
|
||||
#category .messages {
|
||||
#category .messages, #search .messages {
|
||||
background: #bfa56d;
|
||||
/*background: -webkit-linear-gradient(top, #dec77f, #d0b878);
|
||||
background: -o-linear-gradient(top, #dec77f, #d0b878);
|
||||
@ -254,7 +274,7 @@ body#index main, body#password main { background: #000 }
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
}
|
||||
#category .message {
|
||||
#category .message, #search .message {
|
||||
|
||||
|
||||
|
||||
@ -278,12 +298,20 @@ body#index main, body#password main { background: #000 }
|
||||
-webkit-transition: all 0.3s ease 0s;
|
||||
-moz-transition: all 0.3s ease 0s;
|
||||
}
|
||||
#category .message.open { opacity: 1; }
|
||||
#category .message.open, #search .message.open { opacity: 1; }
|
||||
#search .products-list,
|
||||
.products-list {
|
||||
margin-bottom: 205px;
|
||||
min-height: 500px;
|
||||
padding: 30px 0;
|
||||
position: relative;
|
||||
}
|
||||
#search .products-list .bg-img,
|
||||
.products-list .bg-img {
|
||||
right: 102%;
|
||||
max-width: 150px;
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
}
|
||||
|
||||
#category .products-list.no-product { font-size: 14px; min-height: 250px; text-align: center; }
|
||||
@ -350,7 +378,7 @@ body#index main, body#password main { background: #000 }
|
||||
text-transform: uppercase;
|
||||
}
|
||||
#cart-bottom .resume {
|
||||
background: url('../img/cart-footer.png') no-repeat left center;
|
||||
background: url('../img/cart-footer_levest.png') no-repeat left center;
|
||||
padding: 15px 15px 15px 80px;
|
||||
}
|
||||
#cart-bottom .price .shipping-cost {
|
||||
@ -407,6 +435,9 @@ body#index main, body#password main { background: #000 }
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (max-width: 1650px) {
|
||||
#search .products-list .bg-img, .products-list .bg-img { display: none; }
|
||||
}
|
||||
@media (max-width: 1420px) {
|
||||
#header { padding: 0 }
|
||||
#header > .ctn { padding: 40px 15px 0 15px; position: static; }
|
||||
@ -420,6 +451,13 @@ body#index main, body#password main { background: #000 }
|
||||
#cart-bottom .btn { text-align: center }
|
||||
#category main nav #children-categories li a { margin: 7px 5px }
|
||||
#header #home-slider { padding-bottom: 30px;}
|
||||
#search .products-list .bg-img, .products-list .bg-img { display: block; max-width: 150px; right: 98% }
|
||||
}
|
||||
@media (max-width: 1280px) {
|
||||
#search .products-list .bg-img, .products-list .bg-img { max-width: 100px; }
|
||||
}
|
||||
@media (max-width: 1180px) {
|
||||
#search .products-list .bg-img, .products-list .bg-img { display: none; }
|
||||
}
|
||||
@media (max-width: 991px) {
|
||||
|
||||
@ -431,7 +469,7 @@ body#index main, body#password main { background: #000 }
|
||||
|
||||
#header-cart { padding-left: 0 }
|
||||
|
||||
#category main nav #children-categories { padding: 15px }
|
||||
#category main nav #children-categories { padding: 15px; padding-left: 100px; }
|
||||
|
||||
|
||||
#category .products-list { padding: 30px 0 }
|
||||
@ -486,6 +524,26 @@ body#index main, body#password main { background: #000 }
|
||||
#shopping-cart-products .products {
|
||||
box-shadow: 0 -4px 5px 0 rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
#shopping-cart-products .products .product-group {
|
||||
border: 3px solid #f4f4f4;
|
||||
margin: 30px 0;
|
||||
padding: 15px;
|
||||
}
|
||||
#shopping-cart-products .product-group .table-row {
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
}
|
||||
#shopping-cart-products .product-group .table-row:last-child { border: 0 }
|
||||
#shopping-cart-products .products .product-group .brand-name {
|
||||
background: #f4f4f4;
|
||||
color: #1e1e1e;
|
||||
font-family: 'ITCAvantGarde';
|
||||
font-size: 14px;
|
||||
margin: -15px;
|
||||
margin-bottom:0px;
|
||||
padding: 15px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#shopping-cart-products .table-row .inner {
|
||||
padding: 15px 0;
|
||||
position: relative;
|
||||
@ -794,7 +852,7 @@ body#index main, body#password main { background: #000 }
|
||||
|
||||
|
||||
@media (max-width: 1420px) {
|
||||
#shopping-cart-products .cart_quantity_button .cart_quantity_input { margin: 0 5px; width: 40px; }
|
||||
#shopping-cart-products .cart_quantity_button .cart_quantity_input { margin: 0 5px; width: 35px; }
|
||||
#shopping-cart-calcul .featured-voucher .voucher_name { line-height: 15px; padding-left: 0 }
|
||||
#shopping-cart-products .product-stock { padding: 0 30px; }
|
||||
#shopping-cart-products .price { font-size: 17px }
|
||||
@ -1236,6 +1294,7 @@ body .addresses {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 1420px) {
|
||||
.account .addresses { margin-bottom: 0 }
|
||||
#order-detail .account .product-row .form-group input { display: block; padding: 0; margin-left: -5px; width: 35px; }
|
||||
@ -1651,3 +1710,13 @@ body .addresses {
|
||||
.loyalty_shopping_cart {
|
||||
font-size:14px !important;
|
||||
}
|
||||
|
||||
#orderdetail .product-group .brand-name {
|
||||
/*background: white;*/ /*#f4f4f4;*/
|
||||
border-bottom: 3px solid #f4f4f4;
|
||||
color: #1e1e1e;
|
||||
font-family: 'ITCAvantGarde';
|
||||
font-size: 14px;
|
||||
padding: 30px 0px 15px 15px ;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
BIN
themes/roykin/img/cart-footer_levest.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
BIN
themes/roykin/img/cart_levest.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
BIN
themes/roykin/img/logo-old.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 19 KiB |
@ -307,7 +307,7 @@ $_LANG['order-detail_cfe1b4b75fb8dc152b124f9305835a11'] = 'Votre message';
|
||||
$_LANG['order-detail_d93651d012e77dac5581b08db33195b2'] = 'Si vous souhaitez nous laisser un commentaire a propos de votre commande, remplissez l\'encart de texte ci-dessous.';
|
||||
$_LANG['order-detail_d95cf4ab2cbf1dfb63f066b50558b07d'] = 'Mon compte';
|
||||
$_LANG['order-detail_deb10517653c255364175796ace3553f'] = 'Produit';
|
||||
$_LANG['order-detail_e02d1a9572b7c323138c99007a6b6c6e'] = 'Prix par boîte';
|
||||
$_LANG['order-detail_e02d1a9572b7c323138c99007a6b6c6e'] = 'Prix';
|
||||
$_LANG['order-detail_e682495785e844d491378817aa34aa3f'] = 'Télécharger votre facture';
|
||||
$_LANG['order-detail_ec53a8c4f07baed5d8825072c89799be'] = 'État';
|
||||
$_LANG['order-detail_f0aaaae189e9c7711931a65ffcd22543'] = 'Méthode de paiement';
|
||||
@ -552,13 +552,13 @@ $_LANG['shopping-cart-product-line_ec211f7c20af43e742bf2570c3cb84f9'] = 'Ajouter
|
||||
$_LANG['shopping-cart-product-line_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
|
||||
$_LANG['shopping-cart_03ab340b3f99e03cff9e84314ead38c0'] = 'Quantité';
|
||||
$_LANG['shopping-cart_042fc2839f45ea5207494ec3005f1aab'] = 'Vous avez un bon de réduction ?';
|
||||
$_LANG['shopping-cart_0743a4c9b7922a0a2589d0d74c5ea231'] = 'Nombre total de boites';
|
||||
$_LANG['shopping-cart_0743a4c9b7922a0a2589d0d74c5ea231'] = 'Nombre total d\'articles';
|
||||
$_LANG['shopping-cart_12a7a93d72ded50311b52c7d0a853e3c'] = 'Profitez de nos offres exclusives :';
|
||||
$_LANG['shopping-cart_16f6c60cf0b840982bc1f595ac1641cb'] = 'Indiquez votre code';
|
||||
$_LANG['shopping-cart_27ce7f8b5623b2e2df568d64cf051607'] = 'Stock';
|
||||
$_LANG['shopping-cart_300225ee958b6350abc51805dab83c24'] = 'Continuer mes achats';
|
||||
$_LANG['shopping-cart_30efeba472c0bc4d0747d0109948a714'] = 'Envoyer les produits disponibles en premier.';
|
||||
$_LANG['shopping-cart_6c957f72dc8cdacc75762f2cbdcdfaf2'] = 'Prix par boîte ';
|
||||
$_LANG['shopping-cart_6c957f72dc8cdacc75762f2cbdcdfaf2'] = 'Prix';
|
||||
$_LANG['shopping-cart_7494b947fb8d75b27f502865f1c0a45d'] = 'Valider';
|
||||
$_LANG['shopping-cart_7e0bf6d67701868aac3116ade8fea957'] = 'Finaliser ma commande';
|
||||
$_LANG['shopping-cart_86024cad1e83101d97359d7351051156'] = 'produits';
|
||||
|
BIN
themes/roykin/mails/footer-mail_levest.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -1,5 +1,21 @@
|
||||
{foreach $list as $product}
|
||||
{foreach $category_brands as $brand}
|
||||
<tr>
|
||||
<td style="border:1px solid #D6D4D4;" colspan='5'>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td width="10"> </td>
|
||||
<td>
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<strong>{$brand.name}</strong>
|
||||
</font>
|
||||
</td>
|
||||
<td width="10"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{foreach $products_per_brand[$brand.id_category] as $product}
|
||||
<tr>
|
||||
<td style="border:1px solid #D6D4D4;">
|
||||
<table class="table">
|
||||
<tr>
|
||||
@ -65,7 +81,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
{foreach $product['customization'] as $customization}
|
||||
<tr>
|
||||
<td colspan="2" style="border:1px solid #D6D4D4;">
|
||||
@ -123,4 +139,5 @@
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/foreach}
|
@ -1,4 +1,7 @@
|
||||
{foreach $list as $product}
|
||||
{foreach $category_brands as $brand}
|
||||
{$brand.name} :
|
||||
|
||||
{foreach $products_per_brand[$brand.id_category] as $product}
|
||||
{$product['reference']}
|
||||
|
||||
{$product['name']}
|
||||
@ -18,4 +21,5 @@
|
||||
|
||||
{$product['quantity']}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/foreach}
|
BIN
themes/roykin/mails/header-mail_levest.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@ -13,7 +13,7 @@
|
||||
</span>
|
||||
<div class="lg3 md4 sm5 resume">
|
||||
<span class="title">{l s='Number of boxes' mod='blockcart'}</span>
|
||||
<span class="nb-total-boxes">{$nb_total_products}</span> {l s='boxe(s), or' mod='blockcart'} <span class="nb-total-bottles">{$nbTotalBottles}</span> {l s='bottle(s)' mod='blockcart'}
|
||||
<span class="nb-total-boxes">{$nb_total_products}</span> {l s='boxe(s), or' mod='blockcart'}
|
||||
</div>
|
||||
<div class="md2 sm3 price pr0">
|
||||
<span class="title">{l s='Total' mod='blockcart'}</span>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<a href="{$link->getPageLink("$order_process", true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockcart'}" rel="nofollow">
|
||||
<span class="header-title">{l s='My cart' mod='blockcart'}</span>
|
||||
<div class="total">
|
||||
<span class="nb-total-boxes">{$nb_total_products}</span> {l s='boxe(s), or' mod='blockcart'} <span class="nb-total-bottles">{$nbTotalBottles}</span> {l s='bottle(s)' mod='blockcart'}
|
||||
<span class="nb-total-boxes">{$nb_total_products}</span> {l s='boxe(s), or' mod='blockcart'}
|
||||
<span class="nb-total-price">
|
||||
<span class="value">{$product_total}</span>
|
||||
{if $shipping_cost_float}
|
||||
|
@ -44,8 +44,8 @@ $_MODULE['<{blockcart}roykin>crossselling_4351cfebe4b61d8aa5efa1d020710005'] = '
|
||||
$_MODULE['<{blockcart}roykin>crossselling_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Suivant';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_c46bcd6d3ff43e7181a51a089dc8d792'] = 'Vider mon panier';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_6f16ab6ec0a6064d0c8961257a3eb1f5'] = 'Récapitulatif de votre panier';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_acb46aae1913e9040ddffbe0df2e2c6d'] = 'Nombre de boites';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_cb7ef5fea931e52d22d88f4cb0623ee2'] = 'boite(s) soit';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_acb46aae1913e9040ddffbe0df2e2c6d'] = 'Nombre d\'articles';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_cb7ef5fea931e52d22d88f4cb0623ee2'] = 'article(s)';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_33d40894dc3f2fce1e9a0d6bca96c992'] = 'bouteille(s)';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_96b0141273eabab320119c467cdcaf17'] = 'Montant total';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_e8ba1e996094fe96e62784d8e768fd58'] = 'de livraison';
|
||||
@ -53,7 +53,7 @@ $_MODULE['<{blockcart}roykin>blockcart-footer_38a0287959316c9dd616fbf138727f76']
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_0c3bf3014aafb90201805e45b5e62881'] = 'Finaliser votre commande';
|
||||
$_MODULE['<{blockcart}roykin>blockcart-footer_6ff063fbc860a79759a7369ac32cee22'] = 'Finaliser votre commande';
|
||||
$_MODULE['<{blockcart}roykin>blockcart_dae3b417a0fc4a49e851ce55d6d49551'] = 'Votre panier';
|
||||
$_MODULE['<{blockcart}roykin>blockcart_cb7ef5fea931e52d22d88f4cb0623ee2'] = 'boite(s) soit';
|
||||
$_MODULE['<{blockcart}roykin>blockcart_cb7ef5fea931e52d22d88f4cb0623ee2'] = 'article(s)';
|
||||
$_MODULE['<{blockcart}roykin>blockcart_33d40894dc3f2fce1e9a0d6bca96c992'] = 'bouteille(s)';
|
||||
$_MODULE['<{blockcart}roykin>blockcart_e8ba1e996094fe96e62784d8e768fd58'] = 'de livraison';
|
||||
$_MODULE['<{blockcart}roykin>blockcart_38a0287959316c9dd616fbf138727f76'] = 'Livraison offerte';
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- Block search module -->
|
||||
<form method="get" action="{$link->getPageLink('search', true, null, null, false, null, true)|escape:'html':'UTF-8'}" id="searchbox">
|
||||
<form method="get" action="{$link->getPageLink('search', true, null, null, false, null, true)|escape:'html':'UTF-8'}" id="searchbox">
|
||||
<div class="hidden">
|
||||
<input type="hidden" name="orderby" value="position" />
|
||||
<input type="hidden" name="controller" value="search" />
|
||||
@ -7,6 +7,5 @@
|
||||
</div>
|
||||
<input class="search_query form-control grey" type="text" id="search_query_block" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" />
|
||||
<button type="submit" id="search_button"></button>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
<!-- /Block search module -->
|
@ -211,7 +211,11 @@
|
||||
|
||||
<div class="hidden-md hidden-lg sm12">{l s='Order detail'}</div>
|
||||
</div>
|
||||
{foreach from=$products item=product name=products}
|
||||
{foreach $brands as $brand}
|
||||
<div class="product-group">
|
||||
<div class="brand-name">{$brand.name}</div>
|
||||
{foreach from=$products_per_brand[$brand.id_category] item=product name=products}
|
||||
|
||||
{if !isset($product.deleted)}
|
||||
{assign var='productId' value=$product.product_id}
|
||||
{assign var='productAttributeId' value=$product.product_attribute_id}
|
||||
@ -347,6 +351,8 @@
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
{foreach from=$discounts item=discount}
|
||||
<div class="table-row noinner discount hidden-sm hidden-xs">
|
||||
|
@ -24,6 +24,7 @@
|
||||
{include file="$tpl_dir./page-heading.tpl" title=$smarty.capture.title type=''}
|
||||
|
||||
<nav>
|
||||
{*
|
||||
<ul id="family">
|
||||
{foreach from=$families item=family name=family}
|
||||
<li{if $smarty.foreach.family.first} class="active"{/if}>
|
||||
@ -31,7 +32,13 @@
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
*}
|
||||
<ul id="children-categories">
|
||||
{if isset($menu_logo) && !empty($menu_logo)}
|
||||
<li>
|
||||
<img src='{$menu_logo}'>
|
||||
</li>
|
||||
{/if}
|
||||
{foreach from=$categoriesTree item=child}
|
||||
<li>
|
||||
<a href="{$child.link}">{$child.name}</a>
|
||||
@ -41,11 +48,22 @@
|
||||
{hook h="displaySearch"}
|
||||
</li>
|
||||
</ul>
|
||||
{if isset($children) && $children|count>0}
|
||||
<ul id="subchildren-categories">
|
||||
{foreach from=$children item=child}
|
||||
<li{if $child.id_category == $category->id} class="active"{/if}>
|
||||
<a href="{$child.link}">{$child.name}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</nav>
|
||||
|
||||
<div class="messages">
|
||||
{hook h="displayAlert"}
|
||||
</div>
|
||||
|
||||
<div class="ctn">
|
||||
<div class="ctn" {if isset($page_background) && !empty($page_background)}style="background-image:url('{$page_background}');background-repeat:no-repeat;"{/if}>
|
||||
{if $products}
|
||||
<div class="products-list">
|
||||
<div class="row">
|
||||
|
@ -49,10 +49,11 @@
|
||||
{assign var='have_non_virtual_products' value=false}
|
||||
|
||||
<!-- Ligne(s) de produit -->
|
||||
{foreach $products as $product}
|
||||
{if $product.is_virtual == 0}
|
||||
{assign var='have_non_virtual_products' value=true}
|
||||
{/if}
|
||||
{if isset($brands)}
|
||||
{foreach $brands as $brand}
|
||||
<div class="product-group">
|
||||
<div class="brand-name">{$brand.name}</div>
|
||||
{foreach $products_per_brand[$brand.id_category] as $product}
|
||||
|
||||
{assign var='productId' value=$product.id_product}
|
||||
{assign var='productAttributeId' value=$product.id_product_attribute}
|
||||
@ -73,10 +74,14 @@
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{foreach $gift_products as $product}
|
||||
{include file="$tpl_dir./shopping-cart-product-line.tpl" product=$product}
|
||||
{/foreach}
|
||||
|
||||
{if !isset($recap)}</div>{/if}
|
||||
</div>
|
||||
</div>
|
||||
|