// Merging multishipping branche on 1.5

This commit is contained in:
mDeflotte
2011-11-18 11:13:31 +00:00
parent bc06976a52
commit 0df1a7e2eb
41 changed files with 2870 additions and 889 deletions
@@ -0,0 +1,27 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}">
<img src="../img/admin/delivery.gif" alt="{$action}" title="{$action}" /></a>
@@ -429,6 +429,20 @@ $(document).ready(function(){
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" border="0" style="width: 100%;">
<tr>
<td class="col-left" style="width:600px">
<label>Carriers:</label>
</td>
<td class="padding-bottom:5px;">
<select name="carriers[]" multiple="multiple" size="4">
{foreach $carrier_list as $carrier}
<option value="{$carrier.id_reference}" {if isset($carrier.selected) && $carrier.selected}selected="selected"{/if}>{$carrier.name}</option>
{/foreach}
</select>
</td>
</tr>
</table>
</div>
{* [end] of physical product *}
{* [begin] virtual product *}
+95 -2
View File
@@ -92,13 +92,29 @@ class CarrierCore extends ObjectModel
/** @var int Position */
public $position;
/** @var int maximum package width managed by the transporter */
public $max_width;
/** @var int maximum package height managed by the transporter */
public $max_height;
/** @var int maximum package deep managed by the transporter */
public $max_depth;
/** @var int maximum package weight managed by the transporter */
public $max_weight;
/** @var int grade of the shipping delay (0 for longest, 9 for shortest) */
public $grade;
protected $langMultiShop = true;
protected $fieldsRequired = array('name', 'active');
protected $fieldsSize = array('name' => 64);
protected $fieldsSize = array('name' => 64, 'grade' => 1);
protected $fieldsValidate = array('id_tax_rules_group' => 'isInt', 'name' => 'isCarrierName', 'active' => 'isBool',
'is_free' => 'isBool', 'url' => 'isAbsoluteUrl', 'shipping_handling' => 'isBool', 'range_behavior' => 'isBool',
'shipping_method' => 'isUnsignedInt');
'shipping_method' => 'isUnsignedInt', 'max_width' => 'isUnsignedInt', 'max_height' => 'isUnsignedInt',
'max_deep' => 'isUnsignedInt', 'max_weight' => 'isUnsignedInt', 'grade' => 'isUnsignedInt');
protected $fieldsRequiredLang = array('delay');
protected $fieldsSizeLang = array('delay' => 128);
protected $fieldsValidateLang = array('delay' => 'isGenericName');
@@ -138,6 +154,11 @@ class CarrierCore extends ObjectModel
$fields['external_module_name'] = $this->external_module_name;
$fields['need_range'] = $this->need_range;
$fields['position'] = (int)$this->position;
$fields['max_width'] = (int)$this->max_width;
$fields['max_height'] = (int)$this->max_height;
$fields['max_depth'] = (int)$this->max_depth;
$fields['max_weight'] = (int)$this->max_weight;
$fields['grade'] = (int)$this->grade;
return $fields;
}
@@ -553,6 +574,7 @@ class CarrierCore extends ObjectModel
}
// if we have to sort carriers by price
$prices = array();
if (Configuration::get('PS_CARRIER_DEFAULT_SORT') == Carrier::SORT_BY_PRICE)
{
foreach ($results_array as $r)
@@ -993,5 +1015,76 @@ class CarrierCore extends ObjectModel
$position = DB::getInstance()->getValue($sql);
return ($position !== false) ? $position : -1;
}
/**
* For a given {product, warehouse}, gets the carrier available
*
* @param $product integer The id of the product, or an array with at least the package size and weight
*/
public static function getAvailableCarrierList($product, $id_warehouse, $id_shop = null)
{
if(is_numeric($product))
$product = new Product((int)$product);
else if (is_array($product))
{
$product['id'] = $product['id_product'];
$product = (object)$product;
}
if (is_null($id_shop))
$id_shop = Context::getContext()->shop->getID(true);
// Does the product is linked with carriers?
$query = new DbQuery();
$query->select('id_carrier');
$query->from('product_carrier pc');
$query->innerJoin('carrier c ON (c.id_reference = pc.id_carrier_reference AND c.deleted = 0)');
$query->where('id_product = '.(int)($product->id));
$query->where('id_shop = '.(int)$id_shop);
$carriers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
if (!empty($carriers))
{
$carrier_list = array();
foreach ($carriers as $carrier)
$carrier_list[] = $carrier['id_carrier'];
return $carrier_list;
}
$carrier_list = array();
// The product is not dirrectly linked with a carrier
// Get all the carriers linked to a warehouse
if ($id_warehouse)
{
$warehouse = new Warehouse($id_warehouse);
$carrier_list = $warehouse->getCarriers();
}
if (empty($carrier_list)) // No carriers defined, get all available carriers
{
$carrier_list = array();
$id_address = ((isset($product->id_address_delivery) && $product->id_address_delivery != 0) ? $product->id_address_delivery : Context::getContext()->cart->id_address_delivery);
$address = new Address($id_address);
$id_zone = Address::getZoneById($address->id);
$carriers = Carrier::getCarriersForOrder($id_zone, Context::getContext()->customer->getGroups());
foreach ($carriers as $carrier)
$carrier_list[] = $carrier['id_carrier'];
}
if ($product->width > 0 || $product->height > 0 || $product->depth > 0 || $product->weight > 0)
{
foreach ($carrier_list as $key => $id_carrier)
{
$carrier = new Carrier($id_carrier);
if (($carrier->max_width > 0 && $carrier->max_width < $product->width)
|| ($carrier->max_height > 0 && $carrier->max_height > $product->height)
|| ($carrier->max_depth > 0 && $carrier->max_depth > $product->depth)
|| ($carrier->max_weight > 0 && $carrier->max_weight > $product->weight)
)
unset($carrier_list[$key]);
}
}
return $carrier_list;
}
}
+932 -117
View File
File diff suppressed because it is too large Load Diff
+16 -14
View File
@@ -366,44 +366,46 @@ class HookCore extends ObjectModel
static public function orderConfirmation($id_order)
{
if (Validate::isUnsignedId($id_order))
{
if (Validate::isUnsignedId($id_order))
{
$params = array();
$order = new Order((int)$id_order);
$currency = new Currency((int)$order->id_currency);
if (Validate::isLoadedObject($order))
{
$params['total_to_pay'] = $order->total_paid;
if (Validate::isLoadedObject($order))
{
$cart = new Cart((int)$order->id_cart);
$params['total_to_pay'] = $cart->getOrderTotal();
$params['currency'] = $currency->sign;
$params['objOrder'] = $order;
$params['currencyObj'] = $currency;
return Hook::exec('orderConfirmation', $params);
}
}
}
return false;
return false;
}
static public function paymentReturn($id_order, $id_module)
{
if (Validate::isUnsignedId($id_order) AND Validate::isUnsignedId($id_module))
{
if (Validate::isUnsignedId($id_order) AND Validate::isUnsignedId($id_module))
{
$params = array();
$order = new Order((int)($id_order));
$currency = new Currency((int)($order->id_currency));
if (Validate::isLoadedObject($order))
{
$params['total_to_pay'] = $order->total_paid;
if (Validate::isLoadedObject($order))
{
$cart = new Cart((int)$order->id_cart);
$params['total_to_pay'] = $cart->getOrderTotal();
$params['currency'] = $currency->sign;
$params['objOrder'] = $order;
$params['currencyObj'] = $currency;
return Hook::exec('paymentReturn', $params, (int)($id_module));
}
}
return false;
}
return false;
}
static public function PDFInvoice($pdf, $id_order)
+141 -102
View File
@@ -21,69 +21,69 @@
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7331 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class OrderCore extends ObjectModel
{
/** @var integer Delivery address id */
public $id_address_delivery;
public $id_address_delivery;
/** @var integer Invoice address id */
public $id_address_invoice;
public $id_address_invoice;
public $id_group_shop;
public $id_group_shop;
public $id_shop;
public $id_shop;
/** @var integer Cart id */
public $id_cart;
public $id_cart;
/** @var integer Currency id */
public $id_currency;
public $id_currency;
/** @var integer Language id */
public $id_lang;
public $id_lang;
/** @var integer Customer id */
public $id_customer;
public $id_customer;
/** @var integer Carrier id */
public $id_carrier;
public $id_carrier;
/** @var string Secure key */
public $secure_key;
public $secure_key;
/** @var string Payment method */
public $payment;
public $payment;
/** @var string Payment module */
public $module;
public $module;
/** @var float Currency conversion rate */
public $conversion_rate;
public $conversion_rate;
/** @var boolean Customer is ok for a recyclable package */
public $recyclable = 1;
public $recyclable = 1;
/** @var boolean True if the customer wants a gift wrapping */
public $gift = 0;
public $gift = 0;
/** @var string Gift message if specified */
public $gift_message;
public $gift_message;
/** @var string Shipping number */
public $shipping_number;
public $shipping_number;
/** @var float Discounts total */
public $total_discounts;
public $total_discounts;
public $total_discounts_tax_incl;
public $total_discounts_tax_excl;
/** @var float Total to pay */
public $total_paid;
public $total_paid;
/** @var float Total to pay tax included */
public $total_paid_tax_incl;
@@ -92,16 +92,16 @@ class OrderCore extends ObjectModel
public $total_paid_tax_excl;
/** @var float Total really paid */
public $total_paid_real;
public $total_paid_real;
/** @var float Products total */
public $total_products;
public $total_products;
/** @var float Products total tax excluded */
public $total_products_wt;
public $total_products_wt;
/** @var float Shipping total */
public $total_shipping;
public $total_shipping;
/** @var float Shipping total tax included */
public $total_shipping_tax_incl;
@@ -110,10 +110,10 @@ class OrderCore extends ObjectModel
public $total_shipping_tax_excl;
/** @var float Shipping tax rate */
public $carrier_tax_rate;
public $carrier_tax_rate;
/** @var float Wrapping total */
public $total_wrapping;
public $total_wrapping;
/** @var float Wrapping total tax included */
public $total_wrapping_tax_incl;
@@ -122,30 +122,38 @@ class OrderCore extends ObjectModel
public $total_wrapping_tax_excl;
/** @var integer Invoice number */
public $invoice_number;
public $invoice_number;
/** @var integer Delivery number */
public $delivery_number;
public $delivery_number;
/** @var string Invoice creation date */
public $invoice_date;
public $invoice_date;
/** @var string Delivery creation date */
public $delivery_date;
public $delivery_date;
/** @var boolean Order validity (paid and not canceled) */
public $valid;
public $valid;
/** @var string Object creation date */
public $date_add;
public $date_add;
/** @var string Object last modification date */
public $date_upd;
public $date_upd;
/** @var string Order reference
* This reference is not unique, but unique for a payment
*/
public $reference;
/** @var int Id warehouse */
public $id_warehouse;
protected $tables = array ('orders');
protected $fieldsRequired = array('conversion_rate', 'id_address_delivery', 'id_address_invoice', 'id_cart', 'id_currency', 'id_lang', 'id_customer', 'id_carrier', 'payment', 'total_paid', 'total_paid_real', 'total_products', 'total_products_wt');
protected $fieldsValidate = array(
protected $fieldsRequired = array('conversion_rate', 'id_address_delivery', 'id_address_invoice', 'id_cart', 'id_currency', 'id_lang', 'id_customer', 'id_carrier', 'payment', 'total_paid', 'total_paid_real', 'total_products', 'total_products_wt');
protected $fieldsValidate = array(
'id_address_delivery' => 'isUnsignedId',
'id_address_invoice' => 'isUnsignedId',
'id_cart' => 'isUnsignedId',
@@ -155,6 +163,7 @@ class OrderCore extends ObjectModel
'id_lang' => 'isUnsignedId',
'id_customer' => 'isUnsignedId',
'id_carrier' => 'isUnsignedId',
'id_warehouse' => 'isUnsignedId',
'secure_key' => 'isMd5',
'payment' => 'isGenericName',
'recyclable' => 'isBool',
@@ -172,7 +181,7 @@ class OrderCore extends ObjectModel
'conversion_rate' => 'isFloat'
);
protected $webserviceParameters = array(
protected $webserviceParameters = array(
'objectMethods' => array('add' => 'addWs'),
'objectNodeName' => 'order',
'objectsNodeName' => 'orders',
@@ -209,9 +218,9 @@ class OrderCore extends ObjectModel
);
/* MySQL does not allow 'order' for a table name */
protected $table = 'orders';
protected $identifier = 'id_order';
protected $_taxCalculationMethod = PS_TAX_EXC;
protected $table = 'orders';
protected $identifier = 'id_order';
protected $_taxCalculationMethod = PS_TAX_EXC;
protected static $_historyCache = array();
@@ -262,6 +271,8 @@ class OrderCore extends ObjectModel
$fields['valid'] = (int)($this->valid) ? 1 : 0;
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['reference'] = pSQL($this->reference);
$fields['id_warehouse'] = pSQL($this->id_warehouse);
return $fields;
}
@@ -321,7 +332,7 @@ class OrderCore extends ObjectModel
$productPrice = number_format($quantity * $price, 2, '.', '');
/* Update cart */
$cart = new Cart($this->id_cart);
$cart->updateQty($quantity, $orderDetail->product_id, $orderDetail->product_attribute_id, false, 'down'); // customization are deleted in deleteCustomization
$cart->updateQty($quantity, $orderDetail->product_id, $orderDetail->product_attribute_id, false, 0, 'down'); // customization are deleted in deleteCustomization
$cart->update();
/* Update order */
@@ -335,7 +346,7 @@ class OrderCore extends ObjectModel
if ($this->total_products_wt != 0)
$this->total_products_wt -= $productPrice;
$this->total_shipping = $cart->getOrderShippingCost();
$this->total_shipping = $cart->getTotalShippingCost();
/* It's temporary fix for 1.3 version... */
if ($orderDetail->product_quantity_discount != '0.000000')
@@ -731,16 +742,16 @@ class OrderCore extends ObjectModel
* @return array Customer orders
*/
static public function getCustomerOrders($id_customer, $showHiddenStatus = false, Context $context = null)
{
{
if (!$context)
$context = Context::getContext();
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT o.*, (SELECT SUM(od.`product_quantity`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = o.`id_order`) nb_products
FROM `'._DB_PREFIX_.'orders` o
WHERE o.`id_customer` = '.(int)$id_customer.'
GROUP BY o.`id_order`
ORDER BY o.`date_add` DESC');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT o.*, (SELECT SUM(od.`product_quantity`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = o.`id_order`) nb_products
FROM `'._DB_PREFIX_.'orders` o
WHERE o.`id_customer` = '.(int)$id_customer.'
GROUP BY o.`id_order`
ORDER BY o.`date_add` DESC');
if (!$res)
return array();
@@ -760,7 +771,7 @@ class OrderCore extends ObjectModel
}
return $res;
}
}
public static function getOrdersIdByDate($date_from, $date_to, $id_customer = NULL, $type = NULL)
{
@@ -839,22 +850,22 @@ class OrderCore extends ObjectModel
return $orders;
}
/**
* Get product total without taxes
*
* @return Product total with taxes
*/
public function getTotalProductsWithoutTaxes($products = false)
/**
* Get product total without taxes
*
* @return Product total with taxes
*/
public function getTotalProductsWithoutTaxes($products = false)
{
return $this->total_products;
}
/**
* Get product total with taxes
*
* @return Product total with taxes
*/
public function getTotalProductsWithTaxes($products = false)
/**
* Get product total with taxes
*
* @return Product total with taxes
*/
public function getTotalProductsWithTaxes($products = false)
{
if ($this->total_products_wt != '0.00' AND !$products)
return $this->total_products_wt;
@@ -895,15 +906,15 @@ class OrderCore extends ObjectModel
* @return array Customer orders number
*/
public static function getCustomerNbOrders($id_customer)
{
$sql = 'SELECT COUNT(`id_order`) AS nb
{
$sql = 'SELECT COUNT(`id_order`) AS nb
FROM `'._DB_PREFIX_.'orders`
WHERE `id_customer` = '.(int)$id_customer
.Context::getContext()->shop->addSqlRestriction();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
.Context::getContext()->shop->addSqlRestriction();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
return isset($result['nb']) ? $result['nb'] : 0;
}
}
/**
* Get an order by its cart id
@@ -912,26 +923,26 @@ class OrderCore extends ObjectModel
* @return array Order details
*/
public static function getOrderByCartId($id_cart)
{
$sql = 'SELECT `id_order`
{
$sql = 'SELECT `id_order`
FROM `'._DB_PREFIX_.'orders`
WHERE `id_cart` = '.(int)($id_cart)
.Context::getContext()->shop->addSqlRestriction();
$result = Db::getInstance()->getRow($sql);
.Context::getContext()->shop->addSqlRestriction();
$result = Db::getInstance()->getRow($sql);
return isset($result['id_order']) ? $result['id_order'] : false;
}
}
/**
/**
* @deprecated 1.5.0.1
*/
public function addDiscount($id_cart_rule, $name, $value)
public function addDiscount($id_cart_rule, $name, $value)
{
Tools::displayAsDeprecated();
return Order::addCartRule($id_cart_rule, $name, $value);
}
public function addCartRule($id_cart_rule, $name, $value)
public function addCartRule($id_cart_rule, $name, $value)
{
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_cart_rule', array('id_order' => (int)$this->id, 'id_cart_rule' => (int)$id_cart_rule, 'name' => pSQL($name), 'value' => (float)$value), 'INSERT');
}
@@ -961,38 +972,38 @@ class OrderCore extends ObjectModel
}
public static function getLastInvoiceNumber()
{
return (int)Db::getInstance()->getValue('
SELECT MAX(`invoice_number`) AS `invoice_number`
public static function getLastInvoiceNumber()
{
return (int)Db::getInstance()->getValue('
SELECT MAX(`invoice_number`) AS `invoice_number`
FROM `'._DB_PREFIX_.'orders`');
}
}
public function setInvoice()
{
$number = (int)Configuration::get('PS_INVOICE_START_NUMBER');
if ($number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false);
else
$number = '(SELECT `invoice_number`
FROM (
SELECT MAX(`invoice_number`) + 1 AS `invoice_number`
FROM `'._DB_PREFIX_.'orders`)
tmp )';
// a way to avoid duplicate invoice number
Configuration::updateValue('PS_INVOICE_START_NUMBER', false);
else
$number = '(SELECT `invoice_number`
FROM (
SELECT MAX(`invoice_number`) + 1 AS `invoice_number`
FROM `'._DB_PREFIX_.'orders`)
tmp )';
// a way to avoid duplicate invoice number
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'orders`
SET `invoice_number` = '.$number.', `invoice_date` = \''.date('Y-m-d H:i:s').'\'
WHERE `id_order` = '.(int)$this->id
);
$res = Db::getInstance()->getRow('
SELECT `invoice_number`, `invoice_date`
FROM `'._DB_PREFIX_.'orders`
$res = Db::getInstance()->getRow('
SELECT `invoice_number`, `invoice_date`
FROM `'._DB_PREFIX_.'orders`
WHERE `id_order` = '.(int)$this->id
);
);
$this->invoice_date = $res['invoice_date'];
$this->invoice_number = $res['invoice_number'];
$this->invoice_date = $res['invoice_date'];
$this->invoice_number = $res['invoice_number'];
}
public function setDelivery()
@@ -1034,10 +1045,10 @@ class OrderCore extends ObjectModel
public static function getByDelivery($id_delivery)
{
$sql = 'SELECT id_order
FROM `'._DB_PREFIX_.'orders`
WHERE `delivery_number` = '.(int)($id_delivery).'
'.Context::getContext()->shop->addSqlRestriction();
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
FROM `'._DB_PREFIX_.'orders`
WHERE `delivery_number` = '.(int)($id_delivery).'
'.Context::getContext()->shop->addSqlRestriction();
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
return new Order((int)($res['id_order']));
}
@@ -1108,10 +1119,10 @@ class OrderCore extends ObjectModel
SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date`
FROM `'._DB_PREFIX_.'orders`
WHERE `id_order` = '.(int)$this->id);
$this->invoice_date = $res['invoice_date'];
$this->invoice_number = $res['invoice_number'];
$this->delivery_date = $res['delivery_date'];
$this->delivery_number = $res['delivery_number'];
$this->invoice_date = $res['invoice_date'];
$this->invoice_number = $res['invoice_number'];
$this->delivery_date = $res['delivery_date'];
$this->delivery_number = $res['delivery_number'];
$history->addWithemail();
}
@@ -1166,6 +1177,35 @@ class OrderCore extends ObjectModel
return OrderDetail::getList($this->id);
}
/**
* Gennerate a unique reference for orders generated with the same cart id
* This references, is usefull for check payment
*
* @return String
*/
public static function generateReference()
{
// To generate a random reference, we first generate a random number
// This number is a rand concated with the current timestamp
$rand = (int)(microtime(true) * 100 % 10000000000).rand(10, 1000);
$reference = '';
do {
$reference .= chr(65 + $rand % 26);
$rand = (int)($rand / 26);
} while ($rand > 26);
// Check if semi-random string generated is not already used
// /!\ Here we CANNOT/MUSTN'T use _PS_USE_SQL_SLAVE_
if (Db::getInstance()->getValue('
SELECT count(*)
FROM '._DB_PREFIX_.'orders
WHERE reference = \''.$reference.'\'') > 0)
return self::generateReference(); // If the reference already exists, generate a new one
return $reference;
}
public function orderContainProduct($id_product)
{
$product_list = $this->getOrderDetailList();
@@ -1174,7 +1214,6 @@ class OrderCore extends ObjectModel
return true;
return false;
}
/**
* This method returns true if at least one order details uses the
* One After Another tax computation method.
+2 -2
View File
@@ -522,13 +522,13 @@ class OrderDetailCore extends ObjectModel
* @param object $cart
* @param int $id_order_status
*/
public function createList(Order $order, Cart $cart, $id_order_state)
public function createList(Order $order, Cart $cart, $id_order_state, $product_list)
{
$this->vat_address = new Address((int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
$this->customer = new Customer((int)($order->id_customer));
$this->id_order = $order->id;
$products = $cart->getProducts();
$products = $product_list;
$this->outOfStock = false;
foreach ($products as $product)
+329 -287
View File
@@ -114,309 +114,351 @@ abstract class PaymentModuleCore extends Module
{
if ($secure_key !== false AND $secure_key != $cart->secure_key)
die(Tools::displayError());
// Be carefull, carrier may not exist
$carrier = new Carrier($cart->id_carrier, $cart->id_lang);
// Copying data from cart
$order = new Order();
$order->id_carrier = (int)$carrier->id;
$order->id_customer = (int)($cart->id_customer);
$order->id_address_invoice = (int)($cart->id_address_invoice);
$order->id_address_delivery = (int)($cart->id_address_delivery);
$order->id_currency = ($currency_special ? (int)($currency_special) : (int)($cart->id_currency));
$order->id_lang = (int)($cart->id_lang);
$order->id_cart = (int)($cart->id);
$order->id_shop = (int)($shop->getID() ? $shop->getID() : $cart->id_shop);
$order->id_group_shop = (int)($shop->getID() ? $shop->getGroupID() : $cart->id_group_shop);
$customer = new Customer((int)($order->id_customer));
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($customer->secure_key));
$order->payment = $paymentMethod;
if (isset($this->name))
$order->module = $this->name;
$order->recyclable = $cart->recyclable;
$order->gift = (int)($cart->gift);
$order->gift_message = $cart->gift_message;
$currency = new Currency($order->id_currency);
$order->conversion_rate = $currency->conversion_rate;
$amountPaid = !$dont_touch_amount ? Tools::ps_round((float)($amountPaid), 2) : $amountPaid;
$order->total_paid_real = $amountPaid;
$order->total_products = (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);
$order->total_products_wt = (float)$cart->getOrderTotal(true, Cart::ONLY_PRODUCTS);
$order->total_discounts = (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
$order->total_discounts_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS));
$order->total_discounts_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
$order->total_shipping = (float)$cart->getOrderShippingCost();
$order->total_shipping_tax_excl = (float)$cart->getOrderShippingCost(NULL, false);
$order->total_shipping_tax_incl = (float)$cart->getOrderShippingCost();
if (Validate::isLoadedObject($carrier))
$order->carrier_tax_rate = $carrier->getTaxesRate(new Address($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
$order->total_wrapping = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING));
$order->total_wrapping_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING));
$order->total_wrapping_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING));
$order->total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH)), 2);
$order->total_paid_tax_excl = (float)Tools::ps_round((float)($cart->getOrderTotal(false, Cart::BOTH)), 2);
$order->total_paid_tax_incl = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH)), 2);
$order->invoice_date = '0000-00-00 00:00:00';
$order->delivery_date = '0000-00-00 00:00:00';
// 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 (number_format($order->total_paid, 2) != number_format($order->total_paid_real, 2))
$id_order_state = Configuration::get('PS_OS_ERROR');
// Creating order
if ($cart->OrderExists() == false)
$result = $order->add();
else
// For each package, generate an order
$delivery_option_list = $cart->getDeliveryOptionList();
$package_list = $cart->getPackageList();
$cart_delivery_option = unserialize($cart->delivery_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))
die('Error: delivery option for some addresses is not defined');
}
$order_list = array();
$order_detail_list = array();
$reference = Order::generateReference();
$this->currentOrderReference = $reference;
$id_currency = $currency_special ? (int)($currency_special) : (int)($cart->id_currency);
$currency = new Currency($id_currency);
$this->context->cart->order_reference = $reference;
$orderCreationFailed = false;
$cart_total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH)), 2);
if ($cart->orderExists())
{
$errorMessage = Tools::displayError('An order has already been placed using this cart.');
Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($order->id_cart));
Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($cart->id));
die($errorMessage);
}
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)
{
$product_list = $package_list[$id_address][$id_package]['product_list'];
$carrier = new Carrier($id_carrier, $cart->id_lang);
$order = new Order();
$order->id_carrier = (int)$carrier->id;
$order->id_customer = (int)($cart->id_customer);
$order->id_address_invoice = (int)($cart->id_address_invoice);
$order->id_address_delivery = (int)$id_address;
$order->id_currency = $id_currency;
$order->id_lang = (int)($cart->id_lang);
$order->id_warehouse = $package_list[$id_address][$id_package]['id_warehouse'];
$order->id_cart = (int)($cart->id);
$order->reference = $reference;
$order->id_shop = (int)($shop->getID() ? $shop->getID() : $cart->id_shop);
$order->id_group_shop = (int)($shop->getID() ? $shop->getGroupID() : $cart->id_group_shop);
$customer = new Customer((int)($order->id_customer));
$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($customer->secure_key));
$order->payment = $paymentMethod;
if (isset($this->name))
$order->module = $this->name;
$order->recyclable = $cart->recyclable;
$order->gift = (int)($cart->gift);
$order->gift_message = $cart->gift_message;
$order->conversion_rate = $currency->conversion_rate;
$amountPaid = !$dont_touch_amount ? Tools::ps_round((float)($amountPaid), 2) : $amountPaid;
$order->total_paid_real = $amountPaid;
$order->total_products = (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS, $product_list, $id_carrier);
$order->total_products_wt = (float)$cart->getOrderTotal(true, Cart::ONLY_PRODUCTS, $product_list, $id_carrier);
$order->total_discounts = (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS, $product_list, $id_carrier));
$order->total_discounts_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS, $product_list, $id_carrier));
$order->total_discounts_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS, $product_list, $id_carrier));
$order->total_shipping = (float)$cart->getPackageShippingCost((int)$id_carrier, true, null, $product_list, $id_carrier);
$order->total_shipping_tax_excl = (float)$cart->getPackageShippingCost((int)$id_carrier, false, null, $product_list, $id_carrier);
$order->total_shipping_tax_incl = (float)$cart->getPackageShippingCost((int)$id_carrier, true, null, $product_list, $id_carrier);
if (Validate::isLoadedObject($carrier))
$order->carrier_tax_rate = $carrier->getTaxesRate(new Address($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
$order->total_wrapping = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $product_list, $id_carrier));
$order->total_wrapping_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING, $product_list, $id_carrier));
$order->total_wrapping_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $product_list, $id_carrier));
$order->total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH, $product_list, $id_carrier)), 2);
$order->total_paid_tax_excl = (float)Tools::ps_round((float)($cart->getOrderTotal(false, Cart::BOTH, $product_list, $id_carrier)), 2);
$order->total_paid_tax_incl = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH, $product_list, $id_carrier)), 2);
$order->invoice_date = '0000-00-00 00:00:00';
$order->delivery_date = '0000-00-00 00:00:00';
// 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 (number_format($cart_total_paid, 2) != number_format($order->total_paid_real, 2))
$id_order_state = Configuration::get('PS_OS_ERROR');
// Creating order
$result = $order->add();
$order_list[] = $order;
// Insert new Order detail list using cart for the current order
$order_detail = new OrderDetail($this->context);
$order_detail->createList($order, $cart, $id_order_state, $product_list);
$order_detail_list[] = $order_detail;
}
$this->addPCC($reference, $id_currency, $amountPaid);
// Next !
if ($result AND isset($order->id))
foreach ($order_detail_list as $key => $order_detail)
{
if (!$secure_key)
$message .= $this->l('Warning : the secure key is empty, check your payment account before validation');
// Optional message to attach to this order
if (isset($message) AND !empty($message))
$order = $order_list[$key];
if (!$orderCreationFailed AND isset($order->id))
{
$msg = new Message();
$message = strip_tags($message, '<br>');
if (Validate::isCleanHtml($message))
if (!$secure_key)
$message .= $this->l('Warning : the secure key is empty, check your payment account before validation');
// Optional message to attach to this order
if (isset($message) AND !empty($message))
{
$msg->message = $message;
$msg->id_order = intval($order->id);
$msg->private = 1;
$msg->add();
}
}
// Insert new Order detail list using cart for the current order
$orderDetail = new OrderDetail($this->context);
$orderDetail->createList($order, $cart, $id_order_state);
$this->addPCC($order->id, $order->id_currency, $amountPaid);
// Insert products from cart into order_detail table
$productsList = '';
$products = $cart->getProducts();
foreach ($products AS $key => $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')}));
$customizationQuantity = 0;
if (isset($customizedDatas[$product['id_product']][$product['id_product_attribute']]))
{
$customizationText = '';
foreach ($customizedDatas[$product['id_product']][$product['id_product_attribute']] AS $customization)
$msg = new Message();
$message = strip_tags($message, '<br>');
if (Validate::isCleanHtml($message))
{
if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD]))
foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] AS $text)
$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';
if (isset($customization['datas'][Product::CUSTOMIZE_FILE]))
$customizationText .= sizeof($customization['datas'][Product::CUSTOMIZE_FILE]) .' '. Tools::displayError('image(s)').'<br />';
$customizationText .= '---<br />';
$msg->message = $message;
$msg->id_order = intval($order->id);
$msg->private = 1;
$msg->add();
}
$customizationText = rtrim($customizationText, '---<br />');
$customizationQuantity = (int)($product['customizationQuantityTotal']);
$productsList .=
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.$this->l('Customized').(!empty($customizationText) ? ' - '.$customizationText : '').'</strong></td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>
<td style="padding: 0.6em 0.4em; text-align: center;">'.$customizationQuantity.'</td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>
</tr>';
}
if (!$customizationQuantity OR (int)$product['cart_quantity'] > $customizationQuantity)
$productsList .=
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>
<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)($product['cart_quantity']) - $customizationQuantity).'</td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>
</tr>';
} // end foreach ($products)
$cartRulesList = '';
$result = $cart->getCartRules();
$cartRules = ObjectModel::hydrateCollection('CartRule', $result, (int)$order->id_lang);
foreach ($cartRules AS $cartRule)
{
$value = $cartRule->getContextualValue(true);
// Todo: repair shrunk
// if ($shrunk AND ($total_discount_value + $value) > ($order->total_products_wt + $order->total_shipping + $order->total_wrapping))
// {
// $amount_to_add = ($order->total_products_wt + $order->total_shipping + $order->total_wrapping) - $total_discount_value;
// if ($cartRule->id_discount_type == Discount::AMOUNT AND $cartRule->behavior_not_exhausted == 2)
// {
// $voucher = new Discount();
// foreach ($cartRule AS $key => $discountValue)
// $voucher->$key = $discountValue;
// $voucher->name = 'VSRK'.(int)$order->id_customer.'O'.(int)$order->id;
// $voucher->value = (float)$value - $amount_to_add;
// $voucher->add();
// $params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
// $params['{voucher_num}'] = $voucher->name;
// $params['{firstname}'] = $customer->firstname;
// $params['{lastname}'] = $customer->lastname;
// $params['{id_order}'] = $order->id;
// @Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order #').$order->id, $params, $customer->email, $customer->firstname.' '.$customer->lastname);
// }
// }
$order->addCartRule($cartRule->id, $cartRule->name, $value);
if ($id_order_state != Configuration::get('PS_OS_ERROR') AND $id_order_state != Configuration::get('PS_OS_CANCELED'))
$cartRule->quantity = $cartRule->quantity - 1;
$cartRule->update();
$cartRulesList .= '
<tr style="background-color:#EBECEE;">
<td colspan="4" style="padding:0.6em 0.4em;text-align:right">'.$this->l('Voucher name:').' '.$cartRule->name.'</td>
<td style="padding:0.6em 0.4em;text-align:right">'.($value != 0.00 ? '-' : '').Tools::displayPrice($value, $currency, false).'</td>
</tr>';
}
// Specify order id for message
$oldMessage = Message::getMessageByCartId((int)($cart->id));
if ($oldMessage)
{
$message = new Message((int)$oldMessage['id_message']);
$message->id_order = (int)$order->id;
$message->update();
}
// Hook validate order
$orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang);
if (Validate::isLoadedObject($orderStatus))
{
Hook::exec('newOrder', array('cart' => $cart, 'order' => $order, 'customer' => $customer, 'currency' => $currency, 'orderStatus' => $orderStatus));
foreach ($cart->getProducts() AS $product)
if ($orderStatus->logable)
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
}
if (Configuration::get('PS_STOCK_MANAGEMENT') && $orderDetail->getStockState())
{
$history = new OrderHistory();
$history->id_order = (int)$order->id;
$history->changeIdOrderState(Configuration::get('PS_OS_OUTOFSTOCK'), (int)$order->id);
$history->addWithemail();
}
// Set order state in order history ONLY even if the "out of stock" status has not been yet reached
// So you migth have two order states
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, (int)$order->id);
$new_history->addWithemail(true, $extraVars);
unset($orderDetail, $pcc);
// Order is reloaded because the status just changed
$order = new Order($order->id);
// Send an e-mail to customer
if ($id_order_state != Configuration::get('PS_OS_ERROR') AND $id_order_state != Configuration::get('PS_OS_CANCELED') AND $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}' => $customer->firstname,
'{lastname}' => $customer->lastname,
'{email}' => $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="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
'{invoice_block_html}' => $this->_getFormatedAddress($invoice, "<br />",
array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; 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}' => sprintf("#%06d", (int)($order->id)),
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)($order->id_lang), 1),
'{carrier}' => $carrier->name,
'{payment}' => Tools::substr($order->payment, 0, 32),
'{products}' => $productsList,
'{discounts}' => $cartRulesList,
'{total_paid}' => Tools::displayPrice($order->total_paid, $currency, false),
'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false),
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false));
if (is_array($extraVars))
$data = array_merge($data, $extraVars);
// Join PDF invoice
if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
// Insert new Order detail list using cart for the current order
//$orderDetail = new OrderDetail($this->context);
//$orderDetail->createList($order, $cart, $id_order_state);
//$this->addPCC($order->id, $order->id_currency, $amountPaid);
// Construct order detail table for the email
$productsList = '';
$products = $cart->getProducts();
foreach ($products AS $key => $product)
{
$fileAttachment['content'] = PDF::invoice($order, 'S');
$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';
$fileAttachment['mime'] = 'application/pdf';
$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')}));
$customizationQuantity = 0;
if (isset($customizedDatas[$product['id_product']][$product['id_product_attribute']]))
{
$customizationText = '';
foreach ($customizedDatas[$product['id_product']][$product['id_product_attribute']] AS $customization)
{
if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD]))
foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] AS $text)
$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';
if (isset($customization['datas'][Product::CUSTOMIZE_FILE]))
$customizationText .= sizeof($customization['datas'][Product::CUSTOMIZE_FILE]) .' '. Tools::displayError('image(s)').'<br />';
$customizationText .= '---<br />';
}
$customizationText = rtrim($customizationText, '---<br />');
$customizationQuantity = (int)($product['customizationQuantityTotal']);
$productsList .=
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.$this->l('Customized').(!empty($customizationText) ? ' - '.$customizationText : '').'</strong></td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>
<td style="padding: 0.6em 0.4em; text-align: center;">'.$customizationQuantity.'</td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>
</tr>';
}
if (!$customizationQuantity OR (int)$product['cart_quantity'] > $customizationQuantity)
$productsList .=
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>
<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)($product['cart_quantity']) - $customizationQuantity).'</td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>
</tr>';
} // end foreach ($products)
$cartRulesList = '';
$result = $cart->getCartRules();
$cartRules = ObjectModel::hydrateCollection('CartRule', $result, (int)$order->id_lang);
// @todo How to menage cart rules, with multiple shipping?
foreach ($cartRules AS $cartRule)
{
$value = $cartRule->getContextualValue(true);
// Todo: repair shrunk
// if ($shrunk AND ($total_discount_value + $value) > ($order->total_products_wt + $order->total_shipping + $order->total_wrapping))
// {
// $amount_to_add = ($order->total_products_wt + $order->total_shipping + $order->total_wrapping) - $total_discount_value;
// if ($cartRule->id_discount_type == Discount::AMOUNT AND $cartRule->behavior_not_exhausted == 2)
// {
// $voucher = new Discount();
// foreach ($cartRule AS $key => $discountValue)
// $voucher->$key = $discountValue;
// $voucher->name = 'VSRK'.(int)$order->id_customer.'O'.(int)$order->id;
// $voucher->value = (float)$value - $amount_to_add;
// $voucher->add();
// $params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
// $params['{voucher_num}'] = $voucher->name;
// $params['{firstname}'] = $customer->firstname;
// $params['{lastname}'] = $customer->lastname;
// $params['{id_order}'] = $order->id;
// @Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order #').$order->id, $params, $customer->email, $customer->firstname.' '.$customer->lastname);
// }
// }
$order->addCartRule($cartRule->id, $cartRule->name, $value);
if ($id_order_state != Configuration::get('PS_OS_ERROR') AND $id_order_state != Configuration::get('PS_OS_CANCELED'))
$cartRule->quantity = $cartRule->quantity - 1;
$cartRule->update();
$cartRulesList .= '
<tr style="background-color:#EBECEE;">
<td colspan="4" style="padding:0.6em 0.4em;text-align:right">'.$this->l('Voucher name:').' '.$cartRule->name.'</td>
<td style="padding:0.6em 0.4em;text-align:right">'.($value != 0.00 ? '-' : '').Tools::displayPrice($value, $currency, false).'</td>
</tr>';
}
// Specify order id for message
$oldMessage = Message::getMessageByCartId((int)($cart->id));
if ($oldMessage)
{
$message = new Message((int)$oldMessage['id_message']);
$message->id_order = (int)$order->id;
$message->update();
}
// Hook validate order
$orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang);
if (Validate::isLoadedObject($orderStatus))
{
Hook::exec('newOrder', array('cart' => $cart, 'order' => $order, 'customer' => $customer, 'currency' => $currency, 'orderStatus' => $orderStatus));
foreach ($cart->getProducts() AS $product)
if ($orderStatus->logable)
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
}
if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState())
{
$history = new OrderHistory();
$history->id_order = (int)$order->id;
$history->changeIdOrderState(Configuration::get('PS_OS_OUTOFSTOCK'), (int)$order->id);
$history->addWithemail();
}
else
$fileAttachment = NULL;
if (Validate::isEmail($customer->email))
Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);
// Set order state in order history ONLY even if the "out of stock" status has not been yet reached
// So you migth have two order states
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, (int)$order->id);
$new_history->addWithemail(true, $extraVars);
unset($order_detail, $pcc);
// Order is reloaded because the status just changed
$order = new Order($order->id);
// Send an e-mail to customer (one order = one email)
if ($id_order_state != Configuration::get('PS_OS_ERROR') AND $id_order_state != Configuration::get('PS_OS_CANCELED') AND $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}' => $customer->firstname,
'{lastname}' => $customer->lastname,
'{email}' => $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="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
'{invoice_block_html}' => $this->_getFormatedAddress($invoice, "<br />",
array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; 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}' => sprintf("#%06d", (int)($order->id)),
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)($order->id_lang), 1),
'{carrier}' => $carrier->name,
'{payment}' => Tools::substr($order->payment, 0, 32),
'{products}' => $productsList,
'{discounts}' => $cartRulesList,
'{total_paid}' => Tools::displayPrice($order->total_paid, $currency, false),
'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false),
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false));
if (is_array($extraVars))
$data = array_merge($data, $extraVars);
// Join PDF invoice
if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
{
$fileAttachment['content'] = PDF::invoice($order, 'S');
$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';
$fileAttachment['mime'] = 'application/pdf';
}
else
$fileAttachment = NULL;
if (Validate::isEmail($customer->email))
Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);
}
}
else
{
$errorMessage = Tools::displayError('Order creation failed');
Logger::addLog($errorMessage, 4, '0000002', 'Cart', intval($order->id_cart));
die($errorMessage);
}
$this->currentOrder = (int)$order->id;
return true;
}
else
{
$errorMessage = Tools::displayError('Order creation failed');
Logger::addLog($errorMessage, 4, '0000002', 'Cart', intval($order->id_cart));
die($errorMessage);
}
// Use the last order as currentOrder
$this->currentOrder = (int)$order->id;
return true;
}
else
{
@@ -432,11 +474,11 @@ abstract class PaymentModuleCore extends Module
* @var int id_currency
* @var float amount
*/
private function addPCC($id_order, $id_currency, $amount)
private function addPCC($reference, $id_currency, $amount)
{
// Other information are set by the module
$this->pcc->id_order = (int)$id_order;
$this->pcc->order_reference = (int)$reference;
$this->pcc->id_currency = (int)$id_currency;
$this->pcc->amount = (float)$amount;
$this->pcc->add();
+43 -7
View File
@@ -1696,6 +1696,38 @@ class ProductCore extends ObjectModel
{
return Product::getProductCategories($this->id);
}
/**
* Gets carriers assigned to the product
*/
public function getCarriers()
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT c.*
FROM `'._DB_PREFIX_.'product_carrier` pc
INNER JOIN `'._DB_PREFIX_.'carrier` c
ON (c.`id_reference` = pc.`id_carrier_reference` AND c.`deleted` = 0)
WHERE pc.`id_product` = '.(int)$this->id.'
AND pc.`id_shop` = '.(int)$this->id_shop);
}
/**
* Sets carriers assigned to the product
*/
public function setCarriers($carrier_list)
{
$data = array();
foreach($carrier_list as $carrier)
{
$data[] = array(
'id_product' => (int)$this->id,
'id_carrier_reference' => (int)$carrier,
'id_shop' => (int)$this->id_shop
);
}
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_carrier` WHERE id_product = '.(int)$this->id.' AND id_shop = '.(int)$this->id_shop);
Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_carrier', $data, 'INSERT');
}
/**
* Get product images and legends
@@ -2994,7 +3026,7 @@ class ProductCore extends ObjectModel
$id_lang = Context::getContext()->language->id;
if (!$result = Db::getInstance()->executeS('
SELECT cd.`id_customization`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`, cd.`type`, cd.`index`, cd.`value`, cfl.`name`
SELECT cd.`id_customization`, c.`id_address_delivery`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`, cd.`type`, cd.`index`, cd.`value`, cfl.`name`
FROM `'._DB_PREFIX_.'customized_data` cd
NATURAL JOIN `'._DB_PREFIX_.'customization` c
LEFT JOIN `'._DB_PREFIX_.'customization_field_lang` cfl ON (cfl.id_customization_field = cd.`index` AND id_lang = '.(int)($id_lang).')
@@ -3004,21 +3036,24 @@ class ProductCore extends ObjectModel
return false;
$customizedDatas = array();
foreach ($result as $row)
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_customization'])]['datas'][(int)($row['type'])][] = $row;
if (!$result = Db::getInstance()->executeS('SELECT `id_product`, `id_product_attribute`, `id_customization`, `quantity`, `quantity_refunded`, `quantity_returned`
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_address_delivery'])][(int)($row['id_customization'])]['datas'][(int)($row['type'])][] = $row;
if (!$result = Db::getInstance()->executeS('SELECT `id_product`, `id_product_attribute`, `id_customization`, `id_address_delivery`, `quantity`, `quantity_refunded`, `quantity_returned`
FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($id_cart).($only_in_cart ? ' AND `in_cart` = 1' : '')))
return false;
foreach ($result as $row)
{
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_customization'])]['quantity'] = (int)($row['quantity']);
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_customization'])]['quantity_refunded'] = (int)($row['quantity_refunded']);
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_customization'])]['quantity_returned'] = (int)($row['quantity_returned']);
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_address_delivery'])][(int)($row['id_customization'])]['quantity'] = (int)($row['quantity']);
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_address_delivery'])][(int)($row['id_customization'])]['quantity_refunded'] = (int)($row['quantity_refunded']);
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_address_delivery'])][(int)($row['id_customization'])]['quantity_returned'] = (int)($row['quantity_returned']);
}
return $customizedDatas;
}
public static function addCustomizationPrice(&$products, &$customizedDatas)
{
if(!$customizedDatas)
return;
foreach ($products as &$productUpdate)
{
if (!Customization::isFeatureActive())
@@ -3035,11 +3070,12 @@ class ProductCore extends ObjectModel
/* Compatibility */
$productId = (int)(isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']);
$productAttributeId = (int)(isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']);
$id_address_delivery = (int)$productUpdate['id_address_delivery'];
$productQuantity = (int)(isset($productUpdate['cart_quantity']) ? $productUpdate['cart_quantity'] : $productUpdate['product_quantity']);
$price = isset($productUpdate['price']) ? $productUpdate['price'] : $productUpdate['product_price'];
$priceWt = $price * (1 + ((isset($productUpdate['tax_rate']) ? $productUpdate['tax_rate'] : $productUpdate['rate']) * 0.01));
if (isset($customizedDatas[$productId][$productAttributeId]))
foreach ($customizedDatas[$productId][$productAttributeId] as $customization)
foreach ($customizedDatas[$productId][$productAttributeId][$id_address_delivery] as $customization)
{
$customizationQuantity += (int)$customization['quantity'];
$customizationQuantityRefunded += (int)$customization['quantity_refunded'];
+14
View File
@@ -590,6 +590,20 @@ class ToolsCore
return $object;
}
/**
* Display a var dump in firebug console
*
* @param object $object Object to display
*/
public static function fd($object)
{
echo '
<script type="text/javascript">
console.log('.json_encode($object).');
</script>
';
}
/**
* ALIAS OF dieObject() - Display an error with detailed object
*
+23 -3
View File
@@ -250,13 +250,33 @@ class StockAvailableCore extends ObjectModel
/**
* Upgrades total_quantity_available after having saved
* @see ObjectModel::save()
* @see ObjectModel::add()
*/
public function save($null_values = false, $autodate = true)
public function add($autodate = true, $null_values = false)
{
if (!parent::save($null_values, $autodate))
if (!parent::add($autodate, $null_values))
return false;
$this->afterSave();
}
/**
* Upgrades total_quantity_available after having update
* @see ObjectModel::update()
*/
public function update($null_values = false)
{
if (!parent::update($null_values))
return false;
$this->afterSave();
}
/**
* Upgrades total_quantity_available after having saved
* @see StockAvailableCore::update()
* @see StockAvailableCore::add()
*/
public function afterSave()
{
if ($this->id_product_attribute == 0)
return true;
+24
View File
@@ -267,6 +267,30 @@ class WarehouseCore extends ObjectModel
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query));
}
/**
* For a given {product, product attribute} gets warehouse list
*
* @param int $id_product
* @param int $id_product_attribute
* @param int $id_shop
* @return string
*/
public static function getProductWarehouseList($id_product, $id_product_attribute, $id_shop = null)
{
if (is_null($id_shop))
$id_shop = Context::getContext()->shop->getID(true);
$query = new DbQuery();
$query->select('wpl.id_warehouse');
$query->from('warehouse_product_location wpl');
$query->innerJoin('warehouse_shop ws ON (ws.id_warehouse = wpl.id_warehouse AND id_shop = '.(int)$id_shop.')');
$query->where('id_product = '.(int)$id_product);
$query->where('id_product_attribute = '.(int)$id_product_attribute);
$query->groupBy('wpl.id_warehouse');
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query));
}
/**
* Gets available warehouses
+5
View File
@@ -25,6 +25,11 @@
* International Registered Trademark & Property of PrestaShop SA
*/
function fd($var)
{
return (Tools::fd($var));
}
function p($var)
{
return (Tools::p($var));
+41 -1
View File
@@ -214,6 +214,14 @@ class AdminCarriersControllerCore extends AdminController
'maxlength' => 128,
'p' => $this->l('Time taken for product delivery; displayed during checkout')
),
array(
'type' => 'text',
'label' => $this->l('Grade:'),
'name' => 'grade',
'required' => false,
'size' => 1,
'p' => $this->l('"0" for a longest shipping delay,"9" for the shortest shipping delay.')
),
array(
'type' => 'text',
'label' => $this->l('URL:'),
@@ -360,6 +368,38 @@ class AdminCarriersControllerCore extends AdminController
),
'p' => $this->l('Out-of-range behavior when none is defined (e.g., when a customer\'s cart weight is greater than the highest range limit)')
),
array(
'type' => 'text',
'label' => $this->l('Maximium package height:'),
'name' => 'max_height',
'required' => false,
'size' => 10,
'p' => $this->l('Maximum height managed by this carrier. Set "0" or nothing, to ignore this field.')
),
array(
'type' => 'text',
'label' => $this->l('Maximium package width:'),
'name' => 'max_width',
'required' => false,
'size' => 10,
'p' => $this->l('Maximum width managed by this carrier. Set "0" or nothing, to ignore this field.')
),
array(
'type' => 'text',
'label' => $this->l('Maximium package deep:'),
'name' => 'max_deep',
'required' => false,
'size' => 10,
'p' => $this->l('Maximum deep managed by this carrier. Set "0" or nothing, to ignore this field.')
),
array(
'type' => 'text',
'label' => $this->l('Maximium package weigth:'),
'name' => 'max_weight',
'required' => false,
'size' => 10,
'p' => $this->l('Maximum weight managed by this carrier. Set "0" or nothing, to ignore this field.')
),
array(
'type' => 'hidden',
'name' => 'is_module'
@@ -375,7 +415,7 @@ class AdminCarriersControllerCore extends AdminController
array(
'type' => 'hidden',
'name' => 'need_range'
)
),
)
);
+13 -12
View File
@@ -30,25 +30,25 @@ class AdminOrdersControllerCore extends AdminController
public function __construct()
{
$this->table = 'order';
$this->className = 'Order';
$this->lang = false;
$this->className = 'Order';
$this->lang = false;
$this->edit = true;
$this->addRowAction('view');
$this->addRowAction('view');
$this->deleted = false;
$this->colorOnBackground = true;
$this->requiredDatabase = false;
$this->context = Context::getContext();
$this->deleted = false;
$this->colorOnBackground = true;
$this->requiredDatabase = false;
$this->context = Context::getContext();
$this->_select = '
$this->_select = '
a.id_order AS id_pdf,
CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
osl.`name` AS `osname`,
os.`color`,
IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new,
(SELECT COUNT(od.`id_order`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`)
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
$this->_where = 'AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)';
@@ -62,6 +62,7 @@ class AdminOrdersControllerCore extends AdminController
$this->fieldsDisplay = array(
'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 65),
'new' => array('title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'new', 'tmpTableFilter' => true, 'icon' => array(0 => 'blank.gif', 1 => 'news-new.gif'), 'orderby' => false),
'customer' => array('title' => $this->l('Customer'), 'filter_key' => 'customer', 'tmpTableFilter' => true),
'total_paid' => array('title' => $this->l('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'type' => 'price', 'currency' => true),
@@ -70,8 +71,8 @@ class AdminOrdersControllerCore extends AdminController
'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'),
'id_pdf' => array('title' => $this->l('PDF'), 'width' => 35, 'align' => 'center', 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false));
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_ORDER;
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_ORDER;
parent::__construct();
}
+36 -4
View File
@@ -87,7 +87,7 @@ class AdminProductsController extends AdminController
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group`
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
$this->_filter = 'AND cp.`id_category` = '.(int)$this->_category->id;
$this->_select = 'cl.name `name_category`, cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final';
@@ -1195,6 +1195,7 @@ if (false)
$this->copyFromPost($object, $this->table);
if ($object->update())
{
$this->addCarriers();
if ($id_reason = (int)Tools::getValue('id_mvt_reason') && Tools::getValue('mvt_quantity') > 0 && $id_reason > 0)
{
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, null, null, $this->context->employee->id))
@@ -1258,6 +1259,7 @@ if (false)
$this->copyFromPost($object, $this->table);
if ($object->add())
{
$this->addCarriers();
$this->updateAssoShop((int)$object->id);
$this->updateAccessories($object);
if (!$this->updatePackItems($object))
@@ -1305,19 +1307,30 @@ if (false)
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
}
}
}
protected function addCarriers()
{
if (Tools::getValue('carriers'))
{
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
{
if (Tools::getValue('carriers'))
$product->setCarriers(Tools::getValue('carriers'));
}
}
}
private function _removeTaxFromEcotax()
{
$ecotaxTaxRate = Tax::getProductEcotaxRate();
$ecotaxTaxRate = Tax::getProductEcotaxRate();
if ($ecotax = Tools::getValue('ecotax'))
$_POST['ecotax'] = Tools::ps_round(Tools::getValue('ecotax') / (1 + $ecotaxTaxRate / 100), 6);
}
private function _applyTaxToEcotax($product)
{
$ecotaxTaxRate = Tax::getProductEcotaxRate();
$ecotaxTaxRate = Tax::getProductEcotaxRate();
if ($product->ecotax)
$product->ecotax = Tools::ps_round($product->ecotax * (1 + $ecotaxTaxRate / 100), 2);
}
@@ -2353,6 +2366,8 @@ if (false)
$cache_default_attribute = (int) $this->getFieldValue($product, 'cache_default_attribute');
$data->assign('feature_shop_active', Shop::isFeatureActive());
$data->assign('displayAssoShop', $this->displayAssoShop());
$data->assign('carrier_list', $this->getCarrierList());
$product_props = array();
// global informations
@@ -3199,6 +3214,23 @@ if (false)
$data->assign('default_form_language', $this->default_form_language);
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
protected function getCarrierList()
{
$carrier_list = Carrier::getCarriers($this->context->language->id);
if ($product = $this->loadObject(true))
{
$carrier_selected_list = $product->getCarriers();
foreach ($carrier_list as &$carrier)
foreach ($carrier_selected_list as $carrier_selected)
if ($carrier_selected['id_reference'] == $carrier['id_reference'])
{
$carrier['selected'] = true;
continue;
}
}
return $carrier_list;
}
public function ajaxProcessProductQuantity()
{
-1
View File
@@ -246,7 +246,6 @@ class AddressControllerCore extends FrontController
}
else
Tools::redirect('index.php?controller=addresses');
Tools::redirect($mod ? $back.'&back='.$mod : $back);
}
$this->errors[] = Tools::displayError('An error occurred while updating your address.');
}
+41 -2
View File
@@ -31,6 +31,7 @@ class CartControllerCore extends FrontController
protected $id_product;
protected $id_product_attribute;
protected $id_address_delivery;
protected $customization_id;
protected $qty;
@@ -54,6 +55,7 @@ class CartControllerCore extends FrontController
$this->id_product_attribute = (int)Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
$this->customization_id = (int)Tools::getValue('id_customization');
$this->qty = abs(Tools::getValue('qty', 1));
$this->id_address_delivery = (int)Tools::getValue('id_address_delivery');
}
public function postProcess()
@@ -68,6 +70,10 @@ class CartControllerCore extends FrontController
$this->processChangeProductInCart();
else if (Tools::getIsset('delete'))
$this->processDeleteProductInCart();
else if(Tools::getIsset('changeAddressDelivery'))
$this->processChangeProductAddressDelivery();
else if(Tools::getIsset('duplicate'))
$this->processDuplicateProduct();
// Make redirection
if (!$this->errors && !$this->ajax)
@@ -94,7 +100,8 @@ class CartControllerCore extends FrontController
*/
protected function processDeleteProductInCart()
{
if ($this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id))
if ($this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery))
{
if (!Cart::getNbProducts((int)($this->context->cart->id)))
{
$this->context->cart->id_carrier = 0;
@@ -102,8 +109,40 @@ class CartControllerCore extends FrontController
$this->context->cart->gift_message = '';
$this->context->cart->update();
}
}
CartRule::autoRemoveFromCart();
}
protected function processChangeProductAddressDelivery()
{
$old_id_address_delivery = (int)Tools::getValue('old_id_address_delivery');
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
$this->context->cart->setProductAddressDelivery(
$this->id_product,
$this->id_product_attribute,
$old_id_address_delivery,
$new_id_address_delivery);
}
protected function processDuplicateProduct()
{
if (
!$this->context->cart->duplicateProduct(
$this->id_product,
$this->id_product_attribute,
$this->id_address_delivery,
(int)Tools::getValue('new_id_address_delivery'),
1,
true
)
)
{
//$error_message = $this->l('Error durring product duplication');
// For the moment no translations
$error_message = 'Error durring product duplication';
}
}
/**
* This process add or update a product in the cart
@@ -160,7 +199,7 @@ class CartControllerCore extends FrontController
if (!$this->errors)
{
$updateQuantity = $this->context->cart->updateQty($this->qty, $this->id_product, $this->id_product_attribute, $this->customization_id, Tools::getValue('op', 'up'));
$updateQuantity = $this->context->cart->updateQty($this->qty, $this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery, Tools::getValue('op', 'up'));
if ($updateQuantity < 0)
{
// If product has attribute, minimal quantity is set with minimal quantity of attribute
+27 -4
View File
@@ -64,6 +64,16 @@ class OrderControllerCore extends ParentOrderController
if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3)))
Tools::redirect('index.php?controller=authentication&back='.urlencode('order.php&step='.$this->step));
if (Tools::getValue('multi-shipping') == 1)
$this->context->smarty->assign('multi_shipping', true);
else
$this->context->smarty->assign('multi_shipping', false);
if ($this->context->customer->id)
$this->context->smarty->assign('address_list', $this->context->customer->getAddresses($this->context->language->id));
else
$this->context->smarty->assign('address_list', array());
}
/**
@@ -84,11 +94,17 @@ class OrderControllerCore extends ParentOrderController
$this->context->smarty->assign('empty', 1);
$this->setTemplate(_PS_THEME_DIR_.'shopping-cart.tpl');
break;
case 1:
$this->_assignAddress();
$this->processAddressFormat();
$this->setTemplate(_PS_THEME_DIR_.'order-address.tpl');
if (Tools::getValue('multi-shipping') == 1)
{
$this->_assignSummaryInformations();
$this->setTemplate(_PS_THEME_DIR_.'order-address-multishipping.tpl');
}
else
$this->setTemplate(_PS_THEME_DIR_.'order-address.tpl');
break;
case 2:
@@ -183,6 +199,11 @@ class OrderControllerCore extends ParentOrderController
*/
public function processAddress()
{
if (!Tools::getValue('multi-shipping'))
$this->context->cart->setNoMultishipping();
// Add checking for all addresses
if (!Tools::isSubmit('id_address_delivery') || !Address::isCountryActiveById((int)Tools::getValue('id_address_delivery')))
$this->errors[] = Tools::displayError('This address is not in a valid area.');
else
@@ -213,7 +234,6 @@ class OrderControllerCore extends ParentOrderController
protected function processCarrier()
{
global $orderTotal;
parent::_processCarrier();
if (count($this->errors))
@@ -227,7 +247,7 @@ class OrderControllerCore extends ParentOrderController
}
$orderTotal = $this->context->cart->getOrderTotal();
}
/**
* Address step
*/
@@ -235,6 +255,9 @@ class OrderControllerCore extends ParentOrderController
{
parent::_assignAddress();
if (Tools::getValue('multi-shipping'))
$this->context->cart->autosetProductAddress();
$this->context->smarty->assign('cart', $this->context->cart);
if ($this->context->customer->is_guest)
Tools::redirect('index.php?controller=order&step=2');
+22 -4
View File
@@ -217,10 +217,8 @@ class ParentOrderControllerCore extends FrontController
else
$id_zone = Country::getIdZone((int)Configuration::get('PS_COUNTRY_DEFAULT'));
if (Validate::isInt(Tools::getValue('id_carrier')) && count(Carrier::checkCarrierZone((int)(Tools::getValue('id_carrier')), (int)($id_zone))))
$this->context->cart->id_carrier = (int)(Tools::getValue('id_carrier'));
else if (!$this->context->cart->isVirtualCart() && (int)(Tools::getValue('id_carrier')) == 0)
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
if (Tools::getIsset('delivery_option') && $this->validateDeliveryOption(Tools::getValue('delivery_option')))
$this->context->cart->delivery_option = serialize(Tools::getValue('delivery_option'));
Hook::exec('processCarrier', array('cart' => $this->context->cart));
@@ -230,6 +228,22 @@ class ParentOrderControllerCore extends FrontController
// Carrier has changed, so we check if the cart rules still apply
CartRule::autoRemoveFromCart();
}
/**
* Validate get/post param delivery option
* @param array $delivery_option
*/
protected function validateDeliveryOption($delivery_option)
{
if (!is_array($delivery_option))
return false;
foreach ($delivery_option as $option)
if (!preg_match('/(\d+,)?\d+/', $option))
return false;
return true;
}
protected function _assignSummaryInformations()
{
@@ -364,10 +378,14 @@ class ParentOrderControllerCore extends FrontController
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
$carriers = Carrier::getCarriersForOrder($id_zone, $this->context->customer->getGroups());
$this->context->smarty->assign(array(
'checked' => $this->setDefaultCarrierSelection($carriers),
'carriers' => $carriers,
'address_collection' => $this->context->cart->getAddressCollection(),
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option' => $this->context->cart->getDeliveryOption(),
'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT'))
));
$this->context->smarty->assign(array(
+21 -3
View File
@@ -139,6 +139,11 @@ CREATE TABLE `PREFIX_carrier` (
`external_module_name` varchar(64) DEFAULT NULL,
`shipping_method` int(2) NOT NULL DEFAULT '0',
`position` int(10) unsigned NOT NULL default '0',
`max_width` int(10) DEFAULT 0,
`max_height` int(10) DEFAULT 0,
`max_deep` int(10) DEFAULT 0,
`max_weight` int(10) DEFAULT 0,
`grade` int(10) DEFAULT 0,
PRIMARY KEY (`id_carrier`),
KEY `deleted` (`deleted`,`active`),
KEY `id_tax_rules_group` (`id_tax_rules_group`)
@@ -148,8 +153,8 @@ CREATE TABLE `PREFIX_carrier_lang` (
`id_carrier` int(10) unsigned NOT NULL,
`id_shop` int(11) unsigned NOT NULL DEFAULT '1',
`id_lang` int(10) unsigned NOT NULL,
`delay` varchar(128) default NULL,
UNIQUE KEY `shipper_lang_index` (`id_lang`,`id_shop`, `id_carrier`)
`delay` varchar(128) DEFAULT NULL,
PRIMARY KEY `shipper_lang_index` (`id_lang`,`id_shop`, `id_carrier`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_carrier_zone` (
@@ -163,6 +168,7 @@ CREATE TABLE `PREFIX_cart` (
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
`id_carrier` int(10) unsigned NOT NULL,
`delivery_option` varchar(100),
`id_lang` int(10) unsigned NOT NULL,
`id_address_delivery` int(10) unsigned NOT NULL,
`id_address_invoice` int(10) unsigned NOT NULL,
@@ -173,6 +179,7 @@ CREATE TABLE `PREFIX_cart` (
`recyclable` tinyint(1) unsigned NOT NULL default '1',
`gift` tinyint(1) unsigned NOT NULL default '0',
`gift_message` text,
`allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_cart`),
@@ -274,6 +281,7 @@ CREATE TABLE `PREFIX_cart_cart_rule` (
CREATE TABLE `PREFIX_cart_product` (
`id_cart` int(10) unsigned NOT NULL,
`id_product` int(10) unsigned NOT NULL,
`id_address_delivery` int(10) UNSIGNED DEFAULT 0,
`id_shop` int(10) unsigned NOT NULL DEFAULT '1',
`id_product_attribute` int(10) unsigned default NULL,
`quantity` int(10) unsigned NOT NULL default '0',
@@ -583,13 +591,14 @@ CREATE TABLE `PREFIX_customer_thread` (
CREATE TABLE `PREFIX_customization` (
`id_customization` int(10) unsigned NOT NULL auto_increment,
`id_product_attribute` int(10) unsigned NOT NULL default '0',
`id_address_delivery` int(10) UNSIGNED NOT NULL DEFAULT 0,
`id_cart` int(10) unsigned NOT NULL,
`id_product` int(10) NOT NULL,
`quantity` int(10) NOT NULL,
`quantity_refunded` INT NOT NULL DEFAULT '0',
`quantity_returned` INT NOT NULL DEFAULT '0',
`in_cart` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id_customization`,`id_cart`,`id_product`),
PRIMARY KEY (`id_customization`,`id_cart`,`id_product`, `id_address_delivery`),
KEY `id_product_attribute` (`id_product_attribute`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
@@ -753,6 +762,13 @@ CREATE TABLE `PREFIX_product_group_reduction_cache` (
PRIMARY KEY(`id_product`, `id_group`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_product_carrier` (
`id_product` int(10) unsigned NOT NULL,
`id_carrier_reference` int(10) unsigned NOT NULL,
`id_shop` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product`, `id_carrier_reference`, `id_shop`)
) ENGINE = ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_guest` (
`id_guest` int(10) unsigned NOT NULL auto_increment,
`id_operating_system` int(10) unsigned default NULL,
@@ -971,9 +987,11 @@ CREATE TABLE `PREFIX_operating_system` (
CREATE TABLE `PREFIX_orders` (
`id_order` int(10) unsigned NOT NULL auto_increment,
`reference` VARCHAR(9),
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
`id_carrier` int(10) unsigned NOT NULL,
`id_warehouse` int(10) unsigned DEFAULT 0,
`id_lang` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
`id_cart` int(10) unsigned NOT NULL,
+2 -2
View File
@@ -174,8 +174,8 @@ INSERT INTO `PREFIX_cart` (`id_cart`, `id_carrier`, `id_lang`, `id_address_deliv
INSERT INTO `PREFIX_cart_product` (`id_cart`, `id_product`, `id_shop`, `id_product_attribute`, `quantity`, `date_add`) VALUES (1, 7, 1, 23, 1, NOW());
INSERT INTO `PREFIX_cart_product` (`id_cart`, `id_product`, `id_shop`, `id_product_attribute`, `quantity`, `date_add`) VALUES (1, 9, 1, 0, 1, NOW());
INSERT INTO `PREFIX_orders` (`id_order`, `id_carrier`, `id_lang`, `id_customer`, `id_cart`, `id_currency`, `id_address_delivery`, `id_address_invoice`, `secure_key`, `payment`, `module`, `recyclable`, `gift`, `gift_message`, `shipping_number`, `total_discounts`, `total_paid`, `total_paid_real`, `total_products`, `total_products_wt`, `total_shipping`, `total_wrapping`, `invoice_number`, `delivery_number`, `invoice_date`, `delivery_date`, `date_add`, `date_upd`)
VALUES (1, 2, 2, 1, 1, 1, 2, 2, '47ce86627c1f3c792a80773c5d2deaf8', 'Chèque', 'cheque', 0, 0, '', '', '0.00', '625.98', '625.98', '516.72', '618.00', '7.98', '0.00', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NOW(), NOW());
INSERT INTO `PREFIX_orders` (`id_order`, `reference`, `id_carrier`, `id_lang`, `id_customer`, `id_cart`, `id_currency`, `id_address_delivery`, `id_address_invoice`, `secure_key`, `payment`, `module`, `recyclable`, `gift`, `gift_message`, `shipping_number`, `total_discounts`, `total_paid`, `total_paid_real`, `total_products`, `total_products_wt`, `total_shipping`, `total_wrapping`, `invoice_number`, `delivery_number`, `invoice_date`, `delivery_date`, `date_add`, `date_upd`)
VALUES (1, 'XKBKNABJ', 2, 2, 1, 1, 1, 2, 2, '47ce86627c1f3c792a80773c5d2deaf8', 'Chèque', 'cheque', 0, 0, '', '', '0.00', '625.98', '625.98', '516.72', '618.00', '7.98', '0.00', 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NOW(), NOW());
INSERT INTO `PREFIX_order_detail` (`id_order_detail`, `id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_return`, `product_price`, `product_quantity_discount`, `product_ean13`, `product_reference`, `product_supplier_reference`, `product_weight`, `ecotax`, `download_hash`, `download_nb`, `download_deadline`, `tax_name`)
VALUES (1, 1, 7, 23, 'iPod touch - Capacité: 32Go', 1, 0, '392.140500', '0.000000', NULL, NULL, NULL, 0, '0.00', '', 0, '0000-00-00 00:00:00', '');
INSERT INTO `PREFIX_order_detail` (`id_order_detail`, `id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_return`, `product_price`, `product_quantity_discount`, `product_ean13`, `product_reference`, `product_supplier_reference`, `product_weight`, `ecotax`, `download_hash`, `download_nb`, `download_deadline`, `tax_name`)
+32 -1
View File
@@ -189,7 +189,6 @@ CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` (
/* PHP:add_new_tab(AdminRequestSql, fr:SQL Manager|es:SQL Manager|en:SQL Manager|de:Wunsh|it:SQL Manager, 9); */;
ALTER TABLE `PREFIX_carrier` ADD COLUMN `id_reference` int(10) NOT NULL AFTER `id_carrier`;
UPDATE `PREFIX_carrier` SET id_reference = id_carrier;
@@ -241,6 +240,31 @@ ALTER TABLE `PREFIX_order_state` ADD COLUMN `shipped` TINYINT(1) UNSIGNED NOT NU
UPDATE `PREFIX_order_state` SET `shipped` = 1 WHERE id_order_states IN (4, 5);
ALTER TABLE `PREFIX_carrier`
ADD COLUMN `max_width` int(10) DEFAULT 0 AFTER `position`,
ADD COLUMN `max_height` int(10) DEFAULT 0 AFTER `max_width`,
ADD COLUMN `max_depth` int(10) DEFAULT 0 AFTER `max_height`,
ADD COLUMN `max_weight` int(10) DEFAULT 0 AFTER `max_deep`,
ADD COLUMN `grade` int(10) DEFAULT 0 AFTER `max_weight`;
ALTER TABLE `PREFIX_cart_product`
ADD COLUMN `id_address_delivery` int(10) UNSIGNED DEFAULT 0 AFTER `date_add`;
UPDATE `PREFIX_cart_product` SET id_address_delivery = 0;
ALTER TABLE `PREFIX_cart` ADD COLUMN `allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `gift_message`;
CREATE TABLE `PREFIX_product_carrier` (
`id_product` int(10) unsigned NOT NULL,
`id_carrier_reference` int(10) unsigned NOT NULL,
`id_shop` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product`, `id_carrier_reference`, `id_shop`)
) ENGINE = ENGINE_TYPE DEFAULT CHARSET=utf8;
ALTER TABLE `PREFIX_customization` ADD COLUMN `id_address_delivery` int(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `id_product_attribute`,
DROP PRIMARY KEY,
ADD PRIMARY KEY USING BTREE(`id_customization`, `id_cart`, `id_product`, `id_address_delivery`);
CREATE TABLE `PREFIX_cart_rule` (
`id_cart_rule` int(10) unsigned NOT NULL auto_increment,
`id_customer` int unsigned NOT NULL default 0,
@@ -490,6 +514,13 @@ ALTER TABLE `PREFIX_specific_price` ADD `id_product_attribute` INT UNSIGNED NOT
ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product`;
ALTER TABLE `PREFIX_specific_price` ADD INDEX `id_product` (`id_product`, `id_product_attribute`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`);
ALTER TABLE `PREFIX_orders` ADD COLUMN `reference` varchar(9) AFTER `id_order`;
ALTER TABLE `PREFIX_orders` ADD COLUMN `id_warehouse` int(10) unsigned DEFAULT 0 AFTER `id_carrier`;
ALTER TABLE `PREFIX_cart` ADD COLUMN `order_reference` varchar(9) AFTER `id_cart`;
ALTER TABLE `PREFIX_cart` ADD COLUMN `delivery_option` varchar(100) AFTER `id_carrier`;
ALTER TABLE `PREFIX_hook` ADD `is_native` TINYINT( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `PREFIX_tax` ADD COLUMN `account_number` VARCHAR(64) NOT NULL;
+1 -1
View File
@@ -48,7 +48,7 @@
"customizedDatas":[
{if isset($blockcart_customizedDatas.$productId.$productAttributeId)}
{foreach from=$blockcart_customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizedDatas'}{ldelim}
{foreach from=$blockcart_customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization' name='customizedDatas'}{ldelim}
{* This empty line was made in purpose (product addition debug), please leave it here *}
"customizationId": {$id_customization},
+2 -2
View File
@@ -76,7 +76,7 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
{if isset($blockcart_customizedDatas.$productId.$productAttributeId)}
{if !isset($product.attributes_small)}<dd id="cart_block_combination_of_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">{/if}
<ul class="cart_block_customizations" id="customization_{$productId}_{$productAttributeId}">
{foreach from=$blockcart_customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizations'}
{foreach from=$blockcart_customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization' name='customizations'}
<li name="customization">
<div class="deleteCustomizableProduct" id="deleteCustomizableProduct_{$id_customization|intval}_{$product.id_product|intval}_{$product.id_product_attribute|intval}"><a class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$static_token}")}"> </a></div>
<span class="quantity-formated"><span class="quantity">{$customization.quantity}</span>x</span>{if isset($customization.datas.$blockcart_CUSTOMIZE_TEXTFIELD.0)}
@@ -142,7 +142,7 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
{/if}
<p id="cart-buttons">
{capture name=step_order_process}
{if $blockcart_order_process == 'order'}step=1{/if}
{if $blockcart_order_process == 'order'}step=1{/if}
{/capture}
{if $blockcart_order_process == 'order'}<a href="{$link->getPageLink("$blockcart_order_process", true)}" class="button_small" title="{l s='Cart' mod='blockcart'}">{l s='Cart' mod='blockcart'}</a>{/if}
<a href="{$link->getPageLink("$blockcart_order_process", true, NULL, "{$smarty.capture.step_order_process}")}" id="button_order_cart" class="exclusive{if $blockcart_order_process == 'order-opc'}_large{/if}" title="{l s='Check out' mod='blockcart'}">{l s='Check out' mod='blockcart'}</a>
+18 -57
View File
@@ -19,7 +19,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7096 $
* @version Release: $Revision: 9532 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registred Trademark & Property of PrestaShop SA
*/
@@ -52,16 +52,16 @@ $(document).ready(function()
// Click on label
$('label a').live({
click: function() {
if($(this).parent().parent().find('input').attr('disabled') == '')
click: function() {
if ($(this).parent().parent().find('input').attr('disabled') == '')
{
$(this).parent().parent().find('input').click();
reloadContent();
$(this).parent().parent().find('input').click();
reloadContent();
}
return false;
}
});
return false;
}
});
paginationButton();
initLayered();
});
@@ -94,14 +94,6 @@ function initLayered()
var params = window.location.href.split('#')[1];
reloadContent('&selected_filters='+params);
}
}
function updatelink(link)
{
baseUrl = link.split('#');
linkFilterUpdate = baseUrl[0]+getValueSelected();
linkFilterUpdate = friendlyUrl(linkFilterUpdate, 'short');
return linkFilterUpdate;
}
function getValueSelected(){
@@ -125,37 +117,6 @@ function getValueSelected(){
return checkboxChecked;
}
function friendlyUrl(link, encode)
{
var friendlyTab =
{
'layered_condition_' : 'cond_',
'layered_id_attribute_group_' : 'g_',
'id_category_layered=' : 'c=',
'layered_manufacturer_' : 'm_',
'layered_id_feature_' : 'f_',
'layered_category_' : 'cat_',
};
if(encode == 'short')
{
$.each(friendlyTab, function(key, value)
{
Expression = new RegExp(key,'g');
link = link.replace(Expression, value);
});
}else
{
$.each(friendlyTab, function(key, value)
{
Expression = new RegExp(value,'g');
link = link.replace(Expression, key);
});
}
return link;
}
function paginationButton() {
$('#pagination li').not('.current, .disabled').each( function () {
var nbPage = 0;
@@ -181,7 +142,7 @@ function cancelFilter()
{
$('#enabled_filters a').live('click', function(e)
{
if($(this).attr('rel').search(/_slider$/) > 0)
if ($(this).attr('rel').search(/_slider$/) > 0)
{
$('#'+$(this).attr('rel')).slider('values' , 0, $('#'+$(this).attr('rel')).slider('option' , 'min' ));
$('#'+$(this).attr('rel')).slider('values' , 1, $('#'+$(this).attr('rel')).slider('option' , 'max' ));
@@ -189,8 +150,8 @@ function cancelFilter()
}
else
{
$('#'+$(this).attr('rel')).attr('checked', false);
$('#layered_form input[name='+$(this).attr('rel')+']:hidden').remove();
$('#'+$(this).attr('rel')).attr('checked', false);
$('#layered_form input[name='+$(this).attr('rel')+']:hidden').remove();
}
reloadContent();
e.preventDefault();
@@ -224,7 +185,7 @@ function reloadContent(params_plus)
if (!ajaxLoaderOn)
{
$('#product_list').prepend($('#layered_ajax_loader').html());
$('#product_list').prepend($('#layered_ajax_loader').html());
$('#product_list').css('opacity', '0.7');
ajaxLoaderOn = 1;
}
@@ -233,7 +194,7 @@ function reloadContent(params_plus)
$('.layered_slider').each( function () {
var sliderStart = $(this).slider('values', 0);
var sliderStop = $(this).slider('values', 1);
if(typeof(sliderStart) == 'number' && typeof(sliderStop) == 'number')
if (typeof(sliderStart) == 'number' && typeof(sliderStop) == 'number')
data += '&'+$(this).attr('id')+'='+sliderStart+'_'+sliderStop;
});
@@ -244,7 +205,7 @@ function reloadContent(params_plus)
}
var slideUp = true;
if(params_plus == undefined)
if (params_plus == undefined)
{
params_plus = '';
slideUp = false;
@@ -267,7 +228,7 @@ function reloadContent(params_plus)
{
$('#layered_block_left').after('<div id="tmp_layered_block_left"></div>').remove();
$('#tmp_layered_block_left').html(result.filtersBlock).attr('id', 'layered_block_left');
$('.category-product-count').html(result.categoryCount);
$('#product_list').replaceWith(result.productList);
@@ -290,7 +251,7 @@ function reloadContent(params_plus)
return false;
});
if (typeof(ajaxCart) != "undefined")
ajaxCart.overrideButtonsInThePage();
ajaxCart.overrideButtonsInThePage();
if (typeof(reloadProductComparison) == 'function')
reloadProductComparison();
@@ -314,7 +275,7 @@ function reloadContent(params_plus)
});
if (current_friendly_url == '#')
current_friendly_url = '#/';
window.location = current_friendly_url;
window.location = current_friendly_url;
lockLocationChecking = true;
if(slideUp)
@@ -339,7 +300,7 @@ function initLocationChange(func, time)
lockLocationChecking = true;
reloadContent('&selected_filters='+getUrlParams().replace(/^#/, ''));
}
}
else {
lockLocationChecking = false;
current_friendly_url = getUrlParams();
+23 -22
View File
@@ -19,7 +19,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7310 $
* @version Release: $Revision: 9528 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registred Trademark & Property of PrestaShop SA
*}
@@ -72,7 +72,7 @@ param_product_url = '#{$param_product_url}';
{if isset($filter.slider)}
<div class="layered_{$filter.type}" style="display: none;">
{else}
<div>
<div>
{/if}
<span class="layered_subtitle">{$filter.name|escape:html:'UTF-8'}</span>
<span class="layered_close"><a href="#" rel="ul_layered_{$filter.type}_{$filter.id_key}">v</a></span>
@@ -85,39 +85,40 @@ param_product_url = '#{$param_product_url}';
<input type="button" name="layered_{$filter.type_lite}_{$id_value}" rel="{$id_value}_{$filter.id_key}" id="layered_id_attribute_group_{$id_value}" {if !$value.nbr} value="X" disabled="disabled"{/if} style="background: {if isset($value.color)}{$value.color}{else}#CCC{/if}; margin-left: 0; width: 16px; height: 16px; padding:0; border: 1px solid {if isset($value.checked) && $value.checked}red{else}#666{/if};" />
{if isset($value.checked) && $value.checked}<input type="hidden" name="layered_{$filter.type_lite}_{$id_value}" value="{$id_value}" />{/if}
{else}
<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
{/if}
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" rel="{$id_value}_{$filter.id_key}"{/if}{/if}>
{if !$value.nbr}
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> (0)</span>{/if}</a>
{else}
<a href="{$value.link}" rel="{$value.rel}">{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a></label>
{/if}
<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
{/if}
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" rel="{$id_value}_{$filter.id_key}"{/if}{/if}>
{if !$value.nbr}
{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> (0)</span>{/if}</a>
{else}
<a href="{$value.link}" rel="{$value.rel}">{$value.name|escape:html:'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a>
{/if}
</label>
</li>
{/foreach}
{else}
<label for="{$filter.type}">{l s='Range:'}</label> <span id="layered_{$filter.type}_range"></span>
<div style="margin: 6px 0 6px 6px; width: 93%;">
<div style="margin-top:5px;" class="layered_slider" id="layered_{$filter.type}_slider"></div>
<div style="margin-top:5px;" class="layered_slider" id="layered_{$filter.type}_slider"></div>
</div>
<script type="text/javascript">
{literal}
addSlider('{/literal}{$filter.type}{literal}',{
range: true,
min: {/literal}{$filter.min}{literal},
max: {/literal}{$filter.max}{literal},
values: [ {/literal}{$filter.values[0]}{literal}, {/literal}{$filter.values[1]}{literal}],
slide: function( event, ui ) {
$('#layered_{/literal}{$filter.type}{literal}_range').html(ui.values[ 0 ] + '{/literal}{$filter.unit}{literal}' + ' - ' + ui.values[ 1 ] + '{/literal}{$filter.unit}{literal}');
},
stop: function () {
reloadContent();
}
range: true,
min: {/literal}{$filter.min}{literal},
max: {/literal}{$filter.max}{literal},
values: [ {/literal}{$filter.values[0]}{literal}, {/literal}{$filter.values[1]}{literal}],
slide: function( event, ui ) {
$('#layered_{/literal}{$filter.type}{literal}_range').html(ui.values[ 0 ] + '{/literal}{$filter.unit}{literal}' + ' - ' + ui.values[ 1 ] + '{/literal}{$filter.unit}{literal}');
},
stop: function () {
reloadContent();
}
}, '{/literal}{$filter.unit}{literal}');
$(document).ready(function()
{
$('.layered_{/literal}{$filter.type}{literal}').show();
});
});
{/literal}
</script>
{/if}
+2 -2
View File
@@ -48,8 +48,8 @@
- {l s='The total amount of your order is' mod='cheque'}
<span id="amount" class="price">{displayPrice price=$total}</span>
{if $use_taxes == 1}
{l s='(tax incl.)' mod='cheque'}
{/if}
{l s='(tax incl.)' mod='cheque'}
{/if}
</p>
<p>
-
+67 -12
View File
@@ -361,6 +361,8 @@ table.std {
.std tr.alternate_item td,
.std tr.alternate_item th { background-color: #f1f2f4 }
.std tbody td,.std tfoot td { border-top: 1px solid #bdc2c9 }
.std tbody tr.shipping-address td,.std tfoot tr.shipping-address td { border-top: none }
.std tbody tr.shipping-address td.label,.std tfoot tr.shipping-address td.label { text-align: right; }
.std thead th {
background-color: transparent;
background-image: url('../img/table_header.gif');
@@ -1024,10 +1026,13 @@ p.cart_navigation .button,
p.cart_navigation .exclusive,
p.cart_navigation .exclusive_large,
p.cart_navigation .exclusive_large_disabled { float: right }
p.cart_navigation .multishipping-button { margin-right: 10px }
p.cart_navigation_extra {
text-align: center;
width: auto
}
.address-form-multishipping { padding: 10px; }
.address-form-multishipping a { float: none; margin-left: 210px; }
form.std p.cart_navigation span {
float: none;
text-align: left;
@@ -1044,6 +1049,7 @@ form.std p.cart_navigation span {
font-size: 1em;
text-decoration: none
}
tr.cart_item td .cart_address_delivery { width: 100px; margin-right: 10px; }
tr.cart_item td { padding: 0.5em 0 }
td.cart_product a { margin: 0 0.6em }
td.cart_product a img {
@@ -1099,23 +1105,13 @@ tr.cart_total_price { font-weight: bold }
cursor:pointer;
}
#order form#voucher h4,
#order form#voucher p,
#order form#voucher .button { display: inline }
#order form#voucher p,
#order form#voucher .button { display: inline }
#order form#voucher h4 {
float: left;
line-height: 1.5em;
margin-right: 6em
}
#order #order_carrier {
clear: both;
margin-top: 1em;
border: 1px solid #bdc2c9;
padding: 0.5em
}
#order #order_carrier h4 {
width: 50%;
display: inline
}
#order #order_carrier img { vertical-align: middle }
#order #order_carrier span { margin: 0 0.2em }
#order #gift_div { display: none }
@@ -1124,6 +1120,65 @@ tr.cart_total_price { font-weight: bold }
width: 100%;
margin: 1em 0
}
#order .delivery_options_address {
width: 541px;
margin-left: 7px;
}
#order .delivery_options_address h3 {
background: url("../img/table_header.gif") no-repeat;
background: url("http://prestashop15.localhost/themes/prestashop/css/../img/table_header.gif") no-repeat;
color: #374853;
font-weight: bold;
height: 14px;
padding: 5px 10px;
margin: 10px 0 0 0;
}
#order .delivery_option_radio {
float: left;
margin-top: 12px;
}
#order .delivery_option label {
display: block;
padding-bottom: 5px;
}
#order .delivery_option label > table.resume {
width: 522px;
height: 40px;
}
#order .delivery_option.item {
background: #FAFAFA;
}
#order .delivery_option.alternate_item {
background: #F1F2F4;
border-top: 1px solid #BDC2C9;
}
#order .delivery_option label > table.resume td {
padding: 0 8px;
}
#order .delivery_option label > table.resume td + td {
text-align: left;
width: 380px;
}
#order .delivery_option label > table.resume td + td + td {
text-align: right;
width: 100px;
}
#order .delivery_options_address .delivery_option_logo {
text-align: center;
width: 100px;
}
#order .delivery_option_icon {
}
#order .delivery_option_price {
}
#order .delivery_options_address .delivery_option_logo img { height: 40px; }
#order .delivery_option_carrier {
border: 1px solid #BDC2C9;
background: white;
margin: 5px 20px;
padding: 5px;
width: 500px;
}
#order-opc tfoot p {
margin: 0;
+1 -1
View File
@@ -55,7 +55,7 @@
<a class="color-myaccount" href="javascript:showOrder(1, {$order.id_order|intval}, 'order-detail');">{l s='#'}{$order.id_order|string_format:"%06d"}</a>
</td>
<td class="history_date bold">{dateFormat date=$order.date_add full=0}</td>
<td class="history_price"><span class="price">{displayPrice price=$order.total_paid_real currency=$order.id_currency no_utf8=false convert=false}</span></td>
<td class="history_price"><span class="price">{displayPrice price=$order.total_paid currency=$order.id_currency no_utf8=false convert=false}</span></td>
<td class="history_method">{$order.payment|escape:'htmlall':'UTF-8'}</td>
<td class="history_state">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}</td>
<td class="history_invoice">
+329 -128
View File
@@ -29,13 +29,186 @@ $(document).ready(function()
// If block cart isn't used, we don't bind the handle actions
if (window.ajaxCart !== undefined)
{
$('.cart_quantity_up').unbind('click').click(function(){ upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false; });
$('.cart_quantity_down').unbind('click').click(function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
$('.cart_quantity_delete' ).unbind('click').click(function(){ deletProductFromSummary($(this).attr('id')); return false; });
$('.cart_quantity_up').unbind('click').live('click', function(){ upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false; });
$('.cart_quantity_down').unbind('click').live('click', function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
$('.cart_quantity_delete' ).unbind('click').live('click', function(){ deleteProductFromSummary($(this).attr('id')); return false; });
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: updateQty });
$('.cart_address_delivery').live('change', function(){ changeAddressDelivery($(this)); });
}
else
{
$('.cart_address_delivery').change(function(){ submit(); });
}
cleanSelectAddressDelivery();
});
function cleanSelectAddressDelivery()
{
if (window.ajaxCart !== undefined)
{
//Removing "Ship to an other address" from the address delivery select option if there is not enought address
$.each($('.cart_address_delivery'), function(it, item)
{
var options = $(item).find('option');
var address_count = 0;
var ids = $(item).attr('id').split('_');
var id_product = ids[3];
var id_product_attribute = ids[4];
var id_address_delivery = ids[5];
$.each(options, function(i) {
if ($(options[i]).val() > 0
&& ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products
|| id_address_delivery == $(options[i]).val()
)
)
address_count++;
});
if (address_count < 2) // Need at least two address to allow skipping products to multiple address
$($(item).find('option[value=-2]')).remove();
else if($($(item).find('option[value=-2]')).length == 0)
$(item).append($('<option value="-2">Ship to an other address</option>')); // @todo add translation
});
}
}
function changeAddressDelivery(obj)
{
var ids = obj.attr('id').split('_');
var id_product = ids[3];
var id_product_attribute = ids[4];
var old_id_address_delivery = ids[5];
var new_id_address_delivery = obj.val();
if (new_id_address_delivery == old_id_address_delivery)
return;
if (new_id_address_delivery > 0) // Change the delivery address
{
$.ajax({
type: 'GET',
url: baseDir,
async: true,
cache: false,
dataType: 'json',
data: 'controller=cart&ajax=true&changeAddressDelivery&summary&id_product='+id_product
+'&id_product_attribute='+id_product_attribute
+'&old_id_address_delivery='+old_id_address_delivery
+'&new_id_address_delivery='+new_id_address_delivery
+'&token='+static_token,
success: function(jsonData)
{
// The product exist
if ($('#product_'+id_product+'_'+id_product_attribute+'_0_'+new_id_address_delivery).length)
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
updateCarrierList(jsonData);
// @todo reverse the remove order
// This effect remove the current line, but it's better to remove the other one, and refresshing this one
$('#product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
// @todo improve customization upgrading
$('.product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
}
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery);
cleanSelectAddressDelivery();
}
});
}
else if (new_id_address_delivery == -1) // Adding a new address
window.location = $($('.address_add a')[0]).attr('href');
else if (new_id_address_delivery == -2) // Add a new line for this product
{
// This test is will not usefull in the future
if (old_id_address_delivery == 0)
{
alert('Please select first an address'); // @todo translate
return false;
}
// Get new address to deliver
var id_address_delivery = 0;
var options = $('#select_address_delivery_'+id_product+'_'+id_product_attribute+'_'+old_id_address_delivery+' option');
$.each(options, function(i) {
if ($(options[i]).val() > 0 && $(options[i]).val() != old_id_address_delivery
&& $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products
)
{
id_address_delivery = $(options[i]).val();
return false;
}
});
$.ajax({
type: 'GET',
url: baseDir,
async: true,
cache: false,
dataType: 'json',
context: obj,
data: 'controller=cart&ajax=true&duplicate&summary&id_product='+id_product+'&id_product_attribute='+id_product_attribute+'&id_address_delivery='+old_id_address_delivery+'&new_id_address_delivery='+id_address_delivery+'&token='+static_token ,
success: function(jsonData)
{
if (jsonData.error)
{
alert(jsonData.reason);
return;
}
var line = $('#product_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery);
var new_line = line.clone();
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, new_line);
line.after(new_line);
new_line.find('input[name=quantity_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery + '_hidden]')
.val(1);
new_line.find('.cart_quantity_input')
.val(1);
$('#select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + old_id_address_delivery).val(old_id_address_delivery);
$('#select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + id_address_delivery).val(id_address_delivery);
cleanSelectAddressDelivery();
updateCartSummary(jsonData.summary);
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
}
});
}
}
function updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, line)
{
if (typeof(line) == 'undefined')
var line = $('#product_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery);
line.attr('id', 'product_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
line.find('.cart_quantity_input')
.attr('name', 'quantity_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
line.find('input[name=quantity_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery + '_hidden]')
.attr('name', 'quantity_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery + '_hidden');
line.find('#cart_quantity_down_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery)
.attr('id', 'cart_quantity_down_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
line.find('#cart_quantity_up_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery)
.attr('id', 'cart_quantity_up_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
line.find('#' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery)
.attr('id', id_product+'_' + id_product_attribute + '_0_' + id_address_delivery);
line.find('#select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + old_id_address_delivery)
.attr('id', 'select_address_delivery_' + id_product+'_' + id_product_attribute + '_' + id_address_delivery);
}
function updateQty(val)
{
var id = $(this.el).attr('name');
@@ -48,19 +221,20 @@ function updateQty(val)
var QtyToUp = parseInt(input) - parseInt(hidden);
if (parseInt(QtyToUp) > 0)
upQuantity(id.replace('quantity_', ''),QtyToUp);
upQuantity(id.replace('quantity_', ''), QtyToUp);
else if(parseInt(QtyToUp) < 0)
downQuantity(id.replace('quantity_', ''),QtyToUp);
downQuantity(id.replace('quantity_', ''), QtyToUp);
}
else
$('input[name='+ id +']').val($('input[name='+ id +'_hidden]').val());
}
function deletProductFromSummary(id)
function deleteProductFromSummary(id)
{
var customizationId = 0;
var productId = 0;
var productAttributeId = 0;
var id_address_delivery = 0;
var ids = 0;
ids = id.split('_');
productId = parseInt(ids[0]);
@@ -68,34 +242,36 @@ function deletProductFromSummary(id)
productAttributeId = parseInt(ids[1]);
if (typeof(ids[2]) != 'undefined')
customizationId = parseInt(ids[2]);
if (typeof(ids[3]) != 'undefined')
id_address_delivery = parseInt(ids[3]);
$.ajax({
type: 'GET',
url: baseDir + 'cart.php',
async: true,
cache: false,
dataType: 'json',
data: 'ajax=true&delete&summary&id_product='+productId+'&ipa='+productAttributeId+ ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&token=' + static_token ,
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
}
else
{
if (parseInt(jsonData.summary.products.length) == 0)
{
$('#center_column').children().each(function() {
if ($(this).attr('id') != 'emptyCartWarning' && $(this).attr('class') != 'breadcrumb' && $(this).attr('id') != 'cart_title')
{
$(this).fadeOut('slow', function () {
$(this).remove();
});
}
type: 'GET',
url: baseDir,
async: true,
cache: false,
dataType: 'json',
data: 'controller=cart&ajax=true&delete&summary&id_product='+productId+'&ipa='+productAttributeId+'&id_address_delivery='+id_address_delivery+ ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&token=' + static_token ,
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
}
else
{
if (parseInt(jsonData.summary.products.length) == 0)
{
$('#center_column').children().each(function() {
if ($(this).attr('id') != 'emptyCartWarning' && $(this).attr('class') != 'breadcrumb' && $(this).attr('id') != 'cart_title')
{
$(this).fadeOut('slow', function () {
$(this).remove();
});
}
});
$('#summary_products_label').remove();
$('#emptyCartWarning').fadeIn('slow');
@@ -104,6 +280,7 @@ function deletProductFromSummary(id)
{
$('#product_'+ id).fadeOut('slow', function() {
$(this).remove();
cleanSelectAddressDelivery();
});
var exist = false;
@@ -123,11 +300,10 @@ function deletProductFromSummary(id)
updateCustomizedDatas(jsonData.customizedDatas);
if (jsonData.carriers != null)
updateCarrierList(jsonData);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
function upQuantity(id, qty)
@@ -137,6 +313,7 @@ function upQuantity(id, qty)
var customizationId = 0;
var productId = 0;
var productAttributeId = 0;
var id_address_delivery = 0;
var ids = 0;
ids = id.split('_');
productId = parseInt(ids[0]);
@@ -144,37 +321,39 @@ function upQuantity(id, qty)
productAttributeId = parseInt(ids[1]);
if (typeof(ids[2]) != 'undefined')
customizationId = parseInt(ids[2]);
if (typeof(ids[3]) != 'undefined')
id_address_delivery = parseInt(ids[3]);
$.ajax({
type: 'GET',
url: baseDir + 'cart.php',
async: true,
cache: false,
dataType: 'json',
data: 'ajax=true&add&getproductprice&summary&id_product='+productId+'&ipa='+productAttributeId + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
}
else
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
type: 'GET',
url: baseDir,
async: true,
cache: false,
dataType: 'json',
data: 'controller=cart&ajax=true&add&getproductprice&summary&id_product='+productId+'&ipa='+productAttributeId+'&id_address_delivery='+id_address_delivery + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
}
else
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
if (jsonData.carriers != null)
updateCarrierList(jsonData);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
function downQuantity(id, qty)
@@ -187,10 +366,11 @@ function downQuantity(id, qty)
newVal = val - 1;
}
else if (qty < 0)
qty = -qty;
qty = -qty;
var customizationId = 0;
var productId = 0;
var productAttributeId = 0;
var id_address_delivery = 0;
var ids = 0;
if (newVal > 0)
{
@@ -200,42 +380,44 @@ function downQuantity(id, qty)
productAttributeId = parseInt(ids[1]);
if (typeof(ids[2]) != 'undefined')
customizationId = parseInt(ids[2]);
if (typeof(ids[3]) != 'undefined')
id_address_delivery = parseInt(ids[3]);
$.ajax({
type: 'GET',
url: baseDir + 'cart.php',
async: true,
cache: false,
dataType: 'json',
data: 'ajax=true&add&getproductprice&summary&id_product='+productId+'&ipa='+productAttributeId+'&op=down' + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
}
else
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
type: 'GET',
url: baseDir,
async: true,
cache: false,
dataType: 'json',
data: 'controller=cart&ajax=true&add&getproductprice&summary&id_product='+productId+'&ipa='+productAttributeId+'&id_address_delivery='+id_address_delivery+'&op=down' + ( (customizationId != 0) ? '&id_customization='+customizationId : '') + '&qty='+qty+'&token=' + static_token ,
success: function(jsonData)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
$('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val());
}
else
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
if (jsonData.carriers != null)
updateCarrierList(jsonData);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
else
{
deletProductFromSummary(id);
deleteProductFromSummary(id);
}
}
@@ -253,7 +435,9 @@ function updateCartSummary(json)
// if reduction, we need to show it in the cart by showing the initial price above the current one
var reduction = json.products[i].reduction_applies;
var initial_price_text = '';
initial_price = formatCurrency(json.products[i].price_without_quantity_discount, currencyFormat, currencySign, currencyBlank);
initial_price = '';
if (typeof(json.products[i].price_without_quantity_discount) != 'undefined')
initial_price = formatCurrency(json.products[i].price_without_quantity_discount, currencyFormat, currencySign, currencyBlank);
var current_price = '';
if (priceDisplayMethod != 0)
current_price = formatCurrency(json.products[i].price, currencyFormat, currencySign, currencyBlank);
@@ -273,34 +457,37 @@ function updateCartSummary(json)
if (priceDisplayMethod != 0)
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(initial_price_text+current_price);
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(initial_price_text+current_price);
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
}
else
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(initial_price_text+current_price);
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(initial_price_text+current_price);
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery).html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
}
nbrProducts += parseInt(json.products[i].cart_quantity);
if(json.products[i].id_customization == null)
{
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+']').val(json.products[i].cart_quantity);
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+'_hidden]').val(json.products[i].cart_quantity);
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_0_'+json.products[i].id_address_delivery+']').val(json.products[i].cart_quantity);
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_0_'+json.products[i].id_address_delivery+'_hidden]').val(json.products[i].cart_quantity);
}
else
{
$('#cart_quantity_custom_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(json.products[i].cart_quantity);
//$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_customization+'_'+json.products[i].id_address_delivery+']')
// .val(json.products[i].cart_quantity);
$('#cart_quantity_custom_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery)
.html(json.products[i].cart_quantity);
}
// Show / hide quantity button if minimal quantity
if (parseInt(json.products[i].minimal_quantity) == parseInt(json.products[i].cart_quantity) && json.products[i].minimal_quantity != 1)
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',0.3);
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+Number(json.products[i].id_customization)+'_'+json.products[i].id_address_delivery).fadeTo('slow',0.3);
else
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',1);
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+Number(json.products[i].id_customization)+'_'+json.products[i].id_address_delivery).fadeTo('slow',1);
}
@@ -342,16 +529,16 @@ function updateCartSummary(json)
}
// Block cart
if (priceDisplayMethod != 0)
if (priceDisplayMethod != 0)
{
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping_tax_exc, currencyFormat, currencySign, currencyBlank));
$('#cart_block_total').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
} else {
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank));
$('#cart_block_total').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
}
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping_tax_exc, currencyFormat, currencySign, currencyBlank));
$('#cart_block_total').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
} else {
$('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
$('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank));
$('#cart_block_total').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
}
$('#cart_block_tax_cost').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
$('.ajax_cart_quantity').html(nbrProducts);
@@ -359,9 +546,9 @@ function updateCartSummary(json)
// Cart summary
$('#summary_products_quantity').html(nbrProducts+' '+(nbrProducts > 1 ? txtProducts : txtProduct));
if (priceDisplayMethod != 0)
$('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank));
else
$('#total_product').html(formatCurrency(json.total_products_wt, currencyFormat, currencySign, currencyBlank));
$('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank));
else
$('#total_product').html(formatCurrency(json.total_products_wt, currencyFormat, currencySign, currencyBlank));
$('#total_price').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
$('#total_price_without_tax').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
$('#total_tax').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
@@ -372,12 +559,12 @@ function updateCartSummary(json)
{
$('.cart_total_delivery').fadeIn();
if (priceDisplayMethod != 0)
{
$('#total_shipping').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
{
$('#total_shipping').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
}
else
{
$('#total_shipping').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
$('#total_shipping').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
}
}
@@ -408,10 +595,11 @@ function updateCustomizedDatas(json)
for(i in json)
for(j in json[i])
for(k in json[i][j])
{
$('input[name=quantity_'+i+'_'+j+'_'+k+'_hidden]').val(json[i][j][k]['quantity']);
$('input[name=quantity_'+i+'_'+j+'_'+k+']').val(json[i][j][k]['quantity']);
}
for(l in json[i][j][k])
{
$('input[name=quantity_'+i+'_'+j+'_'+l+'_'+k+'_hidden]').val(json[i][j][k][l]['quantity']);
$('input[name=quantity_'+i+'_'+j+'_'+l+'_'+k+']').val(json[i][j][k][l]['quantity']);
}
}
function updateHookShoppingCart(html)
@@ -422,4 +610,17 @@ function updateHookShoppingCart(html)
function updateHookShoppingCartExtra(html)
{
$('#HOOK_SHOPPING_CART_EXTRA').html(html);
}
}
$(document).ready(function() {
$.each($('.delivery_option_radio'), function() {
if ($(this).attr('checked'))
$(this).parent().find('.delivery_option_carrier').show();
else
$(this).parent().find('.delivery_option_carrier').hide();
});
$('.delivery_option_radio').change(function() {
$(this).parent().parent().find('.delivery_option_carrier').hide();
$(this).parent().find('.delivery_option_carrier').show();
});
});
+9 -6
View File
@@ -60,7 +60,7 @@ function updateAddressesDisplay(first_view)
else
{
$('#address_invoice_form:hidden').show('fast');
if ($('select#id_address_invoice').val())
if ($('#id_address_invoice').val())
updateAddressDisplay('invoice');
else
{
@@ -82,20 +82,23 @@ function updateAddressDisplay(addressType)
if (formatedAddressFieldsValuesList.length <= 0)
return false;
var idAddress = $('select#id_address_' + addressType + '').val();
var idAddress = $('#id_address_' + addressType + '').val();
buildAddressBlock(idAddress, addressType, $('#address_'+ addressType));
// change update link
var link = $('ul#address_' + addressType + ' li.address_update a').attr('href');
var expression = /id_address=\d+/;
link = link.replace(expression, 'id_address='+idAddress);
$('ul#address_' + addressType + ' li.address_update a').attr('href', link);
if (link)
{
link = link.replace(expression, 'id_address='+idAddress);
$('ul#address_' + addressType + ' li.address_update a').attr('href', link);
}
}
function updateAddresses()
{
var idAddress_delivery = $('select#id_address_delivery').val();
var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : $('select#id_address_invoice').val();
var idAddress_delivery = $('#id_address_delivery').val();
var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : $('#id_address_invoice').val();
$.ajax({
type: 'GET',
+2 -2
View File
@@ -112,8 +112,8 @@ function updatePaymentMethods(json)
function updateAddressSelection()
{
var idAddress_delivery = ($('input#opc_id_address_delivery').length == 1 ? $('input#opc_id_address_delivery').val() : $('select#id_address_delivery').val());
var idAddress_invoice = ($('input#opc_id_address_invoice').length == 1 ? $('input#opc_id_address_invoice').val() : ($('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : ($('select#id_address_invoice').length == 1 ? $('select#id_address_invoice').val() : idAddress_delivery)));
var idAddress_delivery = ($('input#opc_id_address_delivery').length == 1 ? $('input#opc_id_address_delivery').val() : $('#id_address_delivery').val());
var idAddress_invoice = ($('input#opc_id_address_invoice').length == 1 ? $('input#opc_id_address_invoice').val() : ($('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : ($('#id_address_invoice').length == 1 ? $('select#id_address_invoice').val() : idAddress_delivery)));
$('#opc_account-overlay').fadeIn('slow');
$('#opc_delivery_methods-overlay').fadeIn('slow');
@@ -0,0 +1,289 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{* Will be deleted for 1.5 version and more *}
{if !isset($formatedAddressFieldsValuesList)}
{$ignoreList.0 = "id_address"}
{$ignoreList.1 = "id_country"}
{$ignoreList.2 = "id_state"}
{$ignoreList.3 = "id_customer"}
{$ignoreList.4 = "id_manufacturer"}
{$ignoreList.5 = "id_supplier"}
{$ignoreList.6 = "date_add"}
{$ignoreList.7 = "date_upd"}
{$ignoreList.8 = "active"}
{$ignoreList.9 = "deleted"}
{* PrestaShop 1.4.0.17 compatibility *}
{if isset($addresses)}
{foreach from=$addresses key=k item=address}
{counter start=0 skip=1 assign=address_key_number}
{$id_address = $address.id_address}
{foreach from=$address key=address_key item=address_content}
{if !in_array($address_key, $ignoreList)}
{$formatedAddressFieldsValuesList.$id_address.ordered_fields.$address_key_number = $address_key}
{$formatedAddressFieldsValuesList.$id_address.formated_fields_values.$address_key = $address_content}
{counter}
{/if}
{/foreach}
{/foreach}
{/if}
{/if}
<script type="text/javascript">
// <![CDATA[
{if !$opc}
var orderProcess = 'order';
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
var currencyRate = '{$currencyRate|floatval}';
var currencyFormat = '{$currencyFormat|intval}';
var currencyBlank = '{$currencyBlank|intval}';
var txtProduct = "{l s='product'}";
var txtProducts = "{l s='products'}";
{/if}
var formatedAddressFieldsValuesList = new Array();
{foreach from=$formatedAddressFieldsValuesList key=id_address item=type}
formatedAddressFieldsValuesList[{$id_address}] =
{ldelim}
'ordered_fields':[
{foreach from=$type.ordered_fields key=num_field item=field_name name=inv_loop}
{if !$smarty.foreach.inv_loop.first},{/if}"{$field_name}"
{/foreach}
],
'formated_fields_values':{ldelim}
{foreach from=$type.formated_fields_values key=pattern_name item=field_name name=inv_loop}
{if !$smarty.foreach.inv_loop.first},{/if}"{$pattern_name}":"{$field_name}"
{/foreach}
{rdelim}
{rdelim}
{/foreach}
function getAddressesTitles()
{ldelim}
return {ldelim}
'invoice': "{l s='Your billing address'}",
'delivery': "{l s='Your delivery address'}"
{rdelim};
{rdelim}
function buildAddressBlock(id_address, address_type, dest_comp)
{ldelim}
var adr_titles_vals = getAddressesTitles();
var li_content = formatedAddressFieldsValuesList[id_address]['formated_fields_values'];
var ordered_fields_name = ['title'];
ordered_fields_name = ordered_fields_name.concat(formatedAddressFieldsValuesList[id_address]['ordered_fields']);
ordered_fields_name = ordered_fields_name.concat(['update']);
dest_comp.html('');
li_content['title'] = adr_titles_vals[address_type];
li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")}'+id_address+'&amp;back=order?step=1{if $back}&mod={$back}{/if}" title="{l s='Update'}">{l s='Update'}</a>';
appendAddressList(dest_comp, li_content, ordered_fields_name);
{rdelim}
function appendAddressList(dest_comp, values, fields_name)
{ldelim}
for (var item in fields_name)
{ldelim}
var name = fields_name[item];
var value = getFieldValue(name, values);
if (value != "")
{ldelim}
var new_li = document.createElement('li');
new_li.className = 'address_'+ name;
new_li.innerHTML = getFieldValue(name, values);
dest_comp.append(new_li);
{rdelim}
{rdelim}
{rdelim}
function getFieldValue(field_name, values)
{ldelim}
var reg=new RegExp("[ ]+", "g");
var items = field_name.split(reg);
var vals = new Array();
for (var field_item in items)
vals.push(values[items[field_item]]);
return vals.join(" ");
{rdelim}
//]]>
</script>
{if !$opc}
{capture name=path}{l s='Addresses'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
{/if}
{if !$opc}<h1>{l s='Addresses'}</h1>{else}<h2>1. {l s='Addresses'}</h2>{/if}
{if !$opc}
{assign var='current_step' value='address'}
{include file="$tpl_dir./order-steps.tpl"}
{include file="$tpl_dir./errors.tpl"}
<p>{l s='Choose the delivery addresses:'}</p>
<div id="order-detail-content" class="table_block">
<table id="cart_summary" class="std">
<thead>
<tr>
<th class="cart_product first_item">{l s='Product'}</th>
<th class="cart_description item">{l s='Description'}</th>
<th class="cart_ref item">{l s='Ref.'}</th>
<th class="cart_quantity item">{l s='Qty'}</th>
<th class="shipping_address last_item">{l s='Shipping address'}</th>
</tr>
</thead>
<tbody>
{foreach from=$products item=product name=productLoop}
{assign var='productId' value=$product.id_product}
{assign var='productAttributeId' value=$product.id_product_attribute}
{assign var='quantityDisplayed' value=0}
{* Display the product line *}
{include file="$tpl_dir./order-address-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{* Then the customized datas ones*}
{if isset($customizedDatas.$productId.$productAttributeId)}
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization'}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" class="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval} alternate_item cart_item">
<td colspan="4">
{foreach from=$customization.datas key='type' item='datas'}
{if $type == $CUSTOMIZE_FILE}
<div class="customizationUploaded">
<ul class="customizationUploaded">
{foreach from=$datas item='picture'}<li><img src="{$pic_dir}{$picture.value}_small" alt="" class="customizationUploaded" /></li>{/foreach}
</ul>
</div>
{elseif $type == $CUSTOMIZE_TEXTFIELD}
<ul class="typedText">
{foreach from=$datas item='textField' name='typedText'}<li>{if $textField.name}{$textField.name}{else}{l s='Text #'}{$smarty.foreach.typedText.index+1}{/if}{l s=':'} {$textField.value}</li>{/foreach}
</ul>
{/if}
{/foreach}
</td>
<td class="cart_quantity">
{if isset($cannotModify) AND $cannotModify == 1}
<span style="float:left">{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}</span>
{else}
<div style="float:right">
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$token_cart}")}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" title="{l s='Delete this customization'}" width="11" height="13" class="icon" /></a>
</div>
<div id="cart_quantity_button" style="float:left">
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{if $product.minimal_quantity < ($customization.quantity -$quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="#" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{/if}
</div>
<input type="hidden" value="{$customization.quantity}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}_hidden"/>
<input size="2" type="text" value="{$customization.quantity}" class="cart_quantity_input" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}"/>
{/if}
</td>
<td class="cart_total"></td>
</tr>
{assign var='quantityDisplayed' value=$quantityDisplayed+$customization.quantity}
{/foreach}
{* If it exists also some uncustomized products *}
{if $product.quantity-$quantityDisplayed > 0}
{include file="$tpl_dir./order-address-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{/if}
{/if}
{/foreach}
</tbody>
</table>
</div>
<form action="{$link->getPageLink('order', true, NULL, 'multi-shipping=1')}" method="post">
{else}
<div id="opc_account" class="opc-main-block">
<div id="opc_account-overlay" class="opc-overlay" style="display: none;"></div>
{/if}
<div class="addresses">
<input type="hidden" name="id_address_delivery" id="id_address_delivery" value="{$cart->id_address_delivery}" />
<p id="address_invoice_form" class="select" {if $cart->id_address_invoice == $cart->id_address_delivery}style="display: none;"{/if}>
{if $addresses|@count > 1}
<label for="id_address_invoice" class="strong">{l s='Choose a billing address:'}</label>
<select name="id_address_invoice" id="id_address_invoice" class="address_select" onchange="updateAddressesDisplay();{if $opc}updateAddressSelection();{/if}">
{section loop=$addresses step=-1 name=address}
<option value="{$addresses[address].id_address|intval}" {if $addresses[address].id_address == $cart->id_address_invoice && $cart->id_address_delivery != $cart->id_address_invoice}selected="selected"{/if}>{$addresses[address].alias|escape:'htmlall':'UTF-8'}</option>
{/section}
</select>
{else}
{if $back}
<a style="margin-left: 221px;" href="{$link->getPageLink('address', true, NULL, "back=order&amp;step=1&amp;select_address=1&mod=$back")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a>
{else}
<a style="margin-left: 221px;" href="{$link->getPageLink('address', true, NULL, "back=order&amp;step=1&amp;select_address=1")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a>
{/if}
{/if}
</p>
<div class="clear"></div>
<ul class="address item {if $cart->isVirtualCart()}full_width{/if}" id="address_invoice">
</ul>
<br class="clear" />
<p class="address_add submit">
{if $back}
<a href="{$link->getPageLink('address', true, NULL, "back=order%26step=1%26mod={$back}%26multi-shipping=1")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a>
{else}
<a href="{$link->getPageLink('address', true, NULL, "back=order%26step=1%26multi-shipping=1")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a>
{/if}
</p>
{if !$opc}
<div id="ordermsg">
<p>{l s='If you would like to add a comment about your order, please write it below.'}</p>
<p class="textarea"><textarea cols="60" rows="3" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea></p>
</div>
{/if}
</div>
{if !$opc}
<p class="cart_navigation submit">
<input type="hidden" class="hidden" name="step" value="2" />
<input type="hidden" name="back" value="{$back}" />
{if $back}
<a href="{$link->getPageLink('order', true, NULL, "step=0&amp;back={$back}")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
{else}
<a href="{$link->getPageLink('order', true, NULL, "step=0")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
{/if}
<input type="submit" name="processAddress" value="{l s='Next'} &raquo;" class="exclusive" />
</p>
</form>
{else}
</div>
{/if}
@@ -0,0 +1,84 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" class="{if $productLast}last_item{elseif $productFirst}first_item{/if} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item">
<td class="cart_product">
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a>
</td>
<td class="cart_description">
<h5><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></h5>
{if isset($product.attributes) && $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}</a>{/if}
</td>
<td class="cart_ref">{if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td>
<td class="cart_quantity"{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0} style="text-align: center;"{/if}>
{if isset($cannotModify) AND $cannotModify == 1}
<span style="float:left">{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}</span>
{else}
{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}<span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}" >{$product.customizationQuantityTotal}</span>{/if}
{if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0}
<div>
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;token={$token_cart}")}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="icon" width="11" height="13" /></a>
</div>
<div id="cart_quantity_button" style="float:left;">
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{if $product.minimal_quantity < ($product.cart_quantity-$quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" title="{l s='You must purchase a minimum of '}{$product.minimal_quantity}{l s=' of this product.'}">
<img src="{$img_dir}icon/quantity_down.gif" width="14" height="9" alt="{l s='Subtract'}" />
</a>
{/if}
</div>
<input type="hidden" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}_hidden" />
<input size="2" type="text" class="cart_quantity_input" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" />
{/if}
{/if}
</td>
<td>
<from method="post" action="{$link->getPageLink('cart', true, NULL, "token={$token_cart}")}">
<input type="hidden" name="id_product" value="{$product.id_product}" />
<input type="hidden" name="id_product_attribute" value="{$product.id_product_attribute}" />
<select name="address_delivery" id="select_address_delivery_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}" class="cart_address_delivery">
{if $product.id_address_delivery == 0 && $delivery->id == 0}
<option></option>
{/if}
<option value="-1">{l s='New address'}</option>
{foreach $address_list as $address}
<option value="{$address.id_address}"
{if ($product.id_address_delivery > 0 && $product.id_address_delivery == $address.id_address) || ($product.id_address_delivery == 0 && $address.id_address == $delivery->id)}
selected="selected"
{/if}
>
{$address.alias}
</option>
{/foreach}
<option value="-2">{l s='Ship to an other address'}</option>
</select>
</form>
</td>
</tr>
+6
View File
@@ -157,6 +157,12 @@
{assign var='current_step' value='address'}
{include file="$tpl_dir./order-steps.tpl"}
{include file="$tpl_dir./errors.tpl"}
<div class="address-form-multishipping">
<a href="{$link->getPageLink('order', true, NULL, 'step=1&multi-shipping=1')}" title="{l s='Multi-shipping'}" class="button exclusive">
{l s='Multi-shipping'}
</a>
</div>
<form action="{$link->getPageLink('order', true)}" method="post">
{else}
<div id="opc_account" class="opc-main-block">
+81 -43
View File
@@ -82,7 +82,7 @@
{include file="$tpl_dir./errors.tpl"}
<form id="form" action="{$link->getPageLink('order', true)}" method="post" onsubmit="return acceptCGV();">
<form id="form" action="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" method="post" onsubmit="return acceptCGV();">
{else}
<div id="opc_delivery_methods" class="opc-main-block">
<div id="opc_delivery_methods-overlay" class="opc-overlay" style="display: none;"></div>
@@ -112,45 +112,83 @@
<label for="recyclable">{l s='I agree to receive my order in recycled packaging'}.</label>
</p>
{/if}
<p class="warning" id="noCarrierWarning" {if isset($carriers) && $carriers && count($carriers)}style="display:none;"{/if}>{l s='There are no carriers available that deliver to this address.'}</p>
<table id="carrierTable" class="std" {if !isset($carriers) || !$carriers || !count($carriers)}style="display:none;"{/if}>
<thead>
<tr>
<th class="carrier_action first_item"></th>
<th class="carrier_name item">{l s='Carrier'}</th>
<th class="carrier_infos item">{l s='Information'}</th>
<th class="carrier_price last_item">{l s='Price'}</th>
</tr>
</thead>
<tbody>
{if isset($carriers)}
{foreach from=$carriers item=carrier name=myLoop}
<tr class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{/if} {if $smarty.foreach.myLoop.index % 2}alternate_item{else}item{/if}">
<td class="carrier_action radio">
<input type="radio" name="id_carrier" value="{$carrier.id_carrier|intval}" id="id_carrier{$carrier.id_carrier|intval}" {if $opc}onclick="updateCarrierSelectionAndGift();"{/if} {if !($carrier.is_module AND $opc AND !$isLogged)}{if $carrier.id_carrier == $checked}checked="checked"{/if}{else}disabled="disabled"{/if} />
</td>
<td class="carrier_name">
<label for="id_carrier{$carrier.id_carrier|intval}">
{if $carrier.img}<img src="{$carrier.img|escape:'htmlall':'UTF-8'}" alt="{$carrier.name|escape:'htmlall':'UTF-8'}" />{else}{$carrier.name|escape:'htmlall':'UTF-8'}{/if}
</label>
</td>
<td class="carrier_infos">{$carrier.delay|escape:'htmlall':'UTF-8'}</td>
<td class="carrier_price">
{if $carrier.price}
<span class="price">
{if $priceDisplay == 1}{convertPrice price=$carrier.price_tax_exc}{else}{convertPrice price=$carrier.price}{/if}
</span>
{if $use_taxes}{if $priceDisplay == 1} {l s='(tax excl.)'}{else} {l s='(tax incl.)'}{/if}{/if}
{else}
{l s='Free!'}
{/if}
</td>
</tr>
{/foreach}
<tr id="HOOK_EXTRACARRIER">{$HOOK_EXTRACARRIER}</tr>
{/if}
</tbody>
</table>
<div class="delivery_options_address">
{foreach $delivery_option_list as $id_address => $option_list}
<h3>{$address_collection[$id_address]->alias}</h3>
<div class="delivery_options">
{foreach $option_list as $key => $option}
<div class="delivery_option {if ($option@index % 2)}alternate_{/if}item">
<input class="delivery_option_radio" type="radio" name="delivery_option[{$id_address}]" id="delivery_option_{$id_address}_{$option@index}" value="{$key}" />
<label for="delivery_option_{$id_address}_{$option@index}">
<table class="resume">
<tr>
<td class="delivery_option_logo">
{* If there is only one carrier, show the logo of the carrier *}
{if $option.unique_carrier}
{foreach $option.carrier_list as $carrier}
{if $carrier.logo}
<img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
{else}
{$carrier.instance->name}
{/if}
{/foreach}
{else}
{$carrier.instance->name}
{/if}
</td>
<td>
{if $option.is_best_grade}
{if $option.is_best_price}
<div class="delivery_option_best delivery_option_icon">{l s="The best price and grade"}</div>
{else}
<div class="delivery_option_fast delivery_option_icon">{l s="The faster"}</div>
{/if}
{else}
{if $option.is_best_price}
<div class="delivery_option_best_price delivery_option_icon">{l s="The best price"}</div>
{/if}
{/if}
</td>
<td>
<div class="delivery_option_price">
{if $option.total_price_with_tax}
{if $use_taxes == 1}
{convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'}
{else}
{convertPrice price=$option.total_price_without_tax} {l s='(tax excl.)'}
{/if}
{else}
{l s='Free!'}
{/if}
</div>
</td>
</tr>
</table>
<table class="delivery_option_carrier">
{foreach $option.carrier_list as $carrier}
<tr>
<td>
{if $carrier.logo}
<img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
{/if}
</td>
<td>
{$carrier.instance->name}
</td>
<td>
{if isset($carrier.instance->delay[$cookie->id_lang])}
{$carrier.instance->delay[$cookie->id_lang]}
{/if}
</td>
</tr>
{/foreach}
</table>
</label>
</div>
{/foreach}
</div>
{/foreach}
</div>
<div style="display: none;" id="extra_carrier"></div>
{if $giftAllowed}
@@ -182,12 +220,12 @@
<input type="hidden" name="back" value="{$back}" />
{if !$is_guest}
{if $back}
<a href="{$link->getPageLink('order', true, NULL, "step=1&amp;back={$back}")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
<a href="{$link->getPageLink('order', true, NULL, "step=1&back={$back}&multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
{else}
<a href="{$link->getPageLink('order', true, NULL, "step=1")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
<a href="{$link->getPageLink('order', true, NULL, "step=1&multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
{/if}
{else}
<a href="{$link->getPageLink('order', true)}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
<a href="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">&laquo; {l s='Previous'}</a>
{/if}
<input type="submit" name="processCarrier" value="{l s='Next'} &raquo;" class="exclusive" />
</p>
+1 -1
View File
@@ -207,7 +207,7 @@
{include file="$tpl_dir./shopping-cart-product-line.tpl"}
{* Then the customized datas ones*}
{if isset($customizedDatas.$productId.$productAttributeId)}
{foreach from=$customizedDatas.$productId.$productAttributeId key='id_customization' item='customization'}
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization'}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}" class="alternate_item cart_item">
<td colspan="5">
{foreach from=$customization.datas key='type' item='datas'}
+4 -4
View File
@@ -33,7 +33,7 @@
<ul class="step" id="order_step">
<li class="{if $current_step=='summary'}step_current{else}{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address' || $current_step=='login'}step_done{else}step_todo{/if}{/if}">
{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address' || $current_step=='login'}
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}")}">
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&multi-shipping={$multi_shipping}")}">
{l s='Summary'}
</a>
{else}
@@ -42,7 +42,7 @@
</li>
<li class="{if $current_step=='login'}step_current{else}{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address'}step_done{else}step_todo{/if}{/if}">
{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address'}
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=1")}">
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=1&multi-shipping={$multi_shipping}")}">
{l s='Login'}
</a>
{else}
@@ -51,7 +51,7 @@
</li>
<li class="{if $current_step=='address'}step_current{else}{if $current_step=='payment' || $current_step=='shipping'}step_done{else}step_todo{/if}{/if}">
{if $current_step=='payment' || $current_step=='shipping'}
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=1")}">
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=1&multi-shipping={$multi_shipping}")}">
{l s='Address'}
</a>
{else}
@@ -60,7 +60,7 @@
</li>
<li class="{if $current_step=='shipping'}step_current{else}{if $current_step=='payment'}step_done{else}step_todo{/if}{/if}">
{if $current_step=='payment'}
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=2")}">
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=2&multi-shipping={$multi_shipping}")}">
{l s='Shipping'}
</a>
{else}
@@ -24,7 +24,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}" class="{if $smarty.foreach.productLoop.last}last_item{elseif $smarty.foreach.productLoop.first}first_item{/if}{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item">
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" class="{if $productLast}last_item{elseif $productFirst}first_item{/if} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item">
<td class="cart_product">
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a>
</td>
@@ -41,7 +41,7 @@
{/if}
</td>
<td class="cart_unit">
<span class="price" id="product_price_{$product.id_product}_{$product.id_product_attribute}">
<span class="price" id="product_price_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}">
{if isset($product.is_discounted) && $product.is_discounted}
<span style="text-decoration:line-through;">{convertPrice price=$product.price_without_specific_price}</span><br />
{/if}
@@ -56,31 +56,31 @@
{if isset($cannotModify) AND $cannotModify == 1}
<span style="float:left">{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}</span>
{else}
{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}<span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}" >{$product.customizationQuantityTotal}</span>{/if}
{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}<span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}" >{$product.customizationQuantityTotal}</span>{/if}
{if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0}
<div>
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;token={$token_cart}")}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="icon" width="11" height="13" /></a>
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;token={$token_cart}")}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="icon" width="11" height="13" /></a>
</div>
<div id="cart_quantity_button" style="float:left;">
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{if $product.minimal_quantity < ($product.cart_quantity-$quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}" title="{l s='You must purchase a minimum of '}{$product.minimal_quantity}{l s=' of this product.'}">
<a class="cart_quantity_down" style="opacity: 0.3;" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" title="{l s='You must purchase a minimum of '}{$product.minimal_quantity}{l s=' of this product.'}">
<img src="{$img_dir}icon/quantity_down.gif" width="14" height="9" alt="{l s='Subtract'}" />
</a>
{/if}
</div>
<input type="hidden" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_hidden" />
<input size="2" type="text" class="cart_quantity_input" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}" />
<input type="hidden" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}_hidden" />
<input size="2" type="text" class="cart_quantity_input" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}" />
{/if}
{/if}
{/if}
</td>
<td class="cart_total">
<span class="price" id="total_product_price_{$product.id_product}_{$product.id_product_attribute}">
<span class="price" id="total_product_price_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}">
{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}
{if !$priceDisplay}{displayPrice price=$product.total_customization_wt}{else}{displayPrice price=$product.total_customization}{/if}
{else}
+40 -29
View File
@@ -55,21 +55,17 @@
</script>
<p style="display:none" id="emptyCartWarning" class="warning">{l s='Your shopping cart is empty.'}</p>
{if isset($lastProductAdded) AND $lastProductAdded}
{foreach from=$products item=product}
{if $product.id_product == $lastProductAdded.id_product AND (!$product.id_product_attribute OR ($product.id_product_attribute == $lastProductAdded.id_product_attribute))}
<div class="cart_last_product">
<div class="cart_last_product_header">
<div class="left">{l s='Last added product'}</div>
</div>
<a class="cart_last_product_img" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $lastProductAdded.id_shop)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}"/></a>
<div class="cart_last_product_content">
<h5><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></h5>
{if isset($product.attributes) && $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}</a>{/if}
</div>
<br class="clear" />
</div>
{/if}
{/foreach}
<div class="cart_last_product">
<div class="cart_last_product_header">
<div class="left">{l s='Last added product'}</div>
</div>
<a class="cart_last_product_img" href="{$link->getProductLink($lastProductAdded.id_product, $lastProductAdded.link_rewrite, $lastProductAdded.category, null, null, $lastProductAdded.id_shop)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($lastProductAdded.link_rewrite, $lastProductAdded.id_image, 'small')}" alt="{$lastProductAdded.name|escape:'htmlall':'UTF-8'}"/></a>
<div class="cart_last_product_content">
<h5><a href="{$link->getProductLink($lastProductAdded.id_product, $lastProductAdded.link_rewrite, $lastProductAdded.category)|escape:'htmlall':'UTF-8'}">{$lastProductAdded.name|escape:'htmlall':'UTF-8'}</a></h5>
{if isset($lastProductAdded.attributes) && $lastProductAdded.attributes}<a href="{$link->getProductLink($lastProductAdded.id_product, $lastProductAdded.link_rewrite, $lastProductAdded.category)|escape:'htmlall':'UTF-8'}">{$lastProductAdded.attributes|escape:'htmlall':'UTF-8'}</a>{/if}
</div>
<br class="clear" />
</div>
{/if}
<p>{l s='Your shopping cart contains'} <span id="summary_products_quantity">{$productNumber} {if $productNumber == 1}{l s='product'}{else}{l s='products'}{/if}</span></p>
<div id="order-detail-content" class="table_block">
@@ -219,24 +215,36 @@
{assign var='productAttributeId' value=$product.id_product_attribute}
{assign var='quantityDisplayed' value=0}
{* Display the product line *}
{include file="$tpl_dir./shopping-cart-product-line.tpl"}
{include file="$tpl_dir/shopping-cart-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{* Then the customized datas ones*}
{if isset($customizedDatas.$productId.$productAttributeId)}
{foreach from=$customizedDatas.$productId.$productAttributeId key='id_customization' item='customization'}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}" class="alternate_item cart_item">
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key=id_customization item=customization}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" class="alternate_item cart_item">
<td colspan="5">
{foreach from=$customization.datas key='type' item='datas'}
{foreach from=$customization.datas key=type item=custom_data}
{if $type == $CUSTOMIZE_FILE}
<div class="customizationUploaded">
<ul class="customizationUploaded">
{foreach from=$datas item='picture'}<li><img src="{$pic_dir}{$picture.value}_small" alt="" class="customizationUploaded" /></li>{/foreach}
{foreach from=$datas item=picture}<li><img src="{$pic_dir}{$picture.value}_small" alt="" class="customizationUploaded" /></li>{/foreach}
</ul>
</div>
{elseif $type == $CUSTOMIZE_TEXTFIELD}
<ul class="typedText">
{foreach from=$datas item='textField' name='typedText'}<li>{if $textField.name}{$textField.name}{else}{l s='Text #'}{$smarty.foreach.typedText.index+1}{/if}{l s=':'} {$textField.value}</li>{/foreach}
{foreach from=$custom_data item=textField name=typedText}
<li>
{if $textField.name}
{$textField.name}
{else}
{l s='Text #'}{$smarty.foreach.typedText.index+1}
{/if}
{l s=':'} {$textField.value}
</li>
{/foreach}
</ul>
{/if}
{/foreach}
</td>
<td class="cart_quantity">
@@ -244,22 +252,22 @@
<span style="float:left">{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}</span>
{else}
<div style="float:right">
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{$id_customization}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$token_cart}")}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" title="{l s='Delete this customization'}" width="11" height="13" class="icon" /></a>
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$token_cart}")}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" title="{l s='Delete this customization'}" width="11" height="13" class="icon" /></a>
</div>
<div id="cart_quantity_button" style="float:left">
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{if $product.minimal_quantity < ($customization.quantity -$quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}" href="#" title="{l s='Subtract'}">
<a class="cart_quantity_down" style="opacity: 0.3;" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="#" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{/if}
</div>
<input type="hidden" value="{$customization.quantity}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_hidden"/>
<input size="2" type="text" value="{$customization.quantity}" class="cart_quantity_input" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}"/>
<input type="hidden" value="{$customization.quantity}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}_hidden"/>
<input size="2" type="text" value="{$customization.quantity}" class="cart_quantity_input" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}"/>
{/if}
</td>
<td class="cart_total"></td>
@@ -267,7 +275,7 @@
{assign var='quantityDisplayed' value=$quantityDisplayed+$customization.quantity}
{/foreach}
{* If it exists also some uncustomized products *}
{if $product.quantity-$quantityDisplayed > 0}{include file="$tpl_dir./shopping-cart-product-line.tpl"}{/if}
{if $product.quantity-$quantityDisplayed > 0}{include file="$tpl_dir./shopping-cart-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}{/if}
{/if}
{/foreach}
</tbody>
@@ -395,7 +403,10 @@
</div>
{/if}
<p class="cart_navigation">
{if !$opc}<a href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&amp;back={$back}')}{else}{$link->getPageLink('order', true, NULL, 'step=1')}{/if}" class="exclusive" title="{l s='Next'}">{l s='Next'} &raquo;</a>{/if}
{if !$opc}
<a href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&amp;back={$back}')}{else}{$link->getPageLink('order', true, NULL, 'step=1')}{/if}" class="exclusive" title="{l s='Next'}">{l s='Next'} &raquo;</a>
<a href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&amp;back={$back}')}{else}{$link->getPageLink('order', true, NULL, 'step=1')}{/if}&amp;multi-shipping=1" class="multishipping-button exclusive" title="{l s='Multi-shipping'}">{l s='Multi-shipping'} &raquo;</a>
{/if}
<a href="{if (isset($smarty.server.HTTP_REFERER) && strstr($smarty.server.HTTP_REFERER, 'order.php')) || !isset($smarty.server.HTTP_REFERER)}{$link->getPageLink('index')}', {else}{$smarty.server.HTTP_REFERER|escape:'htmlall':'UTF-8'|secureReferrer}{/if}" class="button_large" title="{l s='Continue shopping'}">&laquo; {l s='Continue shopping'}</a>
</p>
<p class="clear"><br /><br /></p>