// Natives modules moved
@@ -1,553 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class WishList extends ObjectModel
|
||||
{
|
||||
/** @var integer Wishlist ID */
|
||||
public $id;
|
||||
|
||||
/** @var integer Customer ID */
|
||||
public $id_customer;
|
||||
|
||||
/** @var integer Token */
|
||||
public $token;
|
||||
|
||||
/** @var integer Name */
|
||||
public $name;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $date_upd;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $id_shop;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $id_shop_group;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'wishlist',
|
||||
'primary' => 'id_wishlist',
|
||||
'fields' => array(
|
||||
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'token' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
)
|
||||
);
|
||||
|
||||
public function delete()
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
if (isset($this->context->cookie->id_wishlist))
|
||||
unset($this->context->cookie->id_wishlist);
|
||||
|
||||
return (parent::delete());
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment counter
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function incCounter($id_wishlist)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist))
|
||||
die (Tools::displayError());
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT `counter`
|
||||
FROM `'._DB_PREFIX_.'wishlist`
|
||||
WHERE `id_wishlist` = '.(int)$id_wishlist
|
||||
);
|
||||
if ($result == false || !count($result) || empty($result) === true)
|
||||
return (false);
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist` SET
|
||||
`counter` = '.(int)($result['counter'] + 1).'
|
||||
WHERE `id_wishlist` = '.(int)$id_wishlist
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static function isExistsByNameForUser($name)
|
||||
{
|
||||
if (Shop::getContextShopID())
|
||||
$shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
elseif (Shop::getContextShopGroupID())
|
||||
$shop_restriction = 'AND id_shop_group = '.(int)Shop::getContextShopGroupID();
|
||||
else
|
||||
$shop_restriction = '';
|
||||
|
||||
$context = Context::getContext();
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) AS total
|
||||
FROM `'._DB_PREFIX_.'wishlist`
|
||||
WHERE `name` = \''.pSQL($name).'\'
|
||||
AND `id_customer` = '.(int)$context->customer->id.'
|
||||
'.$shop_restriction
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if wishlist exists else false
|
||||
*
|
||||
* @return boolean exists
|
||||
*/
|
||||
public static function exists($id_wishlist, $id_customer, $return = false)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR
|
||||
!Validate::isUnsignedId($id_customer))
|
||||
die (Tools::displayError());
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT `id_wishlist`, `name`, `token`
|
||||
FROM `'._DB_PREFIX_.'wishlist`
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_customer` = '.(int)($id_customer));
|
||||
if (empty($result) === false AND $result != false AND sizeof($result))
|
||||
{
|
||||
if ($return === false)
|
||||
return (true);
|
||||
else
|
||||
return ($result);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ID wishlist by Token
|
||||
*
|
||||
* @return array Results
|
||||
*/
|
||||
public static function getByToken($token)
|
||||
{
|
||||
if (!Validate::isMessage($token))
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT w.`id_wishlist`, w.`name`, w.`id_customer`, c.`firstname`, c.`lastname`
|
||||
FROM `'._DB_PREFIX_.'wishlist` w
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = w.`id_customer`
|
||||
WHERE `token` = \''.pSQL($token).'\''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wishlists by Customer ID
|
||||
*
|
||||
* @return array Results
|
||||
*/
|
||||
public static function getByIdCustomer($id_customer)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_customer))
|
||||
die (Tools::displayError());
|
||||
if (Shop::getContextShopID())
|
||||
$shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
elseif (Shop::getContextShopGroupID())
|
||||
$shop_restriction = 'AND id_shop_group = '.(int)Shop::getContextShopGroupID();
|
||||
else
|
||||
$shop_restriction = '';
|
||||
|
||||
$cache_id = 'WhishList::getByIdCustomer_'.(int)$id_customer.'-'.(int)Shop::getContextShopID().'-'.(int)Shop::getContextShopGroupID();
|
||||
if (!Cache::isStored($cache_id))
|
||||
{
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT w.`id_wishlist`, w.`name`, w.`token`, w.`date_add`, w.`date_upd`, w.`counter`
|
||||
FROM `'._DB_PREFIX_.'wishlist` w
|
||||
WHERE `id_customer` = '.(int)($id_customer).'
|
||||
'.$shop_restriction.'
|
||||
ORDER BY w.`name` ASC');
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
public static function refreshWishList($id_wishlist)
|
||||
{
|
||||
$old_carts = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT wp.id_product, wp.id_product_attribute, wpc.id_cart, UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(wpc.date_add) AS timecart
|
||||
FROM `'._DB_PREFIX_.'wishlist_product_cart` wpc
|
||||
JOIN `'._DB_PREFIX_.'wishlist_product` wp ON (wp.id_wishlist_product = wpc.id_wishlist_product)
|
||||
JOIN `'._DB_PREFIX_.'cart` c ON (c.id_cart = wpc.id_cart)
|
||||
JOIN `'._DB_PREFIX_.'cart_product` cp ON (wpc.id_cart = cp.id_cart)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.id_cart = c.id_cart)
|
||||
WHERE (wp.id_wishlist='.(int)($id_wishlist).' AND o.id_cart IS NULL)
|
||||
HAVING timecart >= 3600*6');
|
||||
|
||||
if (isset($old_carts) AND $old_carts != false)
|
||||
foreach ($old_carts AS $old_cart)
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE id_cart='.(int)($old_cart['id_cart']).' AND id_product='.(int)($old_cart['id_product']).' AND id_product_attribute='.(int)($old_cart['id_product_attribute'])
|
||||
);
|
||||
|
||||
$freshwish = Db::getInstance()->executeS('
|
||||
SELECT wpc.id_cart, wpc.id_wishlist_product
|
||||
FROM `'._DB_PREFIX_.'wishlist_product_cart` wpc
|
||||
JOIN `'._DB_PREFIX_.'wishlist_product` wp ON (wpc.id_wishlist_product = wp.id_wishlist_product)
|
||||
JOIN `'._DB_PREFIX_.'cart` c ON (c.id_cart = wpc.id_cart)
|
||||
LEFT JOIN `'._DB_PREFIX_.'cart_product` cp ON (cp.id_cart = wpc.id_cart AND cp.id_product = wp.id_product AND cp.id_product_attribute = wp.id_product_attribute)
|
||||
WHERE (wp.id_wishlist = '.(int)($id_wishlist).' AND ((cp.id_product IS NULL AND cp.id_product_attribute IS NULL)))
|
||||
');
|
||||
$res = Db::getInstance()->executeS('
|
||||
SELECT wp.id_wishlist_product, cp.quantity AS cart_quantity, wpc.quantity AS wish_quantity, wpc.id_cart
|
||||
FROM `'._DB_PREFIX_.'wishlist_product_cart` wpc
|
||||
JOIN `'._DB_PREFIX_.'wishlist_product` wp ON (wp.id_wishlist_product = wpc.id_wishlist_product)
|
||||
JOIN `'._DB_PREFIX_.'cart` c ON (c.id_cart = wpc.id_cart)
|
||||
JOIN `'._DB_PREFIX_.'cart_product` cp ON (cp.id_cart = wpc.id_cart AND cp.id_product = wp.id_product AND cp.id_product_attribute = wp.id_product_attribute)
|
||||
WHERE wp.id_wishlist='.(int)($id_wishlist)
|
||||
);
|
||||
|
||||
if (isset($res) AND $res != false)
|
||||
foreach ($res AS $refresh)
|
||||
if ($refresh['wish_quantity'] > $refresh['cart_quantity'])
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product`
|
||||
SET `quantity`= `quantity` + '.((int)($refresh['wish_quantity']) - (int)($refresh['cart_quantity'])).'
|
||||
WHERE id_wishlist_product='.(int)($refresh['id_wishlist_product'])
|
||||
);
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
SET `quantity`='.(int)($refresh['cart_quantity']).'
|
||||
WHERE id_wishlist_product='.(int)($refresh['id_wishlist_product']).' AND id_cart='.(int)($refresh['id_cart'])
|
||||
);
|
||||
}
|
||||
if (isset($freshwish) AND $freshwish != false)
|
||||
foreach ($freshwish AS $prodcustomer)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product` SET `quantity`=`quantity` +
|
||||
(
|
||||
SELECT `quantity` FROM `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
WHERE `id_wishlist_product`='.(int)($prodcustomer['id_wishlist_product']).' AND `id_cart`='.(int)($prodcustomer['id_cart']).'
|
||||
)
|
||||
WHERE `id_wishlist_product`='.(int)($prodcustomer['id_wishlist_product']).' AND `id_wishlist`='.(int)($id_wishlist)
|
||||
);
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
WHERE `id_wishlist_product`='.(int)($prodcustomer['id_wishlist_product']).' AND `id_cart`='.(int)($prodcustomer['id_cart'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wishlist products by Customer ID
|
||||
*
|
||||
* @return array Results
|
||||
*/
|
||||
public static function getProductByIdCustomer($id_wishlist, $id_customer, $id_lang, $id_product = null, $quantity = false)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_customer) OR
|
||||
!Validate::isUnsignedId($id_lang) OR
|
||||
!Validate::isUnsignedId($id_wishlist))
|
||||
die (Tools::displayError());
|
||||
$products = Db::getInstance()->executeS('
|
||||
SELECT wp.`id_product`, wp.`quantity`, p.`quantity` AS product_quantity, pl.`name`, wp.`id_product_attribute`, wp.`priority`, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = wp.`id_product`
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = wp.`id_product`'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'wishlist` w ON w.`id_wishlist` = wp.`id_wishlist`
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = product_shop.`id_category_default` AND cl.id_lang='.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).'
|
||||
AND pl.`id_lang` = '.(int)($id_lang).'
|
||||
AND wp.`id_wishlist` = '.(int)($id_wishlist).
|
||||
(empty($id_product) === false ? ' AND wp.`id_product` = '.(int)($id_product) : '').
|
||||
($quantity == true ? ' AND wp.`quantity` != 0': '').'
|
||||
GROUP BY p.id_product, wp.id_product_attribute');
|
||||
if (empty($products) === true OR !sizeof($products))
|
||||
return array();
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
if (isset($products[$i]['id_product_attribute']) AND
|
||||
Validate::isUnsignedInt($products[$i]['id_product_attribute']))
|
||||
{
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT al.`name` AS attribute_name, pa.`quantity` AS "attribute_quantity"
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE pac.`id_product_attribute` = '.(int)($products[$i]['id_product_attribute']));
|
||||
$products[$i]['attributes_small'] = '';
|
||||
if ($result)
|
||||
foreach ($result AS $k => $row)
|
||||
$products[$i]['attributes_small'] .= $row['attribute_name'].', ';
|
||||
$products[$i]['attributes_small'] = rtrim($products[$i]['attributes_small'], ', ');
|
||||
if (isset($result[0]))
|
||||
$products[$i]['attribute_quantity'] = $result[0]['attribute_quantity'];
|
||||
}
|
||||
else
|
||||
$products[$i]['attribute_quantity'] = $products[$i]['product_quantity'];
|
||||
}
|
||||
return ($products);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wishlists number products by Customer ID
|
||||
*
|
||||
* @return array Results
|
||||
*/
|
||||
public static function getInfosByIdCustomer($id_customer)
|
||||
{
|
||||
if (Shop::getContextShopID())
|
||||
$shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID();
|
||||
elseif (Shop::getContextShopGroupID())
|
||||
$shop_restriction = 'AND id_shop_group = '.(int)Shop::getContextShopGroupID();
|
||||
else
|
||||
$shop_restriction = '';
|
||||
|
||||
if (!Validate::isUnsignedId($id_customer))
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT SUM(wp.`quantity`) AS nbProducts, wp.`id_wishlist`
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
INNER JOIN `'._DB_PREFIX_.'wishlist` w ON (w.`id_wishlist` = wp.`id_wishlist`)
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).'
|
||||
'.$shop_restriction.'
|
||||
GROUP BY w.`id_wishlist`
|
||||
ORDER BY w.`name` ASC'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add product to ID wishlist
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function addProduct($id_wishlist, $id_customer, $id_product, $id_product_attribute, $quantity)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR
|
||||
!Validate::isUnsignedId($id_customer) OR
|
||||
!Validate::isUnsignedId($id_product) OR
|
||||
!Validate::isUnsignedId($quantity))
|
||||
die (Tools::displayError());
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT wp.`quantity`
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
JOIN `'._DB_PREFIX_.'wishlist` w ON (w.`id_wishlist` = wp.`id_wishlist`)
|
||||
WHERE wp.`id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND w.`id_customer` = '.(int)($id_customer).'
|
||||
AND wp.`id_product` = '.(int)($id_product).'
|
||||
AND wp.`id_product_attribute` = '.(int)($id_product_attribute));
|
||||
if (empty($result) === false AND sizeof($result))
|
||||
{
|
||||
if (($result['quantity'] + $quantity) <= 0)
|
||||
return (WishList::removeProduct($id_wishlist, $id_customer, $id_product, $id_product_attribute));
|
||||
else
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product` SET
|
||||
`quantity` = '.(int)($quantity + $result['quantity']).'
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_product` = '.(int)($id_product).'
|
||||
AND `id_product_attribute` = '.(int)($id_product_attribute)));
|
||||
}
|
||||
else
|
||||
return (Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'wishlist_product` (`id_wishlist`, `id_product`, `id_product_attribute`, `quantity`, `priority`) VALUES(
|
||||
'.(int)($id_wishlist).',
|
||||
'.(int)($id_product).',
|
||||
'.(int)($id_product_attribute).',
|
||||
'.(int)($quantity).', 1)'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update product to wishlist
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function updateProduct($id_wishlist, $id_product, $id_product_attribute, $priority, $quantity)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR
|
||||
!Validate::isUnsignedId($id_product) OR
|
||||
!Validate::isUnsignedId($quantity) OR
|
||||
$priority < 0 OR $priority > 2)
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product` SET
|
||||
`priority` = '.(int)($priority).',
|
||||
`quantity` = '.(int)($quantity).'
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_product` = '.(int)($id_product).'
|
||||
AND `id_product_attribute` = '.(int)($id_product_attribute)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove product from wishlist
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function removeProduct($id_wishlist, $id_customer, $id_product, $id_product_attribute)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR
|
||||
!Validate::isUnsignedId($id_customer) OR
|
||||
!Validate::isUnsignedId($id_product))
|
||||
die (Tools::displayError());
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT w.`id_wishlist`, wp.`id_wishlist_product`
|
||||
FROM `'._DB_PREFIX_.'wishlist` w
|
||||
LEFT JOIN `'._DB_PREFIX_.'wishlist_product` wp ON (wp.`id_wishlist` = w.`id_wishlist`)
|
||||
WHERE `id_customer` = '.(int)($id_customer).'
|
||||
AND w.`id_wishlist` = '.(int)($id_wishlist));
|
||||
if (empty($result) === true OR
|
||||
$result === false OR
|
||||
!sizeof($result) OR
|
||||
$result['id_wishlist'] != $id_wishlist)
|
||||
return (false);
|
||||
// Delete product in wishlist_product_cart
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
WHERE `id_wishlist_product` = '.(int)($result['id_wishlist_product'])
|
||||
);
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'wishlist_product`
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_product` = '.(int)($id_product).'
|
||||
AND `id_product_attribute` = '.(int)($id_product_attribute)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return bought product by ID wishlist
|
||||
*
|
||||
* @return Array results
|
||||
*/
|
||||
public static function getBoughtProduct($id_wishlist)
|
||||
{
|
||||
|
||||
if (!Validate::isUnsignedId($id_wishlist))
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT wp.`id_product`, wp.`id_product_attribute`, wpc.`quantity`, wpc.`date_add`, cu.`lastname`, cu.`firstname`
|
||||
FROM `'._DB_PREFIX_.'wishlist_product_cart` wpc
|
||||
JOIN `'._DB_PREFIX_.'wishlist_product` wp ON (wp.id_wishlist_product = wpc.id_wishlist_product)
|
||||
JOIN `'._DB_PREFIX_.'cart` ca ON (ca.id_cart = wpc.id_cart)
|
||||
JOIN `'._DB_PREFIX_.'customer` cu ON (cu.`id_customer` = ca.`id_customer`)
|
||||
WHERE wp.`id_wishlist` = '.(int)($id_wishlist)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add bought product
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function addBoughtProduct($id_wishlist, $id_product, $id_product_attribute, $id_cart, $quantity)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR
|
||||
!Validate::isUnsignedId($id_product) OR
|
||||
!Validate::isUnsignedId($quantity))
|
||||
die (Tools::displayError());
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT `quantity`, `id_wishlist_product`
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_product` = '.(int)($id_product).'
|
||||
AND `id_product_attribute` = '.(int)($id_product_attribute));
|
||||
|
||||
if (!sizeof($result) OR
|
||||
($result['quantity'] - $quantity) < 0 OR
|
||||
$quantity > $result['quantity'])
|
||||
return (false);
|
||||
|
||||
Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
WHERE `id_wishlist_product`='.(int)($result['id_wishlist_product']).' AND `id_cart`='.(int)($id_cart)
|
||||
);
|
||||
|
||||
if (Db::getInstance()->NumRows() > 0)
|
||||
$result2= Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
SET `quantity`=`quantity` + '.(int)($quantity).'
|
||||
WHERE `id_wishlist_product`='.(int)($result['id_wishlist_product']).' AND `id_cart`='.(int)($id_cart)
|
||||
);
|
||||
|
||||
else
|
||||
$result2 = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'wishlist_product_cart`
|
||||
(`id_wishlist_product`, `id_cart`, `quantity`, `date_add`) VALUES(
|
||||
'.(int)($result['id_wishlist_product']).',
|
||||
'.(int)($id_cart).',
|
||||
'.(int)($quantity).',
|
||||
\''.pSQL(date('Y-m-d H:i:s')).'\')');
|
||||
|
||||
if ($result2 === false)
|
||||
return (false);
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'wishlist_product` SET
|
||||
`quantity` = '.(int)($result['quantity'] - $quantity).'
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_product` = '.(int)($id_product).'
|
||||
AND `id_product_attribute` = '.(int)($id_product_attribute)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add email to wishlist
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function addEmail($id_wishlist, $email)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR empty($email) OR !Validate::isEmail($email))
|
||||
return false;
|
||||
return (Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'wishlist_email` (`id_wishlist`, `email`, `date_add`) VALUES(
|
||||
'.(int)($id_wishlist).',
|
||||
\''.pSQL($email).'\',
|
||||
\''.pSQL(date('Y-m-d H:i:s')).'\')'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email from wishlist
|
||||
*
|
||||
* @return Array results
|
||||
*/
|
||||
public static function getEmail($id_wishlist, $id_customer)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist) OR
|
||||
!Validate::isUnsignedId($id_customer))
|
||||
die (Tools::displayError());
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT we.`email`, we.`date_add`
|
||||
FROM `'._DB_PREFIX_.'wishlist_email` we
|
||||
INNER JOIN `'._DB_PREFIX_.'wishlist` w ON w.`id_wishlist` = we.`id_wishlist`
|
||||
WHERE we.`id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND w.`id_customer` = '.(int)($id_customer)));
|
||||
}
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $products}
|
||||
<dl class="products" style="{if $products}border-bottom:1px solid #fff;{/if}">
|
||||
{foreach from=$products item=product name=i}
|
||||
<dt class="{if $smarty.foreach.i.first}first_item{elseif $smarty.foreach.i.last}last_item{else}item{/if}">
|
||||
<span class="quantity-formated"><span class="quantity">{$product.quantity|intval}</span>x</span>
|
||||
<a class="cart_block_product_name" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{$product.name|escape:'html':'UTF-8'}" style="font-weight:bold;">{$product.name|truncate:13:'...'|escape:'html':'UTF-8'}</a>
|
||||
<a class="ajax_cart_block_remove_link" href="javascript:;" onclick="javascript:WishlistCart('wishlist_block_list', 'delete', '{$product.id_product}', {$product.id_product_attribute}, '0');" title="{l s='remove this product from my wishlist' mod='blockwishlist'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" width="12" height="12" alt="{l s='Delete'}" class="icon" /></a>
|
||||
</dt>
|
||||
{if isset($product.attributes_small)}
|
||||
<dd class="{if $smarty.foreach.i.first}first_item{elseif $smarty.foreach.i.last}last_item{else}item{/if}" style="font-style:italic;margin:0 0 0 10px;">
|
||||
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite)|escape:'html'}" title="{l s='Product detail'}">{$product.attributes_small|escape:'html':'UTF-8'}</a>
|
||||
</dd>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</dl>
|
||||
{else}
|
||||
<dl class="products" style="font-size:10px;border-bottom:1px solid #fff;">
|
||||
{if isset($error) && $error}
|
||||
<dt>{l s='You must create a wishlist before adding products' mod='blockwishlist'}</dt>
|
||||
{else}
|
||||
<dt>{l s='No products' mod='blockwishlist'}</dt>
|
||||
{/if}
|
||||
</dl>
|
||||
{/if}
|
||||
@@ -1,28 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<p class="buttons_bottom_block">
|
||||
<a href="#" id="wishlist_button" onclick="WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value); return false;" title="{l s='Add to my wishlist' mod='blockwishlist'}" rel="nofollow">» {l s='Add to my wishlist' mod='blockwishlist'}</a>
|
||||
</p>
|
||||
@@ -1,248 +0,0 @@
|
||||
/* module blockwishlist */
|
||||
|
||||
/* lnk on detail product page */
|
||||
#wishlist_button {
|
||||
padding:2px 0 2px 20px;
|
||||
background:url(img/icon/add.png) no-repeat 0 0 transparent
|
||||
}
|
||||
|
||||
|
||||
/* bt add */
|
||||
.add_wishlist_button a {padding:5px 7px 5px 18px}
|
||||
.add_wishlist_button a span {
|
||||
z-index:10;
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:-1px;
|
||||
left:-12px;
|
||||
height:26px;
|
||||
width:26px;
|
||||
background:url(img/icon/pict_add_wishlist.png) no-repeat 0 0 transparent
|
||||
}
|
||||
|
||||
/* bloc */
|
||||
#wishlist_block #wishlist_block_list {
|
||||
margin:5px 0 10px 0;
|
||||
padding-bottom:10px;
|
||||
border-bottom:1px dotted #ccc
|
||||
}
|
||||
#wishlist_block_list dt {
|
||||
position:relative;
|
||||
margin-top:5px;
|
||||
padding-right:20px
|
||||
}
|
||||
|
||||
#wishlist_block_list .quantity-formated {
|
||||
display:inline-block;
|
||||
margin-right:5px;
|
||||
width:15px
|
||||
}
|
||||
#wishlist_block_list .cart_block_product_name {font-weight:bold}
|
||||
#wishlist_block_list .ajax_cart_block_remove_link {
|
||||
display:inline-block;
|
||||
position:absolute;
|
||||
right:0;
|
||||
top:0;
|
||||
margin:1px 0 0 5px;
|
||||
height:12px;
|
||||
width:12px
|
||||
}
|
||||
#wishlist_block_list dd {margin:0 0 0 24px}
|
||||
|
||||
|
||||
#wishlist_block_list .ajax_cart_block_remove_link a {
|
||||
display:inline-block;
|
||||
height:12px;
|
||||
width:12px;
|
||||
background: url(img/icon/delete.gif) no-repeat 0 0
|
||||
}
|
||||
#wishlist_block_list .price {
|
||||
float:right
|
||||
}
|
||||
|
||||
#wishlist_block select#wishlists {
|
||||
margin-bottom:10px;
|
||||
width:99%;
|
||||
border:1px solid #ccc;
|
||||
}
|
||||
#wishlist_block .lnk {padding:0}
|
||||
#wishlist_block .lnk a {
|
||||
display:block;
|
||||
font-weight:bold;
|
||||
text-align:right
|
||||
}
|
||||
|
||||
/* page in my account ************************************************************************* */
|
||||
#module-blockwishlist-mywishlist #left_column {display:none}
|
||||
#module-blockwishlist-mywishlist #center_column{width:757px}
|
||||
|
||||
#module-blockwishlist-mywishlist #mywishlist fieldset {
|
||||
padding:10px;
|
||||
-moz-border-radius:3px;
|
||||
-webkit-border-radius:3px;
|
||||
border-radius:3px;
|
||||
background:#eee
|
||||
}
|
||||
#module-blockwishlist-mywishlist #mywishlist p.text label {
|
||||
display:inline-block;
|
||||
padding-right:10px;
|
||||
width:174px;
|
||||
font-weight:bold;
|
||||
font-size:12px;
|
||||
text-align:right
|
||||
}
|
||||
#module-blockwishlist-mywishlist #mywishlist p.text input {
|
||||
padding:0 5px;
|
||||
height:20px;
|
||||
width:288px;
|
||||
border:1px solid #ccc;
|
||||
}
|
||||
#module-blockwishlist-mywishlist #mywishlist p.submit {
|
||||
margin-right:25px;
|
||||
padding-bottom:5px;
|
||||
text-align:right
|
||||
}
|
||||
|
||||
#mywishlist td.wishlist_delete {
|
||||
text-align:center;
|
||||
border-right: 1px solid #999
|
||||
}
|
||||
#mywishlist td.wishlist_delete a {
|
||||
display:inline-block;
|
||||
font-size:8px;
|
||||
padding:1px 2px;
|
||||
-moz-border-radius:3px;
|
||||
-webkit-border-radius:3px;
|
||||
border-radius:3px;
|
||||
color:#666;
|
||||
text-shadow:0 1px 0 #fff;
|
||||
text-transform:uppercase;
|
||||
background: none repeat scroll 0 0 #ccc;
|
||||
}
|
||||
|
||||
|
||||
/* form add ****************************************** */
|
||||
#form_wishlist {}
|
||||
#form_wishlist fieldset { padding: 20px }
|
||||
#form_wishlist label {
|
||||
display:inline-block;
|
||||
padding:6px 15px;
|
||||
width:150px;
|
||||
font-size:12px;
|
||||
text-align:right;
|
||||
}
|
||||
#form_wishlist input.inputTxt {
|
||||
padding:0 5px;
|
||||
height:26px;
|
||||
width:260px;
|
||||
font-size:12px;
|
||||
color:#666;
|
||||
border:1px solid #ccc;
|
||||
}
|
||||
|
||||
/* block-order-detail ********************************** */
|
||||
#module-blockwishlist-mywishlist #block-order-detail {margin-top:20px}
|
||||
|
||||
/* wishlistLinkTop */
|
||||
#module-blockwishlist-mywishlist #block-order-detail #hideSendWishlist {
|
||||
display:inline-block;
|
||||
height:12px;
|
||||
width:12px;
|
||||
background: url(img/icon/delete.gif) no-repeat 0 0
|
||||
}
|
||||
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop {}
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop ul {
|
||||
list-style-type:none;
|
||||
border-bottom:1px dotted #ccc
|
||||
}
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop ul.wlp_bought_list {border:none;}
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop li {float:left}
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop .display_list li a {
|
||||
display:inline-block;
|
||||
padding:7px 11px 5px 22px;
|
||||
color: #333;
|
||||
background:url(img/arrow_right_2.png) no-repeat 10px 10px transparent
|
||||
}
|
||||
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop #hideSendWishlist {
|
||||
float:right;
|
||||
display:block;
|
||||
height:12px;
|
||||
width:12px;
|
||||
text-indent:-5000px;
|
||||
background: url(img/icon/delete.gif) no-repeat 0 0
|
||||
}
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop #showBoughtProducts,
|
||||
#module-blockwishlist-mywishlist .wishlistLinkTop #hideBoughtProductsInfos {display:none}
|
||||
|
||||
/* wishlisturl */
|
||||
#module-blockwishlist-mywishlist .wishlisturl {
|
||||
margin:20px 0;
|
||||
padding:10px;
|
||||
background:#eee
|
||||
}
|
||||
#module-blockwishlist-mywishlist .wishlisturl input {
|
||||
padding:2px 5px;
|
||||
border:1px solid #ccc
|
||||
}
|
||||
|
||||
|
||||
/* wlp_bought ****************************************** */
|
||||
|
||||
/* wlp_bought_list */
|
||||
ul.wlp_bought_list {
|
||||
list-style-type:none;
|
||||
margin-bottom:20px
|
||||
}
|
||||
ul.wlp_bought_list li {
|
||||
position:relative;
|
||||
float:left;
|
||||
margin:20px 20px 0 0;
|
||||
padding:5px;
|
||||
width:218px;/* 230 */
|
||||
border:1px solid #d1d1d1;
|
||||
-moz-border-radius:3px;
|
||||
-webkit-border-radius:3px;
|
||||
border-radius:3px;
|
||||
}
|
||||
ul.wlp_bought_list li .product_image {
|
||||
float:left;
|
||||
width:82px
|
||||
}
|
||||
ul.wlp_bought_list li .product_image a {
|
||||
display:block;
|
||||
padding:0;
|
||||
border:1px solid #d1d1d1
|
||||
}
|
||||
|
||||
ul.wlp_bought_list li .product_infos {
|
||||
float:left;
|
||||
margin-left:10px;
|
||||
width:126px
|
||||
}
|
||||
ul.wlp_bought_list li .product_infos .s_title_block.product_name {
|
||||
padding:5px 0;
|
||||
font-size:12px;
|
||||
color:#222
|
||||
}
|
||||
ul.wlp_bought_list li .product_infos .wishlist_product_detail input,
|
||||
ul.wlp_bought_list li .product_infos .wishlist_product_detail select {
|
||||
border:1px solid #d1d1d1
|
||||
}
|
||||
|
||||
ul.wlp_bought_list li .btn_action {
|
||||
clear:both;
|
||||
margin-top:10px
|
||||
}
|
||||
ul.wlp_bought_list li .btn_action .lnksave {float:right}
|
||||
ul.wlp_bought_list li .lnkdel {
|
||||
position:absolute;
|
||||
top:5px;
|
||||
right:5px;
|
||||
display:block;
|
||||
height:12px;
|
||||
width:12px;
|
||||
text-indent:-5000px;
|
||||
background: url(img/icon/delete.gif) no-repeat 0 0
|
||||
}
|
||||
@@ -1,455 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class BlockWishList extends Module
|
||||
{
|
||||
const INSTALL_SQL_FILE = 'install.sql';
|
||||
|
||||
private $_html = '';
|
||||
private $_postErrors = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blockwishlist';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = 0.4;
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Wishlist block');
|
||||
$this->description = $this->l('Adds a block containing the customer\'s wishlists.');
|
||||
$this->default_wishlist_name = $this->l('My wishlist');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE))
|
||||
return (false);
|
||||
else if (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE))
|
||||
return (false);
|
||||
$sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql);
|
||||
$sql = preg_split("/;\s*[\r\n]+/", $sql);
|
||||
foreach ($sql AS $query)
|
||||
if($query)
|
||||
if(!Db::getInstance()->execute(trim($query)))
|
||||
return false;
|
||||
if (!parent::install() ||
|
||||
!$this->registerHook('rightColumn') ||
|
||||
!$this->registerHook('productActions') ||
|
||||
!$this->registerHook('cart') ||
|
||||
!$this->registerHook('customerAccount') ||
|
||||
!$this->registerHook('header') ||
|
||||
!$this->registerHook('adminCustomers') ||
|
||||
!$this->registerHook('displayProductListFunctionalButtons') ||
|
||||
!$this->registerHook('top')
|
||||
)
|
||||
return false;
|
||||
/* This hook is optional */
|
||||
$this->registerHook('displayMyAccountBlock');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
return (
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist') &&
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_email') &&
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product') &&
|
||||
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product_cart') &&
|
||||
parent::uninstall()
|
||||
);
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$this->_html = '<h2>'.$this->displayName.'</h2>';
|
||||
if (Tools::isSubmit('submitSettings'))
|
||||
{
|
||||
$activated = Tools::getValue('activated');
|
||||
if ($activated != 0 AND $activated != 1)
|
||||
$this->_html .= '<div class="alert error">'.$this->l('Activate module : Invalid choice.').'</div>';
|
||||
$this->_html .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>';
|
||||
}
|
||||
|
||||
$this->_html .= $this->renderJS();
|
||||
$this->_html .= $this->renderForm();
|
||||
if (Tools::getValue('id_customer') && Tools::getValue('id_wishlist'))
|
||||
$this->_html .= $this->renderList((int)Tools::getValue('id_wishlist'));
|
||||
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
public function hookDisplayProductListFunctionalButtons($params)
|
||||
{
|
||||
//TODO : Add cache
|
||||
$this->smarty->assign('product', $params['product']);
|
||||
return $this->display(__FILE__, 'blockwishlist_button.tpl');
|
||||
}
|
||||
|
||||
public function hookTop($params)
|
||||
{
|
||||
|
||||
global $errors;
|
||||
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
if ($this->context->customer->isLogged())
|
||||
{
|
||||
$wishlists = Wishlist::getByIdCustomer($this->context->customer->id);
|
||||
if (empty($this->context->cookie->id_wishlist) === true ||
|
||||
WishList::exists($this->context->cookie->id_wishlist, $this->context->customer->id) === false)
|
||||
{
|
||||
if (!sizeof($wishlists))
|
||||
$id_wishlist = false;
|
||||
else
|
||||
{
|
||||
$id_wishlist = (int)($wishlists[0]['id_wishlist']);
|
||||
$this->context->cookie->id_wishlist = (int)($id_wishlist);
|
||||
}
|
||||
}
|
||||
else
|
||||
$id_wishlist = $this->context->cookie->id_wishlist;
|
||||
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'id_wishlist' => $id_wishlist,
|
||||
'isLogged' => true,
|
||||
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $this->context->customer->id, $this->context->language->id, null, true)),
|
||||
'wishlists' => $wishlists,
|
||||
'ptoken' => Tools::getToken(false)));
|
||||
}
|
||||
else
|
||||
$this->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
|
||||
return $this->display(__FILE__, 'blockwishlist_top.tpl');
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
|
||||
$this->context->controller->addJS(($this->_path).'js/ajax-wishlist.js');
|
||||
|
||||
$this->smarty->assign(array('wishlist_link' => $this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
|
||||
}
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
global $errors;
|
||||
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
if ($this->context->customer->isLogged())
|
||||
{
|
||||
$wishlists = Wishlist::getByIdCustomer($this->context->customer->id);
|
||||
if (empty($this->context->cookie->id_wishlist) === true ||
|
||||
WishList::exists($this->context->cookie->id_wishlist, $this->context->customer->id) === false)
|
||||
{
|
||||
if (!sizeof($wishlists))
|
||||
$id_wishlist = false;
|
||||
else
|
||||
{
|
||||
$id_wishlist = (int)($wishlists[0]['id_wishlist']);
|
||||
$this->context->cookie->id_wishlist = (int)($id_wishlist);
|
||||
}
|
||||
}
|
||||
else
|
||||
$id_wishlist = $this->context->cookie->id_wishlist;
|
||||
$this->smarty->assign(array(
|
||||
'id_wishlist' => $id_wishlist,
|
||||
'isLogged' => true,
|
||||
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $this->context->customer->id, $this->context->language->id, null, true)),
|
||||
'wishlists' => $wishlists,
|
||||
'ptoken' => Tools::getToken(false)));
|
||||
}
|
||||
else
|
||||
$this->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
|
||||
return ($this->display(__FILE__, 'blockwishlist.tpl'));
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
return $this->hookRightColumn($params);
|
||||
}
|
||||
|
||||
public function hookProductActions($params)
|
||||
{
|
||||
$this->smarty->assign('id_product', (int)(Tools::getValue('id_product')));
|
||||
return ($this->display(__FILE__, 'blockwishlist-extra.tpl'));
|
||||
}
|
||||
|
||||
public function hookCustomerAccount($params)
|
||||
{
|
||||
return $this->display(__FILE__, 'my-account.tpl');
|
||||
}
|
||||
|
||||
public function hookDisplayMyAccountBlock($params)
|
||||
{
|
||||
return $this->hookCustomerAccount($params);
|
||||
}
|
||||
|
||||
private function _displayProducts($id_wishlist)
|
||||
{
|
||||
include_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$wishlist = new WishList($id_wishlist);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($obj))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
$images = $obj->getImages($this->context->language->id);
|
||||
foreach ($images AS $k => $image)
|
||||
{
|
||||
if ($image['cover'])
|
||||
{
|
||||
$products[$i]['cover'] = $obj->id.'-'.$image['id_image'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = $this->context->language->iso_code.'-default';
|
||||
}
|
||||
}
|
||||
$this->_html .= '
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="first_item" style="width:600px;">'.$this->l('Product').'</th>
|
||||
<th class="item" style="text-align:center;width:150px;">'.$this->l('Quantity').'</th>
|
||||
<th class="item" style="text-align:center;width:150px;">'.$this->l('Priority').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
$priority = array($this->l('High'), $this->l('Medium'), $this->l('Low'));
|
||||
foreach ($products as $product)
|
||||
{
|
||||
$this->_html .= '
|
||||
<tr>
|
||||
<td class="first_item">
|
||||
<img src="'.$this->context->link->getImageLink($product['link_rewrite'], $product['cover'], ImageType::getFormatedName('small')).'" alt="'.htmlentities($product['name'], ENT_COMPAT, 'UTF-8').'" style="float:left;" />
|
||||
'.$product['name'];
|
||||
if (isset($product['attributes_small']))
|
||||
$this->_html .= '<br /><i>'.htmlentities($product['attributes_small'], ENT_COMPAT, 'UTF-8').'</i>';
|
||||
$this->_html .= '
|
||||
</td>
|
||||
<td class="item" style="text-align:center;">'.(int)($product['quantity']).'</td>
|
||||
<td class="item" style="text-align:center;">'.$priority[(int)($product['priority']) % 3].'</td>
|
||||
</tr>';
|
||||
}
|
||||
$this->_html .= '</tbody></table>';
|
||||
}
|
||||
|
||||
public function hookAdminCustomers($params)
|
||||
{
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$customer = new Customer((int)($params['id_customer']));
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
die (Tools::displayError());
|
||||
|
||||
$this->_html = '<h2>'.$this->l('Wishlists').'</h2>';
|
||||
|
||||
$wishlists = WishList::getByIdCustomer((int)($customer->id));
|
||||
if (!sizeof($wishlists))
|
||||
$this->_html .= $customer->lastname.' '.$customer->firstname.' '.$this->l('No wishlist.');
|
||||
else
|
||||
{
|
||||
$this->_html .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" id="listing">';
|
||||
|
||||
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
|
||||
if (!$id_wishlist)
|
||||
$id_wishlist = $wishlists[0]['id_wishlist'];
|
||||
|
||||
$this->_html .= '<span>'.$this->l('Wishlist').': </span> <select name="id_wishlist" onchange="$(\'#listing\').submit();">';
|
||||
foreach ($wishlists as $wishlist)
|
||||
{
|
||||
$this->_html .= '<option value="'.(int)($wishlist['id_wishlist']).'"';
|
||||
if ($wishlist['id_wishlist'] == $id_wishlist)
|
||||
{
|
||||
$this->_html .= ' selected="selected"';
|
||||
$counter = $wishlist['counter'];
|
||||
}
|
||||
$this->_html .= '>'.htmlentities($wishlist['name'], ENT_COMPAT, 'UTF-8').'</option>';
|
||||
}
|
||||
$this->_html .= '</select>';
|
||||
|
||||
$this->_displayProducts((int)($id_wishlist));
|
||||
|
||||
$this->_html .= '</form><br />';
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Display Error from controler
|
||||
*/
|
||||
public function errorLogged()
|
||||
{
|
||||
return $this->l('You must be logged in to manage your wishlists.');
|
||||
}
|
||||
|
||||
public function renderJS()
|
||||
{
|
||||
return "<script>
|
||||
$(document).ready(function () { $('#id_customer, #id_wishlist').change( function () { $('#module_form').submit(); }) });
|
||||
</script>";
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$customers = Customer::getCustomers();
|
||||
foreach ($customers as $key => $val)
|
||||
$customers[$key]['name'] = $val['firstname'].' '.$val['lastname'];
|
||||
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Listing'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Customers :'),
|
||||
'name' => 'id_customer',
|
||||
'options' => array(
|
||||
'default' => array('value' => 0, 'label' => $this->l('Choose customer')),
|
||||
'query' => $customers,
|
||||
'id' => 'id_customer',
|
||||
'name' => 'name'
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if ($id_customer = Tools::getValue('id_customer'))
|
||||
{
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
$wishlists = WishList::getByIdCustomer($id_customer);
|
||||
$fields_form['form']['input'][] = array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Wishlist :'),
|
||||
'name' => 'id_wishlist',
|
||||
'options' => array(
|
||||
'default' => array('value' => 0, 'label' => $this->l('Choose wishlist')),
|
||||
'query' => $wishlists,
|
||||
'id' => 'id_wishlist',
|
||||
'name' => 'name'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitModule';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'id_customer' => Tools::getValue('id_customer'),
|
||||
'id_wishlist' => Tools::getValue('id_wishlist'),
|
||||
);
|
||||
}
|
||||
|
||||
public function renderList($id_wishlist)
|
||||
{
|
||||
$wishlist = new WishList($id_wishlist);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
|
||||
|
||||
foreach ($products as $key => $val)
|
||||
{
|
||||
$image = Image::getCover($val['id_product']);
|
||||
$products[$key]['image'] = $this->context->link->getImageLink($val['link_rewrite'], $image['id_image'], ImageType::getFormatedName('small'));
|
||||
}
|
||||
|
||||
$fields_list = array(
|
||||
'image' => array(
|
||||
'title' => $this->l('Image'),
|
||||
'type' => 'image',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Product'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'attributes_small' => array(
|
||||
'title' => $this->l('Combination'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'quantity' => array(
|
||||
'title' => $this->l('Quantity'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'priority' => array(
|
||||
'title' => $this->l('Priority'),
|
||||
'type' => 'priority',
|
||||
'values' => array($this->l('High'), $this->l('Medium'), $this->l('Low')),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->actions = array();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->module = $this;
|
||||
$helper->identifier = 'image';
|
||||
$helper->title = $this->l('Product list');
|
||||
$helper->table = $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
|
||||
$helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
|
||||
|
||||
return $helper->generateList($products, $fields_list);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div id="wishlist_block" class="block account">
|
||||
<h4 class="title_block">
|
||||
<a href="{$wishlist_link}" title="{l s='My wishlists' mod='blockwishlist'}" rel="nofollow">{l s='Wishlist' mod='blockwishlist'}</a>
|
||||
</h4>
|
||||
<div class="block_content">
|
||||
<div id="wishlist_block_list" class="expanded">
|
||||
{if $wishlist_products}
|
||||
<dl class="products">
|
||||
{foreach from=$wishlist_products item=product name=i}
|
||||
<dt class="{if $smarty.foreach.i.first}first_item{elseif $smarty.foreach.i.last}last_item{else}item{/if}">
|
||||
<span class="quantity-formated"><span class="quantity">{$product.quantity|intval}</span>x</span>
|
||||
<a class="cart_block_product_name"
|
||||
href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{$product.name|escape:'html':'UTF-8'}">{$product.name|truncate:30:'...'|escape:'html':'UTF-8'}</a>
|
||||
<a class="ajax_cart_block_remove_link" href="javascript:;" onclick="javascript:WishlistCart('wishlist_block_list', 'delete', '{$product.id_product}', {$product.id_product_attribute}, '0', '{if isset($token)}{$token}{/if}');" title="{l s='remove this product from my wishlist' mod='blockwishlist'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" width="12" height="12" alt="{l s='Delete'}" class="icon" /></a>
|
||||
</dt>
|
||||
{if isset($product.attributes_small)}
|
||||
<dd class="{if $smarty.foreach.i.first}first_item{elseif $smarty.foreach.i.last}last_item{else}item{/if}">
|
||||
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{l s='Product detail'}">{$product.attributes_small|escape:'html':'UTF-8'}</a>
|
||||
</dd>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</dl>
|
||||
{else}
|
||||
<dl class="products">
|
||||
<dt>{l s='No products' mod='blockwishlist'}</dt>
|
||||
</dl>
|
||||
{/if}
|
||||
</div>
|
||||
<p class="lnk">
|
||||
{if $wishlists}
|
||||
<select name="wishlists" id="wishlists" onchange="WishlistChangeDefault('wishlist_block_list', $('#wishlists').val());">
|
||||
{foreach from=$wishlists item=wishlist name=i}
|
||||
<option value="{$wishlist.id_wishlist}"{if $id_wishlist eq $wishlist.id_wishlist or ($id_wishlist == false and $smarty.foreach.i.first)} selected="selected"{/if}>{$wishlist.name|truncate:22:'...'|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
<a href="{$wishlist_link}" title="{l s='My wishlists' mod='blockwishlist'}">» {l s='My wishlists' mod='blockwishlist'}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,28 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div class="wishlist">
|
||||
<a href="#" id="wishlist_button" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1); return false;" class="addToWishlist"><i class="icon-heart-empty"></i> Add to Wishlist</a>
|
||||
</div>
|
||||
@@ -1,28 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
var isLoggedWishlist = {if $logged}true{else}false{/if};
|
||||
</script>
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
|
||||
$error = '';
|
||||
|
||||
// Instance of module class for translations
|
||||
$module = new BlockWishList();
|
||||
|
||||
$token = Tools::getValue('token');
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 && strcmp(Tools::getToken(false), Tools::getValue('static_token')))
|
||||
$error = $module->l('Invalid token', 'buywishlistproduct');
|
||||
|
||||
if (!strlen($error) &&
|
||||
empty($token) === false &&
|
||||
empty($id_product) === false)
|
||||
{
|
||||
$wishlist = WishList::getByToken($token);
|
||||
if ($wishlist !== false)
|
||||
WishList::addBoughtProduct($wishlist['id_wishlist'], $id_product, $id_product_attribute, $cart->id, 1);
|
||||
}
|
||||
else
|
||||
$error = $module->l('You must log in', 'buywishlistproduct');
|
||||
|
||||
if (empty($error) === false)
|
||||
echo $error;
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
require_once(dirname(__FILE__).'/blockwishlist.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$action = Tools::getValue('action');
|
||||
$add = (!strcmp($action, 'add') ? 1 : 0);
|
||||
$delete = (!strcmp($action, 'delete') ? 1 : 0);
|
||||
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
$quantity = (int)(Tools::getValue('quantity'));
|
||||
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
|
||||
|
||||
// Instance of module class for translations
|
||||
$module = new BlockWishList();
|
||||
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
|
||||
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
|
||||
$context->customer->isLogged() === true)
|
||||
echo $module->l('Invalid token', 'cart');
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
if ($id_wishlist AND WishList::exists($id_wishlist, $context->customer->id) === true)
|
||||
$context->cookie->id_wishlist = (int)($id_wishlist);
|
||||
if (empty($context->cookie->id_wishlist) === true OR $context->cookie->id_wishlist == false)
|
||||
$context->smarty->assign('error', true);
|
||||
if (($add OR $delete) AND empty($id_product) === false)
|
||||
{
|
||||
if(!isset($context->cookie->id_wishlist) OR $context->cookie->id_wishlist == '')
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->id_shop = $context->shop->id;
|
||||
$wishlist->id_shop_group = $context->shop->id_shop_group;
|
||||
|
||||
$modWishlist = new BlockWishList();
|
||||
$wishlist->name = $modWishlist->default_wishlist_name;
|
||||
$wishlist->id_customer = (int)($context->customer->id);
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
$context->cookie->id_wishlist = (int)($wishlist->id);
|
||||
}
|
||||
if ($add AND $quantity)
|
||||
WishList::addProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute, $quantity);
|
||||
else if ($delete)
|
||||
WishList::removeProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute);
|
||||
}
|
||||
$context->smarty->assign('products', WishList::getProductByIdCustomer($context->cookie->id_wishlist, $context->customer->id, $context->language->id, null, true));
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/blockwishlist-ajax.tpl'))
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/blockwishlist-ajax.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/blockwishlist-ajax.tpl'))
|
||||
$context->smarty->display(dirname(__FILE__).'/blockwishlist-ajax.tpl');
|
||||
else
|
||||
echo $module->l('No template found', 'cart');
|
||||
}
|
||||
else
|
||||
echo $module->l('You must be logged in to manage your wishlist.', 'cart');
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockwishlist</name>
|
||||
<displayName><![CDATA[Wishlist block]]></displayName>
|
||||
<version><![CDATA[0.4]]></version>
|
||||
<description><![CDATA[Adds a block containing the customer's wishlists.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,129 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $ssl = true;
|
||||
public $display_column_left = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->context = Context::getContext();
|
||||
include_once($this->module->getLocalPath().'WishList.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
$this->assign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign wishlist template
|
||||
*/
|
||||
public function assign()
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
if ($this->context->customer->isLogged())
|
||||
{
|
||||
$add = Tools::getIsset('add');
|
||||
$add = (empty($add) === false ? 1 : 0);
|
||||
$delete = Tools::getIsset('deleted');
|
||||
$delete = (empty($delete) === false ? 1 : 0);
|
||||
$id_wishlist = Tools::getValue('id_wishlist');
|
||||
if (Tools::isSubmit('submitWishlist'))
|
||||
{
|
||||
if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 && strcmp(Tools::getToken(), Tools::getValue('token')))
|
||||
$errors[] = $this->module->l('Invalid token', 'mywishlist');
|
||||
if (!count($errors))
|
||||
{
|
||||
$name = Tools::getValue('name');
|
||||
if (empty($name))
|
||||
$errors[] = $this->module->l('You must specify a name.', 'mywishlist');
|
||||
if (WishList::isExistsByNameForUser($name))
|
||||
$errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
|
||||
|
||||
if (!count($errors))
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->id_shop = $this->context->shop->id;
|
||||
$wishlist->id_shop_group = $this->context->shop->id_shop_group;
|
||||
$wishlist->name = $name;
|
||||
$wishlist->id_customer = (int)$this->context->customer->id;
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$this->context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
Mail::Send(
|
||||
$this->context->language->id,
|
||||
'wishlink',
|
||||
Mail::l('Your wishlist\'s link', $this->context->language->id),
|
||||
array(
|
||||
'{wishlist}' => $wishlist->name,
|
||||
'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist->token),
|
||||
$this->context->customer->email,
|
||||
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||
null,
|
||||
strval(Configuration::get('PS_SHOP_NAME')),
|
||||
null,
|
||||
null,
|
||||
$this->module->getLocalPath().'mails/');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($add)
|
||||
WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
|
||||
elseif ($delete && empty($id_wishlist) === false)
|
||||
{
|
||||
$wishlist = new WishList((int)($id_wishlist));
|
||||
if (Validate::isLoadedObject($wishlist))
|
||||
$wishlist->delete();
|
||||
else
|
||||
$errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
|
||||
}
|
||||
$this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
|
||||
$this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
|
||||
}
|
||||
else
|
||||
Tools::redirect('index.php?controller=authentication&back='.urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'id_customer' => (int)$this->context->customer->id,
|
||||
'errors' => $errors,
|
||||
'form_link' => $errors,
|
||||
));
|
||||
|
||||
$this->setTemplate('mywishlist.tpl');
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 752 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 917 B |
|
Before Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 715 B |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 853 B |
|
Before Width: | Height: | Size: 898 B |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 815 B |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_wishlist` (
|
||||
`id_wishlist` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
`token` varchar(64) character set utf8 NOT NULL,
|
||||
`name` varchar(64) character set utf8 NOT NULL,
|
||||
`counter` int(10) unsigned NULL,
|
||||
`id_shop` int(10) unsigned default 1,
|
||||
`id_shop_group` int(10) unsigned default 1,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_wishlist`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_wishlist_email` (
|
||||
`id_wishlist` int(10) unsigned NOT NULL,
|
||||
`email` varchar(128) character set utf8 NOT NULL,
|
||||
`date_add` datetime NOT NULL
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_wishlist_product` (
|
||||
`id_wishlist_product` int(10) NOT NULL auto_increment,
|
||||
`id_wishlist` int(10) unsigned NOT NULL,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_product_attribute` int(10) unsigned NOT NULL,
|
||||
`quantity` int(10) unsigned NOT NULL,
|
||||
`priority` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_wishlist_product`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_wishlist_product_cart` (
|
||||
`id_wishlist_product` int(10) unsigned NOT NULL,
|
||||
`id_cart` int(10) unsigned NOT NULL,
|
||||
`quantity` int(10) unsigned NOT NULL,
|
||||
`date_add` datetime NOT NULL
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
@@ -1,253 +0,0 @@
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Update WishList Cart by adding, deleting, updating objects
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistCart(id, action, id_product, id_product_attribute, quantity)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseDir + 'modules/blockwishlist/cart.php',
|
||||
async: true,
|
||||
cache: false,
|
||||
data: 'action=' + action + '&id_product=' + id_product + '&quantity=' + quantity + '&token=' + static_token + '&id_product_attribute=' + id_product_attribute,
|
||||
success: function(data)
|
||||
{
|
||||
if (action == 'add')
|
||||
{
|
||||
var $element = $('#bigpic');
|
||||
if (!$element.length)
|
||||
var $element = $('#wishlist_button');
|
||||
var $picture = $element.clone();
|
||||
var pictureOffsetOriginal = $element.offset();
|
||||
$picture.css({'position': 'absolute', 'top': pictureOffsetOriginal.top, 'left': pictureOffsetOriginal.left});
|
||||
var pictureOffset = $picture.offset();
|
||||
var wishlistBlockOffset = $('#wishlist_block').offset();
|
||||
|
||||
$picture.appendTo('body');
|
||||
$picture.css({ 'position': 'absolute', 'top': $picture.css('top'), 'left': $picture.css('left') })
|
||||
.animate({ 'width': $element.attr('width')*0.66, 'height': $element.attr('height')*0.66, 'opacity': 0.2, 'top': wishlistBlockOffset.top + 30, 'left': wishlistBlockOffset.left + 15 }, 1000)
|
||||
.fadeOut(800);
|
||||
}
|
||||
|
||||
if($('#' + id).length != 0)
|
||||
{
|
||||
$('#' + id).slideUp('normal');
|
||||
$('#' + id).html(data);
|
||||
$('#' + id).slideDown('normal');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Change customer default wishlist
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistChangeDefault(id, id_wishlist)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseDir + 'modules/blockwishlist/cart.php',
|
||||
async: true,
|
||||
data: 'id_wishlist=' + id_wishlist + '&token=' + static_token,
|
||||
cache: false,
|
||||
success: function(data)
|
||||
{
|
||||
$('#' + id).slideUp('normal');
|
||||
$('#' + id).html(data);
|
||||
$('#' + id).slideDown('normal');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Buy Product
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistBuyProduct(token, id_product, id_product_attribute, id_quantity, button, ajax)
|
||||
{
|
||||
if(ajax)
|
||||
ajaxCart.add(id_product, id_product_attribute, false, button, 1, [token, id_quantity]);
|
||||
else
|
||||
{
|
||||
$('#' + id_quantity).val(0);
|
||||
WishlistAddProductCart(token, id_product, id_product_attribute, id_quantity)
|
||||
document.forms['addtocart' + '_' + id_product + '_' + id_product_attribute].method='POST';
|
||||
document.forms['addtocart' + '_' + id_product + '_' + id_product_attribute].action=baseUri + '?controller=cart';
|
||||
document.forms['addtocart' + '_' + id_product + '_' + id_product_attribute].elements['token'].value = static_token;
|
||||
document.forms['addtocart' + '_' + id_product + '_' + id_product_attribute].submit();
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
function WishlistAddProductCart(token, id_product, id_product_attribute, id_quantity)
|
||||
{
|
||||
if ($('#' + id_quantity).val() <= 0)
|
||||
return (false);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseDir + 'modules/blockwishlist/buywishlistproduct.php',
|
||||
data: 'token=' + token + '&static_token=' + static_token + '&id_product=' + id_product + '&id_product_attribute=' + id_product_attribute,
|
||||
async: true,
|
||||
cache: false,
|
||||
success: function(data)
|
||||
{
|
||||
if (data)
|
||||
alert(data);
|
||||
else
|
||||
{
|
||||
$('#' + id_quantity).val($('#' + id_quantity).val() - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
return (true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show wishlist managment page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistManage(id, id_wishlist)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
async: true,
|
||||
url: baseDir + 'modules/blockwishlist/managewishlist.php',
|
||||
data: 'id_wishlist=' + id_wishlist + '&refresh=' + false,
|
||||
cache: false,
|
||||
success: function(data)
|
||||
{
|
||||
$('#' + id).hide();
|
||||
$('#' + id).html(data);
|
||||
$('#' + id).fadeIn('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show wishlist product managment page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistProductManage(id, action, id_wishlist, id_product, id_product_attribute, quantity, priority)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
async: true,
|
||||
url: baseDir + 'modules/blockwishlist/managewishlist.php',
|
||||
data: 'action=' + action + '&id_wishlist=' + id_wishlist + '&id_product=' + id_product + '&id_product_attribute=' + id_product_attribute + '&quantity=' + quantity + '&priority=' + priority + '&refresh=' + true,
|
||||
cache: false,
|
||||
success: function(data)
|
||||
{
|
||||
if (action == 'delete')
|
||||
$('#wlp_' + id_product + '_' + id_product_attribute).fadeOut('fast');
|
||||
else if (action == 'update')
|
||||
{
|
||||
$('#wlp_' + id_product + '_' + id_product_attribute).fadeOut('fast');
|
||||
$('#wlp_' + id_product + '_' + id_product_attribute).fadeIn('fast');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete wishlist
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
function WishlistDelete(id, id_wishlist, msg)
|
||||
{
|
||||
var res = confirm(msg);
|
||||
if (res == false)
|
||||
return (false);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
async: true,
|
||||
url: baseDir + 'modules/blockwishlist/mywishlist.php',
|
||||
cache: false,
|
||||
data: 'deleted&id_wishlist=' + id_wishlist,
|
||||
success: function(data)
|
||||
{
|
||||
$('#' + id).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide/Show bought product
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistVisibility(bought_class, id_button)
|
||||
{
|
||||
if ($('#hide' + id_button).css('display') == 'none')
|
||||
{
|
||||
$('.' + bought_class).slideDown('fast');
|
||||
$('#show' + id_button).hide();
|
||||
$('#hide' + id_button).css('display', 'block');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.' + bought_class).slideUp('fast');
|
||||
$('#hide' + id_button).hide();
|
||||
$('#show' + id_button).css('display', 'block');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send wishlist by email
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function WishlistSend(id, id_wishlist, id_email)
|
||||
{
|
||||
$.post(baseDir + 'modules/blockwishlist/sendwishlist.php',
|
||||
{ token: static_token,
|
||||
id_wishlist: id_wishlist,
|
||||
email1: $('#' + id_email + '1').val(),
|
||||
email2: $('#' + id_email + '2').val(),
|
||||
email3: $('#' + id_email + '3').val(),
|
||||
email4: $('#' + id_email + '4').val(),
|
||||
email5: $('#' + id_email + '5').val(),
|
||||
email6: $('#' + id_email + '6').val(),
|
||||
email7: $('#' + id_email + '7').val(),
|
||||
email8: $('#' + id_email + '8').val(),
|
||||
email9: $('#' + id_email + '9').val(),
|
||||
email10: $('#' + id_email + '10').val() },
|
||||
function(data)
|
||||
{
|
||||
if (data)
|
||||
alert(data);
|
||||
else
|
||||
WishlistVisibility(id, 'hideSendWishlist');
|
||||
});
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 853 B |
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,112 +0,0 @@
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px){
|
||||
body {
|
||||
width:218px !important;
|
||||
margin:auto !important;
|
||||
}
|
||||
.table {width:195px !important;margin:auto !important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
|
||||
span.title{font-size:20px !important;line-height: 23px !important}
|
||||
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
|
||||
td.box p{font-size: 12px !important;font-weight: bold !important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 200px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 293px !important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {width:478px!important;margin:auto!important;}
|
||||
.table {width:450px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
}
|
||||
|
||||
|
||||
/* Mobile */
|
||||
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
|
||||
.table-recap{width: 285px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center!important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
Message from {shop_name} </p>
|
||||
<span style="color:#777">
|
||||
<span style="color:#333"><strong>{shop_name}</strong></span> invites you to send this link to your friends, so they can see your wishlist: <span style="color:#333"><strong>{wishlist}</strong></span><br /><br />
|
||||
<a title="WishList" href="{message}" style="color:#337ff1">{message}</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="http://www.prestashop.com/" style="color:#337ff1">PrestaShop™</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
Message from {shop_name}
|
||||
|
||||
{shop_name} invites you to send this link to your friends, so they
|
||||
can see your wishlist: {wishlist}
|
||||
|
||||
{message} [{message}]
|
||||
|
||||
{shop_name} [{shop_url}] powered by
|
||||
PrestaShop(tm) [http://www.prestashop.com/]
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px){
|
||||
body {
|
||||
width:218px !important;
|
||||
margin:auto !important;
|
||||
}
|
||||
.table {width:195px !important;margin:auto !important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
|
||||
span.title{font-size:20px !important;line-height: 23px !important}
|
||||
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
|
||||
td.box p{font-size: 12px !important;font-weight: bold !important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 200px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 293px !important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {width:478px!important;margin:auto!important;}
|
||||
.table {width:450px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
}
|
||||
|
||||
|
||||
/* Mobile */
|
||||
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
|
||||
.table-recap{width: 285px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center!important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
Message from {shop_name} </p>
|
||||
<span style="color:#777">
|
||||
<span style="color:#333"><strong>{firstname} {lastname}</strong></span> indicated you may want to see his/her wishlist: <span style="color:#333"><strong>{wishlist}</strong></span><br /><br />
|
||||
<a title="WishList" href="{message}" style="color:#337ff1">{wishlist}</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="http://www.prestashop.com/" style="color:#337ff1">PrestaShop™</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
Message from {shop_name}
|
||||
|
||||
{firstname} {lastname} indicated you may want to see his/her
|
||||
wishlist: {wishlist}
|
||||
|
||||
{wishlist} [{message}]
|
||||
|
||||
{shop_name} [{shop_url}] powered by
|
||||
PrestaShop(tm) [http://www.prestashop.com/]
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,124 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/* SSL Management */
|
||||
$useSSL = true;
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
require_once(dirname(__FILE__).'/blockwishlist.php');
|
||||
$context = Context::getContext();
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$action = Tools::getValue('action');
|
||||
$id_wishlist = (int)Tools::getValue('id_wishlist');
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
$quantity = (int)Tools::getValue('quantity');
|
||||
$priority = Tools::getValue('priority');
|
||||
$wishlist = new WishList((int)($id_wishlist));
|
||||
$refresh = (($_GET['refresh'] == 'true') ? 1 : 0);
|
||||
if (empty($id_wishlist) === false)
|
||||
{
|
||||
if (!strcmp($action, 'update'))
|
||||
{
|
||||
WishList::updateProduct($id_wishlist, $id_product, $id_product_attribute, $priority, $quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp($action, 'delete'))
|
||||
WishList::removeProduct($id_wishlist, (int)$context->customer->id, $id_product, $id_product_attribute);
|
||||
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $context->customer->id, $context->language->id);
|
||||
$bought = WishList::getBoughtProduct($id_wishlist);
|
||||
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, $context->language->id);
|
||||
if (!Validate::isLoadedObject($obj))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if ($products[$i]['id_product_attribute'] != 0)
|
||||
{
|
||||
$combination_imgs = $obj->getCombinationImages($context->language->id);
|
||||
if (isset($combination_imgs[$products[$i]['id_product_attribute']][0]))
|
||||
$products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
|
||||
else
|
||||
{
|
||||
$cover = Product::getCover($obj->id);
|
||||
$products[$i]['cover'] = $obj->id.'-'.$cover['id_image'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$images = $obj->getImages($context->language->id);
|
||||
foreach ($images AS $k => $image)
|
||||
if ($image['cover'])
|
||||
{
|
||||
$products[$i]['cover'] = $obj->id.'-'.$image['id_image'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = $context->language->iso_code.'-default';
|
||||
}
|
||||
$products[$i]['bought'] = false;
|
||||
for ($j = 0, $k = 0; $j < sizeof($bought); ++$j)
|
||||
{
|
||||
if ($bought[$j]['id_product'] == $products[$i]['id_product'] AND
|
||||
$bought[$j]['id_product_attribute'] == $products[$i]['id_product_attribute'])
|
||||
$products[$i]['bought'][$k++] = $bought[$j];
|
||||
}
|
||||
}
|
||||
|
||||
$productBoughts = array();
|
||||
|
||||
foreach ($products as $product)
|
||||
if (sizeof($product['bought']))
|
||||
$productBoughts[] = $product;
|
||||
$context->smarty->assign(array(
|
||||
'products' => $products,
|
||||
'productsBoughts' => $productBoughts,
|
||||
'id_wishlist' => $id_wishlist,
|
||||
'refresh' => $refresh,
|
||||
'token_wish' => $wishlist->token
|
||||
));
|
||||
|
||||
// Instance of module class for translations
|
||||
$module = new BlockWishList();
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/managewishlist.tpl'))
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/managewishlist.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/managewishlist.tpl'))
|
||||
$context->smarty->display(dirname(__FILE__).'/managewishlist.tpl');
|
||||
else
|
||||
echo $module->l('No template found', 'managewishlist');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $products}
|
||||
{if !$refresh}
|
||||
<div class="wishlistLinkTop">
|
||||
<a href="#" id="hideSendWishlist" class="button_account" onclick="WishlistVisibility('wishlistLinkTop', 'SendWishlist'); return false;" title="{l s='Close send this wishlist' mod='blockwishlist'}" rel="nofollow">{l s='Close send this wishlist' mod='blockwishlist'}</a>
|
||||
<ul class="clearfix display_list">
|
||||
<li>
|
||||
<a href="#" id="hideBoughtProducts" class="button_account" onclick="WishlistVisibility('wlp_bought', 'BoughtProducts'); return false;" title="{l s='Hide products' mod='blockwishlist'}">{l s='Hide products' mod='blockwishlist'}</a>
|
||||
<a href="#" id="showBoughtProducts" class="button_account" onclick="WishlistVisibility('wlp_bought', 'BoughtProducts'); return false;" title="{l s='Show products' mod='blockwishlist'}">{l s='Show products' mod='blockwishlist'}</a>
|
||||
</li>
|
||||
{if count($productsBoughts)}
|
||||
<li>
|
||||
<a href="#" id="hideBoughtProductsInfos" class="button_account" onclick="WishlistVisibility('wlp_bought_infos', 'BoughtProductsInfos'); return false;" title="{l s="Hide products" mod='blockwishlist'}">{l s="Hide bought product's info" mod='blockwishlist'}</a>
|
||||
<a href="#" id="showBoughtProductsInfos" class="button_account" onclick="WishlistVisibility('wlp_bought_infos', 'BoughtProductsInfos'); return false;" title="{l s="Show products" mod='blockwishlist'}">{l s="Show bought product's info" mod='blockwishlist'}</a>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
<p class="wishlisturl">{l s='Permalink' mod='blockwishlist'}: <input type="text" value="{$base_dir_ssl}modules/blockwishlist/view.php?token={$token_wish|escape:'html':'UTF-8'}" style="width:540px;" readonly="readonly" /></p>
|
||||
<p class="submit">
|
||||
<a href="#" id="showSendWishlist" class="button_account exclusive" onclick="WishlistVisibility('wl_send', 'SendWishlist'); return false;" title="{l s='Send this wishlist' mod='blockwishlist'}">{l s='Send this wishlist' mod='blockwishlist'}</a>
|
||||
</p>
|
||||
{/if}
|
||||
<div class="wlp_bought">
|
||||
<ul class="clearfix wlp_bought_list">
|
||||
{foreach from=$products item=product name=i}
|
||||
<li id="wlp_{$product.id_product}_{$product.id_product_attribute}" class="clearfix address {if $smarty.foreach.i.index % 2}alternate_{/if}item">
|
||||
<a href="javascript:;" class="lnkdel" onclick="WishlistProductManage('wlp_bought', 'delete', '{$id_wishlist}', '{$product.id_product}', '{$product.id_product_attribute}', $('#quantity_{$product.id_product}_{$product.id_product_attribute}').val(), $('#priority_{$product.id_product}_{$product.id_product_attribute}').val());" title="{l s='Delete' mod='blockwishlist'}">» {l s='Delete' mod='blockwishlist'}</a>
|
||||
<div class="clearfix">
|
||||
<div class="product_image">
|
||||
<a href="{$link->getProductlink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{l s='Product detail' mod='blockwishlist'}">
|
||||
<img src="{$link->getImageLink($product.link_rewrite, $product.cover, ImageType::getFormatedName('medium'))|escape:'html'}" alt="{$product.name|escape:'html':'UTF-8'}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="product_infos">
|
||||
<p id="s_title" class="product_name">{$product.name|truncate:30:'...'|escape:'html':'UTF-8'}</p>
|
||||
<span class="wishlist_product_detail">
|
||||
{if isset($product.attributes_small)}
|
||||
<a href="{$link->getProductlink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{l s='Product detail' mod='blockwishlist'}">{$product.attributes_small|escape:'html':'UTF-8'}</a>
|
||||
{/if}
|
||||
<br />{l s='Quantity' mod='blockwishlist'}:<input type="text" id="quantity_{$product.id_product}_{$product.id_product_attribute}" value="{$product.quantity|intval}" size="3" />
|
||||
<br /><br />
|
||||
{l s='Priority' mod='blockwishlist'}:
|
||||
<select id="priority_{$product.id_product}_{$product.id_product_attribute}">
|
||||
<option value="0"{if $product.priority eq 0} selected="selected"{/if}>{l s='High' mod='blockwishlist'}</option>
|
||||
<option value="1"{if $product.priority eq 1} selected="selected"{/if}>{l s='Medium' mod='blockwishlist'}</option>
|
||||
<option value="2"{if $product.priority eq 2} selected="selected"{/if}>{l s='Low' mod='blockwishlist'}</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn_action">
|
||||
<a href="javascript:;" class="exclusive lnksave" onclick="WishlistProductManage('wlp_bought_{$product.id_product_attribute}', 'update', '{$id_wishlist}', '{$product.id_product}', '{$product.id_product_attribute}', $('#quantity_{$product.id_product}_{$product.id_product_attribute}').val(), $('#priority_{$product.id_product}_{$product.id_product_attribute}').val());" title="{l s='Save' mod='blockwishlist'}">{l s='Save' mod='blockwishlist'}</a>
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{if !$refresh}
|
||||
<form method="post" class="wl_send std hidden" onsubmit="return (false);">
|
||||
<fieldset>
|
||||
<p class="required">
|
||||
<label for="email1">{l s='Email' mod='blockwishlist'}1 <sup>*</sup></label>
|
||||
<input type="text" name="email1" id="email1" />
|
||||
</p>
|
||||
{section name=i loop=11 start=2}
|
||||
<p>
|
||||
<label for="email{$smarty.section.i.index}">{l s='Email' mod='blockwishlist'}{$smarty.section.i.index}</label>
|
||||
<input type="text" name="email{$smarty.section.i.index}" id="email{$smarty.section.i.index}" />
|
||||
</p>
|
||||
{/section}
|
||||
<p class="submit">
|
||||
<input class="button" type="submit" value="{l s='Send' mod='blockwishlist'}" name="submitWishlist" onclick="WishlistSend('wl_send', '{$id_wishlist}', 'email');" />
|
||||
</p>
|
||||
<p class="required">
|
||||
<sup>*</sup> {l s='Required field'}
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
{if count($productsBoughts)}
|
||||
<table class="wlp_bought_infos hidden std">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="first_item">{l s='Product' mod='blockwishlist'}</td>
|
||||
<th class="item">{l s='Quantity' mod='blockwishlist'}</td>
|
||||
<th class="item">{l s='Offered by' mod='blockwishlist'}</td>
|
||||
<th class="last_item">{l s='Date' mod='blockwishlist'}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$productsBoughts item=product name=i}
|
||||
{foreach from=$product.bought item=bought name=j}
|
||||
{if $bought.quantity > 0}
|
||||
<tr>
|
||||
<td class="first_item">
|
||||
<span style="float:left;"><img src="{$link->getImageLink($product.link_rewrite, $product.cover, 'small')|escape:'html'}" alt="{$product.name|escape:'html':'UTF-8'}" /></span>
|
||||
<span style="float:left;">
|
||||
{$product.name|truncate:40:'...'|escape:'html':'UTF-8'}
|
||||
{if isset($product.attributes_small)}
|
||||
<br /><i>{$product.attributes_small|escape:'html':'UTF-8'}</i>
|
||||
{/if}
|
||||
</span>
|
||||
</td>
|
||||
<td class="item align_center">{$bought.quantity|intval}</td>
|
||||
<td class="item align_center">{$bought.firstname} {$bought.lastname}</td>
|
||||
<td class="last_item align_center">{$bought.date_add|date_format:"%Y-%m-%d"}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<p class="warning">{l s='No products' mod='blockwishlist'}</p>
|
||||
{/if}
|
||||
@@ -1,33 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<!-- MODULE WishList -->
|
||||
<li class="lnk_wishlist">
|
||||
<a href="{$wishlist_link}" title="{l s='My wishlists' mod='blockwishlist'}">
|
||||
<img src="{$module_template_dir}img/gift.gif" alt="{l s='My wishlists' mod='blockwishlist'}" class="icon" />
|
||||
{l s='My wishlists' mod='blockwishlist'}
|
||||
</a>
|
||||
</li>
|
||||
<!-- END : MODULE WishList -->
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/* SSL Management */
|
||||
$useSSL = true;
|
||||
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
// Instance of module class for translations
|
||||
$module = new BlockWishList();
|
||||
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$add = Tools::getIsset('add');
|
||||
$add = (empty($add) === false ? 1 : 0);
|
||||
$delete = Tools::getIsset('deleted');
|
||||
$delete = (empty($delete) === false ? 1 : 0);
|
||||
$id_wishlist = Tools::getValue('id_wishlist');
|
||||
if (Tools::isSubmit('submitWishlist'))
|
||||
{
|
||||
if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 AND
|
||||
strcmp(Tools::getToken(), Tools::getValue('token')))
|
||||
$errors[] = $module->l('Invalid token', 'mywishlist');
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
$name = Tools::getValue('name');
|
||||
if (empty($name))
|
||||
$errors[] = $module->l('You must specify a name.', 'mywishlist');
|
||||
if (WishList::isExistsByNameForUser($name))
|
||||
$errors[] = $module->l('This name is already used by another list.', 'mywishlist');
|
||||
|
||||
if(!sizeof($errors))
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->name = $name;
|
||||
$wishlist->id_customer = (int)$context->customer->id;
|
||||
$wishlist->id_shop = $context->shop->id;
|
||||
$wishlist->id_shop_group = $context->shop->id_shop_group;
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
Mail::Send($context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $context->language->id),
|
||||
array(
|
||||
'{wishlist}' => $wishlist->name,
|
||||
'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist->token),
|
||||
$context->customer->email, $context->customer->firstname.' '.$context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($add)
|
||||
WishList::addCardToWishlist($context->customer->id, Tools::getValue('id_wishlist'), $context->language->id);
|
||||
else if ($delete AND empty($id_wishlist) === false)
|
||||
{
|
||||
$wishlist = new WishList((int)($id_wishlist));
|
||||
if (Validate::isLoadedObject($wishlist))
|
||||
$wishlist->delete();
|
||||
else
|
||||
$errors[] = $module->l('Cannot delete this wishlist', 'mywishlist');
|
||||
}
|
||||
$context->smarty->assign('wishlists', WishList::getByIdCustomer($context->customer->id));
|
||||
$context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($context->customer->id));
|
||||
}
|
||||
else
|
||||
{
|
||||
Tools::redirect('index.php?controller=authentication&back=modules/blockwishlist/mywishlist.php');
|
||||
}
|
||||
|
||||
$context->smarty->assign(array(
|
||||
'id_customer' => (int)$context->customer->id,
|
||||
'errors' => $errors
|
||||
));
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl'))
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/views/templates/front/mywishlist.tpl'))
|
||||
$context->smarty->display(dirname(__FILE__).'/views/templates/front/mywishlist.tpl');
|
||||
else
|
||||
echo $module->l('No template found', 'mywishlist');
|
||||
|
||||
include(dirname(__FILE__).'/../../footer.php');
|
||||
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
require_once(dirname(__FILE__).'/blockwishlist.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
// Instance of module class for translations
|
||||
$module = new BlockWishList();
|
||||
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
|
||||
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
|
||||
$context->customer->isLogged() === true)
|
||||
exit($module->l('invalid token', 'sendwishlist'));
|
||||
|
||||
if ($context->customer->isLogged())
|
||||
{
|
||||
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
|
||||
if (empty($id_wishlist) === true)
|
||||
exit($module->l('Invalid wishlist', 'sendwishlist'));
|
||||
for ($i = 1; empty($_POST['email'.strval($i)]) === false; ++$i)
|
||||
{
|
||||
$to = Tools::getValue('email'.$i);
|
||||
$wishlist = WishList::exists($id_wishlist, $context->customer->id, true);
|
||||
if ($wishlist === false)
|
||||
exit($module->l('Invalid wishlist', 'sendwishlist'));
|
||||
if (WishList::addEmail($id_wishlist, $to) === false)
|
||||
exit($module->l('Wishlist send error', 'sendwishlist'));
|
||||
$toName = strval(Configuration::get('PS_SHOP_NAME'));
|
||||
$customer = $context->customer;
|
||||
if (Validate::isLoadedObject($customer))
|
||||
Mail::Send(
|
||||
$context->language->id,
|
||||
'wishlist',
|
||||
sprintf(Mail::l('Message from %1$s %2$s', $context->language->id), $customer->lastname, $customer->firstname),
|
||||
array(
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{wishlist}' => $wishlist['name'],
|
||||
'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist['token']),
|
||||
$to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_0_3($object)
|
||||
{
|
||||
return ($object->registerHook('displayProductListFunctionalButtons') && $object->registerHook('top'));
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/* SSL Management */
|
||||
$useSSL = true;
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../header.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
error_reporting(0);
|
||||
|
||||
$context = Context::getContext();
|
||||
$token = Tools::getValue('token');
|
||||
|
||||
// Instance of module class for translations
|
||||
$module = new BlockWishList();
|
||||
|
||||
if (empty($token) === false)
|
||||
{
|
||||
$wishlist = WishList::getByToken($token);
|
||||
if (empty($result) === true || $result === false)
|
||||
$errors[] = $module->l('Invalid wishlist token', 'view');
|
||||
WishList::refreshWishList($wishlist['id_wishlist']);
|
||||
$products = WishList::getProductByIdCustomer((int)($wishlist['id_wishlist']), (int)($wishlist['id_customer']), $context->language->id, null, true);
|
||||
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, $context->language->id);
|
||||
if (!Validate::isLoadedObject($obj))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
$quantity = Product::getQuantity((int)$products[$i]['id_product'], $products[$i]['id_product_attribute']);
|
||||
$products[$i]['attribute_quantity'] = $quantity;
|
||||
$products[$i]['product_quantity'] = $quantity;
|
||||
if ($products[$i]['id_product_attribute'] != 0)
|
||||
{
|
||||
$combination_imgs = $obj->getCombinationImages($context->language->id);
|
||||
if (isset($combination_imgs[$products[$i]['id_product_attribute']][0]))
|
||||
$products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
|
||||
else
|
||||
{
|
||||
$cover = Product::getCover($obj->id);
|
||||
$products[$i]['cover'] = $obj->id.'-'.$cover['id_image'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$images = $obj->getImages($context->language->id);
|
||||
foreach ($images AS $k => $image)
|
||||
if ($image['cover'])
|
||||
{
|
||||
$products[$i]['cover'] = $obj->id.'-'.$image['id_image'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = $context->language->iso_code.'-default';
|
||||
}
|
||||
$products[$i]['bought'] = false;
|
||||
for ($j = 0, $k = 0; $j < sizeof($bought); ++$j)
|
||||
{
|
||||
if ($bought[$j]['id_product'] == $products[$i]['id_product'] AND
|
||||
$bought[$j]['id_product_attribute'] == $products[$i]['id_product_attribute'])
|
||||
$products[$i]['bought'][$k++] = $bought[$j];
|
||||
}
|
||||
}
|
||||
|
||||
WishList::incCounter((int)($wishlist['id_wishlist']));
|
||||
$ajax = Configuration::get('PS_BLOCK_CART_AJAX');
|
||||
$context->smarty->assign(array (
|
||||
'current_wishlist' => $wishlist,
|
||||
'token' => $token,
|
||||
'ajax' => ((isset($ajax) AND (int)($ajax) == 1) ? '1' : '0'),
|
||||
'wishlists' => WishList::getByIdCustomer((int)($wishlist['id_customer'])),
|
||||
'products' => $products));
|
||||
}
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/view.tpl'))
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/view.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/view.tpl'))
|
||||
$context->smarty->display(dirname(__FILE__).'/view.tpl');
|
||||
else
|
||||
echo $module->l('No template found', 'view');
|
||||
|
||||
require(dirname(__FILE__).'/../../footer.php');
|
||||
@@ -1,92 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div id="view_wishlist">
|
||||
<h2>{l s='Wishlist' mod='blockwishlist'}</h2>
|
||||
{if $wishlists}
|
||||
<p>
|
||||
{l s='Other wishlists of' mod='blockwishlist'} {$current_wishlist.firstname} {$current_wishlist.lastname}:
|
||||
{foreach from=$wishlists item=wishlist name=i}
|
||||
{if $wishlist.id_wishlist != $current_wishlist.id_wishlist}
|
||||
<a href="{$base_dir_ssl}modules/blockwishlist/view.php?token={$wishlist.token}" title="{$wishlist.name}" rel="nofollow">{$wishlist.name}</a>
|
||||
{if !$smarty.foreach.i.last}
|
||||
/
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="wlp_bought">
|
||||
<ul class="clearfix wlp_bought_list">
|
||||
{foreach from=$products item=product name=i}
|
||||
<li id="wlp_{$product.id_product}_{$product.id_product_attribute}" class="clearfix address {if $smarty.foreach.i.index % 2}alternate_{/if}item">
|
||||
<div class="clearfix">
|
||||
<div class="product_image">
|
||||
<a href="{$link->getProductlink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{l s='Product detail' mod='blockwishlist'}">
|
||||
<img src="{$link->getImageLink($product.link_rewrite, $product.cover, ImageType::getFormatedName('medium'))|escape:'html'}" alt="{$product.name|escape:'html':'UTF-8'}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="product_infos">
|
||||
<p id="s_title" class="product_name">{$product.name|truncate:30:'...'|escape:'html':'UTF-8'}</p>
|
||||
<span class="wishlist_product_detail">
|
||||
{if isset($product.attributes_small)}
|
||||
<a href="{$link->getProductlink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{l s='Product detail' mod='blockwishlist'}">{$product.attributes_small|escape:'html':'UTF-8'}</a>
|
||||
{/if}
|
||||
<br />{l s='Quantity' mod='blockwishlist'}:<input type="text" id="quantity_{$product.id_product}_{$product.id_product_attribute}" value="{$product.quantity|intval}" size="3" />
|
||||
<br /><br />
|
||||
{l s='Priority' mod='blockwishlist'}:
|
||||
<select id="priority_{$product.id_product}_{$product.id_product_attribute}">
|
||||
<option value="0"{if $product.priority eq 0} selected="selected"{/if}>{l s='High' mod='blockwishlist'}</option>
|
||||
<option value="1"{if $product.priority eq 1} selected="selected"{/if}>{l s='Medium' mod='blockwishlist'}</option>
|
||||
<option value="2"{if $product.priority eq 2} selected="selected"{/if}>{l s='Low' mod='blockwishlist'}</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn_action">
|
||||
<a class="button_small clear" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category_rewrite)|escape:'html'}" title="{l s='View' mod='blockwishlist'}" rel="nofollow">{l s='View' mod='blockwishlist'}</a>
|
||||
{if isset($product.attribute_quantity) AND $product.attribute_quantity >= 1 OR !isset($product.attribute_quantity) AND $product.product_quantity >= 1}
|
||||
{if !$ajax}
|
||||
<form id="addtocart_{$product.id_product|intval}_{$product.id_product_attribute|intval}" action="{$link->getPageLink('cart')|escape:'html'}" method="post">
|
||||
<p class="hidden">
|
||||
<input type="hidden" name="id_product" value="{$product.id_product|intval}" id="product_page_product_id" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<input type="hidden" name="token" value="{$token}" />
|
||||
<input type="hidden" name="id_product_attribute" id="idCombination" value="{$product.id_product_attribute|intval}" />
|
||||
</p>
|
||||
</form>
|
||||
{/if}
|
||||
<a href="javascript:;" class="exclusive" onclick="WishlistBuyProduct('{$token|escape:'html':'UTF-8'}', '{$product.id_product}', '{$product.id_product_attribute}', '{$product.id_product}_{$product.id_product_attribute}', this, {$ajax});" title="{l s='Add to cart' mod='homefeatured'}" rel="nofollow">{l s='Add to cart' mod='blockwishlist'}</a>
|
||||
{else}
|
||||
<span class="exclusive">{l s='Add to cart' mod='blockwishlist'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,37 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/list/list_content.tpl"}
|
||||
|
||||
{block name="td_content"}
|
||||
{if isset($params.type) && $params.type == 'priority'}
|
||||
<span class="label label-default">{$priority[$tr.$key]}</span>
|
||||
{elseif isset($params.type) && $params.type == 'image'}
|
||||
<img src="{$tr.$key}"/>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,99 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div id="mywishlist">
|
||||
{capture name=path}<a href="{$link->getPageLink('my-account', true)|escape:'html'}">{l s='My account' mod='blockwishlist'}</a><span class="navigation-pipe">{$navigationPipe}</span>{l s='My wishlists' mod='blockwishlist'}{/capture}
|
||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||
|
||||
<h2>{l s='My wishlists' mod='blockwishlist'}</h2>
|
||||
|
||||
{include file="$tpl_dir./errors.tpl"}
|
||||
|
||||
{if $id_customer|intval neq 0}
|
||||
<form method="post" class="std" id="form_wishlist">
|
||||
<fieldset>
|
||||
<h3>{l s='New wishlist' mod='blockwishlist'}</h3>
|
||||
<p class="text">
|
||||
<input type="hidden" name="token" value="{$token|escape:'html':'UTF-8'}" />
|
||||
<label class="align_right" for="name">{l s='Name' mod='blockwishlist'}</label>
|
||||
<input type="text" id="name" name="name" class="inputTxt" value="{if isset($smarty.post.name) and $errors|@count > 0}{$smarty.post.name|escape:'html':'UTF-8'}{/if}" />
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submitWishlist" id="submitWishlist" value="{l s='Save' mod='blockwishlist'}" class="exclusive" />
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
{if $wishlists}
|
||||
<div id="block-history" class="block-center">
|
||||
<table class="std">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="first_item">{l s='Name' mod='blockwishlist'}</th>
|
||||
<th class="item mywishlist_first">{l s='Qty' mod='blockwishlist'}</th>
|
||||
<th class="item mywishlist_first">{l s='Viewed' mod='blockwishlist'}</th>
|
||||
<th class="item mywishlist_second">{l s='Created' mod='blockwishlist'}</th>
|
||||
<th class="item mywishlist_second">{l s='Direct Link' mod='blockwishlist'}</th>
|
||||
<th class="last_item mywishlist_first">{l s='Delete' mod='blockwishlist'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{section name=i loop=$wishlists}
|
||||
<tr id="wishlist_{$wishlists[i].id_wishlist|intval}">
|
||||
<td style="width:200px;">
|
||||
<a href="javascript:;" onclick="javascript:WishlistManage('block-order-detail', '{$wishlists[i].id_wishlist|intval}');">{$wishlists[i].name|truncate:30:'...'|escape:'html':'UTF-8'}</a>
|
||||
</td>
|
||||
<td class="bold align_center">
|
||||
{assign var=n value=0}
|
||||
{foreach from=$nbProducts item=nb name=i}
|
||||
{if $nb.id_wishlist eq $wishlists[i].id_wishlist}
|
||||
{assign var=n value=$nb.nbProducts|intval}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $n}
|
||||
{$n|intval}
|
||||
{else}
|
||||
0
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$wishlists[i].counter|intval}</td>
|
||||
<td>{$wishlists[i].date_add|date_format:"%Y-%m-%d"}</td>
|
||||
<td><a href="javascript:;" onclick="javascript:WishlistManage('block-order-detail', '{$wishlists[i].id_wishlist|intval}');">{l s='View' mod='blockwishlist'}</a></td>
|
||||
<td class="wishlist_delete">
|
||||
<a href="javascript:;"onclick="return (WishlistDelete('wishlist_{$wishlists[i].id_wishlist|intval}', '{$wishlists[i].id_wishlist|intval}', '{l s='Do you really want to delete this wishlist ?' mod='blockwishlist' js=1}'));">{l s='Delete' mod='blockwishlist'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/section}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="block-order-detail"> </div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<ul class="footer_links">
|
||||
<li><a href="{$link->getPageLink('my-account', true)}"><img src="{$img_dir}icon/my-account.gif" alt="" class="icon" /></a><a href="{$link->getPageLink('my-account', true)|escape:'html'}">{l s='Back to Your Account' mod='blockwishlist'}</a></li>
|
||||
<li class="f_right"><a href="{$base_dir}"><img src="{$img_dir}icon/home.gif" alt="" class="icon" /></a><a href="{$base_dir}">{l s='Home' mod='blockwishlist'}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/* SSL Management */
|
||||
$useSSL = true;
|
||||
|
||||
require_once(dirname(__FILE__).'../../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'../../../init.php');
|
||||
require_once(dirname(__FILE__).'/carriercompare.php');
|
||||
|
||||
$carrierCompare = new CarrierCompare();
|
||||
|
||||
switch (Tools::getValue('method'))
|
||||
{
|
||||
case 'getStates':
|
||||
if (!(int)Tools::getValue('id_country'))
|
||||
exit;
|
||||
die(Tools::jsonEncode($carrierCompare->getStatesByIdCountry((int)Tools::getValue('id_country'))));
|
||||
break;
|
||||
case 'getCarriers':
|
||||
die(Tools::jsonEncode($carrierCompare->getCarriersListByIdZone((int)Tools::getValue('id_country'), (int)Tools::getValue('id_state', 0), Tools::safeOutput(Tools::getValue('zipcode', 0)))));
|
||||
break;
|
||||
case 'saveSelection':
|
||||
$errors = $carrierCompare->saveSelection((int)Tools::getValue('id_country'), (int)Tools::getValue('id_state', 0), Tools::getValue('zipcode', 0), (int)Tools::getValue('id_carrier', 0));
|
||||
die(Tools::jsonEncode($errors));
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
}
|
||||
exit;
|
||||
@@ -1,194 +0,0 @@
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
function PS_SE_HandleEvent()
|
||||
{
|
||||
$(document).ready(function() {
|
||||
$('#id_country').change(function() {
|
||||
resetAjaxQueries();
|
||||
updateStateByIdCountry();
|
||||
});
|
||||
|
||||
if (SE_RefreshMethod == 0)
|
||||
{
|
||||
$('#id_state').change(function() {
|
||||
resetAjaxQueries();
|
||||
updateCarriersList();
|
||||
});
|
||||
|
||||
$('#zipcode').bind('keyup',function(e) {
|
||||
if (e.keyCode == '13')
|
||||
{
|
||||
resetAjaxQueries();
|
||||
updateCarriersList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#update_carriers_list').click(function() {
|
||||
updateCarriersList();
|
||||
});
|
||||
|
||||
$('#carriercompare_submit').click(function() {
|
||||
resetAjaxQueries();
|
||||
saveSelection();
|
||||
return false;
|
||||
});
|
||||
|
||||
updateStateByIdCountry();
|
||||
});
|
||||
}
|
||||
|
||||
function displayWaitingAjax(type, message)
|
||||
{
|
||||
$('#SE_AjaxDisplay').find('p').html(message);
|
||||
$('#SE_AjaxDisplay').css('display', type);
|
||||
}
|
||||
|
||||
function updateStateByIdCountry()
|
||||
{
|
||||
$('#id_state').children().remove();
|
||||
$('#availableCarriers').slideUp('fast');
|
||||
$('#states').slideUp('fast');
|
||||
displayWaitingAjax('block', SE_RefreshStateTS);
|
||||
|
||||
var query = $.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(),
|
||||
data: 'method=getStates&id_country=' + $('#id_country').val(),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (json.length)
|
||||
{
|
||||
for (state in json)
|
||||
{
|
||||
$('#id_state').append('<option value=\''+json[state].id_state+'\' '+(id_state == json[state].id_state ? 'selected="selected"' : '')+'>'+json[state].name+'</option>');
|
||||
}
|
||||
$('#states').slideDown('fast');
|
||||
}
|
||||
if (SE_RefreshMethod == 0)
|
||||
updateCarriersList();
|
||||
displayWaitingAjax('none', '');
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(query);
|
||||
}
|
||||
|
||||
function updateCarriersList()
|
||||
{
|
||||
$('#carriercompare_errors_list').children().remove();
|
||||
$('#availableCarriers').slideUp('normal', function(){
|
||||
$(this).find(('tbody')).children().remove();
|
||||
$('#noCarrier').slideUp('fast');
|
||||
displayWaitingAjax('block', SE_RetrievingInfoTS);
|
||||
|
||||
var query = $.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(),
|
||||
data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (json.length)
|
||||
{
|
||||
for (carrier in json)
|
||||
{
|
||||
var html = '<tr class="'+(carrier % 2 ? 'alternate_' : '')+'item">'+
|
||||
'<td class="carrier_action radio">'+
|
||||
'<input type="radio" name="id_carrier" value="'+json[carrier].id_carrier+'" id="id_carrier'+json[carrier].id_carrier+'" '+(id_carrier == json[carrier].id_carrier ? 'checked="checked"' : '')+'/>'+
|
||||
'</td>'+
|
||||
'<td class="carrier_name">'+
|
||||
'<label for="id_carrier'+json[carrier].id_carrier+'">'+
|
||||
(json[carrier].img ? '<img src="'+json[carrier].img+'" alt="'+json[carrier].name+'" />' : json[carrier].name)+
|
||||
'</label>'+
|
||||
'</td>'+
|
||||
'<td class="carrier_infos">'+((json[carrier].delay != null) ? json[carrier].delay : '') +'</td>'+
|
||||
'<td class="carrier_price">';
|
||||
|
||||
if (json[carrier].price)
|
||||
{
|
||||
html += '<span class="price">'+(displayPrice == 1 ? formatCurrency(json[carrier].price_tax_exc, currencyFormat, currencySign, currencyBlank) : formatCurrency(json[carrier].price, currencyFormat, currencySign, currencyBlank))+'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
html += txtFree;
|
||||
}
|
||||
html += '</td>'+
|
||||
'</tr>';
|
||||
$('#carriers_list').append(html);
|
||||
}
|
||||
displayWaitingAjax('none', '');
|
||||
$('#availableCarriers').slideDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
displayWaitingAjax('none', '');
|
||||
$('#noCarrier').slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(query);
|
||||
});
|
||||
}
|
||||
|
||||
function saveSelection()
|
||||
{
|
||||
$('#carriercompare_errors').slideUp();
|
||||
$('#carriercompare_errors_list').children().remove();
|
||||
displayWaitingAjax('block', SE_RedirectTS);
|
||||
|
||||
var query = $.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(),
|
||||
data: 'method=saveSelection&' + $('#compare_shipping_form').serialize(),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (json.length)
|
||||
{
|
||||
for (error in json)
|
||||
$('#carriercompare_errors_list').append('<li>'+json[error]+'</li>');
|
||||
$('#carriercompare_errors').slideDown();
|
||||
displayWaitingAjax('none', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.SE_SubmitRefreshCard').fadeOut('fast');
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
var ajaxQueries = new Array();
|
||||
function resetAjaxQueries()
|
||||
{
|
||||
for (i = 0; i < ajaxQueries.length; ++i)
|
||||
ajaxQueries[i].abort();
|
||||
ajaxQueries = new Array();
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class CarrierCompare extends Module
|
||||
{
|
||||
public $template_directory = '';
|
||||
public $smarty;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'carriercompare';
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = '1.2';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Shipping Estimate');
|
||||
$this->description = $this->l('Compares carrier choices before checkout.');
|
||||
$this->template_directory = dirname(__FILE__).'/template/';
|
||||
$this->initRetroCompatibilityVar();
|
||||
}
|
||||
|
||||
// Retro-compatibiliy 1.4/1.5
|
||||
private function initRetroCompatibilityVar()
|
||||
{
|
||||
if (class_exists('Context'))
|
||||
$smarty = Context::getContext()->smarty;
|
||||
else
|
||||
global $smarty;
|
||||
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() OR !$this->registerHook('shoppingCart') OR !$this->registerHook('header'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = '';
|
||||
if (Tools::isSubmit('setGlobalConfiguration'))
|
||||
if (Configuration::updateValue('SE_RERESH_METHOD', (int)Tools::getValue('SE_RERESH_METHOD')))
|
||||
$output .= $this->displayConfirmation('Configuration updated');
|
||||
|
||||
return $output.$this->renderForm();
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
if (!$this->isModuleAvailable())
|
||||
return;
|
||||
$this->context->controller->addCSS(($this->_path).'style.css', 'all');
|
||||
$this->context->controller->addJS(($this->_path).'carriercompare.js');
|
||||
}
|
||||
|
||||
/*
|
||||
** Hook Shopping Cart Process
|
||||
*/
|
||||
public function hookShoppingCart($params)
|
||||
{
|
||||
if (!$this->isModuleAvailable())
|
||||
return;
|
||||
|
||||
if (!isset($this->context->cart) || $this->context->cart->getProducts() == 0)
|
||||
return;
|
||||
|
||||
$protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS'])
|
||||
&& strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
|
||||
|
||||
$endURL = __PS_BASE_URI__.'modules/carriercompare/';
|
||||
|
||||
if (method_exists('Tools', 'getShopDomainSsl'))
|
||||
$moduleURL = $protocol.Tools::getShopDomainSsl().$endURL;
|
||||
else
|
||||
$moduleURL = $protocol.$_SERVER['HTTP_HOST'].$endURL;
|
||||
|
||||
$refresh_method = Configuration::get('SE_RERESH_METHOD');
|
||||
|
||||
if(isset($this->context->cookie->id_country) && $this->context->cookie->id_country > 0)
|
||||
$id_country = (int)$this->context->cookie->id_country;
|
||||
if(!isset($id_country))
|
||||
$id_country = (isset($this->context->customer->geoloc_id_country) ? (int)$this->context->customer->geoloc_id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
if (isset($this->context->customer->id) && $this->context->customer->id && isset($this->context->cart->id_address_delivery) && $this->context->cart->id_address_delivery)
|
||||
{
|
||||
$address = new Address((int)($this->context->cart->id_address_delivery));
|
||||
$id_country = (int)$address->id_country;
|
||||
}
|
||||
|
||||
|
||||
if(isset($this->context->cookie->id_state) && $this->context->cookie->id_state > 0)
|
||||
$id_state = (int)$this->context->cookie->id_state;
|
||||
if(!isset($id_state))
|
||||
$id_state = (isset($this->context->customer->geoloc_id_state) ? (int)$this->context->customer->geoloc_id_state : 0);
|
||||
|
||||
if(isset($this->context->cookie->postcode) && $this->context->cookie->postcode > 0)
|
||||
$zipcode = Tools::safeOutput($this->context->cookie->postcode);
|
||||
if(!isset($zipcode))
|
||||
$zipcode = (isset($this->context->customer->geoloc_postcode) ? $this->context->customer->geoloc_postcode : '');
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'countries' => Country::getCountries((int)$this->context->cookie->id_lang, true),
|
||||
'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')),
|
||||
'id_country' => $id_country,
|
||||
'id_state' => $id_state,
|
||||
'zipcode' => $zipcode,
|
||||
'currencySign' => $this->context->currency->sign,
|
||||
'currencyRate' => $this->context->currency->conversion_rate,
|
||||
'currencyFormat' => $this->context->currency->format,
|
||||
'currencyBlank' => $this->context->currency->blank,
|
||||
'new_base_dir' => $moduleURL,
|
||||
'refresh_method' => ($refresh_method === false) ? 0 : $refresh_method
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'template/carriercompare.tpl');
|
||||
}
|
||||
|
||||
/*
|
||||
** Get states by Country id, called by the ajax process
|
||||
** id_state allow to preselect the selection option
|
||||
*/
|
||||
public function getStatesByIdCountry($id_country, $id_state = '')
|
||||
{
|
||||
$states = State::getStatesByIdCountry($id_country);
|
||||
|
||||
return (sizeof($states) ? $states : array());
|
||||
}
|
||||
|
||||
/*
|
||||
** Get carriers by country id, called by the ajax process
|
||||
*/
|
||||
public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
|
||||
{
|
||||
// cookie saving/updating
|
||||
$this->context->cookie->id_country = $id_country;
|
||||
if ($id_state != 0)
|
||||
$this->context->cookie->id_state = $id_state;
|
||||
if ($zipcode != 0)
|
||||
$this->context->cookie->postcode = $zipcode;
|
||||
|
||||
$id_zone = 0;
|
||||
if ($id_state != 0)
|
||||
$id_zone = State::getIdZone($id_state);
|
||||
if (!$id_zone)
|
||||
$id_zone = Country::getIdZone($id_country);
|
||||
|
||||
// Need to set the infos for carrier module !
|
||||
$this->context->cookie->id_country = $id_country;
|
||||
$this->context->cookie->id_state = $id_state;
|
||||
$this->context->cookie->postcode = $zipcode;
|
||||
|
||||
$carriers = Carrier::getCarriersForOrder((int)$id_zone);
|
||||
|
||||
return (sizeof($carriers) ? $carriers : array());
|
||||
}
|
||||
|
||||
public function saveSelection($id_country, $id_state, $zipcode, $id_carrier)
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
if (!Validate::isInt($id_state))
|
||||
$errors[] = $this->l('Invalid State ID');
|
||||
if ($id_state != 0 && !Validate::isLoadedObject(new State($id_state)))
|
||||
$errors[] = $this->l('Please select a state');
|
||||
if (!Validate::isInt($id_country) || !Validate::isLoadedObject(new Country($id_country)))
|
||||
$errors[] = $this->l('Please select a country');
|
||||
if (!$this->checkZipcode($zipcode, $id_country))
|
||||
$errors[] = $this->l('Depending on your country selection, please use a valid zip/postal code.');
|
||||
if (!Validate::isInt($id_carrier) || !Validate::isLoadedObject(new Carrier($id_carrier)))
|
||||
$errors[] = $this->l('Please select a carrier');
|
||||
|
||||
if (sizeof($errors))
|
||||
return $errors;
|
||||
|
||||
$ids_carrier = array();
|
||||
foreach (self::getCarriersListByIdZone($id_country, $id_state, $zipcode) as $carrier)
|
||||
$ids_carrier[] = $carrier['id_carrier'];
|
||||
if (!in_array($id_carrier, $ids_carrier))
|
||||
$errors[] = $this->l('The carrier ID isn\'t available for your selection');
|
||||
|
||||
if (sizeof($errors))
|
||||
return $errors;
|
||||
|
||||
$this->context->cookie->id_country = $id_country;
|
||||
$this->context->cookie->id_state = $id_state;
|
||||
$this->context->cookie->postcode = $zipcode;
|
||||
$this->context->cart->id_carrier = $id_carrier;
|
||||
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||
|
||||
$delivery_option = reset($delivery_option_list);
|
||||
$id_carrier = (string)$id_carrier;
|
||||
$id_carrier .= ',';
|
||||
foreach ($delivery_option_list as $id_address => $options)
|
||||
if (isset($options[$id_carrier]))
|
||||
$this->context->cart->setDeliveryOption(array($id_address => $id_carrier));
|
||||
|
||||
if (!$this->context->cart->update())
|
||||
return array($this->l('Cannot update the shopping cart.'));
|
||||
return array();
|
||||
}
|
||||
|
||||
/*
|
||||
** Check the validity of the zipcode format depending of the country
|
||||
*/
|
||||
private function checkZipcode($zipcode, $id_country)
|
||||
{
|
||||
$country = new Country((int)$id_country);
|
||||
if (!Validate::isLoadedObject($country))
|
||||
return true;
|
||||
$zipcodeFormat = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `zip_code_format`
|
||||
FROM `'._DB_PREFIX_.'country`
|
||||
WHERE `id_country` = '.(int)$id_country);
|
||||
|
||||
if (!$country->need_zip_code || !$country->zip_code_format)
|
||||
return true;
|
||||
|
||||
$regxMask = str_replace(
|
||||
array('N', 'C', 'L'),
|
||||
array(
|
||||
'[0-9]',
|
||||
$country->iso_code,
|
||||
'[a-zA-Z]'),
|
||||
$country->zip_code_format);
|
||||
if (preg_match('/'.$regxMask.'/', $zipcode))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This module is shown on front office, in only some conditions
|
||||
* @return bool
|
||||
*/
|
||||
private function isModuleAvailable()
|
||||
{
|
||||
$fileName = basename($_SERVER['SCRIPT_FILENAME']);
|
||||
/**
|
||||
* This module is only available on standard order process because
|
||||
* on One Page Checkout the carrier list is already available.
|
||||
*/
|
||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
|
||||
return false;
|
||||
/**
|
||||
* If visitor is logged, the module isn't available on Front office,
|
||||
* we use the account informations for carrier selection and taxes.
|
||||
*/
|
||||
/*if (Context::getContext()->customer->id)
|
||||
return false;*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('How to refresh the carrier list?'),
|
||||
'name' => 'SE_RERESH_METHOD',
|
||||
'required' => false,
|
||||
'desc' => $this->l('This determines when the list of carriers presented to the customer is updated.'),
|
||||
'default_value' => (int)$this->context->country->id,
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 0, 'name' => $this->l('Automatically with each field change')),
|
||||
array('id' => 1, 'name' => $this->l('When the customer clicks on the "Estimate Shipping Cost" button'))
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default')
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'setGlobalConfiguration';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'SE_RERESH_METHOD' => Tools::getValue('SE_RERESH_METHOD', Configuration::get('SE_RERESH_METHOD')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>carriercompare</name>
|
||||
<displayName><![CDATA[Shipping Estimate]]></displayName>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<description><![CDATA[Compares carrier choices before checkout.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[shipping_logistics]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,44 +0,0 @@
|
||||
#compare_shipping .center {text-align: center;}
|
||||
|
||||
#compare_shipping {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#compare_shipping #availableCarriers {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#compare_shipping #availableCarriers_table {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#compare_shipping ul#carriercompare_errors_list {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#compare_shipping ul#carriercompare_errors_list li {
|
||||
margin-left: 30px;
|
||||
text-decoration: none;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#SE_AjaxDisplay
|
||||
{
|
||||
text-align: center;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#SE_AjaxDisplay img
|
||||
{
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
.SE_SubmitRefreshCard
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.SE_SubmitRefreshCard input
|
||||
{
|
||||
display: inline;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if !$opc}
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
var taxEnabled = "{$use_taxes}";
|
||||
var displayPrice = "{$priceDisplay}";
|
||||
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
|
||||
var currencyRate = '{$currencyRate|floatval}';
|
||||
var currencyFormat = '{$currencyFormat|intval}';
|
||||
var currencyBlank = '{$currencyBlank|intval}';
|
||||
var id_carrier = '{$id_carrier|intval}';
|
||||
var id_state = '{$id_state|intval}';
|
||||
var SE_RedirectTS = "{l s='Refreshing the page and updating your cart...' mod='carriercompare'}";
|
||||
var SE_RefreshStateTS = "{l s='Checking available states...' mod='carriercompare'}";
|
||||
var SE_RetrievingInfoTS = "{l s='Retrieving information...' mod='carriercompare'}";
|
||||
var SE_RefreshMethod = {$refresh_method};
|
||||
var txtFree = "{l s='Free!' mod='carriercompare'}";
|
||||
PS_SE_HandleEvent();
|
||||
//]]>
|
||||
</script>
|
||||
<form class="std" id="compare_shipping_form" method="post" action="#" >
|
||||
<fieldset id="compare_shipping">
|
||||
<h3>{l s='Estimate the cost of shipping & taxes.' mod='carriercompare'}</h3>
|
||||
<p>
|
||||
<label for="id_country">{l s='Country' mod='carriercompare'}</label>
|
||||
<select name="id_country" id="id_country">
|
||||
{foreach from=$countries item=country}
|
||||
<option value="{$country.id_country}" {if $id_country == $country.id_country}selected="selected"{/if}>{$country.name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</p>
|
||||
<p id="states" style="display: none;">
|
||||
<label for="id_state">{l s='State' mod='carriercompare'}</label>
|
||||
<select name="id_state" id="id_state">
|
||||
<option></option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="zipcode">{l s='Zip Code' mod='carriercompare'}</label>
|
||||
<input type="text" name="zipcode" id="zipcode" value="{$zipcode|escape:'html':'UTF-8'}"/> ({l s='Needed for certain carriers.' mod='carriercompare'})
|
||||
</p>
|
||||
<div id="carriercompare_errors" style="display: none;">
|
||||
<ul id="carriercompare_errors_list"></ul><br />
|
||||
</div>
|
||||
<div id="SE_AjaxDisplay">
|
||||
<img src="{$new_base_dir}loader.gif" alt="Loading data" /><br />
|
||||
<p></p>
|
||||
</div>
|
||||
<div id="availableCarriers" style="display: none;">
|
||||
<table cellspacing="0" cellpadding="0" id="availableCarriers_table" class="std">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="carrier_action first_item"></th>
|
||||
<th class="carrier_name item">{l s='Carrier' mod='carriercompare'}</th>
|
||||
<th class="carrier_infos item">{l s='Information' mod='carriercompare'}</th>
|
||||
<th class="carrier_price last_item">{l s='Price' mod='carriercompare'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="carriers_list">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="warning center" id="noCarrier" style="display: none;">{l s='No carrier has been made available for this selection.' mod='carriercompare'}</p>
|
||||
<p class="SE_SubmitRefreshCard">
|
||||
<input class="exclusive_large" id="carriercompare_submit" type="submit" name="carriercompare_submit" value="{l s='Update cart' mod='carriercompare'}"/>
|
||||
<input id="update_carriers_list" type="button" class="exclusive_large" value="{l s='Estimate Shipping Cost' mod='carriercompare'}" />
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
{/if}
|
||||
@@ -1,27 +0,0 @@
|
||||
{if isset($display_error)}
|
||||
{if $display_error}
|
||||
<div class="error">{l s='An error occured during form validation.' mod='carriercompare'}</div>
|
||||
{else}
|
||||
<div class="conf">{l s='Configuration updated' mod='carriercompare'}</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<form method="post" action="{$smarty.server.REQUEST_URI|escape:'html':'UTF-8'}">
|
||||
<fieldset>
|
||||
<div class="warn">{l s='This module is only available during the standard five-step checkout process. The carrier list has already been defined for one-page checkout. ' mod='carriercompare'}.</div>
|
||||
<legend>{l s='Global Configuration' mod='carriercompare'}</legend>
|
||||
|
||||
<label for="refresh_method">Refresh carrier list method</label>
|
||||
<div class="margin-form">
|
||||
<select id="refresh_method" name="refresh_method">
|
||||
<option value="0" {if $refresh_method == 0}selected{/if}>{l s='Anytime' mod='carriercompare'}</option>
|
||||
<option value="1" {if $refresh_method == 1}selected{/if}>{l s='The required information is set.' mod='carriercompare'}</option>
|
||||
</select>
|
||||
<p>{l s='How would you like to refresh information for a customer?' mod='carriercompare'}</p>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input name="setGlobalConfiguration" type="submit" class="button" value="{l s='Submit' mod='carriercompare'}">
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class CashOnDelivery extends PaymentModule
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'cashondelivery';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '0.4';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 1;
|
||||
|
||||
$this->currencies = false;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Cash on delivery (COD)');
|
||||
$this->description = $this->l('Accept cash on delivery payments');
|
||||
|
||||
/* For 1.4.3 and less compatibility */
|
||||
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
|
||||
if (!Configuration::get('PS_OS_PAYMENT'))
|
||||
foreach ($updateConfig as $u)
|
||||
if (!Configuration::get($u) && defined('_'.$u.'_'))
|
||||
Configuration::updateValue($u, constant('_'.$u.'_'));
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
|
||||
// Check if cart has product download
|
||||
foreach ($params['cart']->getProducts() AS $product)
|
||||
{
|
||||
$pd = ProductDownload::getIdFromIdProduct((int)($product['id_product']));
|
||||
if ($pd AND Validate::isUnsignedInt($pd))
|
||||
return false;
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
'this_path' => $this->_path, //keep for retro compat
|
||||
'this_path_cod' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
return $this->display(__FILE__, 'payment.tpl');
|
||||
}
|
||||
|
||||
public function hookPaymentReturn($params)
|
||||
{
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
return $this->display(__FILE__, 'confirmation.tpl');
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>cashondelivery</name>
|
||||
<displayName><![CDATA[Cash on delivery (COD)]]></displayName>
|
||||
<version><![CDATA[0.4]]></version>
|
||||
<description><![CDATA[Accept cash on delivery payments]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[payments_gateways]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class CashondeliveryValidationModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $ssl = true;
|
||||
public $display_column_left = false;
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->context->cart->id_customer == 0 || $this->context->cart->id_address_delivery == 0 || $this->context->cart->id_address_invoice == 0 || !$this->module->active)
|
||||
Tools::redirectLink(__PS_BASE_URI__.'order.php?step=1');
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
$authorized = false;
|
||||
foreach (Module::getPaymentModules() as $module)
|
||||
if ($module['name'] == 'cashondelivery')
|
||||
{
|
||||
$authorized = true;
|
||||
break;
|
||||
}
|
||||
if (!$authorized)
|
||||
die(Tools::displayError('This payment method is not available.'));
|
||||
|
||||
$customer = new Customer($this->context->cart->id_customer);
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
Tools::redirectLink(__PS_BASE_URI__.'order.php?step=1');
|
||||
|
||||
if (Tools::getValue('confirm'))
|
||||
{
|
||||
$customer = new Customer((int)$this->context->cart->id_customer);
|
||||
$total = $this->context->cart->getOrderTotal(true, Cart::BOTH);
|
||||
$this->module->validateOrder((int)$this->context->cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
|
||||
Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?key='.$customer->secure_key.'&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->module->id.'&id_order='.(int)$this->module->currentOrder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'total' => $this->context->cart->getOrderTotal(true, Cart::BOTH),
|
||||
'this_path' => $this->module->getPathUri(),//keep for retro compat
|
||||
'this_path_cod' => $this->module->getPathUri(),
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/'
|
||||
));
|
||||
|
||||
$this->setTemplate('validation.tpl');
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,57 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{capture name=path}{l s='Shipping' mod='cashondelivery'}{/capture}
|
||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||
|
||||
<h2>{l s='Order summation' mod='cashondelivery'}</h2>
|
||||
|
||||
{assign var='current_step' value='payment'}
|
||||
{include file="$tpl_dir./order-steps.tpl"}
|
||||
|
||||
<h3>{l s='Cash on delivery (COD) payment' mod='cashondelivery'}</h3>
|
||||
|
||||
<form action="{$link->getModuleLink('cashondelivery', 'validation', [], true)|escape:'html'}" method="post">
|
||||
<input type="hidden" name="confirm" value="1" />
|
||||
<p>
|
||||
<img src="{$this_path_cod}cashondelivery.jpg" alt="{l s='Cash on delivery (COD) payment' mod='cashondelivery'}" style="float:left; margin: 0px 10px 5px 0px;" />
|
||||
{l s='You have chosen the cash on delivery method.' mod='cashondelivery'}
|
||||
<br/><br />
|
||||
{l s='The total amount of your order is' mod='cashondelivery'}
|
||||
<span id="amount_{$currencies.0.id_currency}" class="price">{convertPrice price=$total}</span>
|
||||
{if $use_taxes == 1}
|
||||
{l s='(tax incl.)' mod='cashondelivery'}
|
||||
{/if}
|
||||
</p>
|
||||
<p>
|
||||
<br /><br />
|
||||
<br /><br />
|
||||
<b>{l s='Please confirm your order by clicking \'I confirm my order\'' mod='cashondelivery'}.</b>
|
||||
</p>
|
||||
<p class="cart_navigation" id="cart_navigation">
|
||||
<a href="{$link->getPageLink('order', true)}?step=3" class="button_large">{l s='Other payment methods' mod='cashondelivery'}</a>
|
||||
<input type="submit" value="{l s='I confirm my order' mod='cashondelivery'}" class="exclusive_large" />
|
||||
</p>
|
||||
</form>
|
||||
@@ -1,31 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<p>{l s='Your order on' mod='cashondelivery'} <span class="bold">{$shop_name}</span> {l s='is complete.' mod='cashondelivery'}
|
||||
<br /><br />
|
||||
{l s='You have chosen the cash on delivery method.' mod='cashondelivery'}
|
||||
<br /><br /><span class="bold">{l s='Your order will be sent very soon.' mod='cashondelivery'}</span>
|
||||
<br /><br />{l s='For any questions or for further information, please contact our' mod='cashondelivery'} <a href="{$link->getPageLink('contact-form', true)|escape:'html'}">{l s='customer support' mod='cashondelivery'}</a>.
|
||||
</p>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,33 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<p class="payment_module">
|
||||
<a href="{$link->getModuleLink('cashondelivery', 'validation', [], true)|escape:'html'}" title="{l s='Pay with cash on delivery (COD)' mod='cashondelivery'}" rel="nofollow">
|
||||
<img src="{$this_path_cod}cashondelivery.gif" alt="{l s='Pay with cash on delivery (COD)' mod='cashondelivery'}" style="float:left;" />
|
||||
<br />{l s='Pay with cash on delivery (COD)' mod='cashondelivery'}
|
||||
<br />{l s='You pay for the merchandise upon delivery' mod='cashondelivery'}
|
||||
<br style="clear:both;" />
|
||||
</a>
|
||||
</p>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -1,91 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $datesDelivery|count}
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
var datesDelivery = {};
|
||||
{/literal}
|
||||
{foreach $datesDelivery as $by_address}
|
||||
datesDelivery[{$by_address@key}] = {};
|
||||
{foreach $by_address as $date}
|
||||
{if $date && isset($date[0])}
|
||||
datesDelivery[{$by_address@key}]["{$date@key}"] = {};
|
||||
datesDelivery[{$by_address@key}]["{$date@key}"]['minimal'] = ["{$date.0.0}",{$date.0.1}];
|
||||
datesDelivery[{$by_address@key}]["{$date@key}"]['maximal'] = ["{$date.1.0}",{$date.1.1}];
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{literal}
|
||||
|
||||
function refreshDateOfDelivery()
|
||||
{
|
||||
var date_from = null;
|
||||
var date_to = null;
|
||||
var set = true;
|
||||
$.each($('.delivery_option_radio:checked'), function()
|
||||
{
|
||||
var date = datesDelivery[$(this).attr('name').replace(/delivery_option\[(.*)\]/, '$1')][$(this).val()];
|
||||
if (typeof(date) != 'undefined')
|
||||
{
|
||||
if (date_from == null || date_from[1] < date['minimal'][1])
|
||||
date_from = date['minimal'];
|
||||
if (date_to == null || date_to[1] < date['maximal'][1])
|
||||
date_to = date['maximal'];
|
||||
}
|
||||
else
|
||||
set = false;
|
||||
});
|
||||
|
||||
if (date_from != null && date_to != null && set)
|
||||
{
|
||||
$('p#dateofdelivery').show();
|
||||
$('span#minimal').html('<b>'+date_from[0]+'</b>');
|
||||
$('span#maximal').html('<b>'+date_to[0]+'</b>');
|
||||
}
|
||||
else
|
||||
$('p#dateofdelivery').hide();
|
||||
}
|
||||
$(function(){
|
||||
refreshDateOfDelivery();
|
||||
$('input[name=id_carrier]').change(function(){
|
||||
refreshDateOfDelivery();
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<br />
|
||||
<p id="dateofdelivery">
|
||||
{if $nbPackages <= 1}
|
||||
{l s='Approximate date of delivery with this carrier is between' mod='dateofdelivery'}
|
||||
{else}
|
||||
{l s='There are %s packages, that will be approximately delivered with the delivery option you choose between' sprintf=$nbPackages mod='dateofdelivery'}
|
||||
{/if}
|
||||
<span id="minimal"></span> {l s='and' mod='dateofdelivery'} <span id="maximal"></span> <sup>*</sup>
|
||||
<br />
|
||||
<span style="font-size:10px;margin:0;padding:0;"><sup>*</sup> {l s='with direct payment methods (e.g. credit card)' mod='dateofdelivery'}</span>
|
||||
</p>
|
||||
{/if}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dateofdelivery</name>
|
||||
<displayName><![CDATA[Date of delivery]]></displayName>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<description><![CDATA[Displays an approximate date of delivery]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[shipping_logistics]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -1,709 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class DateOfDelivery extends Module
|
||||
{
|
||||
private $_html = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'dateofdelivery';
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = '1.2';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Date of delivery');
|
||||
$this->description = $this->l('Displays an approximate date of delivery');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('beforeCarrier')
|
||||
|| !$this->registerHook('orderDetailDisplayed')
|
||||
||!$this->registerHook('displayPDFInvoice'))
|
||||
return false;
|
||||
|
||||
if (!Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'dateofdelivery_carrier_rule` (
|
||||
`id_carrier_rule` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_carrier` INT NOT NULL,
|
||||
`minimal_time` INT NOT NULL,
|
||||
`maximal_time` INT NOT NULL,
|
||||
`delivery_saturday` TINYINT(1) NOT NULL,
|
||||
`delivery_sunday` TINYINT(1) NOT NULL
|
||||
) ENGINE ='._MYSQL_ENGINE_.';
|
||||
'))
|
||||
return false;
|
||||
|
||||
Configuration::updateValue('DOD_EXTRA_TIME_PRODUCT_OOS', 0);
|
||||
Configuration::updateValue('DOD_EXTRA_TIME_PREPARATION', 1);
|
||||
Configuration::updateValue('DOD_PREPARATION_SATURDAY', 1);
|
||||
Configuration::updateValue('DOD_PREPARATION_SUNDAY', 1);
|
||||
Configuration::updateValue('DOD_DATE_FORMAT', 'l j F Y');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
Configuration::deleteByName('DOD_EXTRA_TIME_PRODUCT_OOS');
|
||||
Configuration::deleteByName('DOD_EXTRA_TIME_PREPARATION');
|
||||
Configuration::deleteByName('DOD_PREPARATION_SATURDAY');
|
||||
Configuration::deleteByName('DOD_PREPARATION_SUNDAY');
|
||||
Configuration::deleteByName('DOD_DATE_FORMAT');
|
||||
Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'dateofdelivery_carrier_rule`');
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$this->_html .= '';
|
||||
|
||||
$this->_postProcess();
|
||||
if (Tools::isSubmit('addCarrierRule') OR (Tools::isSubmit('updatedateofdelivery') AND Tools::isSubmit('id_carrier_rule')))
|
||||
$this->_html .= $this->renderAddForm();
|
||||
else
|
||||
{
|
||||
$this->_html .= $this->renderList();
|
||||
$this->_html .= $this->renderForm();
|
||||
}
|
||||
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
public function hookBeforeCarrier($params)
|
||||
{
|
||||
if (!isset($params['delivery_option_list']) || !count($params['delivery_option_list']))
|
||||
return false;
|
||||
|
||||
$package_list = $params['cart']->getPackageList();
|
||||
|
||||
$datesDelivery = array();
|
||||
foreach ($params['delivery_option_list'] as $id_address => $by_address)
|
||||
{
|
||||
$datesDelivery[$id_address] = array();
|
||||
foreach ($by_address as $key => $delivery_option)
|
||||
{
|
||||
$date_from = null;
|
||||
$date_to = null;
|
||||
$datesDelivery[$id_address][$key] = array();
|
||||
|
||||
foreach ($delivery_option['carrier_list'] as $id_carrier => $carrier)
|
||||
{
|
||||
foreach ($carrier['package_list'] as $id_package)
|
||||
{
|
||||
$package = $package_list[$id_address][$id_package];
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($package['product_list'] as $product)
|
||||
if (StockAvailable::getQuantityAvailableByProduct($product['id_product'], ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), (int)$this->context->shop->id) <= 0)
|
||||
{
|
||||
$oos = true;
|
||||
break;
|
||||
}
|
||||
$available_date = Product::getAvailableDate($product['id_product'], ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), (int)$this->context->shop->id);
|
||||
$date_range = $this->_getDatesOfDelivery($id_carrier, $oos, $available_date);
|
||||
if (is_null($date_from) || $date_from < $date_range[0])
|
||||
{
|
||||
$date_from = $date_range[0][1];
|
||||
$datesDelivery[$id_address][$key][0] = $date_range[0];
|
||||
}
|
||||
if (is_null($date_to) || $date_to < $date_range[1])
|
||||
{
|
||||
$date_to = $date_range[1][1];
|
||||
$datesDelivery[$id_address][$key][1] = $date_range[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->smarty->assign(array(
|
||||
'nbPackages' => $params['cart']->getNbOfPackages(),
|
||||
'datesDelivery' => $datesDelivery,
|
||||
'delivery_option' => $params['delivery_option']
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'beforeCarrier.tpl');
|
||||
}
|
||||
|
||||
public function hookOrderDetailDisplayed($params)
|
||||
{
|
||||
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($params['order']->getProducts() as $product)
|
||||
if ($product['product_quantity_in_stock'] < 1)
|
||||
$oos = true;
|
||||
|
||||
$datesDelivery = array();
|
||||
$datesDelivery = $this->_getDatesOfDelivery((int)($params['order']->id_carrier), $oos, $params['order']->date_add);
|
||||
|
||||
if (!is_array($datesDelivery) OR !sizeof($datesDelivery))
|
||||
return ;
|
||||
|
||||
$this->smarty->assign('datesDelivery', $datesDelivery);
|
||||
|
||||
return $this->display(__FILE__, 'orderDetail.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the delivery dates on the invoice
|
||||
*
|
||||
* @param $params contains an instance of OrderInvoice
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function hookDisplayPDFInvoice($params)
|
||||
{
|
||||
$order_invoice = $params['object'];
|
||||
if (!($order_invoice instanceof OrderInvoice))
|
||||
return;
|
||||
|
||||
$order = new Order((int)$order_invoice->id_order);
|
||||
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($order->getProducts() as $product)
|
||||
if ($product['product_quantity_in_stock'] < 1)
|
||||
$oos = true;
|
||||
|
||||
$id_carrier = (int)OrderInvoice::getCarrierId($order_invoice->id);
|
||||
$return = '';
|
||||
if (($datesDelivery = $this->_getDatesOfDelivery($id_carrier, $oos, $order_invoice->date_add)) && isset($datesDelivery[0][0]) && isset($datesDelivery[1][0]))
|
||||
$return = sprintf($this->l('Approximate date of delivery is between %1$s and %2$s'), $datesDelivery[0][0], $datesDelivery[1][0]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function _postProcess()
|
||||
{
|
||||
$errors = array();
|
||||
if (Tools::isSubmit('submitMoreOptions'))
|
||||
{
|
||||
if (Tools::getValue('date_format') == '' OR !Validate::isCleanHtml(Tools::getValue('date_format')))
|
||||
$errors[] = $this->l('Date format is invalid');
|
||||
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
Configuration::updateValue('DOD_EXTRA_TIME_PRODUCT_OOS', (int)Tools::getValue('extra_time_product_oos'));
|
||||
Configuration::updateValue('DOD_EXTRA_TIME_PREPARATION', (int)Tools::getValue('extra_time_preparation'));
|
||||
Configuration::updateValue('DOD_PREPARATION_SATURDAY', (int)Tools::getValue('preparation_day_preparation_saturday'));
|
||||
Configuration::updateValue('DOD_PREPARATION_SUNDAY', (int)Tools::getValue('preparation_day_preparation_sunday'));
|
||||
Configuration::updateValue('DOD_DATE_FORMAT', Tools::getValue('date_format'));
|
||||
$this->_html .= $this->displayConfirmation($this->l('Settings are updated'));
|
||||
}
|
||||
else
|
||||
$this->_html .= $this->displayError(implode('<br />', $errors));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitCarrierRule'))
|
||||
{
|
||||
if (!Validate::isUnsignedInt(Tools::getValue('minimal_time')))
|
||||
$errors[] = $this->l('Minimum time is invalid');
|
||||
if (!Validate::isUnsignedInt(Tools::getValue('maximal_time')))
|
||||
$errors[] = $this->l('Maximum time is invalid');
|
||||
if (($carrier = new Carrier((int)Tools::getValue('id_carrier'))) AND !Validate::isLoadedObject($carrier))
|
||||
$errors[] = $this->l('Carrier is invalid');
|
||||
if ($this->_isAlreadyDefinedForCarrier((int)($carrier->id), (int)(Tools::getValue('id_carrier_rule', 0))))
|
||||
$errors[] = $this->l('You cannot use this carrier, a rule has already been saved.');
|
||||
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
if (Tools::isSubmit('addCarrierRule'))
|
||||
{
|
||||
if (Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'dateofdelivery_carrier_rule`(`id_carrier`, `minimal_time`, `maximal_time`, `delivery_saturday`, `delivery_sunday`)
|
||||
VALUES ('.(int)($carrier->id).', '.(int)Tools::getValue('minimal_time').', '.(int)Tools::getValue('maximal_time').', '.(int)Tools::isSubmit('preparation_day_delivery_saturday').', '.(int)Tools::isSubmit('preparation_day_delivery_sunday').')
|
||||
'))
|
||||
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmAddCarrierRule');
|
||||
else
|
||||
$this->_html .= $this->displayError($this->l('An error occurred on adding of carrier rule.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'dateofdelivery_carrier_rule`
|
||||
SET `id_carrier` = '.(int)($carrier->id).', `minimal_time` = '.(int)Tools::getValue('minimal_time').', `maximal_time` = '.(int)Tools::getValue('maximal_time').', `delivery_saturday` = '.(int)Tools::isSubmit('preparation_day_delivery_saturday').', `delivery_sunday` = '.(int)Tools::isSubmit('preparation_day_delivery_sunday').'
|
||||
WHERE `id_carrier_rule` = '.(int)Tools::getValue('id_carrier_rule')
|
||||
))
|
||||
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmupdatedateofdelivery');
|
||||
else
|
||||
$this->_html .= $this->displayError($this->l('An error occurred on updating of carrier rule.'));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
$this->_html .= $this->displayError(implode('<br />', $errors));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('deletedateofdelivery') AND Tools::isSubmit('id_carrier_rule') AND (int)Tools::getValue('id_carrier_rule') AND $this->_isCarrierRuleExists((int)Tools::getValue('id_carrier_rule')))
|
||||
{
|
||||
$this->_deleteByIdCarrierRule((int)Tools::getValue('id_carrier_rule'));
|
||||
$this->_html .= $this->displayConfirmation($this->l('Carrier rule deleted successfully'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('confirmAddCarrierRule'))
|
||||
$this->_html = $this->displayConfirmation($this->l('Carrier rule added successfully'));
|
||||
|
||||
if (Tools::isSubmit('confirmupdatedateofdelivery'))
|
||||
$this->_html = $this->displayConfirmation($this->l('Carrier rule updated successfully'));
|
||||
}
|
||||
|
||||
private function _getCarrierRulesWithCarrierName()
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'dateofdelivery_carrier_rule` dcr
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON (c.`id_carrier` = dcr.`id_carrier`)
|
||||
');
|
||||
}
|
||||
|
||||
private function _getCarrierRule($id_carrier_rule)
|
||||
{
|
||||
if (!(int)($id_carrier_rule))
|
||||
return false;
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'dateofdelivery_carrier_rule`
|
||||
WHERE `id_carrier_rule` = '.(int)($id_carrier_rule)
|
||||
);
|
||||
}
|
||||
|
||||
private function _getCarrierRuleWithIdCarrier($id_carrier)
|
||||
{
|
||||
if (!(int)($id_carrier))
|
||||
return false;
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'dateofdelivery_carrier_rule`
|
||||
WHERE `id_carrier` = '.(int)($id_carrier)
|
||||
);
|
||||
}
|
||||
|
||||
private function _isCarrierRuleExists($id_carrier_rule)
|
||||
{
|
||||
if (!(int)($id_carrier_rule))
|
||||
return false;
|
||||
return (bool)Db::getInstance()->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'dateofdelivery_carrier_rule`
|
||||
WHERE `id_carrier_rule` = '.(int)($id_carrier_rule)
|
||||
);
|
||||
}
|
||||
|
||||
private function _deleteByIdCarrierRule($id_carrier_rule)
|
||||
{
|
||||
if (!(int)($id_carrier_rule))
|
||||
return false;
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'dateofdelivery_carrier_rule`
|
||||
WHERE `id_carrier_rule` = '.(int)($id_carrier_rule)
|
||||
);
|
||||
}
|
||||
|
||||
private function _isAlreadyDefinedForCarrier($id_carrier, $id_carrier_rule = 0)
|
||||
{
|
||||
if (!(int)($id_carrier))
|
||||
return false;
|
||||
return (bool)Db::getInstance()->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'dateofdelivery_carrier_rule`
|
||||
WHERE `id_carrier` = '.(int)($id_carrier).'
|
||||
'.((int)$id_carrier_rule != 0 ? 'AND `id_carrier_rule` != '.(int)($id_carrier_rule) : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id_carrier
|
||||
* @param bool $product_oos
|
||||
* @param string $date
|
||||
*
|
||||
* @return array|bool returns the min & max delivery date
|
||||
*/
|
||||
private function _getDatesOfDelivery($id_carrier, $product_oos = false, $date = null)
|
||||
{
|
||||
if (!(int)($id_carrier))
|
||||
return false;
|
||||
$carrier_rule = $this->_getCarrierRuleWithIdCarrier((int)($id_carrier));
|
||||
if (empty($carrier_rule))
|
||||
return false;
|
||||
|
||||
if ($date != null AND Validate::isDate($date))
|
||||
$date_now = strtotime($date);
|
||||
else
|
||||
$date_now = time(); // Date on timestamp format
|
||||
if ($product_oos)
|
||||
$date_now += Configuration::get('DOD_EXTRA_TIME_PRODUCT_OOS') * 24 * 3600;
|
||||
if (!Configuration::get('DOD_PREPARATION_SATURDAY') AND date('l', $date_now) == 'Saturday')
|
||||
$date_now += 24 * 3600;
|
||||
if (!Configuration::get('DOD_PREPARATION_SUNDAY') AND date('l', $date_now) == 'Sunday')
|
||||
$date_now += 24 * 3600;
|
||||
|
||||
$date_minimal_time = $date_now + ($carrier_rule['minimal_time'] * 24 * 3600) + (Configuration::get('DOD_EXTRA_TIME_PREPARATION') * 24 * 3600);
|
||||
$date_maximal_time = $date_now + ($carrier_rule['maximal_time'] * 24 * 3600) + (Configuration::get('DOD_EXTRA_TIME_PREPARATION') * 24 * 3600);
|
||||
|
||||
if (!$carrier_rule['delivery_saturday'] AND date('l', $date_minimal_time) == 'Saturday')
|
||||
{
|
||||
$date_minimal_time += 24 * 3600;
|
||||
$date_maximal_time += 24 * 3600;
|
||||
}
|
||||
if (!$carrier_rule['delivery_saturday'] AND date('l', $date_maximal_time) == 'Saturday')
|
||||
$date_maximal_time += 24 * 3600;
|
||||
|
||||
if (!$carrier_rule['delivery_sunday'] AND date('l', $date_minimal_time) == 'Sunday')
|
||||
{
|
||||
$date_minimal_time += 24 * 3600;
|
||||
$date_maximal_time += 24 * 3600;
|
||||
}
|
||||
if (!$carrier_rule['delivery_sunday'] AND date('l', $date_maximal_time) == 'Sunday')
|
||||
$date_maximal_time += 24 * 3600;
|
||||
|
||||
/*
|
||||
|
||||
// Do not remove this commentary, it's usefull to allow translations of months and days in the translator tool
|
||||
|
||||
$this->l('Sunday');
|
||||
$this->l('Monday');
|
||||
$this->l('Tuesday');
|
||||
$this->l('Wednesday');
|
||||
$this->l('Thursday');
|
||||
$this->l('Friday');
|
||||
$this->l('Saturday');
|
||||
|
||||
$this->l('January');
|
||||
$this->l('February');
|
||||
$this->l('March');
|
||||
$this->l('April');
|
||||
$this->l('May');
|
||||
$this->l('June');
|
||||
$this->l('July');
|
||||
$this->l('August');
|
||||
$this->l('September');
|
||||
$this->l('October');
|
||||
$this->l('November');
|
||||
$this->l('December');
|
||||
*/
|
||||
|
||||
$date_minimal_string = '';
|
||||
$date_maximal_string = '';
|
||||
$date_format = preg_split('/([a-z])/Ui', Configuration::get('DOD_DATE_FORMAT'), NULL, PREG_SPLIT_DELIM_CAPTURE);
|
||||
foreach ($date_format as $elmt)
|
||||
{
|
||||
if ($elmt == 'l' OR $elmt == 'F')
|
||||
{
|
||||
$date_minimal_string .= $this->l(date($elmt, $date_minimal_time));
|
||||
$date_maximal_string .= $this->l(date($elmt, $date_maximal_time));
|
||||
}
|
||||
elseif (preg_match('/[a-z]/Ui', $elmt))
|
||||
{
|
||||
$date_minimal_string .= date($elmt, $date_minimal_time);
|
||||
$date_maximal_string .= date($elmt, $date_maximal_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
$date_minimal_string .= $elmt;
|
||||
$date_maximal_string .= $elmt;
|
||||
}
|
||||
}
|
||||
return array(
|
||||
array(
|
||||
$date_minimal_string,
|
||||
$date_minimal_time
|
||||
),
|
||||
array(
|
||||
$date_maximal_string,
|
||||
$date_maximal_time
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Extra time when a product is out of stock'),
|
||||
'name' => 'extra_time_product_oos',
|
||||
'suffix' => $this->l('day(s)'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Extra time for preparation of the order'),
|
||||
'name' => 'extra_time_preparation',
|
||||
'suffix' => $this->l('day(s)'),
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'label' => $this->l('Preparation option'),
|
||||
'name' => 'preparation_day',
|
||||
'values' => array(
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'preparation_saturday',
|
||||
'name' => $this->l('Saturday preparation'),
|
||||
'val' => 1
|
||||
),
|
||||
array(
|
||||
'id' => 'preparation_sunday',
|
||||
'name' => $this->l('Sunday preparation'),
|
||||
'val' => 1
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Date format:'),
|
||||
'name' => 'date_format',
|
||||
'desc' => $this->l('You can see all parameters available at:').' <a href="http://www.php.net/manual/en/function.date.php">http://www.php.net/manual/en/function.date.php</a>',
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default')
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitMoreOptions';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function renderAddForm()
|
||||
{
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::ALL_CARRIERS);
|
||||
|
||||
foreach ($carriers as $key => $val)
|
||||
$carriers[$key]['name'] = (!$val['name'] ? Configuration::get('PS_SHOP_NAME') : $val['name']);
|
||||
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Carrier :'),
|
||||
'name' => 'id_carrier',
|
||||
'options' => array(
|
||||
'query' => $carriers,
|
||||
'id' => 'id_carrier',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Delivery between'),
|
||||
'name' => 'minimal_time',
|
||||
'suffix' => $this->l('day(s)'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l(''),
|
||||
'name' => 'maximal_time',
|
||||
'suffix' => $this->l('day(s)'),
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'label' => $this->l('Preparation option'),
|
||||
'name' => 'preparation_day',
|
||||
'values' => array(
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'delivery_saturday',
|
||||
'name' => $this->l('Saturday preparation'),
|
||||
'val' => 1
|
||||
),
|
||||
array(
|
||||
'id' => 'delivery_sunday',
|
||||
'name' => $this->l('Sunday preparation'),
|
||||
'val' => 1
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default',
|
||||
'name' => 'submitCarrierRule',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
if (Tools::getValue('id_carrier_rule') && $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule')))
|
||||
$fields_form['form']['input'][] = array('type' => 'hidden', 'name' => 'id_carrier_rule');
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
|
||||
$helper->identifier = $this->identifier;
|
||||
|
||||
if (Tools::getValue('id_carrier_rule'))
|
||||
$helper->submit_action = 'updatedateofdelivery';
|
||||
else
|
||||
$helper->submit_action = 'addCarrierRule';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getCarrierRuleFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'extra_time_product_oos' => Tools::getValue('extra_time_product_oos', Configuration::get('DOD_EXTRA_TIME_PRODUCT_OOS')),
|
||||
'extra_time_preparation' => Tools::getValue('extra_time_preparation', Configuration::get('DOD_EXTRA_TIME_PREPARATION')),
|
||||
'preparation_day_preparation_saturday' => Tools::getValue('preparation_day_preparation_saturday', Configuration::get('DOD_PREPARATION_SATURDAY')),
|
||||
'preparation_day_preparation_sunday' => Tools::getValue('preparation_day_preparation_sunday', Configuration::get('DOD_PREPARATION_SUNDAY')),
|
||||
'date_format' => Tools::getValue('date_format', Configuration::get('DOD_DATE_FORMAT')),
|
||||
'id_carrier' => Tools::getValue('id_carrier'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getCarrierRuleFieldsValues()
|
||||
{
|
||||
$fields = array(
|
||||
'id_carrier_rule' => Tools::getValue('id_carrier_rule'),
|
||||
'id_carrier' => Tools::getValue('id_carrier'),
|
||||
'minimal_time' => Tools::getValue('minimal_time'),
|
||||
'maximal_time' => Tools::getValue('maximal_time'),
|
||||
'delivery_saturday' => Tools::getValue('delivery_saturday'),
|
||||
'delivery_sunday' => Tools::getValue('delivery_sunday'),
|
||||
);
|
||||
|
||||
if (Tools::isSubmit('updatedateofdelivery') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule')))
|
||||
{
|
||||
$carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule'));
|
||||
|
||||
$fields['id_carrier_rule'] = Tools::getValue('id_carrier_rule', $carrier_rule['id_carrier_rule']);
|
||||
$fields['id_carrier'] = Tools::getValue('id_carrier', $carrier_rule['id_carrier']);
|
||||
$fields['minimal_time'] = Tools::getValue('minimal_time', $carrier_rule['minimal_time']);
|
||||
$fields['maximal_time'] = Tools::getValue('maximal_time', $carrier_rule['maximal_time']);
|
||||
$fields['preparation_day_delivery_saturday'] = Tools::getValue('preparation_day_delivery_saturday', $carrier_rule['delivery_saturday']);
|
||||
$fields['preparation_day_delivery_sunday'] = Tools::getValue('preparation_day_delivery_sunday', $carrier_rule['delivery_sunday']);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
|
||||
$add_url = $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&addCarrierRule=1';
|
||||
|
||||
$fields_list = array(
|
||||
'name' => array(
|
||||
'title' => $this->l('Name of carrier'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'delivery_between' => array(
|
||||
'title' => $this->l('Delivery between'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'delivery_saturday' => array(
|
||||
'title' => $this->l('Saturday delivery'),
|
||||
'type' => 'bool',
|
||||
'align' => 'center',
|
||||
'active' => 'status',
|
||||
),
|
||||
'delivery_sunday' => array(
|
||||
'title' => $this->l('Sunday delivery'),
|
||||
'type' => 'bool',
|
||||
'align' => 'center',
|
||||
'active' => 'status',
|
||||
),
|
||||
);
|
||||
$list = $this->_getCarrierRulesWithCarrierName();
|
||||
|
||||
foreach ($list as $key => $val)
|
||||
{
|
||||
if (!$val['name'])
|
||||
$list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
|
||||
$list[$key]['delivery_between'] = sprintf($this->l('%1$d day(s) and %2$d day(s)'), $val['minimal_time'], $val['maximal_time']);
|
||||
}
|
||||
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->identifier = 'id_carrier_rule';
|
||||
$helper->actions = array('edit', 'delete');
|
||||
$helper->show_toolbar = false;
|
||||
|
||||
$helper->title = $this->l('Link list');
|
||||
$helper->table = $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
|
||||
|
||||
$this->context->smarty->assign(array('add_url' => $add_url));
|
||||
|
||||
return $this->display(__FILE__, 'button.tpl').$helper->generateList($list, $fields_list).$this->display(__FILE__, 'button.tpl');
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 655 B |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 793 B |
|
Before Width: | Height: | Size: 827 B |
|
Before Width: | Height: | Size: 853 B |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
|
Before Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,28 +0,0 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if $datesDelivery|count}
|
||||
<p id="dateofdelivery">{l s='Approximate date of delivery is between %1$s and %2$s' sprintf=[$datesDelivery.0.0, $datesDelivery.1.0] mod='dateofdelivery'} <sup>*</sup></p>
|
||||
<p style="font-size:10px;margin:0;padding:0;"><sup>*</sup> {l s='with direct payment methods (e.g. credit card)' mod='dateofdelivery'}</p>
|
||||
{/if}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||