update
1
modules/leofeature/Readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# Leo Feature
|
||||
153
modules/leofeature/classes/CompareProduct.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class CompareProduct extends ObjectModel
|
||||
{
|
||||
public $id_compare;
|
||||
|
||||
public $id_customer;
|
||||
|
||||
public $date_add;
|
||||
|
||||
public $date_upd;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'leofeature_compare',
|
||||
'primary' => 'id_compare',
|
||||
'fields' => array(
|
||||
'id_compare' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Get all compare products of the customer
|
||||
* @param int $id_customer
|
||||
* @return array
|
||||
*/
|
||||
public static function getCompareProducts($id_compare)
|
||||
{
|
||||
$results = Db::getInstance()->executeS('
|
||||
SELECT DISTINCT `id_product`
|
||||
FROM `'._DB_PREFIX_.'leofeature_compare` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_compare_product` cp ON (cp.`id_compare` = c.`id_compare`)
|
||||
WHERE cp.`id_compare` = '.(int)($id_compare));
|
||||
|
||||
$compareProducts = null;
|
||||
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$compareProducts[] = (int)$result['id_product'];
|
||||
}
|
||||
}
|
||||
|
||||
return $compareProducts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a compare product for the customer
|
||||
* @param int $id_customer, int $id_product
|
||||
* @return bool
|
||||
*/
|
||||
public static function addCompareProduct($id_compare, $id_product)
|
||||
{
|
||||
// Check if compare row exists
|
||||
$id_compare = Db::getInstance()->getValue('SELECT `id_compare`
|
||||
FROM `'._DB_PREFIX_.'leofeature_compare`
|
||||
WHERE `id_compare` = '.(int)$id_compare);
|
||||
|
||||
if (!$id_compare) {
|
||||
$id_customer = false;
|
||||
if (Context::getContext()->customer) {
|
||||
$id_customer = Context::getContext()->customer->id;
|
||||
}
|
||||
$sql = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_compare` (`id_compare`, `id_customer`) VALUES (NULL, "'.($id_customer ? (int)$id_customer: '0').'")');
|
||||
if ($sql) {
|
||||
$id_compare = Db::getInstance()->getValue('SELECT MAX(`id_compare`) FROM `'._DB_PREFIX_.'leofeature_compare`');
|
||||
Context::getContext()->cookie->id_compare = $id_compare;
|
||||
}
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
INSERT IGNORE INTO `'._DB_PREFIX_.'leofeature_compare_product` (`id_compare`, `id_product`, `date_add`, `date_upd`)
|
||||
VALUES ('.(int)($id_compare).', '.(int)($id_product).', NOW(), NOW())');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a compare product for the customer
|
||||
* @param int $id_compare
|
||||
* @param int $id_product
|
||||
* @return bool
|
||||
*/
|
||||
public static function removeCompareProduct($id_compare, $id_product)
|
||||
{
|
||||
return Db::getInstance()->execute('
|
||||
DELETE cp FROM `'._DB_PREFIX_.'leofeature_compare_product` cp, `'._DB_PREFIX_.'leofeature_compare` c
|
||||
WHERE cp.`id_compare`=c.`id_compare`
|
||||
AND cp.`id_product` = '.(int)$id_product.'
|
||||
AND c.`id_compare` = '.(int)$id_compare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of compare products of the customer
|
||||
* @param int $id_compare
|
||||
* @return int
|
||||
*/
|
||||
public static function getNumberProducts($id_compare)
|
||||
{
|
||||
return (int)(Db::getInstance()->getValue('SELECT count(`id_compare`)
|
||||
FROM `'._DB_PREFIX_.'leofeature_compare_product`
|
||||
WHERE `id_compare` = '.(int)($id_compare)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clean entries which are older than the period
|
||||
* @param string $period
|
||||
* @return void
|
||||
*/
|
||||
public static function cleanCompareProducts($period = null)
|
||||
{
|
||||
if ($period !== null) {
|
||||
Tools::displayParameterAsDeprecated('period');
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('
|
||||
DELETE cp, c FROM `'._DB_PREFIX_.'leofeature_compare_product` cp, `'._DB_PREFIX_.'leofeature_compare` c
|
||||
WHERE cp.date_upd < DATE_SUB(NOW(), INTERVAL 1 WEEK) AND c.`id_compare`=cp.`id_compare`');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id_compare by id_customer
|
||||
* @param int $id_customer
|
||||
* @return int $id_compare
|
||||
*/
|
||||
public static function getIdCompareByIdCustomer($id_customer)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue('SELECT `id_compare`
|
||||
FROM `'._DB_PREFIX_.'leofeature_compare`
|
||||
WHERE `id_customer`= '.(int)$id_customer);
|
||||
}
|
||||
}
|
||||
181
modules/leofeature/classes/LeofeatureProduct.php
Normal file
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
use PrestaShop\PrestaShop\Adapter\Product\PriceFormatter;
|
||||
use PrestaShop\PrestaShop\Adapter\Image\ImageRetriever;
|
||||
use PrestaShop\PrestaShop\Core\Product\ProductExtraContentFinder;
|
||||
use PrestaShop\PrestaShop\Core\Product\ProductListingPresenter;
|
||||
use PrestaShop\PrestaShop\Adapter\Product\ProductColorsRetriever;
|
||||
use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder;
|
||||
|
||||
class LeofeatureProduct extends ProductControllerCore
|
||||
{
|
||||
public $php_self = '';
|
||||
public $quantity_discounts;
|
||||
|
||||
protected function assignPriceAndTax()
|
||||
{
|
||||
$id_customer = (isset($this->context->customer) ? (int) $this->context->customer->id : 0);
|
||||
$id_group = (int) Group::getCurrent()->id;
|
||||
$id_country = $id_customer ? (int) Customer::getCurrentCountry($id_customer) : (int) Tools::getCountry();
|
||||
|
||||
// Tax
|
||||
$tax = (float) $this->product->getTaxesRate(new Address((int) $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
$this->context->smarty->assign('tax_rate', $tax);
|
||||
|
||||
$product_price_with_tax = Product::getPriceStatic($this->product->id, true, null, 6);
|
||||
if (Product::$_taxCalculationMethod == PS_TAX_INC) {
|
||||
$product_price_with_tax = Tools::ps_round($product_price_with_tax, 2);
|
||||
}
|
||||
|
||||
$id_currency = (int) $this->context->cookie->id_currency;
|
||||
$id_product = (int) $this->product->id;
|
||||
$id_product_attribute = Tools::getValue('id_product_attribute', null);
|
||||
$id_shop = $this->context->shop->id;
|
||||
|
||||
$quantity_discounts = SpecificPrice::getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_product_attribute, false, (int) $this->context->customer->id);
|
||||
foreach ($quantity_discounts as &$quantity_discount) {
|
||||
if ($quantity_discount['id_product_attribute']) {
|
||||
$combination = new Combination((int) $quantity_discount['id_product_attribute']);
|
||||
$attributes = $combination->getAttributesName((int) $this->context->language->id);
|
||||
foreach ($attributes as $attribute) {
|
||||
$quantity_discount['attributes'] = $attribute['name'].' - ';
|
||||
}
|
||||
$quantity_discount['attributes'] = rtrim($quantity_discount['attributes'], ' - ');
|
||||
}
|
||||
if ((int) $quantity_discount['id_currency'] == 0 && $quantity_discount['reduction_type'] == 'amount') {
|
||||
$quantity_discount['reduction'] = Tools::convertPriceFull($quantity_discount['reduction'], null, Context::getContext()->currency);
|
||||
}
|
||||
}
|
||||
|
||||
$product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false);
|
||||
$this->quantity_discounts = $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float) $tax, $this->product->ecotax);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'no_tax' => Tax::excludeTaxeOption() || !$tax,
|
||||
'tax_enabled' => Configuration::get('PS_TAX') && !Configuration::get('AEUC_LABEL_TAX_INC_EXC'),
|
||||
'customer_group_without_tax' => Group::getPriceDisplayMethod($this->context->customer->id_default_group),
|
||||
));
|
||||
}
|
||||
|
||||
public function getTemplateVarProduct2($id_product, $id_product_attribute)
|
||||
{
|
||||
if ($id_product) {
|
||||
$this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($this->product)) {
|
||||
return false;
|
||||
}
|
||||
$productSettings = $this->getProductPresentationSettings();
|
||||
// Hook displayProductExtraContent
|
||||
$extraContentFinder = new ProductExtraContentFinder();
|
||||
|
||||
$product = $this->objectPresenter->present($this->product);
|
||||
$product['id_product'] = (int) $this->product->id;
|
||||
$product['out_of_stock'] = (int) $this->product->out_of_stock;
|
||||
$product['new'] = (int) $this->product->new;
|
||||
$product['id_product_attribute'] = (int) $id_product_attribute;
|
||||
$product['minimal_quantity'] = $this->getProductMinimalQuantity($product);
|
||||
$product['quantity_wanted'] = $this->getRequiredQuantity($product);
|
||||
$product['extraContent'] = $extraContentFinder->addParams(array('product' => $this->product))->present();
|
||||
|
||||
$product_full = Product::getProductProperties($this->context->language->id, $product, $this->context);
|
||||
|
||||
$product_full = $this->addProductCustomizationData($product_full);
|
||||
|
||||
$product_full['show_quantities'] = (bool) (
|
||||
Configuration::get('PS_DISPLAY_QTIES')
|
||||
&& Configuration::get('PS_STOCK_MANAGEMENT')
|
||||
&& $this->product->quantity > 0
|
||||
&& $this->product->available_for_order
|
||||
&& !Configuration::isCatalogMode()
|
||||
);
|
||||
$product_full['quantity_label'] = ($this->product->quantity > 1) ? $this->trans('Items', array(), 'Shop.Theme.Catalog') : $this->trans('Item', array(), 'Shop.Theme.Catalog');
|
||||
$product_full['quantity_discounts'] = $this->quantity_discounts;
|
||||
|
||||
if ($product_full['unit_price_ratio'] > 0) {
|
||||
$unitPrice = ($productSettings->include_taxes) ? $product_full['price'] : $product_full['price_tax_exc'];
|
||||
$product_full['unit_price'] = $unitPrice / $product_full['unit_price_ratio'];
|
||||
}
|
||||
|
||||
$group_reduction = GroupReduction::getValueForProduct($this->product->id, (int) Group::getCurrent()->id);
|
||||
if ($group_reduction === false) {
|
||||
$group_reduction = Group::getReduction((int) $this->context->cookie->id_customer) / 100;
|
||||
}
|
||||
$product_full['customer_group_discount'] = $group_reduction;
|
||||
$presenter = $this->getProductPresenter();
|
||||
|
||||
return $presenter->present(
|
||||
$productSettings,
|
||||
$product_full,
|
||||
$this->context->language
|
||||
);
|
||||
}
|
||||
|
||||
public function getTemplateVarProduct1($id_product)
|
||||
{
|
||||
if ($id_product) {
|
||||
$this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($this->product)) {
|
||||
return false;
|
||||
}
|
||||
$productSettings = $this->getProductPresentationSettings();
|
||||
// Hook displayProductExtraContent
|
||||
$extraContentFinder = new ProductExtraContentFinder();
|
||||
|
||||
$product = $this->objectPresenter->present($this->product);
|
||||
$product['id_product'] = (int) $this->product->id;
|
||||
$product['out_of_stock'] = (int) $this->product->out_of_stock;
|
||||
$product['new'] = (int) $this->product->new;
|
||||
$product['id_product_attribute'] = Product::getDefaultAttribute((int)$id_product);
|
||||
$product['minimal_quantity'] = $this->getProductMinimalQuantity($product);
|
||||
$product['quantity_wanted'] = $this->getRequiredQuantity($product);
|
||||
$product['extraContent'] = $extraContentFinder->addParams(array('product' => $this->product))->present();
|
||||
|
||||
$product_full = Product::getProductProperties($this->context->language->id, $product, $this->context);
|
||||
$product_full = $this->addProductCustomizationData($product_full);
|
||||
|
||||
$product_full['show_quantities'] = (bool) (
|
||||
Configuration::get('PS_DISPLAY_QTIES')
|
||||
&& Configuration::get('PS_STOCK_MANAGEMENT')
|
||||
&& $this->product->quantity > 0
|
||||
&& $this->product->available_for_order
|
||||
&& !Configuration::isCatalogMode()
|
||||
);
|
||||
$product_full['quantity_label'] = ($this->product->quantity > 1) ? $this->trans('Items', array(), 'Shop.Theme.Catalog') : $this->trans('Item', array(), 'Shop.Theme.Catalog');
|
||||
$product_full['quantity_discounts'] = $this->quantity_discounts;
|
||||
|
||||
if ($product_full['unit_price_ratio'] > 0) {
|
||||
$unitPrice = ($productSettings->include_taxes) ? $product_full['price'] : $product_full['price_tax_exc'];
|
||||
$product_full['unit_price'] = $unitPrice / $product_full['unit_price_ratio'];
|
||||
}
|
||||
|
||||
$group_reduction = GroupReduction::getValueForProduct($this->product->id, (int) Group::getCurrent()->id);
|
||||
if ($group_reduction === false) {
|
||||
$group_reduction = Group::getReduction((int) $this->context->cookie->id_customer) / 100;
|
||||
}
|
||||
$product_full['customer_group_discount'] = $group_reduction;
|
||||
$presenter = $this->getProductPresenter();
|
||||
|
||||
return $presenter->present(
|
||||
$productSettings,
|
||||
$product_full,
|
||||
$this->context->language
|
||||
);
|
||||
}
|
||||
}
|
||||
438
modules/leofeature/classes/ProductReview.php
Normal file
@@ -0,0 +1,438 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ProductReview extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
|
||||
/** @var integer Product's id */
|
||||
public $id_product;
|
||||
|
||||
/** @var integer Customer's id */
|
||||
public $id_customer;
|
||||
|
||||
/** @var integer Guest's id */
|
||||
public $id_guest;
|
||||
|
||||
/** @var integer Customer name */
|
||||
public $customer_name;
|
||||
|
||||
/** @var string Title */
|
||||
public $title;
|
||||
|
||||
/** @var string Content */
|
||||
public $content;
|
||||
|
||||
/** @var integer Grade */
|
||||
public $grade;
|
||||
|
||||
/** @var boolean Validate */
|
||||
public $validate = 0;
|
||||
|
||||
public $deleted = 0;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'leofeature_product_review',
|
||||
'primary' => 'id_product_review',
|
||||
'fields' => array(
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_guest' => array('type' => self::TYPE_INT),
|
||||
'customer_name' => array('type' => self::TYPE_STRING),
|
||||
'title' => array('type' => self::TYPE_STRING),
|
||||
'content' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 65535, 'required' => true),
|
||||
'grade' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'validate' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'deleted' => array('type' => self::TYPE_BOOL),
|
||||
'date_add' => array('type' => self::TYPE_DATE),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Get reviews by IdProduct
|
||||
*
|
||||
* @return array Reviews
|
||||
*/
|
||||
public static function getByProduct($id_product, $p = 1, $n = null, $id_customer = null)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product)) {
|
||||
return false;
|
||||
}
|
||||
$validate = Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
$p = (int)$p;
|
||||
$n = (int)$n;
|
||||
if ($p <= 1) {
|
||||
$p = 1;
|
||||
}
|
||||
if ($n != null && $n <= 0) {
|
||||
$n = 5;
|
||||
}
|
||||
|
||||
$cache_id = 'ProductReview::getByProduct_'.(int)$id_product.'-'.(int)$p.'-'.(int)$n.'-'.(int)$id_customer.'-'.(bool)$validate;
|
||||
if (!Cache::isStored($cache_id)) {
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT pc.`id_product_review`,
|
||||
(SELECT count(*) FROM `'._DB_PREFIX_.'leofeature_product_review_usefulness` pcu WHERE pcu.`id_product_review` = pc.`id_product_review` AND pcu.`usefulness` = 1) as total_useful,
|
||||
(SELECT count(*) FROM `'._DB_PREFIX_.'leofeature_product_review_usefulness` pcu WHERE pcu.`id_product_review` = pc.`id_product_review`) as total_advice, '.
|
||||
((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'leofeature_product_review_usefulness` pcuc WHERE pcuc.`id_product_review` = pc.`id_product_review` AND pcuc.id_customer = '.(int)$id_customer.') as customer_advice, ' : '').
|
||||
((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'leofeature_product_review_report` pcrc WHERE pcrc.`id_product_review` = pc.`id_product_review` AND pcrc.id_customer = '.(int)$id_customer.') as customer_report, ' : '').'
|
||||
if (c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pc.title
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = pc.`id_customer`
|
||||
WHERE pc.`id_product` = '.(int)($id_product).($validate == '1' ? ' AND pc.`validate` = 1' : '').'
|
||||
ORDER BY pc.`date_add` DESC
|
||||
'.($n ? 'LIMIT '.(int)(($p - 1) * $n).', '.(int)($n) : ''));
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return customer's review
|
||||
*
|
||||
* @return arrayReviews
|
||||
*/
|
||||
public static function getByCustomer($id_product, $id_customer, $get_last = false, $id_guest = false)
|
||||
{
|
||||
$cache_id = 'ProductReview::getByCustomer_'.(int)$id_product.'-'.(int)$id_customer.'-'.(bool)$get_last.'-'.(int)$id_guest;
|
||||
if (!Cache::isStored($cache_id)) {
|
||||
$results = Db::getInstance()->executeS('SELECT *
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
WHERE pc.`id_product` = '.(int)$id_product.'
|
||||
AND '.(!$id_guest ? 'pc.`id_customer` = '.(int)$id_customer : 'pc.`id_guest` = '.(int)$id_guest).'
|
||||
ORDER BY pc.`date_add` DESC '
|
||||
.($get_last ? 'LIMIT 1' : ''));
|
||||
|
||||
if ($get_last && count($results)) {
|
||||
$results = array_shift($results);
|
||||
}
|
||||
|
||||
Cache::store($cache_id, $results);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Grade By product
|
||||
*
|
||||
* @return array Grades
|
||||
*/
|
||||
public static function getGradeByProduct($id_product, $id_lang)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product) || !Validate::isUnsignedId($id_lang)) {
|
||||
return false;
|
||||
}
|
||||
$validate = Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT pc.`id_product_review`, pcg.`grade`, pccl.`name`, pcc.`id_product_review_criterion`
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review_grade` pcg ON (pcg.`id_product_review` = pc.`id_product_review`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review_criterion` pcc ON (pcc.`id_product_review_criterion` = pcg.`id_product_review_criterion`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review_criterion_lang` pccl ON (pccl.`id_product_review_criterion` = pcg.`id_product_review_criterion`)
|
||||
WHERE pc.`id_product` = '.(int)$id_product.'
|
||||
AND pccl.`id_lang` = '.(int)$id_lang.($validate == '1' ? ' AND pc.`validate` = 1' : '')));
|
||||
}
|
||||
|
||||
public static function getRatings($id_product)
|
||||
{
|
||||
$validate = Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
|
||||
$sql = 'SELECT (SUM(pc.`grade`) / COUNT(pc.`grade`)) AS avg,
|
||||
MIN(pc.`grade`) AS min,
|
||||
MAX(pc.`grade`) AS max
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
WHERE pc.`id_product` = '.(int)$id_product.'
|
||||
AND pc.`deleted` = 0'.
|
||||
($validate == '1' ? ' AND pc.`validate` = 1' : '');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
}
|
||||
|
||||
public static function getAverageGrade($id_product)
|
||||
{
|
||||
$validate = Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT (SUM(pc.`grade`) / COUNT(pc.`grade`)) AS grade
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
WHERE pc.`id_product` = '.(int)$id_product.'
|
||||
AND pc.`deleted` = 0'.
|
||||
($validate == '1' ? ' AND pc.`validate` = 1' : ''));
|
||||
}
|
||||
|
||||
public static function getAveragesByProduct($id_product, $id_lang)
|
||||
{
|
||||
/* Get all grades */
|
||||
$grades = ProductReview::getGradeByProduct((int)$id_product, (int)$id_lang);
|
||||
$total = ProductReview::getGradedReviewNumber((int)$id_product);
|
||||
if (!count($grades) || (!$total)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/* Addition grades for each criterion */
|
||||
$criterionsGradeTotal = array();
|
||||
$count_grades = count($grades);
|
||||
for ($i = 0; $i < $count_grades; ++$i) {
|
||||
if (array_key_exists($grades[$i]['id_product_review_criterion'], $criterionsGradeTotal) === false) {
|
||||
$criterionsGradeTotal[$grades[$i]['id_product_review_criterion']] = (int)($grades[$i]['grade']);
|
||||
} else {
|
||||
$criterionsGradeTotal[$grades[$i]['id_product_review_criterion']] += (int)($grades[$i]['grade']);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally compute the averages */
|
||||
$averages = array();
|
||||
foreach ($criterionsGradeTotal as $key => $criterionGradeTotal) {
|
||||
$averages[(int)($key)] = (int)($total) ? ((int)($criterionGradeTotal) / (int)($total)) : 0;
|
||||
}
|
||||
return $averages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of reviews and average grade by products
|
||||
*
|
||||
* @return array Info
|
||||
*/
|
||||
public static function getReviewNumber($id_product)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product)) {
|
||||
return false;
|
||||
}
|
||||
$validate = (int)Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
$cache_id = 'ProductReview::getReviewNumber_'.(int)$id_product.'-'.$validate;
|
||||
if (!Cache::isStored($cache_id)) {
|
||||
$result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(`id_product_review`) AS "nbr"
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
WHERE `id_product` = '.(int)($id_product).($validate == '1' ? ' AND `validate` = 1' : ''));
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of reviews and average grade by products
|
||||
*
|
||||
* @return array Info
|
||||
*/
|
||||
public static function getGradedReviewNumber($id_product)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product)) {
|
||||
return false;
|
||||
}
|
||||
$validate = (int)Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(pc.`id_product`) AS nbr
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
WHERE `id_product` = '.(int)($id_product).($validate == '1' ? ' AND `validate` = 1' : '').'
|
||||
AND `grade` > 0');
|
||||
return (int)($result['nbr']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reviews by Validation
|
||||
*
|
||||
* @return array Reviews
|
||||
*/
|
||||
public static function getByValidate($validate = '0', $deleted = false)
|
||||
{
|
||||
$sql = '
|
||||
SELECT pc.`id_product_review`, pc.`id_product`, if (c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`title`, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
WHERE pc.`validate` = '.(int)$validate;
|
||||
|
||||
$sql .= ' ORDER BY pc.`date_add` DESC';
|
||||
|
||||
// validate module
|
||||
unset($deleted);
|
||||
|
||||
return (Db::getInstance()->executeS($sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all reviews
|
||||
*
|
||||
* @return array Reviews
|
||||
*/
|
||||
public static function getAll()
|
||||
{
|
||||
return (Db::getInstance()->executeS('
|
||||
SELECT pc.`id_product_review`, pc.`id_product`, if (c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
ORDER BY pc.`date_add` DESC'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a comment
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public function validate($validate = '1')
|
||||
{
|
||||
if (!Validate::isUnsignedId($this->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$success = (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'leofeature_product_review` SET
|
||||
`validate` = '.(int)$validate.'
|
||||
WHERE `id_product_review` = '.(int)$this->id));
|
||||
|
||||
Hook::exec('actionObjectProductReviewValidateAfter', array('object' => $this));
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a comment, grade and report data
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
ProductReview::deleteGrades($this->id);
|
||||
ProductReview::deleteReports($this->id);
|
||||
ProductReview::deleteUsefulness($this->id);
|
||||
parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Grades
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function deleteGrades($id_product_review)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product_review)) {
|
||||
return false;
|
||||
}
|
||||
return (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_product_review_grade`
|
||||
WHERE `id_product_review` = '.(int)$id_product_review));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Reports
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function deleteReports($id_product_review)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product_review)) {
|
||||
return false;
|
||||
}
|
||||
return (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_product_review_report`
|
||||
WHERE `id_product_review` = '.(int)$id_product_review));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete usefulness
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public static function deleteUsefulness($id_product_review)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product_review)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_product_review_usefulness`
|
||||
WHERE `id_product_review` = '.(int)$id_product_review));
|
||||
}
|
||||
|
||||
/**
|
||||
* Report comment
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function reportReview($id_product_review, $id_customer)
|
||||
{
|
||||
return (Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_report` (`id_product_review`, `id_customer`)
|
||||
VALUES ('.(int)$id_product_review.', '.(int)$id_customer.')'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment already report
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isAlreadyReport($id_product_review, $id_customer)
|
||||
{
|
||||
return (bool)Db::getInstance()->getValue('SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_report`
|
||||
WHERE `id_customer` = '.(int)$id_customer.'
|
||||
AND `id_product_review` = '.(int)$id_product_review);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comment usefulness
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function setReviewUsefulness($id_product_review, $usefulness, $id_customer)
|
||||
{
|
||||
return (Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_usefulness` (`id_product_review`, `usefulness`, `id_customer`)
|
||||
VALUES ('.(int)$id_product_review.', '.(int)$usefulness.', '.(int)$id_customer.')'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Usefulness already set
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isAlreadyUsefulness($id_product_review, $id_customer)
|
||||
{
|
||||
return (bool)Db::getInstance()->getValue('SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_usefulness`
|
||||
WHERE `id_customer` = '.(int)$id_customer.'
|
||||
AND `id_product_review` = '.(int)$id_product_review);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reported reviews
|
||||
*
|
||||
* @return array Reviews
|
||||
*/
|
||||
public static function getReportedReviews()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT DISTINCT(pc.`id_product_review`), pc.`id_product`, if (c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`, pc.`title`
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_report` pcr
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review` pc
|
||||
ON pcr.id_product_review = pc.id_product_review
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.' AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
ORDER BY pc.`date_add` DESC');
|
||||
}
|
||||
}
|
||||
277
modules/leofeature/classes/ProductReviewCriterion.php
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
class ProductReviewCriterion extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
public $id_product_review_criterion_type;
|
||||
public $name;
|
||||
public $active = true;
|
||||
|
||||
const MODULE_NAME = 'leofeature';
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'leofeature_product_review_criterion',
|
||||
'primary' => 'id_product_review_criterion',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'id_product_review_criterion_type' => array('type' => self::TYPE_INT),
|
||||
'active' => array('type' => self::TYPE_BOOL),
|
||||
// Lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
|
||||
)
|
||||
);
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!parent::delete()) {
|
||||
return false;
|
||||
}
|
||||
if ($this->id_product_review_criterion_type == 2) {
|
||||
if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'leofeature_product_review_criterion_category WHERE id_product_review_criterion='.(int)$this->id)) {
|
||||
return false;
|
||||
}
|
||||
} elseif ($this->id_product_review_criterion_type == 3) {
|
||||
if (!Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'leofeature_product_review_criterion_product
|
||||
WHERE id_product_review_criterion='.(int)$this->id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_product_review_grade`
|
||||
WHERE `id_product_review_criterion` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
public function update($nullValues = false)
|
||||
{
|
||||
// print_r('kkk');die();
|
||||
$previousUpdate = new self((int)$this->id);
|
||||
if (!parent::update($nullValues)) {
|
||||
return false;
|
||||
}
|
||||
if ($previousUpdate->id_product_review_criterion_type != $this->id_product_review_criterion_type) {
|
||||
if ($previousUpdate->id_product_review_criterion_type == 2) {
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'leofeature_product_review_criterion_category
|
||||
WHERE id_product_review_criterion = '.(int)$previousUpdate->id);
|
||||
} elseif ($previousUpdate->id_product_review_criterion_type == 3) {
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'leofeature_product_review_criterion_product
|
||||
WHERE id_product_review_criterion = '.(int)$previousUpdate->id);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link a review Criterion to a product
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public function addProduct($id_product)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_criterion_product` (`id_product_review_criterion`, `id_product`)
|
||||
VALUES('.(int)$this->id.','.(int)$id_product.')
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* Link a review Criterion to a category
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public function addCategory($id_category)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_category)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_criterion_category` (`id_product_review_criterion`, `id_category`)
|
||||
VALUES('.(int)$this->id.','.(int)$id_category.')');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add grade to a criterion
|
||||
*
|
||||
* @return boolean succeed
|
||||
*/
|
||||
public function addGrade($id_product_review, $grade)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product_review)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
if ($grade < 0) {
|
||||
$grade = 0;
|
||||
} elseif ($grade > 10) {
|
||||
$grade = 10;
|
||||
}
|
||||
return (Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_grade`
|
||||
(`id_product_review`, `id_product_review_criterion`, `grade`) VALUES(
|
||||
'.(int)($id_product_review).',
|
||||
'.(int)$this->id.',
|
||||
'.(int)($grade).')'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get criterion by Product
|
||||
*
|
||||
* @return array Criterion
|
||||
*/
|
||||
public static function getByProduct($id_product, $id_lang)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product) || !Validate::isUnsignedId($id_lang)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
$alias = 'p';
|
||||
$table = '';
|
||||
// check if version > 1.5 to add shop association
|
||||
if (version_compare(_PS_VERSION_, '1.5', '>')) {
|
||||
$table = '_shop';
|
||||
$alias = 'ps';
|
||||
}
|
||||
|
||||
$cache_id = 'ProductReviewCriterion::getByProduct_'.(int)$id_product.'-'.(int)$id_lang;
|
||||
if (!Cache::isStored($cache_id)) {
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT pcc.`id_product_review_criterion`, pccl.`name`
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_criterion` pcc
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review_criterion_lang` pccl
|
||||
ON (pcc.id_product_review_criterion = pccl.id_product_review_criterion)
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review_criterion_product` pccp
|
||||
ON (pcc.`id_product_review_criterion` = pccp.`id_product_review_criterion` AND pccp.`id_product` = '.(int)$id_product.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_product_review_criterion_category` pccc
|
||||
ON (pcc.`id_product_review_criterion` = pccc.`id_product_review_criterion`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product'.$table.'` '.$alias.'
|
||||
ON ('.$alias.'.id_category_default = pccc.id_category AND '.$alias.'.id_product = '.(int)$id_product.')
|
||||
WHERE pccl.`id_lang` = '.(int)($id_lang).'
|
||||
AND (
|
||||
pccp.id_product IS NOT NULL
|
||||
OR ps.id_product IS NOT NULL
|
||||
OR pcc.id_product_review_criterion_type = 1
|
||||
)
|
||||
AND pcc.active = 1
|
||||
GROUP BY pcc.id_product_review_criterion
|
||||
');
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Criterions
|
||||
*
|
||||
* @return array Criterions
|
||||
*/
|
||||
public static function getCriterions($id_lang, $type = false, $active = false)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_lang)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
$sql = '
|
||||
SELECT pcc.`id_product_review_criterion`, pcc.id_product_review_criterion_type, pccl.`name`, pcc.active
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_criterion` pcc
|
||||
JOIN `'._DB_PREFIX_.'leofeature_product_review_criterion_lang` pccl ON (pcc.id_product_review_criterion = pccl.id_product_review_criterion)
|
||||
WHERE pccl.`id_lang` = '.(int)$id_lang.($active ? ' AND active = 1' : '').($type ? ' AND id_product_review_criterion_type = '.(int)$type : '').'
|
||||
ORDER BY pccl.`name` ASC';
|
||||
$criterions = Db::getInstance()->executeS($sql);
|
||||
|
||||
$types = self::getTypes();
|
||||
foreach ($criterions as $key => $data) {
|
||||
$criterions[$key]['type_name'] = $types[$data['id_product_review_criterion_type']];
|
||||
}
|
||||
|
||||
return $criterions;
|
||||
}
|
||||
|
||||
public function getProducts()
|
||||
{
|
||||
$res = Db::getInstance()->executeS('
|
||||
SELECT pccp.id_product, pccp.id_product_review_criterion
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_criterion_product` pccp
|
||||
WHERE pccp.id_product_review_criterion = '.(int)$this->id);
|
||||
$products = array();
|
||||
if ($res) {
|
||||
foreach ($res as $row) {
|
||||
$products[] = (int)$row['id_product'];
|
||||
}
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
|
||||
public function getCategories()
|
||||
{
|
||||
$res = Db::getInstance()->executeS('
|
||||
SELECT pccc.id_category, pccc.id_product_review_criterion
|
||||
FROM `'._DB_PREFIX_.'leofeature_product_review_criterion_category` pccc
|
||||
WHERE pccc.id_product_review_criterion = '.(int)$this->id);
|
||||
$criterions = array();
|
||||
if ($res) {
|
||||
foreach ($res as $row) {
|
||||
$criterions[] = (int)$row['id_category'];
|
||||
}
|
||||
}
|
||||
return $criterions;
|
||||
}
|
||||
|
||||
public function deleteCategories()
|
||||
{
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_product_review_criterion_category`
|
||||
WHERE `id_product_review_criterion` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
public function deleteProducts()
|
||||
{
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_product_review_criterion_product`
|
||||
WHERE `id_product_review_criterion` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translation for a given module text
|
||||
*
|
||||
* Note: $specific parameter is mandatory for library files.
|
||||
* Otherwise, translation key will not match for Module library
|
||||
* when module is loaded with eval() Module::getModulesOnDisk()
|
||||
*
|
||||
* @param string $string String to translate
|
||||
* @param boolean|string $specific filename to use in translation key
|
||||
* @return string Translation
|
||||
*/
|
||||
public static function l($string, $specific = false)
|
||||
{
|
||||
return Translate::getModuleTranslation(self::MODULE_NAME, $string, ($specific) ? $specific : self::MODULE_NAME);
|
||||
}
|
||||
|
||||
public static function getTypes()
|
||||
{
|
||||
return array(
|
||||
1 => self::l('Valid for the entire catalog'),
|
||||
2 => self::l('Restricted to some categories'),
|
||||
3 => self::l('Restricted to some products')
|
||||
);
|
||||
}
|
||||
}
|
||||
43
modules/leofeature/classes/ProductReviewGrade.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ProductReviewGrade extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
|
||||
public $id_product_review;
|
||||
|
||||
public $id_product_review_criterion;
|
||||
|
||||
public $grade;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'leofeature_product_review_grade',
|
||||
'primary' => 'id_product_review_grade',
|
||||
'fields' => array(
|
||||
'id_product_review' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_product_review_criterion' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'grade' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
)
|
||||
);
|
||||
}
|
||||
566
modules/leofeature/classes/WishList.php
Normal file
@@ -0,0 +1,566 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
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;
|
||||
|
||||
/** @var integer default */
|
||||
public $default;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'leofeature_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'),
|
||||
'default' => array('type' => self::TYPE_BOOL, 'validate' => 'isUnsignedId'),
|
||||
)
|
||||
);
|
||||
|
||||
public function delete()
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'leofeature_wishlist_product` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
if ($this->default) {
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'leofeature_wishlist` WHERE `id_customer` = '.(int)$this->id_customer.' and `id_wishlist` != '.(int)$this->id.' LIMIT 1');
|
||||
foreach ($result as $res) {
|
||||
Db::getInstance()->update('wishlist', array('default' => '1'), 'id_wishlist = '.(int)$res['id_wishlist']);
|
||||
}
|
||||
}
|
||||
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_.'leofeature_wishlist`
|
||||
WHERE `id_wishlist` = '.(int)$id_wishlist);
|
||||
|
||||
if ($result == false || !count($result) || empty($result) === true) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'leofeature_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_.'leofeature_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_.'leofeature_wishlist`
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_customer` = '.(int)($id_customer).'
|
||||
AND `id_shop` = '.(int)Context::getContext()->shop->id);
|
||||
if (empty($result) === false and $result != false and sizeof($result)) {
|
||||
if ($return === false) {
|
||||
return (true);
|
||||
} else {
|
||||
return ($result);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Customers having a wishlist
|
||||
*
|
||||
* @return array Results
|
||||
*/
|
||||
public static function getCustomers()
|
||||
{
|
||||
$cache_id = 'WhishList::getCustomers';
|
||||
if (!Cache::isStored($cache_id)) {
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_customer`, c.`firstname`, c.`lastname`
|
||||
FROM `'._DB_PREFIX_.'leofeature_wishlist` w
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = w.`id_customer`
|
||||
ORDER BY c.`firstname` ASC');
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_.'leofeature_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`, w.`default`
|
||||
FROM `'._DB_PREFIX_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_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'].', ';
|
||||
}
|
||||
// validate module
|
||||
unset($k);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
//DONGND:: get simple list product by wishlist
|
||||
public static function getSimpleProductByIdCustomer($id_customer, $id_shop)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_customer) or !Validate::isUnsignedId($id_shop)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
$wishlists = Db::getInstance()->executeS('
|
||||
SELECT w.`id_wishlist`
|
||||
FROM `'._DB_PREFIX_.'leofeature_wishlist` w
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).' AND w.`id_shop` = '.(int) $id_shop.'');
|
||||
|
||||
if (empty($wishlists) === true or !sizeof($wishlists)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$wishlist_product = array();
|
||||
foreach ($wishlists as $wishlists_val) {
|
||||
$product = Db::getInstance()->executeS('
|
||||
SELECT wp.`id_product`, wp.`id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'leofeature_wishlist_product` wp
|
||||
WHERE wp.`id_wishlist` = '.(int)$wishlists_val['id_wishlist'].'');
|
||||
$wishlist_product[$wishlists_val['id_wishlist']] = $product;
|
||||
}
|
||||
|
||||
return ($wishlist_product);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wishlists number products by Customer ID
|
||||
*
|
||||
* @return array Results
|
||||
*/
|
||||
public static function getInfosByIdCustomer($id_customer, $id_wishlist)
|
||||
{
|
||||
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_)->getRow('
|
||||
SELECT SUM(wp.`quantity`) AS nbProducts, wp.`id_wishlist`
|
||||
FROM `'._DB_PREFIX_.'leofeature_wishlist_product` wp
|
||||
INNER JOIN `'._DB_PREFIX_.'leofeature_wishlist` w ON (w.`id_wishlist` = wp.`id_wishlist`)
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).' AND wp.`id_wishlist` = '.(int)($id_wishlist).'
|
||||
'.$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_.'leofeature_wishlist_product` wp
|
||||
JOIN `'._DB_PREFIX_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_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_.'leofeature_wishlist` w
|
||||
LEFT JOIN `'._DB_PREFIX_.'leofeature_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);
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_wishlist_product`
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_product` = '.(int)($id_product).'
|
||||
AND `id_product_attribute` = '.(int)($id_product_attribute));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if there is a default already set
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isDefault($id_customer)
|
||||
{
|
||||
return (Bool)Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'leofeature_wishlist` WHERE `id_customer` = '.(int)$id_customer.' AND `default` = 1');
|
||||
}
|
||||
|
||||
public static function getDefault($id_customer)
|
||||
{
|
||||
return Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'leofeature_wishlist` WHERE `id_customer` = '.(int)$id_customer.' AND `default` = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set current WishList as default
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function setDefault()
|
||||
{
|
||||
if ($default = $this->getDefault($this->id_customer)) {
|
||||
Db::getInstance()->update('leofeature_wishlist', array('default' => '0'), 'id_wishlist = '.(int)$default[0]['id_wishlist']);
|
||||
}
|
||||
|
||||
return Db::getInstance()->update('leofeature_wishlist', array('default' => '1'), 'id_wishlist = '.(int)$this->id);
|
||||
}
|
||||
|
||||
//DONGND:: delete product of wishlist
|
||||
public static function removeProductWishlist($id_wishlist, $id_wishlist_product)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist_product) || !Validate::isUnsignedId($id_wishlist)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'leofeature_wishlist_product`
|
||||
WHERE `id_wishlist_product` = '.(int)($id_wishlist_product).'
|
||||
AND `id_wishlist` = '.(int)($id_wishlist));
|
||||
}
|
||||
|
||||
//DONGND:: delete product of wishlist
|
||||
public static function updateProductWishlist($id_wishlist, $id_wishlist_product, $priority, $quantity)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist_product) || !Validate::isUnsignedId($id_wishlist) || !Validate::isUnsignedInt($quantity) || !Validate::isUnsignedInt($priority) || $priority < 0 || $priority > 2) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'leofeature_wishlist_product` SET
|
||||
`priority` = '.(int)($priority).',
|
||||
`quantity` = '.(int)($quantity).'
|
||||
WHERE `id_wishlist` = '.(int)($id_wishlist).'
|
||||
AND `id_wishlist_product` = '.(int)($id_wishlist_product));
|
||||
}
|
||||
|
||||
//DONGND::
|
||||
public static function getSimpleProductByIdWishlist($id_wishlist)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_wishlist)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT wp.*
|
||||
FROM `'._DB_PREFIX_.'leofeature_wishlist_product` wp
|
||||
WHERE wp.`id_wishlist` = '.(int)$id_wishlist.'');
|
||||
}
|
||||
}
|
||||
35
modules/leofeature/classes/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
12
modules/leofeature/config.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>leofeature</name>
|
||||
<displayName><![CDATA[Leo Feature]]></displayName>
|
||||
<version><![CDATA[2.1.6]]></version>
|
||||
<description><![CDATA[Leo feature for prestashop 1.7: ajax cart, dropdown cart, fly cart, review, compare, wishlist at product list]]></description>
|
||||
<author><![CDATA[Leotheme]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
12
modules/leofeature/config_pl.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>leofeature</name>
|
||||
<displayName><![CDATA[Leo Feature]]></displayName>
|
||||
<version><![CDATA[2.1.6]]></version>
|
||||
<description><![CDATA[Leo feature for prestashop 1.7: ajax cart, dropdown cart, fly cart, review, compare, wishlist at product list]]></description>
|
||||
<author><![CDATA[Leotheme]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class AdminLeofeatureModuleController extends ModuleAdminControllerCore
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$url = 'index.php?controller=AdminModules&configure=leofeature&token='.Tools::getAdminTokenLite('AdminModules');
|
||||
Tools::redirectAdmin($url);
|
||||
}
|
||||
}
|
||||
505
modules/leofeature/controllers/admin/AdminLeofeatureReviews.php
Normal file
@@ -0,0 +1,505 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/ProductReviewCriterion.php');
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/ProductReview.php');
|
||||
|
||||
class AdminLeofeatureReviewsController extends ModuleAdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'leofeature_product_review_criterion';
|
||||
$this->identifier = 'id_product_review_criterion';
|
||||
$this->className = 'ProductReviewCriterion';
|
||||
$this->lang = true;
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
|
||||
$this->fields_list = array(
|
||||
'id_product_review_criterion' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'type' => 'text',
|
||||
'class' => 'fixed-width-sm'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'type_name' => array(
|
||||
'title' => $this->l('Type'),
|
||||
'type' => 'text',
|
||||
'search' => false,
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'active' => 'status',
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-sm'
|
||||
),
|
||||
);
|
||||
|
||||
$this->_defaultOrderBy = 'id_product_review_criterion';
|
||||
$this->_select .= ' CASE
|
||||
WHEN `id_product_review_criterion_type` = 1 THEN "'.$this->module->l('Valid for the entire catalog').'"
|
||||
WHEN `id_product_review_criterion_type` = 2 THEN "'.$this->module->l('Restricted to some categories').'"
|
||||
WHEN `id_product_review_criterion_type` = 3 THEN "'.$this->module->l('Restricted to some products').'"
|
||||
END as `type_name` ';
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (Validate::isLoadedObject($this->object)) {
|
||||
$this->display = 'edit';
|
||||
} else {
|
||||
$this->display = 'add';
|
||||
}
|
||||
|
||||
$types = ProductReviewCriterion::getTypes();
|
||||
$query = array();
|
||||
foreach ($types as $key => $value) {
|
||||
$query[] = array(
|
||||
'id' => $key,
|
||||
'label' => $value,
|
||||
);
|
||||
}
|
||||
|
||||
if (Tools::getValue('id_product_review_criterion')) {
|
||||
$id_criterion = Tools::getValue('id_product_review_criterion');
|
||||
} else {
|
||||
$id_criterion = 0;
|
||||
}
|
||||
|
||||
$criterion = new ProductReviewCriterion((int) $id_criterion);
|
||||
$selected_categories = $criterion->getCategories();
|
||||
$product_table_values = Product::getSimpleProducts($this->context->language->id);
|
||||
$selected_products = $criterion->getProducts();
|
||||
|
||||
foreach ($product_table_values as $key => $product) {
|
||||
if (false !== array_search($product['id_product'], $selected_products)) {
|
||||
$product_table_values[$key]['selected'] = 1;
|
||||
}
|
||||
}
|
||||
if (version_compare(_PS_VERSION_, '1.6', '<')) {
|
||||
$field_category_tree = array(
|
||||
'type' => 'categories_select',
|
||||
'name' => 'categoryBox',
|
||||
'label' => $this->l('Criterion will be restricted to the following categories'),
|
||||
'category_tree' => $this->initCategoriesAssociation(null, $id_criterion),
|
||||
);
|
||||
} else {
|
||||
$field_category_tree = array(
|
||||
'type' => 'categories',
|
||||
'label' => $this->l('Criterion will be restricted to the following categories'),
|
||||
'name' => 'categoryBox',
|
||||
'desc' => $this->l('Mark the boxes of categories to which this criterion applies.'),
|
||||
'tree' => array(
|
||||
'use_search' => false,
|
||||
'id' => 'categoryBox',
|
||||
'use_checkbox' => true,
|
||||
'selected_categories' => $selected_categories,
|
||||
),
|
||||
//retro compat 1.5 for category tree
|
||||
'values' => array(
|
||||
'trads' => array(
|
||||
'Root' => Category::getTopCategory(),
|
||||
'selected' => $this->l('Selected'),
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Expand All' => $this->l('Expand All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All'),
|
||||
),
|
||||
'selected_cat' => $selected_categories,
|
||||
'input_name' => 'categoryBox[]',
|
||||
'use_radio' => false,
|
||||
'use_search' => false,
|
||||
'disabled_categories' => array(),
|
||||
'top_category' => Category::getTopCategory(),
|
||||
'use_context' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Add new criterion'),
|
||||
'icon' => 'icon-cogs',
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_product_review_criterion',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'lang' => true,
|
||||
'label' => $this->l('Criterion name'),
|
||||
'name' => 'name',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'id_product_review_criterion_type',
|
||||
'label' => $this->l('Application scope of the criterion'),
|
||||
'options' => array(
|
||||
'query' => $query,
|
||||
'id' => 'id',
|
||||
'name' => 'label',
|
||||
),
|
||||
),
|
||||
$field_category_tree,
|
||||
array(
|
||||
'type' => 'products',
|
||||
'label' => $this->l('The criterion will be restricted to the following products'),
|
||||
'name' => 'ids_product',
|
||||
'values' => $product_table_values,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'is_bool' => true, //retro compat 1.5
|
||||
'label' => $this->l('Active'),
|
||||
'name' => 'active',
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'name' => 'submitEditCriterion',
|
||||
),
|
||||
'buttons' => array(
|
||||
'save_and_preview' => array(
|
||||
'name' => 'submitEditCriterionAndStay',
|
||||
'type' => 'submit',
|
||||
'title' => $this->l('Save and stay'),
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'icon' => 'process-icon-save-and-stay'
|
||||
)
|
||||
)
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->toolbar_title = $this->l('Review Criteria');
|
||||
$return = null;
|
||||
$return .= $this->renderModerateLists();
|
||||
$return .= parent::renderList();
|
||||
$return .= $this->renderReviewsList();
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (count($this->errors) > 0) {
|
||||
if ($this->ajax) {
|
||||
$array = array('hasError' => true, 'errors' => $this->errors[0]);
|
||||
die(Tools::jsonEncode($array));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (Tools::isSubmit('submitEditCriterion') || Tools::isSubmit('submitEditCriterionAndStay')) {
|
||||
parent::validateRules();
|
||||
|
||||
if (count($this->errors)) {
|
||||
$this->display = 'edit';
|
||||
return false;
|
||||
}
|
||||
if ((int) Tools::getValue('id_product_review_criterion')) {
|
||||
$mess_id = '4';
|
||||
} else {
|
||||
$mess_id = '3';
|
||||
}
|
||||
|
||||
$criterion = new ProductReviewCriterion((int) Tools::getValue('id_product_review_criterion'));
|
||||
$criterion->id_product_review_criterion_type = Tools::getValue('id_product_review_criterion_type');
|
||||
$criterion->active = Tools::getValue('active');
|
||||
|
||||
$languages = Language::getLanguages();
|
||||
$name = array();
|
||||
foreach ($languages as $key => $value) {
|
||||
$name[$value['id_lang']] = Tools::getValue('name_'.$value['id_lang']);
|
||||
}
|
||||
// validate module
|
||||
unset($key);
|
||||
$criterion->name = $name;
|
||||
|
||||
$criterion->save();
|
||||
|
||||
// Clear before reinserting data
|
||||
$criterion->deleteCategories();
|
||||
$criterion->deleteProducts();
|
||||
if ($criterion->id_product_review_criterion_type == 2) {
|
||||
if ($categories = Tools::getValue('categoryBox')) {
|
||||
if (count($categories)) {
|
||||
foreach ($categories as $id_category) {
|
||||
$criterion->addCategory((int) $id_category);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($criterion->id_product_review_criterion_type == 3) {
|
||||
if ($products = Tools::getValue('ids_product')) {
|
||||
if (count($products)) {
|
||||
foreach ($products as $product) {
|
||||
$criterion->addProduct((int) $product);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($criterion->save()) {
|
||||
if (Tools::isSubmit('submitEditCriterionAndStay')) {
|
||||
# validate module
|
||||
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$criterion->id.'&conf='.$mess_id.'&update'.$this->table.'&token='.$this->token;
|
||||
} else {
|
||||
# validate module
|
||||
$this->redirect_after = self::$currentIndex.'&conf=4&token='.$this->token;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} elseif (Tools::isSubmit('deleteleofeature_product_review') && Tools::getValue('id_product_review')) {
|
||||
$id_product_review = (int) Tools::getValue('id_product_review');
|
||||
$review = new ProductReview($id_product_review);
|
||||
$review->delete();
|
||||
// var_dump($review->delete());die();
|
||||
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
|
||||
} elseif (Tools::isSubmit('approveReview') && Tools::getValue('id_product_review')) {
|
||||
$id_product_review = (int) Tools::getValue('id_product_review');
|
||||
$review = new ProductReview($id_product_review);
|
||||
$review->validate();
|
||||
$this->redirect_after = self::$currentIndex.'&conf=4&token='.$this->token;
|
||||
} elseif (Tools::isSubmit('noabuseReview') && Tools::getValue('id_product_review')) {
|
||||
$id_product_review = (int) Tools::getValue('id_product_review');
|
||||
ProductReview::deleteReports($id_product_review);
|
||||
$this->redirect_after = self::$currentIndex.'&conf=4&token='.$this->token;
|
||||
} else {
|
||||
parent::postProcess(true);
|
||||
}
|
||||
$this->module->_clearcache('leo_list_product_review.tpl');
|
||||
}
|
||||
|
||||
public function initCategoriesAssociation($id_root = null, $id_criterion = 0)
|
||||
{
|
||||
if (is_null($id_root)) {
|
||||
$id_root = Configuration::get('PS_ROOT_CATEGORY');
|
||||
}
|
||||
$id_shop = (int) Tools::getValue('id_shop');
|
||||
$shop = new Shop($id_shop);
|
||||
if ($id_criterion == 0) {
|
||||
$selected_cat = array();
|
||||
} else {
|
||||
$pdc_object = new ProductReviewCriterion($id_criterion);
|
||||
$selected_cat = $pdc_object->getCategories();
|
||||
}
|
||||
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop')) {
|
||||
$root_category = new Category($shop->id_category);
|
||||
} else {
|
||||
$root_category = new Category($id_root);
|
||||
}
|
||||
$root_category = array('id_category' => $root_category->id, 'name' => $root_category->name[$this->context->language->id]);
|
||||
|
||||
$helper = new Helper();
|
||||
|
||||
return $helper->renderCategoryTree($root_category, $selected_cat, 'categoryBox', false, true);
|
||||
}
|
||||
|
||||
//DONGND:: render list reviews have not approved and reported
|
||||
public function renderModerateLists()
|
||||
{
|
||||
$return = null;
|
||||
|
||||
if (Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE')) {
|
||||
$reviews = ProductReview::getByValidate(0, false);
|
||||
|
||||
if (count($reviews) > 0) {
|
||||
$fields_list = $this->getStandardFieldList();
|
||||
|
||||
if (version_compare(_PS_VERSION_, '1.6', '<')) {
|
||||
$return .= $this->l('Reviews waiting for approval');
|
||||
$actions = array('enable', 'delete');
|
||||
} else {
|
||||
$actions = array('approve', 'delete');
|
||||
}
|
||||
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->actions = $actions;
|
||||
$helper->show_toolbar = false;
|
||||
$helper->module = $this->module;
|
||||
$helper->listTotal = count($reviews);
|
||||
$helper->identifier = 'id_product_review';
|
||||
$helper->title = $this->l('Reviews waiting for approval');
|
||||
$helper->table = 'leofeature_product_review';
|
||||
$helper->token = $this->token;
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$helper->no_link = true;
|
||||
$return .= $helper->generateList($reviews, $fields_list);
|
||||
}
|
||||
}
|
||||
|
||||
$reviews = ProductReview::getReportedReviews();
|
||||
|
||||
if (count($reviews) > 0) {
|
||||
$fields_list = $this->getStandardFieldList();
|
||||
if (version_compare(_PS_VERSION_, '1.6', '<')) {
|
||||
$return .= $this->l('Reported Reviews');
|
||||
$actions = array('enable', 'delete');
|
||||
} else {
|
||||
$actions = array('delete', 'noabuse');
|
||||
}
|
||||
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->actions = $actions;
|
||||
$helper->show_toolbar = false;
|
||||
$helper->module = $this->module;
|
||||
$helper->listTotal = count($reviews);
|
||||
$helper->identifier = 'id_product_review';
|
||||
$helper->title = $this->l('Reported Reviews');
|
||||
$helper->table = 'leofeature_product_review';
|
||||
$helper->token = $this->token;
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$helper->no_link = true;
|
||||
|
||||
$return .= $helper->generateList($reviews, $fields_list);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
//DONGND:: render list reviews have approved
|
||||
public function renderReviewsList()
|
||||
{
|
||||
|
||||
$reviews = ProductReview::getByValidate(1, false);
|
||||
$moderate = Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE');
|
||||
if (empty($moderate)) {
|
||||
$reviews = array_merge($reviews, ProductReview::getByValidate(0, false));
|
||||
}
|
||||
|
||||
$fields_list = $this->getStandardFieldList();
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->actions = array('delete');
|
||||
$helper->show_toolbar = false;
|
||||
$helper->module = $this->module;
|
||||
$helper->listTotal = count($reviews);
|
||||
$helper->identifier = 'id_product_review';
|
||||
$helper->title = $this->l('Approved Reviews');
|
||||
$helper->table = 'leofeature_product_review';
|
||||
$helper->token = $this->token;
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$helper->no_link = true;
|
||||
|
||||
return $helper->generateList($reviews, $fields_list);
|
||||
}
|
||||
|
||||
public function displayApproveLink($token, $id, $name = null)
|
||||
{
|
||||
// validate module
|
||||
unset($token);
|
||||
unset($name);
|
||||
$template = $this->createTemplate('list_action_approve.tpl');
|
||||
$template->assign(array(
|
||||
'href' => $this->context->link->getAdminLink('AdminLeofeatureReviews').'&approveReview&id_product_review='.$id,
|
||||
'action' => $this->l('Approve'),
|
||||
));
|
||||
|
||||
return $template->fetch();
|
||||
}
|
||||
|
||||
public function displayNoabuseLink($token, $id, $name = null)
|
||||
{
|
||||
// validate module
|
||||
unset($token);
|
||||
unset($name);
|
||||
|
||||
$template = $this->createTemplate('list_action_noabuse.tpl');
|
||||
|
||||
$template->assign(array(
|
||||
'href' => $this->context->link->getAdminLink('AdminLeofeatureReviews').'&noabuseReview&id_product_review='.$id,
|
||||
'action' => $this->l('Not abusive'),
|
||||
));
|
||||
|
||||
return $template->fetch();
|
||||
}
|
||||
|
||||
public function getStandardFieldList()
|
||||
{
|
||||
return array(
|
||||
'id_product_review' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'title' => array(
|
||||
'title' => $this->l('Review title'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'content' => array(
|
||||
'title' => $this->l('Review'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'grade' => array(
|
||||
'title' => $this->l('Rating'),
|
||||
'type' => 'text',
|
||||
'suffix' => '/5',
|
||||
),
|
||||
'customer_name' => array(
|
||||
'title' => $this->l('Author'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Product'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'date_add' => array(
|
||||
'title' => $this->l('Time of publication'),
|
||||
'type' => 'date',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if (!$this->access('delete')){
|
||||
if (Tools::isSubmit('deleteleofeature_product_review')) {
|
||||
$this->errors[] = $this->trans('You do not have permission to delete this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
modules/leofeature/controllers/admin/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 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-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @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;
|
||||
36
modules/leofeature/controllers/front/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 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-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @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;
|
||||
383
modules/leofeature/controllers/front/mywishlist.php
Normal file
@@ -0,0 +1,383 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/WishList.php');
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/LeofeatureProduct.php');
|
||||
|
||||
class LeoFeatureMyWishListModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $php_self;
|
||||
|
||||
public function displayAjax()
|
||||
{
|
||||
$array_result = array();
|
||||
$errors = array();
|
||||
$result = array();
|
||||
if (!$this->isTokenValid() || !Tools::getValue('action')) {
|
||||
// Ooops! Token is not valid!
|
||||
$errors[] = $this->l('An error while processing. Please try again', 'mywishlist');
|
||||
// die('Token is not valid, hack stop');
|
||||
$array_result['result'] = $result;
|
||||
$array_result['errors'] = $errors;
|
||||
die(Tools::jsonEncode($array_result));
|
||||
};
|
||||
// Add or remove product with Ajax
|
||||
$context = Context::getContext();
|
||||
$action = Tools::getValue('action');
|
||||
$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
|
||||
|
||||
if ($context->customer->isLogged()) {
|
||||
if ($id_wishlist && WishList::exists($id_wishlist, $context->customer->id) === true) {
|
||||
$context->cookie->id_wishlist = (int)$id_wishlist;
|
||||
}
|
||||
|
||||
if ((int)$context->cookie->id_wishlist > 0 && !WishList::exists($context->cookie->id_wishlist, $context->customer->id)) {
|
||||
$context->cookie->id_wishlist = '';
|
||||
}
|
||||
|
||||
if (($action == 'add' || $action == 'remove') && empty($id_product) === false) {
|
||||
if (!isset($context->cookie->id_wishlist) || $context->cookie->id_wishlist == '') {
|
||||
$wishlist = new WishList();
|
||||
$wishlist->id_shop = $context->shop->id;
|
||||
$wishlist->id_shop_group = $context->shop->id_shop_group;
|
||||
$wishlist->default = 1;
|
||||
|
||||
$wishlist->name = $this->l('My wishlist', 'mywishlist');
|
||||
$wishlist->id_customer = (int)$context->customer->id;
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = Tools::strtoupper(Tools::substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
$context->cookie->id_wishlist = (int)$wishlist->id;
|
||||
$result['id_wishlist'] = $context->cookie->id_wishlist;
|
||||
}
|
||||
if ($action == 'add') {
|
||||
WishList::addProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute, $quantity);
|
||||
} else if ($action == 'remove') {
|
||||
WishList::removeProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute);
|
||||
}
|
||||
$result[] = true;
|
||||
}
|
||||
|
||||
if ($action == 'add-wishlist') {
|
||||
$name_wishlist = Tools::getValue('name_wishlist');
|
||||
if (empty($name_wishlist)) {
|
||||
$errors[] = $this->module->l('You must specify a name.', 'mywishlist');
|
||||
}
|
||||
if (WishList::isExistsByNameForUser($name_wishlist)) {
|
||||
$errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
|
||||
}
|
||||
if (!Validate::isMessage($name_wishlist)) {
|
||||
$errors[] = $this->module->l('This name is is incorrect', '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;
|
||||
$wishlist->id_customer = (int)$this->context->customer->id;
|
||||
!$wishlist->isDefault($wishlist->id_customer) ? $wishlist->default = 1 : '';
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = Tools::strtoupper(Tools::substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$this->context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
$leo_is_rewrite_active = (bool)Configuration::get('PS_REWRITING_SETTINGS');
|
||||
if ($leo_is_rewrite_active) {
|
||||
$check_leo_is_rewrite_active = '?';
|
||||
} else {
|
||||
$check_leo_is_rewrite_active = '&';
|
||||
}
|
||||
$checked = '';
|
||||
if ($wishlist->default == 1) {
|
||||
$checked = 'checked="checked"';
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'wishlist' => $wishlist,
|
||||
'checked' => $checked,
|
||||
'url_view_wishlist' => $this->context->link->getModuleLink('leofeature', 'viewwishlist').$check_leo_is_rewrite_active.'token='.$wishlist->token,
|
||||
));
|
||||
|
||||
$result['wishlist'] = $this->module->fetch('module:leofeature/views/templates/front/leo_wishlist_new.tpl');
|
||||
$result['message'] = $this->module->l('The new wishlist has been created', 'mywishlist');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete-wishlist') {
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist)) {
|
||||
$errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
$wishlist->delete();
|
||||
$result[] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'default-wishlist') {
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist)) {
|
||||
$errors[] = $this->module->l('Cannot update this wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
$wishlist->setDefault();
|
||||
$result[] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'show-wishlist-product') {
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist)) {
|
||||
$errors[] = $this->module->l('Cannot show the product(s) of this wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
$products = array();
|
||||
$show_send_wishlist = 0;
|
||||
$wishlist_product = WishList::getSimpleProductByIdWishlist($id_wishlist);
|
||||
$product_object = new LeofeatureProduct();
|
||||
if (count($wishlist_product) > 0) {
|
||||
foreach ($wishlist_product as $wishlist_product_item) {
|
||||
$list_product_tmp = array();
|
||||
$list_product_tmp['wishlist_info'] = $wishlist_product_item;
|
||||
$list_product_tmp['product_info'] = $product_object->getTemplateVarProduct2($wishlist_product_item['id_product'], $wishlist_product_item['id_product_attribute']);
|
||||
$products[] = $list_product_tmp;
|
||||
}
|
||||
$show_send_wishlist = 1;
|
||||
}
|
||||
$wishlists = WishList::getByIdCustomer($this->context->customer->id);
|
||||
foreach ($wishlists as $key => $wishlists_item) {
|
||||
if ($wishlists_item['id_wishlist'] == $id_wishlist) {
|
||||
unset($wishlists[$key]);
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'products' => $products,
|
||||
'wishlists' => $wishlists,
|
||||
));
|
||||
$result['html'] = $this->module->fetch('module:leofeature/views/templates/front/leo_my_wishlist_product.tpl');
|
||||
$result['show_send_wishlist'] = $show_send_wishlist;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'send-wishlist') {
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist)) {
|
||||
$errors[] = $this->module->l('Invalid wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
$to = Tools::getValue('email');
|
||||
$toName = Tools::safeOutput(Configuration::get('PS_SHOP_NAME'));
|
||||
$customer = $context->customer;
|
||||
if (Validate::isLoadedObject($customer)) {
|
||||
if (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}' => $context->link->getModuleLink('leofeature', 'viewwishlist', array('token' => $wishlist->token))
|
||||
), $to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, $this->module->module_path.'/mails/')) {
|
||||
$result[] = true;
|
||||
} else {
|
||||
$errors[] = $this->module->l('Wishlist send error', 'mywishlist');
|
||||
}
|
||||
} else {
|
||||
$errors[] = $this->module->l('Invalid customer', 'mywishlist');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete-wishlist-product') {
|
||||
$id_wishlist_product = Tools::getValue('id_wishlist_product');
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist) || !Validate::isUnsignedId($id_wishlist_product)) {
|
||||
$errors[] = $this->module->l('Invalid wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
if (WishList::removeProductWishlist($id_wishlist, $id_wishlist_product)) {
|
||||
$result[] = true;
|
||||
} else {
|
||||
$errors[] = $this->module->l('Cannot delete', 'mywishlist');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'get-wishlist-info') {
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist)) {
|
||||
$errors[] = $this->module->l('Invalid wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
$wishlist_product = WishList::getInfosByIdCustomer($this->context->customer->id, $id_wishlist);
|
||||
if ($wishlist_product['nbProducts'] && $wishlist_product['nbProducts'] > 0) {
|
||||
$result['number_product'] = $wishlist_product['nbProducts'];
|
||||
} else {
|
||||
$result['number_product'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update-wishlist-product') {
|
||||
$id_wishlist_product = Tools::getValue('id_wishlist_product');
|
||||
$priority = Tools::getValue('priority');
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
|
||||
if ($this->context->customer->id != $wishlist->id_customer || !Validate::isLoadedObject($wishlist) || !Validate::isUnsignedInt($priority) || !Validate::isUnsignedInt($quantity) || !Validate::isUnsignedId($id_wishlist_product)) {
|
||||
$errors[] = $this->module->l('Invalid wishlist', 'mywishlist');
|
||||
}
|
||||
if (!count($errors)) {
|
||||
if (WishList::updateProductWishlist($id_wishlist, $id_wishlist_product, $priority, $quantity)) {
|
||||
$result[] = true;
|
||||
} else {
|
||||
$errors[] = $this->module->l('Cannot update', 'mywishlist');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'move-wishlist-product') {
|
||||
$id_wishlist_product = Tools::getValue('id_wishlist_product');
|
||||
$priority = (int)Tools::getValue('priority');
|
||||
$id_old_wishlist = (int)Tools::getValue('id_old_wishlist');
|
||||
$id_new_wishlist = (int)Tools::getValue('id_new_wishlist');
|
||||
$new_wishlist = new WishList((int)$id_new_wishlist);
|
||||
$old_wishlist = new WishList((int)$id_old_wishlist);
|
||||
if (!Validate::isUnsignedId($id_product) || !Validate::isUnsignedInt($id_product_attribute) || !Validate::isUnsignedInt($quantity) ||
|
||||
!Validate::isUnsignedInt($priority) || ($priority < 0 && $priority > 2) || !Validate::isUnsignedId($id_old_wishlist) || !Validate::isUnsignedId($id_new_wishlist) || !Validate::isUnsignedId($id_wishlist_product) ||
|
||||
(Validate::isLoadedObject($new_wishlist) && $new_wishlist->id_customer != $this->context->customer->id) ||
|
||||
(Validate::isLoadedObject($old_wishlist) && $old_wishlist->id_customer != $this->context->customer->id)) {
|
||||
$errors[] = $this->module->l('Error while moving product to another list', 'mywishlist');
|
||||
}
|
||||
|
||||
$res = true;
|
||||
$check = Db::getInstance()->getRow('SELECT quantity, id_wishlist_product FROM '._DB_PREFIX_.'leofeature_wishlist_product
|
||||
WHERE `id_product` = '.(int)$id_product.' AND `id_product_attribute` = '.(int)$id_product_attribute.' AND `id_wishlist` = '.(int)$id_new_wishlist);
|
||||
|
||||
$res &= $old_wishlist->removeProductWishlist($id_old_wishlist, $id_wishlist_product);
|
||||
if ($check) {
|
||||
$res &= $new_wishlist->updateProductWishlist($id_new_wishlist, $check['id_wishlist_product'], $priority, $quantity + $check['quantity']);
|
||||
} else {
|
||||
$res &= $new_wishlist->addProduct($id_new_wishlist, $this->context->customer->id, $id_product, $id_product_attribute, $quantity);
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
$result[] = true;
|
||||
} else {
|
||||
$errors[] = $this->module->l('Error while moving product to another list', 'mywishlist');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors[] = $this->l('You must be logged in to manage your wishlist.', 'mywishlist');
|
||||
}
|
||||
|
||||
$array_result['result'] = $result;
|
||||
$array_result['errors'] = $errors;
|
||||
die(Tools::jsonEncode($array_result));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
$this->php_self = 'mywishlist';
|
||||
|
||||
if (Tools::getValue('ajax')) {
|
||||
return;
|
||||
}
|
||||
parent::initContent();
|
||||
if (!Configuration::get('LEOFEATURE_ENABLE_PRODUCTWISHLIST')) {
|
||||
return Tools::redirect('index.php?controller=404');
|
||||
}
|
||||
|
||||
if ($this->context->customer->isLogged()) {
|
||||
$wishlists = WishList::getByIdCustomer($this->context->customer->id);
|
||||
if (count($wishlists)>0) {
|
||||
foreach ($wishlists as $key => $wishlists_val) {
|
||||
$wishlist_product = WishList::getInfosByIdCustomer($this->context->customer->id, $wishlists_val['id_wishlist']);
|
||||
$wishlists[$key]['number_product'] = $wishlist_product['nbProducts'];
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'wishlists' => $wishlists,
|
||||
'view_wishlist_url' => $this->context->link->getModuleLink('leofeature', 'viewwishlist'),
|
||||
'leo_is_rewrite_active' => (bool)Configuration::get('PS_REWRITING_SETTINGS'),
|
||||
));
|
||||
} else {
|
||||
Tools::redirect('index.php?controller=authentication&back='.urlencode($this->context->link->getModuleLink('leofeature', 'mywishlist')));
|
||||
}
|
||||
$this->setTemplate('module:leofeature/views/templates/front/leo_my_wishlist.tpl');
|
||||
}
|
||||
|
||||
//DONGND:: add meta title, meta description, meta keywords
|
||||
public function getTemplateVarPage()
|
||||
{
|
||||
$page = parent::getTemplateVarPage();
|
||||
|
||||
$page['meta']['title'] = Configuration::get('PS_SHOP_NAME').' - '.$this->l('My Wishlist', 'mywishlist');
|
||||
$page['meta']['keywords'] = $this->l('my-wishlist', 'mywishlist');
|
||||
$page['meta']['description'] = $this->l('My Wishlist', 'mywishlist');
|
||||
// echo '<pre>';
|
||||
// print_r($page);die();
|
||||
return $page;
|
||||
}
|
||||
|
||||
//DONGND:: add breadcrumb
|
||||
public function getBreadcrumbLinks()
|
||||
{
|
||||
$breadcrumb = parent::getBreadcrumbLinks();
|
||||
// $link = LeoBlogHelper::getInstance()->getFontBlogLink();
|
||||
// $config = LeoBlogConfig::getInstance();
|
||||
$breadcrumb['links'][] = array(
|
||||
'title' => $this->l('My Account', 'mywishlist'),
|
||||
'url' => $this->context->link->getPageLink('my-account', true),
|
||||
);
|
||||
|
||||
$breadcrumb['links'][] = array(
|
||||
'title' => $this->l('My Wishlist', 'mywishlist'),
|
||||
'url' => $this->context->link->getModuleLink('leofeature', 'mywishlist'),
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
//DONGND:: get layout
|
||||
public function getLayout()
|
||||
{
|
||||
$entity = 'module-leofeature-'.$this->php_self;
|
||||
|
||||
$layout = $this->context->shop->theme->getLayoutRelativePathForPage($entity);
|
||||
|
||||
if ($overridden_layout = Hook::exec(
|
||||
'overrideLayoutTemplate',
|
||||
array(
|
||||
'default_layout' => $layout,
|
||||
'entity' => $entity,
|
||||
'locale' => $this->context->language->locale,
|
||||
'controller' => $this,
|
||||
)
|
||||
)) {
|
||||
return $overridden_layout;
|
||||
}
|
||||
|
||||
if ((int) Tools::getValue('content_only')) {
|
||||
$layout = 'layouts/layout-content-only.tpl';
|
||||
}
|
||||
|
||||
return $layout;
|
||||
}
|
||||
}
|
||||
206
modules/leofeature/controllers/front/productscompare.php
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/CompareProduct.php');
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/LeofeatureProduct.php');
|
||||
|
||||
class LeofeatureProductsCompareModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $php_self;
|
||||
|
||||
/**
|
||||
* Display ajax content (this function is called instead of classic display, in ajax mode)
|
||||
*/
|
||||
public function displayAjax()
|
||||
{
|
||||
if (!$this->isTokenValid() || !Tools::getValue('action') || !Tools::getValue('ajax') || !Tools::getValue('id_product')) {
|
||||
// Ooops! Token is not valid!
|
||||
die('Token is not valid, hack stop');
|
||||
};
|
||||
// Add or remove product with Ajax
|
||||
if (Tools::getValue('ajax') && Tools::getValue('id_product') && Tools::getValue('action')) {
|
||||
if (Tools::getValue('action') == 'add') {
|
||||
$id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare: false;
|
||||
if (CompareProduct::getNumberProducts($id_compare) < Configuration::get('LEOFEATURE_COMPARATOR_MAX_ITEM')) {
|
||||
CompareProduct::addCompareProduct($id_compare, (int)Tools::getValue('id_product'));
|
||||
} else {
|
||||
$this->ajaxDie('0');
|
||||
}
|
||||
} elseif (Tools::getValue('action') == 'remove') {
|
||||
if (isset($this->context->cookie->id_compare)) {
|
||||
CompareProduct::removeCompareProduct((int)$this->context->cookie->id_compare, (int)Tools::getValue('id_product'));
|
||||
} else {
|
||||
$this->ajaxDie('0');
|
||||
}
|
||||
} else {
|
||||
$this->ajaxDie('0');
|
||||
}
|
||||
$this->ajaxDie('1');
|
||||
}
|
||||
$this->ajaxDie('0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign template vars related to page content
|
||||
* @see FrontController::initContent()
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
$this->php_self = 'productscompare';
|
||||
|
||||
if (Tools::getValue('ajax')) {
|
||||
return;
|
||||
}
|
||||
parent::initContent();
|
||||
CompareProduct::cleanCompareProducts('week');
|
||||
$hasProduct = false;
|
||||
|
||||
if (!Configuration::get('LEOFEATURE_COMPARATOR_MAX_ITEM') || !Configuration::get('LEOFEATURE_ENABLE_PRODUCTCOMPARE')) {
|
||||
return Tools::redirect('index.php?controller=404');
|
||||
}
|
||||
|
||||
$ids = null;
|
||||
|
||||
if (isset($this->context->cookie->id_compare)) {
|
||||
$ids = CompareProduct::getCompareProducts($this->context->cookie->id_compare);
|
||||
}
|
||||
|
||||
if ($ids) {
|
||||
if (count($ids) > 0) {
|
||||
if (count($ids) > Configuration::get('LEOFEATURE_COMPARATOR_MAX_ITEM')) {
|
||||
$ids = array_slice($ids, 0, Configuration::get('LEOFEATURE_COMPARATOR_MAX_ITEM'));
|
||||
}
|
||||
|
||||
$listProducts = array();
|
||||
$listFeatures = array();
|
||||
|
||||
foreach ($ids as $k => &$id) {
|
||||
$curProduct = new Product((int)$id, true, $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($curProduct) || !$curProduct->active || !$curProduct->isAssociatedToShop()) {
|
||||
if (isset($this->context->cookie->id_compare)) {
|
||||
CompareProduct::removeCompareProduct($this->context->cookie->id_compare, $id);
|
||||
}
|
||||
unset($ids[$k]);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($curProduct->getFrontFeatures($this->context->language->id) as $feature) {
|
||||
$listFeatures[$curProduct->id][$feature['id_feature']] = $feature['value'];
|
||||
}
|
||||
|
||||
$product_object = new LeofeatureProduct();
|
||||
$curProduct = $product_object->getTemplateVarProduct1($id);
|
||||
$listProducts[] = $curProduct;
|
||||
}
|
||||
|
||||
if (count($listProducts) > 0) {
|
||||
$width = 80 / count($listProducts);
|
||||
|
||||
$hasProduct = true;
|
||||
$ordered_features = $this->getFeaturesForComparison($ids, $this->context->language->id);
|
||||
$this->context->smarty->assign(array(
|
||||
'ordered_features' => $ordered_features,
|
||||
'product_features' => $listFeatures,
|
||||
'products' => $listProducts,
|
||||
'width' => $width,
|
||||
// 'HOOK_COMPARE_EXTRA_INFORMATION' => Hook::exec('displayCompareExtraInformation', array('list_ids_product' => $ids)),
|
||||
// 'HOOK_EXTRA_PRODUCT_COMPARISON' => Hook::exec('displayProductComparison', array('list_ids_product' => $ids)),
|
||||
'homeSize' => Image::getSize(ImageType::getFormattedName('home')),
|
||||
'list_product' => $ids,
|
||||
));
|
||||
} elseif (isset($this->context->cookie->id_compare)) {
|
||||
$object = new CompareProduct((int)$this->context->cookie->id_compare);
|
||||
if (Validate::isLoadedObject($object)) {
|
||||
$object->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign('hasProduct', $hasProduct);
|
||||
$this->setTemplate('module:leofeature/views/templates/front/leo_products_compare.tpl');
|
||||
}
|
||||
|
||||
public function getFeaturesForComparison($list_ids_product, $id_lang)
|
||||
{
|
||||
if (!Feature::isFeatureActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ids = '';
|
||||
foreach ($list_ids_product as $id) {
|
||||
$ids .= (int)$id.',';
|
||||
}
|
||||
|
||||
$ids = rtrim($ids, ',');
|
||||
|
||||
if (empty($ids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS('SELECT f.*, fl.*
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp
|
||||
ON f.`id_feature` = fp.`id_feature`
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl
|
||||
ON f.`id_feature` = fl.`id_feature`
|
||||
WHERE fp.`id_product` IN ('.$ids.')
|
||||
AND `id_lang` = '.(int)$id_lang.'
|
||||
GROUP BY f.`id_feature`
|
||||
ORDER BY f.`position` ASC');
|
||||
}
|
||||
|
||||
//DONGND:: add meta title, meta description, meta keywords
|
||||
public function getTemplateVarPage()
|
||||
{
|
||||
$page = parent::getTemplateVarPage();
|
||||
$page['meta']['title'] = Configuration::get('PS_SHOP_NAME').' - '.$this->l('Products Comparison', 'productscompare');
|
||||
$page['meta']['keywords'] = $this->l('products-comparison', 'productscompare');
|
||||
$page['meta']['description'] = $this->l('Products Comparison', 'productscompare');
|
||||
return $page;
|
||||
}
|
||||
|
||||
//DONGND:: add breadcrumb
|
||||
public function getBreadcrumbLinks()
|
||||
{
|
||||
$breadcrumb = parent::getBreadcrumbLinks();
|
||||
$breadcrumb['links'][] = array(
|
||||
'title' => $this->l('Products Comparison', 'productscompare'),
|
||||
'url' => $this->context->link->getModuleLink('leofeature', 'productscompare'),
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
//DONGND:: get layout
|
||||
public function getLayout()
|
||||
{
|
||||
$entity = 'module-leofeature-'.$this->php_self;
|
||||
$layout = $this->context->shop->theme->getLayoutRelativePathForPage($entity);
|
||||
if ($overridden_layout = Hook::exec('overrideLayoutTemplate', array(
|
||||
'default_layout' => $layout,
|
||||
'entity' => $entity,
|
||||
'locale' => $this->context->language->locale,
|
||||
'controller' => $this,
|
||||
))) {
|
||||
return $overridden_layout;
|
||||
}
|
||||
|
||||
if ((int) Tools::getValue('content_only')) {
|
||||
$layout = 'layouts/layout-content-only.tpl';
|
||||
}
|
||||
|
||||
return $layout;
|
||||
}
|
||||
}
|
||||
126
modules/leofeature/controllers/front/viewwishlist.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/WishList.php');
|
||||
require_once(_PS_MODULE_DIR_.'leofeature/classes/LeofeatureProduct.php');
|
||||
|
||||
class LeoFeatureViewWishlistModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public $php_self;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->context = Context::getContext();
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$this->php_self = 'viewwishlist';
|
||||
|
||||
parent::initContent();
|
||||
if (!Configuration::get('LEOFEATURE_ENABLE_PRODUCTWISHLIST')) {
|
||||
return Tools::redirect('index.php?controller=404');
|
||||
}
|
||||
$token = Tools::getValue('token');
|
||||
|
||||
if ($token) {
|
||||
$wishlist = WishList::getByToken($token);
|
||||
$wishlists = WishList::getByIdCustomer((int)$wishlist['id_customer']);
|
||||
if (count($wishlists) > 1) {
|
||||
foreach ($wishlists as $key => $wishlists_item) {
|
||||
if ($wishlists_item['id_wishlist'] == $wishlist['id_wishlist']) {
|
||||
unset($wishlists[$key]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$wishlists = array();
|
||||
}
|
||||
|
||||
$products = array();
|
||||
$wishlist_product = WishList::getSimpleProductByIdWishlist((int)$wishlist['id_wishlist']);
|
||||
$product_object = new LeofeatureProduct();
|
||||
if (count($wishlist_product) > 0) {
|
||||
foreach ($wishlist_product as $wishlist_product_item) {
|
||||
$list_product_tmp = array();
|
||||
$list_product_tmp['wishlist_info'] = $wishlist_product_item;
|
||||
$list_product_tmp['product_info'] = $product_object->getTemplateVarProduct2($wishlist_product_item['id_product'], $wishlist_product_item['id_product_attribute']);
|
||||
$list_product_tmp['product_info']['wishlist_quantity'] = $wishlist_product_item['quantity'];
|
||||
$products[] = $list_product_tmp;
|
||||
}
|
||||
}
|
||||
WishList::incCounter((int)$wishlist['id_wishlist']);
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'current_wishlist' => $wishlist,
|
||||
'wishlists' => $wishlists,
|
||||
'products' => $products,
|
||||
'view_wishlist_url' => $this->context->link->getModuleLink('leofeature', 'viewwishlist'),
|
||||
'show_button_cart' => Configuration::get('LEOFEATURE_ENABLE_AJAXCART'),
|
||||
'leo_is_rewrite_active' => (bool)Configuration::get('PS_REWRITING_SETTINGS'),
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->setTemplate('module:leofeature/views/templates/front/leo_wishlist_view.tpl');
|
||||
}
|
||||
|
||||
//DONGND:: add meta title, meta description, meta keywords
|
||||
public function getTemplateVarPage()
|
||||
{
|
||||
$page = parent::getTemplateVarPage();
|
||||
|
||||
$page['meta']['title'] = Configuration::get('PS_SHOP_NAME').' - '.$this->l('View Wishlist', 'viewwishlist');
|
||||
$page['meta']['keywords'] = $this->l('view-wishlist', 'viewwishlist');
|
||||
$page['meta']['description'] = $this->l('view Wishlist', 'viewwishlist');
|
||||
return $page;
|
||||
}
|
||||
|
||||
//DONGND:: add breadcrumb
|
||||
public function getBreadcrumbLinks()
|
||||
{
|
||||
$breadcrumb = parent::getBreadcrumbLinks();
|
||||
$breadcrumb['links'][] = array(
|
||||
'title' => $this->l('My Account', 'viewwishlist'),
|
||||
'url' => $this->context->link->getPageLink('my-account', true),
|
||||
);
|
||||
|
||||
$breadcrumb['links'][] = array(
|
||||
'title' => $this->l('My Wishlist', 'viewwishlist'),
|
||||
'url' => $this->context->link->getModuleLink('leofeature', 'mywishlist'),
|
||||
);
|
||||
|
||||
return $breadcrumb;
|
||||
}
|
||||
|
||||
//DONGND:: get layout
|
||||
public function getLayout()
|
||||
{
|
||||
$entity = 'module-leofeature-'.$this->php_self;
|
||||
$layout = $this->context->shop->theme->getLayoutRelativePathForPage($entity);
|
||||
if ($overridden_layout = Hook::exec('overrideLayoutTemplate', array(
|
||||
'default_layout' => $layout,
|
||||
'entity' => $entity,
|
||||
'locale' => $this->context->language->locale,
|
||||
'controller' => $this,
|
||||
))) {
|
||||
return $overridden_layout;
|
||||
}
|
||||
|
||||
if ((int) Tools::getValue('content_only')) {
|
||||
$layout = 'layouts/layout-content-only.tpl';
|
||||
}
|
||||
return $layout;
|
||||
}
|
||||
}
|
||||
36
modules/leofeature/controllers/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 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-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @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;
|
||||
73
modules/leofeature/css/back.css
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2017 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
.leofeature-tablist a:hover, .leofeature-tablist li.active a {
|
||||
border-bottom: medium none !important;
|
||||
border-top: 3px solid #25b9d7 !important;
|
||||
}
|
||||
|
||||
.leofeature-tablist a:focus {
|
||||
border-bottom: medium none !important;
|
||||
border-top: 3px solid #25b9d7 !important;
|
||||
}
|
||||
|
||||
#leofeature-setting .panel {
|
||||
display: none;
|
||||
}
|
||||
#leofeature-setting .panel.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#leofeature-setting .panel {
|
||||
border-radius: 0 0 5px 5px !important;
|
||||
}
|
||||
|
||||
.nav-tabs.leofeature-tablist a:focus {
|
||||
outline: medium none;
|
||||
}
|
||||
|
||||
#subtab-AdminLeofeatureReviews
|
||||
{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#subtab-AdminLeofeatureReviews .notification-container
|
||||
{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: inline-block;
|
||||
line-height: .875rem;
|
||||
height: .875rem;
|
||||
vertical-align: middle;
|
||||
|
||||
color: #fff;
|
||||
background: #fb0;
|
||||
font-size: .5625rem;
|
||||
padding: 0 .25rem;
|
||||
border-radius: .625rem;
|
||||
}
|
||||
|
||||
#subtab-AdminLeofeatureManagement.has-review:after
|
||||
{
|
||||
content: "";
|
||||
position: absolute;
|
||||
top:0;
|
||||
right: 0;
|
||||
background: #fb0;
|
||||
border-radius: .625rem;
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
}
|
||||
2370
modules/leofeature/css/front.css
Normal file
35
modules/leofeature/css/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
1276
modules/leofeature/css/jquery.mCustomScrollbar.css
Normal file
24
modules/leofeature/errors.log
Normal file
@@ -0,0 +1,24 @@
|
||||
[13-Apr-2023 00:09:29 Europe/Warsaw] PHP Fatal error: Uncaught Symfony\Component\Filesystem\Exception\IOException: Failed to remove directory "/var/cache/prod/": PHP Startup: Directory not empty. in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:180
|
||||
Stack trace:
|
||||
#0 /classes/Tools.php(3295): Symfony\Component\Filesystem\Filesystem->remove(Array)
|
||||
#1 [internal function]: ToolsCore::{closure}()
|
||||
#2 {main}
|
||||
thrown in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php on line 180
|
||||
[13-Apr-2023 00:10:24 Europe/Warsaw] PHP Fatal error: Uncaught Symfony\Component\Filesystem\Exception\IOException: Failed to remove directory "/var/cache/prod/": PHP Startup: Directory not empty. in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:180
|
||||
Stack trace:
|
||||
#0 /classes/Tools.php(3295): Symfony\Component\Filesystem\Filesystem->remove(Array)
|
||||
#1 [internal function]: ToolsCore::{closure}()
|
||||
#2 {main}
|
||||
thrown in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php on line 180
|
||||
[22-Jun-2023 15:39:44 Europe/Warsaw] PHP Fatal error: Uncaught Symfony\Component\Filesystem\Exception\IOException: Failed to remove directory "/var/cache/prod/": PHP Startup: Directory not empty. in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:180
|
||||
Stack trace:
|
||||
#0 /classes/Tools.php(3295): Symfony\Component\Filesystem\Filesystem->remove(Array)
|
||||
#1 [internal function]: ToolsCore::{closure}()
|
||||
#2 {main}
|
||||
thrown in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php on line 180
|
||||
[11-Aug-2023 22:24:27 Europe/Warsaw] PHP Fatal error: Uncaught Symfony\Component\Filesystem\Exception\IOException: Failed to remove directory "/var/cache/prod/": PHP Startup: Directory not empty. in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:180
|
||||
Stack trace:
|
||||
#0 /classes/Tools.php(3295): Symfony\Component\Filesystem\Filesystem->remove(Array)
|
||||
#1 [internal function]: ToolsCore::{closure}()
|
||||
#2 {main}
|
||||
thrown in /vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php on line 180
|
||||
BIN
modules/leofeature/img/delete.gif
Normal file
|
After Width: | Height: | Size: 752 B |
35
modules/leofeature/img/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
BIN
modules/leofeature/img/star.gif
Normal file
|
After Width: | Height: | Size: 769 B |
BIN
modules/leofeature/img/star.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
modules/leofeature/img/star1.gif
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
modules/leofeature/img/star_ (2).gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
modules/leofeature/img/star_.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
35
modules/leofeature/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
35
modules/leofeature/install/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
156
modules/leofeature/install/install.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
//DONGND:: install database for product review
|
||||
$res = (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review` (
|
||||
`id_product_review` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
`id_guest` int(10) unsigned NULL,
|
||||
`title` varchar(64) NULL,
|
||||
`content` text NOT NULL,
|
||||
`customer_name` varchar(64) NULL,
|
||||
`grade` float unsigned NOT NULL,
|
||||
`validate` tinyint(1) NOT NULL,
|
||||
`deleted` tinyint(1) NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_product_review`),
|
||||
KEY `id_product` (`id_product`),
|
||||
KEY `id_customer` (`id_customer`),
|
||||
KEY `id_guest` (`id_guest`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_criterion` (
|
||||
`id_product_review_criterion` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_product_review_criterion_type` tinyint(1) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id_product_review_criterion`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_criterion_product` (
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_product_review_criterion` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id_product`, `id_product_review_criterion`),
|
||||
KEY `id_product_review_criterion` (`id_product_review_criterion`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_criterion_lang` (
|
||||
`id_product_review_criterion` INT(11) UNSIGNED NOT NULL ,
|
||||
`id_lang` INT(11) UNSIGNED NOT NULL ,
|
||||
`name` VARCHAR(64) NOT NULL ,
|
||||
PRIMARY KEY ( `id_product_review_criterion` , `id_lang` )
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_criterion_category` (
|
||||
`id_product_review_criterion` int(10) unsigned NOT NULL,
|
||||
`id_category` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id_product_review_criterion`, `id_category`),
|
||||
KEY `id_category` (`id_category`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_grade` (
|
||||
`id_product_review_grade` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_product_review` int(10) unsigned NOT NULL,
|
||||
`id_product_review_criterion` int(10) unsigned NOT NULL,
|
||||
`grade` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_product_review_grade`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_usefulness` (
|
||||
`id_product_review` int(10) unsigned NOT NULL,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
`usefulness` tinyint(1) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_product_review`, `id_customer`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_product_review_report` (
|
||||
`id_product_review` int(10) unsigned NOT NULL,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_product_review`, `id_customer`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_product_review_criterion FROM `'._DB_PREFIX_.'leofeature_product_review_criterion`');
|
||||
|
||||
if (count($rows) <= 0) {
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_criterion` VALUES (1, 1, 1)');
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $lang) {
|
||||
$res &= (bool)Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'leofeature_product_review_criterion_lang` VALUES(1, '.(int)$lang['id_lang'].', \'Quality\')');
|
||||
}
|
||||
}
|
||||
|
||||
//DONGND:: install database for product compare
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_compare` (
|
||||
`id_compare` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_compare`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_compare_product` (
|
||||
`id_compare` int(10) unsigned NOT NULL,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_compare`, `id_product`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
//DONGND:: install database for wishlist
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_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,
|
||||
`default` int(10) unsigned default 0,
|
||||
PRIMARY KEY (`id_wishlist`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'leofeature_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='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
87
modules/leofeature/js/back.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('select#id_product_review_criterion_type').change(function() {
|
||||
// PS 1.6
|
||||
$('#categoryBox').closest('div.form-group').hide();
|
||||
$('#ids_product').closest('div.form-group').hide();
|
||||
// PS 1.5
|
||||
$('#categories-treeview').closest('div.margin-form').hide();
|
||||
$('#categories-treeview').closest('div.margin-form').prev().hide();
|
||||
$('#ids_product').closest('div.margin-form').hide();
|
||||
$('#ids_product').closest('div.margin-form').prev().hide();
|
||||
|
||||
if (this.value == 2)
|
||||
{
|
||||
$('#categoryBox').closest('div.form-group').show();
|
||||
// PS 1.5
|
||||
$('#categories-treeview').closest('div.margin-form').show();
|
||||
$('#categories-treeview').closest('div.margin-form').prev().show();
|
||||
}
|
||||
else if (this.value == 3)
|
||||
{
|
||||
$('#ids_product').closest('div.form-group').show();
|
||||
// PS 1.5
|
||||
$('#ids_product').closest('div.margin-form').show();
|
||||
$('#ids_product').closest('div.margin-form').prev().show();
|
||||
}
|
||||
});
|
||||
|
||||
$('select#id_product_review_criterion_type').trigger("change");
|
||||
|
||||
//DONGND:: tab change in group config
|
||||
var id_panel = $("#leofeature-setting .leofeature-tablist li.active a").attr("href");
|
||||
$(id_panel).addClass('active').show();
|
||||
$('.leofeature-tablist li').click(function(){
|
||||
if(!$(this).hasClass('active'))
|
||||
{
|
||||
var default_tab = $(this).find('a').attr("href");
|
||||
$('#LEOFEATURE_DEFAULT_TAB').val(default_tab);
|
||||
}
|
||||
})
|
||||
|
||||
// console.log('test');
|
||||
if (typeof leofeature_module_dir != 'undefined')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: leofeature_module_dir + 'psajax.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "get-new-review",
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if(result != '')
|
||||
{
|
||||
var obj = $.parseJSON(result);
|
||||
if (obj.number_review > 0)
|
||||
{
|
||||
$('#subtab-AdminLeofeatureManagement').addClass('has-review');
|
||||
// $('#subtab-AdminLeofeatureReviews').append('<span id="total_notif_number_wrapper" class="notifs_badge"><span id="total_notif_value">'+obj.number_review+'</span></span>');
|
||||
$('#subtab-AdminLeofeatureReviews').append('<div class="notification-container"><span class="notification-counter">'+obj.number_review+'</span></div>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
// alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
35
modules/leofeature/js/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
2472
modules/leofeature/js/jquery.mCustomScrollbar.js
Normal file
22
modules/leofeature/js/jquery.mousewheel.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
/*!
|
||||
* jQuery Mousewheel 3.1.13
|
||||
*
|
||||
* Copyright 2015 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
||||
26
modules/leofeature/js/jquery.rating.pack.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
/*
|
||||
### jQuery Star Rating Plugin v2.0 - 2008-03-12 ###
|
||||
By Diego A, http://www.fyneworks.com, diego@fyneworks.com
|
||||
- v2 by Keith Wood, kbwood@virginbroadband.com.au
|
||||
|
||||
Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating
|
||||
Website: http://www.fyneworks.com/jquery/star-rating/
|
||||
|
||||
This is a modified version of the star rating plugin from:
|
||||
http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';4(w)(3($){$.Y.T=3(c){c=$.15({m:\'X U\',E:\'\',B:z,8:z},c||{});o d={};o e={t:3(n,a,b){2.6(n);$(a).D(\'.j\').A().l(b||\'x\')},6:3(n){$(d[n].7).O(\'.j\').u(\'9\').u(\'x\')},h:3(n){4(!$(d[n].5).Z(\'.m\')){$(d[n].5).D(\'.j\').A().l(\'9\')}},g:3(n,a){d[n].5=a;o b=$(a).L(\'a\').K();$(d[n].7).J(b);e.6(n);e.h(n);4(c.I)c.I.W(d[n].7,[b,a])}};2.V(3(i){o n=2.G;4(!d[n])d[n]={r:0};i=d[n].r;d[n].r++;4(i==0){c.8=$(2).S(\'p\')||c.8;d[n].7=$(\'<R Q="P" G="\'+n+\'" q=""\'+(c.8?\' p="p"\':\'\')+\'>\');$(2).C(d[n].7);4(c.8||c.B){}F{$(2).C($(\'<k y="m"><a s="\'+c.m+\'">\'+c.E+\'</a></k>\').H(3(){e.6(n);$(2).l(\'9\')}).v(3(){e.h(n);$(2).u(\'9\')}).g(3(){e.g(n,2)}))}};f=$(\'<k y="j"><a s="\'+(2.s||2.q)+\'">\'+2.q+\'</a></k>\');$(2).N(f);4(c.8){$(f).l(\'M\')}F{$(f).H(3(){e.6(n);e.t(n,2)}).v(3(){e.6(n);e.h(n)}).g(3(){e.g(n,2)})};4(2.14)d[n].5=f;$(2).13();4(i+1==2.12)e.h(n)});11(n 10 d)4(d[n].5){e.t(n,d[n].5,\'9\');$(d[n].7).J($(d[n].5).L(\'a\').K())}16 2}})(w);',62,69,'||this|function|if|currentElem|drain|valueElem|readOnly|star_on||||||eStar|click|reset||star|div|addClass|cancel||var|disabled|value|count|title|fill|removeClass|mouseout|jQuery|star_hover|class|false|andSelf|required|before|prevAll|cancelValue|else|name|mouseover|callback|val|text|children|star_readonly|after|siblings|hidden|type|input|attr|rating|Rating|each|apply|Cancel|fn|is|in|for|length|remove|checked|extend|return'.split('|'),0,{}));
|
||||
2172
modules/leofeature/js/leofeature_cart.js
Normal file
234
modules/leofeature/js/leofeature_compare.js
Normal file
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
createLeoCompareModalPopup();
|
||||
LeoCompareButtonAction();
|
||||
prestashop.on('updateProductList', function() {
|
||||
LeoCompareButtonAction();
|
||||
});
|
||||
//DONGND:: recall button action if need when change attribute at product page
|
||||
prestashop.on('updatedProduct', function() {
|
||||
LeoCompareButtonAction();
|
||||
});
|
||||
prestashop.on('clickQuickView', function() {
|
||||
check_active_compare = setInterval(function(){
|
||||
if($('.quickview.modal').length)
|
||||
{
|
||||
$('.quickview.modal').on('shown.bs.modal', function (e) {
|
||||
LeoCompareButtonAction();
|
||||
})
|
||||
clearInterval(check_active_compare);
|
||||
}
|
||||
|
||||
}, 300);
|
||||
|
||||
});
|
||||
activeEventModalCompare();
|
||||
});
|
||||
|
||||
function createLeoCompareModalPopup()
|
||||
{
|
||||
var leoCompareModalPopup = '';
|
||||
leoCompareModalPopup += '<div class="modal leo-modal leo-modal-compare fade" tabindex="-1" role="dialog" aria-hidden="true">';
|
||||
leoCompareModalPopup += '<div class="modal-dialog" role="document">';
|
||||
leoCompareModalPopup += '<div class="modal-content">';
|
||||
leoCompareModalPopup += '<div class="modal-header">';
|
||||
leoCompareModalPopup += '<button type="button" class="close" data-dismiss="modal" aria-label="Close">';
|
||||
leoCompareModalPopup += '<span aria-hidden="true">×</span>';
|
||||
leoCompareModalPopup += '</button>';
|
||||
leoCompareModalPopup += '<h5 class="modal-title text-xs-center">';
|
||||
leoCompareModalPopup += '</h5>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
$('body').append(leoCompareModalPopup);
|
||||
}
|
||||
function LeoCompareButtonAction()
|
||||
{
|
||||
$('.leo-compare-button').click(function(){
|
||||
if (!$('.leo-compare-button.active').length)
|
||||
{
|
||||
var total_product_compare = compared_products.length;
|
||||
var id_product = $(this).data('id-product');
|
||||
|
||||
var content_product_compare_mess_remove = productcompare_remove+'. <a href="'+productcompare_url+'" target="_blank"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
var content_product_compare_mess_add = productcompare_add+'. <a href="'+productcompare_url+'" target="_blank"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
var content_product_compare_mess_max = productcompare_max_item+'. <a href="'+productcompare_url+'" target="_blank"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
|
||||
$(this).addClass('active');
|
||||
$(this).find('.leo-compare-bt-loading').css({'display':'block'});
|
||||
$(this).find('.leo-compare-bt-content').hide();
|
||||
var object_e = $(this);
|
||||
if ($(this).hasClass('added') || $(this).hasClass('delete'))
|
||||
{
|
||||
//DONGND:: remove product form list product compare
|
||||
//DONGND:: add product to list product compare
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: productcompare_url+ '?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"ajax": 1,
|
||||
"action": "remove",
|
||||
"id_product": id_product,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
// console.log(result);
|
||||
if (result == 1)
|
||||
{
|
||||
//Leotheme add: update number product on icon compare
|
||||
if ($('.ap-btn-compare .ap-total-compare').length)
|
||||
{
|
||||
var old_num_compare = parseInt($('.ap-btn-compare .ap-total-compare').data('compare-total'));
|
||||
var new_num_compare = old_num_compare-1;
|
||||
$('.ap-btn-compare .ap-total-compare').data('compare-total',new_num_compare);
|
||||
$('.ap-btn-compare .ap-total-compare').text(new_num_compare);
|
||||
}
|
||||
|
||||
compared_products.splice($.inArray(parseInt(id_product), compared_products), 1);
|
||||
if (object_e.hasClass('delete'))
|
||||
{
|
||||
//DONGND:: remove from page product compare
|
||||
if ($('.leo-productscompare-item').length == 1)
|
||||
{
|
||||
window.location.replace(productcompare_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('td.product-'+id_product).fadeOut(function(){
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//DONGND:: remove from page product list
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_remove);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').removeClass('added');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').attr('title',buttoncompare_title_add);
|
||||
// object_e.find('.leo-compare-bt-loading').hide();
|
||||
// object_e.find('.leo-compare-bt-content').show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(productcompare_remove_error);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
|
||||
}
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (total_product_compare < comparator_max_item)
|
||||
{
|
||||
//DONGND:: add product to list product compare
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: productcompare_url+ '?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"ajax": 1,
|
||||
"action": "add",
|
||||
"id_product": id_product,
|
||||
"token": leo_token,
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
// console.log(result);
|
||||
if (result == 1)
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_add);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
//Leotheme add: update number product on icon compare
|
||||
if ($('.ap-btn-compare .ap-total-compare').length)
|
||||
{
|
||||
var old_num_compare = parseInt($('.ap-btn-compare .ap-total-compare').data('compare-total'));
|
||||
var new_num_compare = old_num_compare+1;
|
||||
$('.ap-btn-compare .ap-total-compare').data('compare-total',new_num_compare);
|
||||
$('.ap-btn-compare .ap-total-compare').text(new_num_compare);
|
||||
}
|
||||
|
||||
compared_products.push(id_product);
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').addClass('added');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').attr('title',buttoncompare_title_remove);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(productcompare_add_error);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
}
|
||||
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//DONGND:: list product compare limited
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_max);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
function activeEventModalCompare()
|
||||
{
|
||||
$('.leo-modal-compare').on('hide.bs.modal', function (e) {
|
||||
// console.log($('.leo-modal-review-bt').length);
|
||||
if ($('.leo-compare-button.active').length)
|
||||
{
|
||||
// console.log('aaa');
|
||||
$('.leo-compare-button.active').removeClass('active');
|
||||
}
|
||||
})
|
||||
$('.leo-modal-compare').on('hidden.bs.modal', function (e) {
|
||||
$('body').css('padding-right', '');
|
||||
})
|
||||
$('.leo-modal-compare').on('shown.bs.modal', function (e) {
|
||||
if ($('.quickview.modal').length)
|
||||
{
|
||||
$('.quickview.modal').modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
306
modules/leofeature/js/leofeature_review.js
Normal file
@@ -0,0 +1,306 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
if ($('.open-review-form').length)
|
||||
{
|
||||
var id_product = $('.open-review-form').data('id-product');
|
||||
var is_logged = $('.open-review-form').data('is-logged');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "render-modal-review",
|
||||
"id_product": id_product,
|
||||
"is_logged": is_logged,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if(result != '')
|
||||
{
|
||||
$('body').append(result);
|
||||
activeEventModalReview();
|
||||
activeStar();
|
||||
$('.open-review-form').fadeIn('fast');
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
// alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
$('.open-review-form').click(function(){
|
||||
if ($('#criterions_list').length)
|
||||
{
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($('.leo-modal-review .modal-body .disable-form-review').length)
|
||||
{
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-review-bt').remove();
|
||||
$('.leo-modal-review .modal-header').remove();
|
||||
$('.leo-modal-review .modal-body').empty();
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group disable-form-review has-danger text-center"><label class="form-control-label">'+disable_review_form_txt+'</label></div>');
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$('.read-review').click(function(){
|
||||
// if ($('.leo-product-show-review-title').length && $('#leo-product-show-review-content').length)
|
||||
if ($('.leo-product-show-review-title').length)
|
||||
{
|
||||
if ($('.leo-product-show-review-title').hasClass('leofeature-accordion'))
|
||||
{
|
||||
if ($('.leo-product-show-review-title').hasClass('collapsed'))
|
||||
{
|
||||
$('.leo-product-show-review-title').trigger('click');
|
||||
}
|
||||
var timer = setInterval(function() {
|
||||
if ($('#collapseleofeatureproductreview').hasClass('collapse in') || $('#collapsereviews').hasClass('collapse in')) {
|
||||
//run some other function
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.leo-product-show-review-title').offset().top
|
||||
}, 500);
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-product-show-review-title').trigger('click');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.leo-product-show-review-title').offset().top
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.usefulness_btn').click(function(){
|
||||
if (!$(this).hasClass('disabled'))
|
||||
{
|
||||
$(this).addClass('active');
|
||||
$(this).parents('.review_button').find('.usefulness_btn').addClass('disabled');
|
||||
var id_product_review = $(this).data('id-product-review');
|
||||
var is_usefull = $(this).data('is-usefull');
|
||||
var e_parent_button = $(this).parent();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "add-review-usefull",
|
||||
"id_product_review": id_product_review,
|
||||
"is_usefull": is_usefull,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
e_parent_button.fadeOut(function(){
|
||||
e_parent_button.remove();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.report_btn').click(function(){
|
||||
if (!$(this).hasClass('disabled'))
|
||||
{
|
||||
$(this).addClass('disabled');
|
||||
var e_button = $(this);
|
||||
var id_product_review = $(this).data('id-product-review');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "add-review-report",
|
||||
"id_product_review": id_product_review,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
e_button.fadeOut(function(){
|
||||
e_button.remove();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// activeEventModalReview();
|
||||
activeStar();
|
||||
});
|
||||
|
||||
function activeStar()
|
||||
{
|
||||
//DONGND:: add txt cancel rating to translate
|
||||
$('input.star').rating({cancel: cancel_rating_txt});
|
||||
$('.auto-submit-star').rating({cancel: cancel_rating_txt});
|
||||
}
|
||||
|
||||
function activeEventModalReview()
|
||||
{
|
||||
$('.form-new-review').submit(function(){
|
||||
if ($('.new_review_form_content .form-group.leo-has-error').length || $('.leo-fake-button').hasClass('validate-ok'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('.leo-modal-review').on('show.bs.modal', function (e) {
|
||||
$('.leo-modal-review-bt').click(function(){
|
||||
if (!$(this).hasClass('active'))
|
||||
{
|
||||
$(this).addClass('active');
|
||||
$('.leo-modal-review-bt-text').hide();
|
||||
$('.leo-modal-review-loading').css({'display':'block'});
|
||||
|
||||
$('.new_review_form_content input, .new_review_form_content textarea').each(function(){
|
||||
|
||||
if ($(this).val() == '')
|
||||
{
|
||||
$(this).parent('.form-group').addClass('leo-has-error');
|
||||
$(this).attr("required", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).parent('.form-group').removeClass('leo-has-error');
|
||||
$(this).removeAttr('required');
|
||||
}
|
||||
})
|
||||
|
||||
if ($('.new_review_form_content .form-group.leo-has-error').length)
|
||||
{
|
||||
$(this).removeClass('active');
|
||||
$('.leo-modal-review-bt-text').show();
|
||||
$('.leo-modal-review-loading').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
// console.log('pass');
|
||||
// $('.leo-modal-review-bt').remove();
|
||||
// console.log($( ".new_review_form_content input, .new_review_form_content textarea" ).serialize());
|
||||
$('.leo-fake-button').addClass('validate-ok');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?action=add-new-review&token='+leo_token+'&rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: $( ".new_review_form_content input, .new_review_form_content textarea" ).serialize(),
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
var object_result = $.parseJSON(result);
|
||||
// console.log(object_result);
|
||||
$('.leo-modal-review-bt').fadeOut('slow', function(){
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
|
||||
$('.leo-modal-review .modal-body>.row').fadeOut('slow', function(){
|
||||
$(this).remove();
|
||||
if (object_result.result)
|
||||
{
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group has-success"><label class="form-control-label">'+object_result.sucess_mess+'</label></div>');
|
||||
}
|
||||
else
|
||||
{
|
||||
// $('.leo-modal-review .modal-body').append('<div class="form-group has-danger text-center"></div>');
|
||||
$.each(object_result.errors, function(key, val){
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group has-danger text-center"><label class="form-control-label">'+val+'</label></div>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
$('.leo-fake-button').trigger('click');
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$('.leo-modal-review').on('hide.bs.modal', function (e) {
|
||||
// console.log($('.leo-modal-review-bt').length);
|
||||
if (!$('.leo-modal-review-bt').length && !$('.leo-modal-review .modal-body .disable-form-review').length)
|
||||
{
|
||||
// console.log('aaa');
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
location.reload();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
1206
modules/leofeature/js/leofeature_wishlist.js
Normal file
2544
modules/leofeature/leofeature.php
Normal file
BIN
modules/leofeature/logo.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
modules/leofeature/logo.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
modules/leofeature/logo.webp
Normal file
|
After Width: | Height: | Size: 994 B |
35
modules/leofeature/mails/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 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-2016 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;
|
||||
120
modules/leofeature/psajax.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
|
||||
include_once(dirname(__FILE__).'/leofeature.php');
|
||||
include_once(dirname(__FILE__).'/classes/LeofeatureProduct.php');
|
||||
|
||||
$module = new Leofeature();
|
||||
|
||||
if ((!$module->isTokenValid() || !Tools::getValue('action')) && Tools::getValue('action') != 'get-new-review') {
|
||||
// Ooops! Token is not valid!
|
||||
// die('Token is not valid, hack stop');
|
||||
$result = '';
|
||||
die($result);
|
||||
}
|
||||
|
||||
//DONGND:: render modal popup and dropdown cart
|
||||
if (Tools::getValue('action') == 'render-modal') {
|
||||
$context = Context::getContext();
|
||||
$modal = '';
|
||||
$notification = '';
|
||||
$dropdown = '';
|
||||
if (Tools::getValue('only_dropdown') == 0) {
|
||||
$modal = $module->renderModal();
|
||||
$notification = $module->renderNotification();
|
||||
}
|
||||
if (Configuration::get('LEOFEATURE_ENABLE_DROPDOWN_DEFAULTCART') || Configuration::get('LEOFEATURE_ENABLE_DROPDOWN_FLYCART')) {
|
||||
$only_total = Tools::getValue('only_total');
|
||||
$dropdown = $module->renderDropDown($only_total);
|
||||
}
|
||||
|
||||
ob_end_clean();
|
||||
header('Content-Type: application/json');
|
||||
die(Tools::jsonEncode(array(
|
||||
'dropdown' => $dropdown,
|
||||
'modal' => $modal,
|
||||
'notification' => $notification,
|
||||
)));
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') == 'get-attribute-data') {
|
||||
$result = array();
|
||||
$context = Context::getContext();
|
||||
$id_product = Tools::getValue('id_product');
|
||||
$id_product_attribute = Tools::getValue('id_product_attribute');
|
||||
|
||||
$attribute_data = new LeofeatureProduct();
|
||||
$result = $attribute_data->getTemplateVarProduct2($id_product, $id_product_attribute);
|
||||
die(Tools::jsonEncode(array(
|
||||
'product_cover' => $result['cover'],
|
||||
'price_attribute' => $module->renderPriceAttribute($result),
|
||||
'product_url' => $context->link->getProductLink($id_product, null, null, null, $context->language->id, null, $id_product_attribute, false, false, true),
|
||||
)));
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') == 'get-new-review') {
|
||||
// $result = array();
|
||||
if (Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MODERATE')) {
|
||||
$reviews = ProductReview::getByValidate(0, false);
|
||||
} else {
|
||||
$reviews = array();
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
'number_review' => count($reviews)
|
||||
)));
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') == 'check-product-outstock') {
|
||||
$id_product = Tools::getValue('id_product');
|
||||
$id_product_attribute = Tools::getValue('id_product_attribute');
|
||||
$id_customization = Tools::getValue('id_customization');
|
||||
$check_product_in_cart = Tools::getValue('check_product_in_cart');
|
||||
$quantity = Tools::getValue('quantity');
|
||||
$context = Context::getContext();
|
||||
$qty_to_check = $quantity;
|
||||
// print_r('test111');
|
||||
if ($check_product_in_cart == 'true') {
|
||||
$cart_products = $context->cart->getProducts();
|
||||
|
||||
if (is_array($cart_products)) {
|
||||
foreach ($cart_products as $cart_product) {
|
||||
if ((!isset($id_product_attribute) || ($cart_product['id_product_attribute'] == $id_product_attribute && $cart_product['id_customization'] == $id_customization )) && isset($id_product) && $cart_product['id_product'] == $id_product) {
|
||||
$qty_to_check = $cart_product['cart_quantity'];
|
||||
$qty_to_check += $quantity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$product = new Product($id_product, true, $context->language->id);
|
||||
$return = true;
|
||||
// Check product quantity availability
|
||||
if ($id_product_attribute) {
|
||||
if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($id_product_attribute, $qty_to_check)) {
|
||||
$return = false;
|
||||
}
|
||||
} elseif (!$product->checkQty($qty_to_check)) {
|
||||
$return = false;
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
'success' => $return,
|
||||
)));
|
||||
}
|
||||
153
modules/leofeature/psajax_review.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__) . '/../../init.php');
|
||||
|
||||
include_once(dirname(__FILE__) . '/leofeature.php');
|
||||
include_once(dirname(__FILE__) . '/classes/ProductReviewCriterion.php');
|
||||
include_once(dirname(__FILE__) . '/classes/ProductReview.php');
|
||||
|
||||
$module = new Leofeature();
|
||||
|
||||
if (!$module->isTokenValid() || !Tools::getValue('action')) {
|
||||
$result = '';
|
||||
die($result);
|
||||
};
|
||||
|
||||
if (Tools::getValue('action') == 'render-modal-review') {
|
||||
$result = $module->renderModalReview(Tools::getValue('id_product'), Tools::getValue('is_logged'));
|
||||
die($result);
|
||||
};
|
||||
|
||||
if (Tools::getValue('action') == 'add-new-review') {
|
||||
$array_result = array();
|
||||
$result = true;
|
||||
$id_guest = 0;
|
||||
$context = Context::getContext();
|
||||
|
||||
$id_customer = $context->customer->id;
|
||||
if (!$id_customer) {
|
||||
$id_guest = $context->cookie->id_guest;
|
||||
}
|
||||
|
||||
$id_product_review = Tools::getValue('id_product_review');
|
||||
$new_review_title = Tools::getValue('new_review_title');
|
||||
$new_review_content = Tools::getValue('new_review_content');
|
||||
$new_review_customer_name = Tools::getValue('new_review_customer_name');
|
||||
$criterion = Tools::getValue('criterion');
|
||||
$errors = array();
|
||||
// Validation
|
||||
if (!Validate::isInt($id_product_review)) {
|
||||
$errors[] = $module->l('Product ID is incorrect', 'psajax_review');
|
||||
}
|
||||
if (!$new_review_title || !Validate::isGenericName($new_review_title)) {
|
||||
$errors[] = $module->l('Title is incorrect', 'psajax_review');
|
||||
}
|
||||
if (!$new_review_content || !Validate::isMessage($new_review_content)) {
|
||||
$errors[] = $module->l('Comment is incorrect', 'psajax_review');
|
||||
}
|
||||
if (!$id_customer && (!Tools::isSubmit('new_review_customer_name') || !$new_review_customer_name || !Validate::isGenericName($new_review_customer_name))) {
|
||||
$errors[] = $module->l('Customer name is incorrect', 'psajax_review');
|
||||
}
|
||||
if (!$context->customer->id && !Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_ALLOW_GUESTS')) {
|
||||
$errors[] = $module->l('You must be connected in order to send a review', 'psajax_review');
|
||||
}
|
||||
if (!count($criterion)) {
|
||||
$errors[] = $module->l('You must give a rating', 'psajax_review');
|
||||
}
|
||||
|
||||
$product = new Product($id_product_review);
|
||||
if (!$product->id) {
|
||||
$errors[] = $module->l('Product not found', 'psajax_review');
|
||||
}
|
||||
|
||||
if (!count($errors)) {
|
||||
$customer_review = ProductReview::getByCustomer($id_product_review, $id_customer, true, $id_guest);
|
||||
if (!$customer_review || ($customer_review && (strtotime($customer_review['date_add']) + (int) Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MINIMAL_TIME')) < time())) {
|
||||
$review = new ProductReview();
|
||||
$review->content = strip_tags($new_review_content);
|
||||
$review->id_product = (int) $id_product_review;
|
||||
$review->id_customer = (int) $id_customer;
|
||||
$review->id_guest = $id_guest;
|
||||
$review->customer_name = $new_review_customer_name;
|
||||
if (!$review->customer_name) {
|
||||
$review->customer_name = pSQL($context->customer->firstname . ' ' . $context->customer->lastname);
|
||||
}
|
||||
$review->title = $new_review_title;
|
||||
$review->grade = 0;
|
||||
$review->validate = 0;
|
||||
$review->save();
|
||||
|
||||
$grade_sum = 0;
|
||||
foreach ($criterion as $id_product_review_criterion => $grade) {
|
||||
$grade_sum += $grade;
|
||||
$product_review_criterion = new ProductReviewCriterion($id_product_review_criterion);
|
||||
if ($product_review_criterion->id) {
|
||||
$product_review_criterion->addGrade($review->id, $grade);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($criterion) >= 1) {
|
||||
$review->grade = $grade_sum / count($criterion);
|
||||
// Update Grade average of comment
|
||||
$review->save();
|
||||
}
|
||||
$result = true;
|
||||
Tools::clearCache($context->smarty, $module->getTemplatePath('leo_list_product_review.tpl'));
|
||||
} else {
|
||||
$result = false;
|
||||
$errors[] = $module->l('Please wait before posting another comment', 'psajax_review') . ' ' . Configuration::get('LEOFEATURE_PRODUCT_REVIEWS_MINIMAL_TIME') . ' ' . $module->l('seconds before posting a new review', 'psajax_review');
|
||||
}
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
$array_result['result'] = $result;
|
||||
$array_result['errors'] = $errors;
|
||||
if ($result) {
|
||||
$array_result['sucess_mess'] = $module->l('Your comment has been added. Thank you!', 'psajax_review');
|
||||
}
|
||||
die(Tools::jsonEncode($array_result));
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') == 'add-review-usefull') {
|
||||
$id_product_review = Tools::getValue('id_product_review');
|
||||
$is_usefull = Tools::getValue('is_usefull');
|
||||
|
||||
if (ProductReview::isAlreadyUsefulness($id_product_review, Context::getContext()->cookie->id_customer)) {
|
||||
die('0');
|
||||
}
|
||||
|
||||
if (ProductReview::setReviewUsefulness((int) $id_product_review, (bool) $is_usefull, Context::getContext()->cookie->id_customer)) {
|
||||
die('1');
|
||||
}
|
||||
|
||||
die('0');
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') == 'add-review-report') {
|
||||
$id_product_review = Tools::getValue('id_product_review');
|
||||
|
||||
if (ProductReview::isAlreadyReport($id_product_review, Context::getContext()->cookie->id_customer)) {
|
||||
die('0');
|
||||
}
|
||||
|
||||
if (ProductReview::reportReview((int) $id_product_review, Context::getContext()->cookie->id_customer)) {
|
||||
die('1');
|
||||
}
|
||||
|
||||
die('0');
|
||||
}
|
||||
35
modules/leofeature/sql/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
27
modules/leofeature/sql/install.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
$sql = array();
|
||||
|
||||
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'leofeature` (
|
||||
`id_leofeature` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id_leofeature`)
|
||||
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;';
|
||||
|
||||
foreach ($sql as $query) {
|
||||
if (Db::getInstance()->execute($query) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
27
modules/leofeature/sql/uninstall.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
/**
|
||||
* In some cases you should not drop the tables.
|
||||
* Maybe the merchant will just try to reset the module
|
||||
* but does not want to loose all of the data associated to the module.
|
||||
*/
|
||||
$sql = array();
|
||||
|
||||
foreach ($sql as $query) {
|
||||
if (Db::getInstance()->execute($query) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
35
modules/leofeature/translations/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
38
modules/leofeature/translations/pl.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_da3e413ae5dde1a6b986203857fb1a59'] = 'Identyfikator produktu jest nieprawidłowy';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_7b0bf23ae4079e07a3a4cb4d07e2caef'] = 'Tytuł jest nieprawidłowy';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_ddbd56de5feb78ef1aaf60401f8c472b'] = 'Komentarz jest nieprawidłowy';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_1b1030b6294e9096a7d7c40d83d61872'] = 'Nazwa klienta jest nieprawidłowa';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_ba0ba469e1c4ba0bea43b77c5c00f9f1'] = 'Musisz być połączony, aby wysłać recenzję';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_a201fbadca94d310a1b62407cdc775d5'] = 'Musisz podać ocenę';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_dfbe69c6d9568ecb0e65e7b32ed92a3a'] = 'produkt nie znaleziony';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_6d10b2f471e8894d59ae18e01537ece5'] = 'Poczekaj, zanim opublikujesz kolejny komentarz';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_498b760d1963039e2fdf4c940f12e3d8'] = 'sekund przed opublikowaniem nowej recenzji';
|
||||
$_MODULE['<{leofeature}prestashop>psajax_review_8a8bc2f7809ee4f789b25182a8cd6417'] = 'Twój komentarz został dodany. Dziękujemy!';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_c31732fda0c6f01c446db7163b214de4'] = 'Napisz recenzję';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_b78a3223503896721cca1303f776159b'] = 'Tytuł';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_0be8406951cdfda82f00f79328cf4efc'] = 'Komentarz';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_221e705c06e231636fdbccfdd14f4d5c'] = 'Twoje imię';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_70397c4b252a5168c5ec003931cea215'] = 'Wymagane pola';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_d3d2e617335f08df83599665eef8a418'] = 'Zamknij';
|
||||
$_MODULE['<{leofeature}prestashop>modal_review_a4d3b161ce1309df1c4e25df28694b7b'] = 'Zatwierdź';
|
||||
$_MODULE['<{leofeature}prestashop>notification_1222b0022fb0d33d952c37cfe42266cd'] = 'Produkt został zaktualizowany w twoim koszyku';
|
||||
$_MODULE['<{leofeature}prestashop>notification_114d0e1aa16fe8baa087238c6d07693a'] = 'Produkt został usunięty z koszyka';
|
||||
$_MODULE['<{leofeature}prestashop>notification_544c3bd0eac526113a9c66542be1e5bc'] = 'Produkt został pomyślnie dodany do koszyka';
|
||||
$_MODULE['<{leofeature}prestashop>notification_63c63a0602a4b74e919059a8cc9ea8af'] = 'Błąd aktualizacji';
|
||||
$_MODULE['<{leofeature}prestashop>notification_4e0ac45de6bd848503ffa98ff6247f2f'] = 'Błąd podczas usuwania';
|
||||
$_MODULE['<{leofeature}prestashop>notification_1929e96729ba794c08e056afec1c40e9'] = 'Błąd dodawania. Przejdź na stronę szczegółów produktu i spróbuj ponownie';
|
||||
$_MODULE['<{leofeature}prestashop>notification_04325f5c10c9818bc464d660daa2b030'] = 'Minimalna ilość zamówienia dla tego produktu to';
|
||||
$_MODULE['<{leofeature}prestashop>notification_a923575984949608ce04c4984806ec2a'] = 'W magazynie nie ma wystarczającej ilości produktów';
|
||||
$_MODULE['<{leofeature}prestashop>notification_61b5f801ab23a9ecf6f652dc12747be5'] = 'Musisz podać ilość';
|
||||
$_MODULE['<{leofeature}prestashop>drop_down_694e8d1f2ee056f98ee488bdc4982d73'] = 'Ilość';
|
||||
$_MODULE['<{leofeature}prestashop>drop_down_2e65a5e30c454ceb77be9bb48e8343f1'] = 'Usuń z koszyka';
|
||||
$_MODULE['<{leofeature}prestashop>drop_down_59fc69e031ecb0f82efe467fd6692383'] = 'Zobacz Koszyk';
|
||||
$_MODULE['<{leofeature}prestashop>drop_down_51f377b830737ebc60c6e4293760f455'] = 'Zamów';
|
||||
$_MODULE['<{leofeature}prestashop>leo_product_tab_content_4b3b9db8c9784468094acde0f8bf7071'] = 'Ocena';
|
||||
$_MODULE['<{leofeature}prestashop>leo_product_tab_content_f444678e4f3575d59b32a858630741fd'] = 'Napisz swoją recenzję jako pierwszy!';
|
||||
$_MODULE['<{leofeature}prestashop>leo_product_tab_content_08c7d6f84301ee7d0aab0a5f67edc419'] = 'Brak recenzji użytkowników.';
|
||||
$_MODULE['<{leofeature}prestashop>leo_cart_button_2d0f6b8300be19cf35e89e66f0677f95'] = 'Dodaj do koszyka';
|
||||
0
modules/leofeature/translations/sk.php
Normal file
35
modules/leofeature/upgrade/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
34
modules/leofeature/upgrade/upgrade-1.1.0.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates your module from previous versions to the version 1.1,
|
||||
* usefull when you modify your database, or register a new hook ...
|
||||
* Don't forget to create one file per version.
|
||||
*/
|
||||
function upgrade_module_1_1_0($module)
|
||||
{
|
||||
/**
|
||||
* Do everything you want right there,
|
||||
* You could add a column in one of your module's tables
|
||||
*/
|
||||
// validate module
|
||||
unset($module);
|
||||
return true;
|
||||
}
|
||||
73
modules/leofeature/views/css/back.css
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2017 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
.leofeature-tablist a:hover, .leofeature-tablist li.active a {
|
||||
border-bottom: medium none !important;
|
||||
border-top: 3px solid #25b9d7 !important;
|
||||
}
|
||||
|
||||
.leofeature-tablist a:focus {
|
||||
border-bottom: medium none !important;
|
||||
border-top: 3px solid #25b9d7 !important;
|
||||
}
|
||||
|
||||
#leofeature-setting .panel {
|
||||
display: none;
|
||||
}
|
||||
#leofeature-setting .panel.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#leofeature-setting .panel {
|
||||
border-radius: 0 0 5px 5px !important;
|
||||
}
|
||||
|
||||
.nav-tabs.leofeature-tablist a:focus {
|
||||
outline: medium none;
|
||||
}
|
||||
|
||||
#subtab-AdminLeofeatureReviews
|
||||
{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#subtab-AdminLeofeatureReviews .notification-container
|
||||
{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: inline-block;
|
||||
line-height: .875rem;
|
||||
height: .875rem;
|
||||
vertical-align: middle;
|
||||
|
||||
color: #fff;
|
||||
background: #fb0;
|
||||
font-size: .5625rem;
|
||||
padding: 0 .25rem;
|
||||
border-radius: .625rem;
|
||||
}
|
||||
|
||||
#subtab-AdminLeofeatureManagement.has-review:after
|
||||
{
|
||||
content: "";
|
||||
position: absolute;
|
||||
top:0;
|
||||
right: 0;
|
||||
background: #fb0;
|
||||
border-radius: .625rem;
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
}
|
||||
2370
modules/leofeature/views/css/front.css
Normal file
35
modules/leofeature/views/css/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
1276
modules/leofeature/views/css/jquery.mCustomScrollbar.css
Normal file
BIN
modules/leofeature/views/img/delete.gif
Normal file
|
After Width: | Height: | Size: 752 B |
35
modules/leofeature/views/img/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
BIN
modules/leofeature/views/img/star.gif
Normal file
|
After Width: | Height: | Size: 769 B |
BIN
modules/leofeature/views/img/star.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
modules/leofeature/views/img/star1.gif
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
modules/leofeature/views/img/star_ (2).gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
modules/leofeature/views/img/star_.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
35
modules/leofeature/views/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
87
modules/leofeature/views/js/back.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('select#id_product_review_criterion_type').change(function() {
|
||||
// PS 1.6
|
||||
$('#categoryBox').closest('div.form-group').hide();
|
||||
$('#ids_product').closest('div.form-group').hide();
|
||||
// PS 1.5
|
||||
$('#categories-treeview').closest('div.margin-form').hide();
|
||||
$('#categories-treeview').closest('div.margin-form').prev().hide();
|
||||
$('#ids_product').closest('div.margin-form').hide();
|
||||
$('#ids_product').closest('div.margin-form').prev().hide();
|
||||
|
||||
if (this.value == 2)
|
||||
{
|
||||
$('#categoryBox').closest('div.form-group').show();
|
||||
// PS 1.5
|
||||
$('#categories-treeview').closest('div.margin-form').show();
|
||||
$('#categories-treeview').closest('div.margin-form').prev().show();
|
||||
}
|
||||
else if (this.value == 3)
|
||||
{
|
||||
$('#ids_product').closest('div.form-group').show();
|
||||
// PS 1.5
|
||||
$('#ids_product').closest('div.margin-form').show();
|
||||
$('#ids_product').closest('div.margin-form').prev().show();
|
||||
}
|
||||
});
|
||||
|
||||
$('select#id_product_review_criterion_type').trigger("change");
|
||||
|
||||
//DONGND:: tab change in group config
|
||||
var id_panel = $("#leofeature-setting .leofeature-tablist li.active a").attr("href");
|
||||
$(id_panel).addClass('active').show();
|
||||
$('.leofeature-tablist li').click(function(){
|
||||
if(!$(this).hasClass('active'))
|
||||
{
|
||||
var default_tab = $(this).find('a').attr("href");
|
||||
$('#LEOFEATURE_DEFAULT_TAB').val(default_tab);
|
||||
}
|
||||
})
|
||||
|
||||
// console.log('test');
|
||||
if (typeof leofeature_module_dir != 'undefined')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: leofeature_module_dir + 'psajax.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "get-new-review",
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if(result != '')
|
||||
{
|
||||
var obj = $.parseJSON(result);
|
||||
if (obj.number_review > 0)
|
||||
{
|
||||
$('#subtab-AdminLeofeatureManagement').addClass('has-review');
|
||||
// $('#subtab-AdminLeofeatureReviews').append('<span id="total_notif_number_wrapper" class="notifs_badge"><span id="total_notif_value">'+obj.number_review+'</span></span>');
|
||||
$('#subtab-AdminLeofeatureReviews').append('<div class="notification-container"><span class="notification-counter">'+obj.number_review+'</span></div>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
// alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
35
modules/leofeature/views/js/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
2472
modules/leofeature/views/js/jquery.mCustomScrollbar.js
Normal file
22
modules/leofeature/views/js/jquery.mousewheel.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
/*!
|
||||
* jQuery Mousewheel 3.1.13
|
||||
*
|
||||
* Copyright 2015 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
||||
26
modules/leofeature/views/js/jquery.rating.pack.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
/*
|
||||
### jQuery Star Rating Plugin v2.0 - 2008-03-12 ###
|
||||
By Diego A, http://www.fyneworks.com, diego@fyneworks.com
|
||||
- v2 by Keith Wood, kbwood@virginbroadband.com.au
|
||||
|
||||
Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating
|
||||
Website: http://www.fyneworks.com/jquery/star-rating/
|
||||
|
||||
This is a modified version of the star rating plugin from:
|
||||
http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';4(w)(3($){$.Y.T=3(c){c=$.15({m:\'X U\',E:\'\',B:z,8:z},c||{});o d={};o e={t:3(n,a,b){2.6(n);$(a).D(\'.j\').A().l(b||\'x\')},6:3(n){$(d[n].7).O(\'.j\').u(\'9\').u(\'x\')},h:3(n){4(!$(d[n].5).Z(\'.m\')){$(d[n].5).D(\'.j\').A().l(\'9\')}},g:3(n,a){d[n].5=a;o b=$(a).L(\'a\').K();$(d[n].7).J(b);e.6(n);e.h(n);4(c.I)c.I.W(d[n].7,[b,a])}};2.V(3(i){o n=2.G;4(!d[n])d[n]={r:0};i=d[n].r;d[n].r++;4(i==0){c.8=$(2).S(\'p\')||c.8;d[n].7=$(\'<R Q="P" G="\'+n+\'" q=""\'+(c.8?\' p="p"\':\'\')+\'>\');$(2).C(d[n].7);4(c.8||c.B){}F{$(2).C($(\'<k y="m"><a s="\'+c.m+\'">\'+c.E+\'</a></k>\').H(3(){e.6(n);$(2).l(\'9\')}).v(3(){e.h(n);$(2).u(\'9\')}).g(3(){e.g(n,2)}))}};f=$(\'<k y="j"><a s="\'+(2.s||2.q)+\'">\'+2.q+\'</a></k>\');$(2).N(f);4(c.8){$(f).l(\'M\')}F{$(f).H(3(){e.6(n);e.t(n,2)}).v(3(){e.6(n);e.h(n)}).g(3(){e.g(n,2)})};4(2.14)d[n].5=f;$(2).13();4(i+1==2.12)e.h(n)});11(n 10 d)4(d[n].5){e.t(n,d[n].5,\'9\');$(d[n].7).J($(d[n].5).L(\'a\').K())}16 2}})(w);',62,69,'||this|function|if|currentElem|drain|valueElem|readOnly|star_on||||||eStar|click|reset||star|div|addClass|cancel||var|disabled|value|count|title|fill|removeClass|mouseout|jQuery|star_hover|class|false|andSelf|required|before|prevAll|cancelValue|else|name|mouseover|callback|val|text|children|star_readonly|after|siblings|hidden|type|input|attr|rating|Rating|each|apply|Cancel|fn|is|in|for|length|remove|checked|extend|return'.split('|'),0,{}));
|
||||
2176
modules/leofeature/views/js/leofeature_cart.js
Normal file
234
modules/leofeature/views/js/leofeature_compare.js
Normal file
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
createLeoCompareModalPopup();
|
||||
LeoCompareButtonAction();
|
||||
prestashop.on('updateProductList', function() {
|
||||
LeoCompareButtonAction();
|
||||
});
|
||||
//DONGND:: recall button action if need when change attribute at product page
|
||||
prestashop.on('updatedProduct', function() {
|
||||
LeoCompareButtonAction();
|
||||
});
|
||||
prestashop.on('clickQuickView', function() {
|
||||
check_active_compare = setInterval(function(){
|
||||
if($('.quickview.modal').length)
|
||||
{
|
||||
$('.quickview.modal').on('shown.bs.modal', function (e) {
|
||||
LeoCompareButtonAction();
|
||||
})
|
||||
clearInterval(check_active_compare);
|
||||
}
|
||||
|
||||
}, 300);
|
||||
|
||||
});
|
||||
activeEventModalCompare();
|
||||
});
|
||||
|
||||
function createLeoCompareModalPopup()
|
||||
{
|
||||
var leoCompareModalPopup = '';
|
||||
leoCompareModalPopup += '<div class="modal leo-modal leo-modal-compare fade" tabindex="-1" role="dialog" aria-hidden="true">';
|
||||
leoCompareModalPopup += '<div class="modal-dialog" role="document">';
|
||||
leoCompareModalPopup += '<div class="modal-content">';
|
||||
leoCompareModalPopup += '<div class="modal-header">';
|
||||
leoCompareModalPopup += '<button type="button" class="close" data-dismiss="modal" aria-label="Close">';
|
||||
leoCompareModalPopup += '<span aria-hidden="true">×</span>';
|
||||
leoCompareModalPopup += '</button>';
|
||||
leoCompareModalPopup += '<h5 class="modal-title text-xs-center">';
|
||||
leoCompareModalPopup += '</h5>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
$('body').append(leoCompareModalPopup);
|
||||
}
|
||||
function LeoCompareButtonAction()
|
||||
{
|
||||
$('.leo-compare-button').click(function(){
|
||||
if (!$('.leo-compare-button.active').length)
|
||||
{
|
||||
var total_product_compare = compared_products.length;
|
||||
var id_product = $(this).data('id-product');
|
||||
|
||||
var content_product_compare_mess_remove = productcompare_remove+'. <a href="'+productcompare_url+'" target="_blank"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
var content_product_compare_mess_add = productcompare_add+'. <a href="'+productcompare_url+'" target="_blank"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
var content_product_compare_mess_max = productcompare_max_item+'. <a href="'+productcompare_url+'" target="_blank"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
|
||||
$(this).addClass('active');
|
||||
$(this).find('.leo-compare-bt-loading').css({'display':'block'});
|
||||
$(this).find('.leo-compare-bt-content').hide();
|
||||
var object_e = $(this);
|
||||
if ($(this).hasClass('added') || $(this).hasClass('delete'))
|
||||
{
|
||||
//DONGND:: remove product form list product compare
|
||||
//DONGND:: add product to list product compare
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: productcompare_url+ '?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"ajax": 1,
|
||||
"action": "remove",
|
||||
"id_product": id_product,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
// console.log(result);
|
||||
if (result == 1)
|
||||
{
|
||||
//Leotheme add: update number product on icon compare
|
||||
if ($('.ap-btn-compare .ap-total-compare').length)
|
||||
{
|
||||
var old_num_compare = parseInt($('.ap-btn-compare .ap-total-compare').data('compare-total'));
|
||||
var new_num_compare = old_num_compare-1;
|
||||
$('.ap-btn-compare .ap-total-compare').data('compare-total',new_num_compare);
|
||||
$('.ap-btn-compare .ap-total-compare').text(new_num_compare);
|
||||
}
|
||||
|
||||
compared_products.splice($.inArray(parseInt(id_product), compared_products), 1);
|
||||
if (object_e.hasClass('delete'))
|
||||
{
|
||||
//DONGND:: remove from page product compare
|
||||
if ($('.leo-productscompare-item').length == 1)
|
||||
{
|
||||
window.location.replace(productcompare_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('td.product-'+id_product).fadeOut(function(){
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//DONGND:: remove from page product list
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_remove);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').removeClass('added');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').attr('title',buttoncompare_title_add);
|
||||
// object_e.find('.leo-compare-bt-loading').hide();
|
||||
// object_e.find('.leo-compare-bt-content').show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(productcompare_remove_error);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
|
||||
}
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (total_product_compare < comparator_max_item)
|
||||
{
|
||||
//DONGND:: add product to list product compare
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: productcompare_url+ '?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"ajax": 1,
|
||||
"action": "add",
|
||||
"id_product": id_product,
|
||||
"token": leo_token,
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
// console.log(result);
|
||||
if (result == 1)
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_add);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
//Leotheme add: update number product on icon compare
|
||||
if ($('.ap-btn-compare .ap-total-compare').length)
|
||||
{
|
||||
var old_num_compare = parseInt($('.ap-btn-compare .ap-total-compare').data('compare-total'));
|
||||
var new_num_compare = old_num_compare+1;
|
||||
$('.ap-btn-compare .ap-total-compare').data('compare-total',new_num_compare);
|
||||
$('.ap-btn-compare .ap-total-compare').text(new_num_compare);
|
||||
}
|
||||
|
||||
compared_products.push(id_product);
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').addClass('added');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').attr('title',buttoncompare_title_remove);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(productcompare_add_error);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
}
|
||||
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//DONGND:: list product compare limited
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_max);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
function activeEventModalCompare()
|
||||
{
|
||||
$('.leo-modal-compare').on('hide.bs.modal', function (e) {
|
||||
// console.log($('.leo-modal-review-bt').length);
|
||||
if ($('.leo-compare-button.active').length)
|
||||
{
|
||||
// console.log('aaa');
|
||||
$('.leo-compare-button.active').removeClass('active');
|
||||
}
|
||||
})
|
||||
$('.leo-modal-compare').on('hidden.bs.modal', function (e) {
|
||||
$('body').css('padding-right', '');
|
||||
})
|
||||
$('.leo-modal-compare').on('shown.bs.modal', function (e) {
|
||||
if ($('.quickview.modal').length)
|
||||
{
|
||||
$('.quickview.modal').modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
306
modules/leofeature/views/js/leofeature_review.js
Normal file
@@ -0,0 +1,306 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
if ($('.open-review-form').length)
|
||||
{
|
||||
var id_product = $('.open-review-form').data('id-product');
|
||||
var is_logged = $('.open-review-form').data('is-logged');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "render-modal-review",
|
||||
"id_product": id_product,
|
||||
"is_logged": is_logged,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if(result != '')
|
||||
{
|
||||
$('body').append(result);
|
||||
activeEventModalReview();
|
||||
activeStar();
|
||||
$('.open-review-form').fadeIn('fast');
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
// alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
$('.open-review-form').click(function(){
|
||||
if ($('#criterions_list').length)
|
||||
{
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($('.leo-modal-review .modal-body .disable-form-review').length)
|
||||
{
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-review-bt').remove();
|
||||
$('.leo-modal-review .modal-header').remove();
|
||||
$('.leo-modal-review .modal-body').empty();
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group disable-form-review has-danger text-center"><label class="form-control-label">'+disable_review_form_txt+'</label></div>');
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$('.read-review').click(function(){
|
||||
// if ($('.leo-product-show-review-title').length && $('#leo-product-show-review-content').length)
|
||||
if ($('.leo-product-show-review-title').length)
|
||||
{
|
||||
if ($('.leo-product-show-review-title').hasClass('leofeature-accordion'))
|
||||
{
|
||||
if ($('.leo-product-show-review-title').hasClass('collapsed'))
|
||||
{
|
||||
$('.leo-product-show-review-title').trigger('click');
|
||||
}
|
||||
var timer = setInterval(function() {
|
||||
if ($('#collapseleofeatureproductreview').hasClass('collapse in') || $('#collapsereviews').hasClass('collapse in')) {
|
||||
//run some other function
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.leo-product-show-review-title').offset().top
|
||||
}, 500);
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-product-show-review-title').trigger('click');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.leo-product-show-review-title').offset().top
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.usefulness_btn').click(function(){
|
||||
if (!$(this).hasClass('disabled'))
|
||||
{
|
||||
$(this).addClass('active');
|
||||
$(this).parents('.review_button').find('.usefulness_btn').addClass('disabled');
|
||||
var id_product_review = $(this).data('id-product-review');
|
||||
var is_usefull = $(this).data('is-usefull');
|
||||
var e_parent_button = $(this).parent();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "add-review-usefull",
|
||||
"id_product_review": id_product_review,
|
||||
"is_usefull": is_usefull,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
e_parent_button.fadeOut(function(){
|
||||
e_parent_button.remove();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.report_btn').click(function(){
|
||||
if (!$(this).hasClass('disabled'))
|
||||
{
|
||||
$(this).addClass('disabled');
|
||||
var e_button = $(this);
|
||||
var id_product_review = $(this).data('id-product-review');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "add-review-report",
|
||||
"id_product_review": id_product_review,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
e_button.fadeOut(function(){
|
||||
e_button.remove();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// activeEventModalReview();
|
||||
activeStar();
|
||||
});
|
||||
|
||||
function activeStar()
|
||||
{
|
||||
//DONGND:: add txt cancel rating to translate
|
||||
$('input.star').rating({cancel: cancel_rating_txt});
|
||||
$('.auto-submit-star').rating({cancel: cancel_rating_txt});
|
||||
}
|
||||
|
||||
function activeEventModalReview()
|
||||
{
|
||||
$('.form-new-review').submit(function(){
|
||||
if ($('.new_review_form_content .form-group.leo-has-error').length || $('.leo-fake-button').hasClass('validate-ok'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('.leo-modal-review').on('show.bs.modal', function (e) {
|
||||
$('.leo-modal-review-bt').click(function(){
|
||||
if (!$(this).hasClass('active'))
|
||||
{
|
||||
$(this).addClass('active');
|
||||
$('.leo-modal-review-bt-text').hide();
|
||||
$('.leo-modal-review-loading').css({'display':'block'});
|
||||
|
||||
$('.new_review_form_content input, .new_review_form_content textarea').each(function(){
|
||||
|
||||
if ($(this).val() == '')
|
||||
{
|
||||
$(this).parent('.form-group').addClass('leo-has-error');
|
||||
$(this).attr("required", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).parent('.form-group').removeClass('leo-has-error');
|
||||
$(this).removeAttr('required');
|
||||
}
|
||||
})
|
||||
|
||||
if ($('.new_review_form_content .form-group.leo-has-error').length)
|
||||
{
|
||||
$(this).removeClass('active');
|
||||
$('.leo-modal-review-bt-text').show();
|
||||
$('.leo-modal-review-loading').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
// console.log('pass');
|
||||
// $('.leo-modal-review-bt').remove();
|
||||
// console.log($( ".new_review_form_content input, .new_review_form_content textarea" ).serialize());
|
||||
$('.leo-fake-button').addClass('validate-ok');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?action=add-new-review&token='+leo_token+'&rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: $( ".new_review_form_content input, .new_review_form_content textarea" ).serialize(),
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
var object_result = $.parseJSON(result);
|
||||
// console.log(object_result);
|
||||
$('.leo-modal-review-bt').fadeOut('slow', function(){
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
|
||||
$('.leo-modal-review .modal-body>.row').fadeOut('slow', function(){
|
||||
$(this).remove();
|
||||
if (object_result.result)
|
||||
{
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group has-success"><label class="form-control-label">'+object_result.sucess_mess+'</label></div>');
|
||||
}
|
||||
else
|
||||
{
|
||||
// $('.leo-modal-review .modal-body').append('<div class="form-group has-danger text-center"></div>');
|
||||
$.each(object_result.errors, function(key, val){
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group has-danger text-center"><label class="form-control-label">'+val+'</label></div>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
$('.leo-fake-button').trigger('click');
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$('.leo-modal-review').on('hide.bs.modal', function (e) {
|
||||
// console.log($('.leo-modal-review-bt').length);
|
||||
if (!$('.leo-modal-review-bt').length && !$('.leo-modal-review .modal-body .disable-form-review').length)
|
||||
{
|
||||
// console.log('aaa');
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
location.reload();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
1206
modules/leofeature/views/js/leofeature_wishlist.js
Normal file
35
modules/leofeature/views/templates/admin/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
@@ -0,0 +1,53 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
|
||||
{block name="input"}
|
||||
{if $input.type == 'products'}
|
||||
<table id="{$input.name}">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>ID</th>
|
||||
<th width="80%">{l s='Product Name' mod='leofeature'}</th>
|
||||
</tr>
|
||||
{foreach $input.values as $value}
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" name="{$input.name}[]" value="{$value.id_product}"
|
||||
{if isset($value.selected) && $value.selected == 1} checked {/if} />
|
||||
</td>
|
||||
<td>{$value.id_product}</td>
|
||||
<td width="80%">{$value.name}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{elseif $input.type == 'switch' && $smarty.const._PS_VERSION_|@addcslashes:'\'' < '1.6'}
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio" name="{$input.name}" id="{$value.id}" value="{$value.value|escape:'html':'UTF-8'}"
|
||||
{if $fields_value[$input.name] == $value.value}checked="checked"{/if}
|
||||
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
|
||||
<label class="t" for="{$value.id}">
|
||||
{if isset($input.is_bool) && $input.is_bool == true}
|
||||
{if $value.value == 1}
|
||||
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
|
||||
{else}
|
||||
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
|
||||
{/if}
|
||||
{else}
|
||||
{$value.label}
|
||||
{/if}
|
||||
</label>
|
||||
{if isset($input.br) && $input.br}<br />{/if}
|
||||
{if isset($value.p) && $value.p}<p>{$value.p}</p>{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 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-2016 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;
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 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-2016 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;
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 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-2016 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;
|
||||
@@ -0,0 +1,10 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<a href="{$href}" class="btn btn-success" title="{$action}" >
|
||||
<i class="icon-check"></i> {$action}
|
||||
</a>
|
||||
@@ -0,0 +1,10 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<a href="{$href}" class="btn btn-info" title="{$action}" >
|
||||
<i class="icon-check"></i> {$action}
|
||||
</a>
|
||||
47
modules/leofeature/views/templates/admin/panel.tpl
Normal file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<div class="panel form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-1">
|
||||
<a class="megamenu-correct-module btn btn-success" href="{$url_admin}&success=correct&correctmodule=1">
|
||||
<i class="icon-AdminParentPreferences"></i>{l s='Correct module' mod='leofeature'}
|
||||
</a>
|
||||
</div>
|
||||
<label class="control-label col-lg-3">* {l s='Please backup the database before run correct module to safe' mod='leofeature'}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="leofeature-group">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><i class="icon-cogs"></i> {l s='Leo Feature Global Config' mod='leofeature'}</div>
|
||||
|
||||
<div class="panel-content" id="leofeature-setting">
|
||||
<ul class="nav nav-tabs leofeature-tablist" role="tablist">
|
||||
<li class="nav-item{if $default_tab == '#fieldset_0'} active{/if}">
|
||||
<a class="nav-link" href="#fieldset_0" role="tab" data-toggle="tab">{l s='Ajax Cart' mod='leofeature'}</a>
|
||||
</li>
|
||||
<li class="nav-item{if $default_tab == '#fieldset_1_1'} active{/if}">
|
||||
<a class="nav-link" href="#fieldset_1_1" role="tab" data-toggle="tab">{l s='Product Review' mod='leofeature'}</a>
|
||||
</li>
|
||||
<li class="nav-item{if $default_tab == '#fieldset_2_2'} active{/if}">
|
||||
<a class="nav-link" href="#fieldset_2_2" role="tab" data-toggle="tab">{l s='Product Compare' mod='leofeature'}</a>
|
||||
</li>
|
||||
<li class="nav-item{if $default_tab == '#fieldset_3_3'} active{/if}">
|
||||
<a class="nav-link" href="#fieldset_3_3" role="tab" data-toggle="tab">{l s='Product Wishlist' mod='leofeature'}</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
{$globalform}{* HTML form , no escape necessary *}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
166
modules/leofeature/views/templates/front/drop_down.tpl
Normal file
@@ -0,0 +1,166 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{if $only_total != 1}
|
||||
<div class="leo-dropdown-cart-content clearfix">
|
||||
<div class="leo-dropdown-list-item-warpper">
|
||||
<ul class="leo-dropdown-list-item">{foreach from=$cart.products item=product name="cart_product"}<li style="width: {$width_cart_item}px; height: {$height_cart_item}px" class="leo-dropdown-cart-item clearfix{if ($product.attributes|count && $show_combination) || ($product.customizations|count && $show_customization)} has-view-additional{/if}{if $smarty.foreach.cart_product.first} first{/if}{if $smarty.foreach.cart_product.last} last{/if}">
|
||||
<div class="leo-cart-item-img">
|
||||
{if $product.images}
|
||||
<a class="label" href="{$product.url}" title="{$product.name}"><img class="img-fluid" src="{$product.images.0.bySize.small_default.url}" alt="{$product.name}" title="{$product.name}"/></a>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="leo-cart-item-info">
|
||||
<div class="product-name"><a class="label" href="{$product.url}" title="{$product.name}">{$product.name|truncate:18:'...'}</a></div>
|
||||
<div class="product-price">
|
||||
{if $product.has_discount}
|
||||
<div class="product-discount">
|
||||
<span class="regular-price">{$product.regular_price}</span>
|
||||
|
||||
{if $product.discount_type === 'percentage'}
|
||||
<span class="discount discount-percentage">
|
||||
-{$product.discount_percentage_absolute}
|
||||
</span>
|
||||
{else}
|
||||
<span class="discount discount-amount">
|
||||
-{$product.discount_to_display}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
<div class="current-price">
|
||||
<span class="price">{$product.price}</span>
|
||||
</div>
|
||||
{if $product.unit_price_full}
|
||||
<div class="unit-price-cart">{$product.unit_price_full}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $enable_update_quantity}
|
||||
<div class="product-quantity">
|
||||
{if $enable_button_quantity}
|
||||
<a href="javascript:void(0)" class="leo-bt-product-quantity leo-bt-product-quantity-down"><i class="material-icons"></i></a>
|
||||
{/if}
|
||||
<input
|
||||
class="leo-input-product-quantity input-group"
|
||||
data-down-url="{$product.down_quantity_url}"
|
||||
data-up-url="{$product.up_quantity_url}"
|
||||
data-update-url="{$product.update_quantity_url}"
|
||||
data-id-product = "{$product.id_product|escape:'javascript'}"
|
||||
data-id-product-attribute = "{$product.id_product_attribute|escape:'javascript'}"
|
||||
data-id-customization = "{$product.id_customization|escape:'javascript'}"
|
||||
data-min-quantity="{$product.minimal_quantity}"
|
||||
data-product-quantity="{$product.quantity}"
|
||||
data-quantity-available="{$product.quantity_available}"
|
||||
type="text"
|
||||
value="{$product.quantity}"
|
||||
min="{$product.minimal_quantity}"
|
||||
/>
|
||||
{if $enable_button_quantity}
|
||||
<a href="javascript:void(0)" class="leo-bt-product-quantity leo-bt-product-quantity-up"><i class="material-icons"></i></a>
|
||||
{/if}
|
||||
</div>
|
||||
{else}
|
||||
<div class="product-quantity"><span class="lablel">{l s='Quantity' mod='leofeature'}</span>: {$product.quantity}</div>
|
||||
{/if}
|
||||
</div>
|
||||
<a class="leo-remove-from-cart"
|
||||
href="javascript:void(0)"
|
||||
title="{l s='Remove from cart' mod='leofeature'}"
|
||||
data-link-url="{$product.remove_from_cart_url}"
|
||||
data-id-product = "{$product.id_product|escape:'javascript'}"
|
||||
data-id-product-attribute = "{$product.id_product_attribute|escape:'javascript'}"
|
||||
data-id-customization = "{$product.id_customization|escape:'javascript'}"
|
||||
>
|
||||
<i class="material-icons"></i>
|
||||
</a>
|
||||
{if ($product.attributes|count && $show_combination) || ($product.customizations|count && $show_customization)}
|
||||
<div class="view-additional">
|
||||
<div class="view-leo-dropdown-additional"></div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="leo-dropdown-overlay">
|
||||
<div class="leo-dropdown-cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="leo-dropdown-additional">
|
||||
{if $product.attributes|count && $show_combination}
|
||||
<div class="view-combination label">
|
||||
|
||||
</div>
|
||||
<div class="combinations">
|
||||
{foreach from=$product.attributes key="attribute" item="value"}
|
||||
<div class="product-line-info">
|
||||
<span class="label">{$attribute}:</span>
|
||||
<span class="value">{$value}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{if $product.customizations|count && $show_customization}
|
||||
<div class="view-customization label">
|
||||
|
||||
</div>
|
||||
<div class="customizations">
|
||||
{foreach from=$product.customizations item='customization'}
|
||||
|
||||
<ul>
|
||||
{foreach from=$customization.fields item='field'}
|
||||
<li>
|
||||
<span class="label">{$field.label}</span>
|
||||
{if $field.type == 'text'}
|
||||
: <span class="value">{$field.text nofilter}</span>
|
||||
{else if $field.type == 'image'}
|
||||
<img src="{$field.image.small.url}">
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</li>{/foreach}</ul>
|
||||
</div>
|
||||
<div class="leo-dropdown-bottom">
|
||||
{/if}
|
||||
<div class="leo-dropdown-total" data-cart-total="{$cart.products_count}">
|
||||
<div class="leo-dropdown-cart-subtotals">
|
||||
{foreach from=$cart.subtotals item="subtotal"}
|
||||
{if $subtotal}
|
||||
<div class="{$subtotal.type} clearfix">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
<span class="label">{$subtotal.label}</span>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
<span class="value">{$subtotal.value}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="leo-dropdown-cart-total clearfix">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
<span class="label">{$cart.totals.total.label}</span>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
<span class="value">{$cart.totals.total.value}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if $only_total != 1}
|
||||
<div class="leo-cart-dropdown-action clearfix">
|
||||
<a class="cart-dropdow-button cart-dropdow-viewcart btn btn-primary btn-outline" href="{$cart_url}">{l s='View Cart' mod='leofeature'}</a>
|
||||
<a class="cart-dropdow-button cart-dropdow-checkout btn btn-primary btn-outline" href="{$order_url}">{l s='Check Out' mod='leofeature'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
17
modules/leofeature/views/templates/front/fly_cart.tpl
Normal file
@@ -0,0 +1,17 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<div data-type="{$type_fly_cart}" style="position: {$type_position}; {$vertical_position}; {$horizontal_position}" class="leo-fly-cart solo type-{$type_position}{if $type_fly_cart == 'dropup' || $type_fly_cart == 'dropdown'} enable-dropdown{/if}{if $type_fly_cart == 'slidebar_top' || $type_fly_cart == 'slidebar_bottom' || $type_fly_cart == 'slidebar_right' || $type_fly_cart == 'slidebar_left'} enable-slidebar{/if}">
|
||||
<div class="leo-fly-cart-icon-wrapper">
|
||||
<a href="javascript:void(0)" class="leo-fly-cart-icon" data-type="{$type_fly_cart}"><i class="material-icons"></i></a>
|
||||
<span class="leo-fly-cart-total"></span>
|
||||
</div>
|
||||
{*
|
||||
<div class="leo-fly-cssload-speeding-wheel"></div>
|
||||
*}
|
||||
<div class="leo-fly-cart-cssload-loader"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{if $enable_overlay_background}
|
||||
<div class="leo-fly-cart-mask"></div>
|
||||
{/if}
|
||||
|
||||
<div class="leo-fly-cart-slidebar {$type}">
|
||||
|
||||
<div class="leo-fly-cart disable-dropdown">
|
||||
<div class="leo-fly-cart-wrapper">
|
||||
<div class="leo-fly-cart-icon-wrapper">
|
||||
<a href="javascript:void(0)" class="leo-fly-cart-icon"><i class="material-icons"></i></a>
|
||||
<span class="leo-fly-cart-total"></span>
|
||||
</div>
|
||||
{*
|
||||
<div class="leo-fly-cssload-speeding-wheel"></div>
|
||||
*}
|
||||
<div class="leo-fly-cart-cssload-loader"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
35
modules/leofeature/views/templates/front/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||
87
modules/leofeature/views/templates/front/leo_my_wishlist.tpl
Normal file
@@ -0,0 +1,87 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{extends file=$layout}
|
||||
|
||||
{block name='content'}
|
||||
<section id="main">
|
||||
<div id="mywishlist">
|
||||
<h2>{l s='New wishlist' mod='leofeature'}</h2>
|
||||
<div class="new-wishlist">
|
||||
<div class="form-group">
|
||||
<label for="wishlist_name">{l s='Name' mod='leofeature'}</label>
|
||||
<input type="text" class="form-control" id="wishlist_name" placeholder="{l s='Enter name of new wishlist' mod='leofeature'}">
|
||||
</div>
|
||||
<div class="form-group has-success">
|
||||
<div class="form-control-feedback"></div>
|
||||
</div>
|
||||
<div class="form-group has-danger">
|
||||
<div class="form-control-feedback"></div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary leo-save-wishlist-bt">
|
||||
<span class="leo-save-wishlist-loading cssload-speeding-wheel"></span>
|
||||
<span class="leo-save-wishlist-bt-text">
|
||||
{l s='Save' mod='leofeature'}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="list-wishlist">
|
||||
<table class="table table-striped">
|
||||
<thead class="wishlist-table-head">
|
||||
<tr>
|
||||
<th>{l s='Name' mod='leofeature'}</th>
|
||||
<th>{l s='Quantity' mod='leofeature'}</th>
|
||||
<th>{l s='Viewed' mod='leofeature'}</th>
|
||||
<th class="wishlist-datecreate-head">{l s='Created' mod='leofeature'}</th>
|
||||
<th>{l s='Direct Link' mod='leofeature'}</th>
|
||||
<th>{l s='Default' mod='leofeature'}</th>
|
||||
<th>{l s='Delete' mod='leofeature'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $wishlists}
|
||||
{foreach from=$wishlists item=wishlists_item name=for_wishlists}
|
||||
<tr>
|
||||
<td><a href="javascript:void(0)" class="view-wishlist-product" data-name-wishlist="{$wishlists_item.name}" data-id-wishlist="{$wishlists_item.id_wishlist}"><i class="material-icons"></i>{$wishlists_item.name}</a><div class="leo-view-wishlist-product-loading leo-view-wishlist-product-loading-{$wishlists_item.id_wishlist} cssload-speeding-wheel"></div></td>
|
||||
<td class="wishlist-numberproduct wishlist-numberproduct-{$wishlists_item.id_wishlist}">{$wishlists_item.number_product|intval}</td>
|
||||
<td>{$wishlists_item.counter|intval}</td>
|
||||
<td class="wishlist-datecreate">{$wishlists_item.date_add}</td>
|
||||
<td><a class="view-wishlist" data-token="{$wishlists_item.token}" target="_blank" href="{$view_wishlist_url}{if $leo_is_rewrite_active}?{else}&{/if}token={$wishlists_item.token}" title="{l s='View' mod='leofeature'}">{l s='View' mod='leofeature'}</a></td>
|
||||
<td>
|
||||
|
||||
<label class="form-check-label">
|
||||
<input class="default-wishlist form-check-input" data-id-wishlist="{$wishlists_item.id_wishlist}" type="checkbox" {if $wishlists_item.default == 1}checked="checked"{/if}>
|
||||
</label>
|
||||
|
||||
</td>
|
||||
<td><a class="delete-wishlist" data-id-wishlist="{$wishlists_item.id_wishlist}" href="javascript:void(0)" title="{l s='Delete' mod='leofeature'}"><i class="material-icons"></i></a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="send-wishlist">
|
||||
<a class="leo-send-wishlist-button btn btn-info" href="javascript:void(0)" title="{l s='Send this wishlist' mod='leofeature'}">
|
||||
<i class="material-icons"></i>
|
||||
{l s='Send this wishlist' mod='leofeature'}
|
||||
</a>
|
||||
</div>
|
||||
<section id="products">
|
||||
<div class="leo-wishlist-product products row">
|
||||
|
||||
</div>
|
||||
</section>
|
||||
<ul class="footer_links">
|
||||
<li class="pull-xs-left"><a class="btn btn-outline" href="{$link->getPageLink('my-account', true)|escape:'html'}"><i class="material-icons"></i>{l s='Back to Your Account' mod='leofeature'}</a></li>
|
||||
<li class="pull-xs-right"><a class="btn btn-outline" href="{$urls.base_url}"><i class="material-icons"></i>{l s='Home' mod='leofeature'}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
{/block}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{if $products && count($products) >0}
|
||||
{foreach from=$products item=product_item name=for_products}
|
||||
{assign var='product' value=$product_item.product_info}
|
||||
{assign var='wishlist' value=$product_item.wishlist_info}
|
||||
<div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12 product-miniature js-product-miniature leo-wishlistproduct-item leo-wishlistproduct-item-{$wishlist.id_wishlist_product} product-{$product.id_product}" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="delete-wishlist-product clearfix">
|
||||
<a class="leo-wishlist-button-delete btn" href="javascript:void(0)" title="{l s='Remove from this wishlist' mod='leofeature'}" data-id-wishlist="{$wishlist.id_wishlist}" data-id-wishlist-product="{$wishlist.id_wishlist_product}" data-id-product="{$product.id_product}"><i class="material-icons"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="thumbnail-container clearfix">
|
||||
|
||||
{block name='product_thumbnail'}
|
||||
<a href="{$product.url}" class="thumbnail product-thumbnail">
|
||||
<img class="img-fluid"
|
||||
src = "{$product.cover.bySize.home_default.url}"
|
||||
alt = "{$product.cover.legend}"
|
||||
data-full-size-image-url = "{$product.cover.large.url}"
|
||||
>
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
<div class="product-description">
|
||||
{block name='product_name'}
|
||||
<h1 class="h3 product-title" itemprop="name"><a href="{$product.url}">{$product.name|truncate:30:'...'}</a></h1>
|
||||
{/block}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="wishlist-product-info">
|
||||
<div class="form-group">
|
||||
<label>{l s='Quantity' mod='leofeature'}</label>
|
||||
<input class="form-control wishlist-product-quantity wishlist-product-quantity-{$wishlist.id_wishlist_product}" type="number" min=1 value="{$wishlist.quantity}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{l s='Priority' mod='leofeature'}</label>
|
||||
<select class="form-control wishlist-product-priority wishlist-product-priority-{$wishlist.id_wishlist_product}">
|
||||
{for $i=0 to 2}
|
||||
<option value="{$i}"{if $i == $wishlist.priority} selected="selected"{/if}>
|
||||
{if $i == 0}{l s='High' mod='leofeature'}{/if}
|
||||
{if $i == 1}{l s='Medium' mod='leofeature'}{/if}
|
||||
{if $i == 2}{l s='Low' mod='leofeature'}{/if}
|
||||
</option>
|
||||
{/for}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wishlist-product-action">
|
||||
<a class="leo-wishlist-product-save-button btn btn-primary" href="javascript:void(0)" title="{l s='Save' mod='leofeature'}" data-id-wishlist="{$wishlist.id_wishlist}" data-id-wishlist-product="{$wishlist.id_wishlist_product}" data-id-product="{$product.id_product}">{l s='Save' mod='leofeature'}
|
||||
</a>
|
||||
{if isset($wishlists) && count($wishlists) > 0}
|
||||
<div class="dropdown leo-wishlist-button-dropdown">
|
||||
<button class="leo-wishlist-button dropdown-toggle btn btn-primary show-list" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{l s='Move' mod='leofeature'}</button>
|
||||
<div class="dropdown-menu leo-list-wishlist leo-list-wishlist-{$product.id_product}">
|
||||
{foreach from=$wishlists item=wishlists_item}
|
||||
<a href="#" class="dropdown-item list-group-item list-group-item-action move-wishlist-item" data-id-wishlist="{$wishlists_item.id_wishlist}" data-id-wishlist-product="{$wishlist.id_wishlist_product}" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" title="{$wishlists_item.name}">{$wishlists_item.name}</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="col-xl-12"><p class="alert alert-warning">{l s='No products' mod='leofeature'}</p></div>
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{extends file=$layout}
|
||||
|
||||
{block name='content'}
|
||||
<section id="main">
|
||||
{capture name=path}{l s='Products Comparison' mod='leofeature'}{/capture}
|
||||
<h1 class="page-heading">{l s='Products Comparison' mod='leofeature'}</h1>
|
||||
{if $hasProduct}
|
||||
<div class="products_block">
|
||||
<table id="product_comparison" class="table table-bordered table-responsive">
|
||||
<tr>
|
||||
<td class="td_empty compare_extra_information">
|
||||
|
||||
<span>{l s='Features:' mod='leofeature'}</span>
|
||||
</td>
|
||||
|
||||
{foreach from=$products item=product name=for_products}
|
||||
{assign var='replace_id' value=$product.id|cat:'|'}
|
||||
<td class="product-miniature js-product-miniature leo-productscompare-item product-{$product.id_product}" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="delete-productcompare clearfix">
|
||||
<a class="leo-compare-button btn delete" href="#" title="{l s='Remove from Compare' mod='leofeature'}" data-id-product="{$product.id_product}"><i class="material-icons"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="thumbnail-container clearfix">
|
||||
<div class="product-image">
|
||||
{block name='product_thumbnail'}
|
||||
<a href="{$product.url}" class="thumbnail product-thumbnail">
|
||||
<img class="img-fluid"
|
||||
src = "{$product.cover.bySize.home_default.url}"
|
||||
alt = "{$product.cover.legend}"
|
||||
data-full-size-image-url = "{$product.cover.large.url}"
|
||||
>
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
{block name='product_flags'}
|
||||
<ul class="product-flags">
|
||||
{foreach from=$product.flags item=flag}
|
||||
<li class="product-flag {$flag.type}">{$flag.label}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/block}
|
||||
</div>
|
||||
<div class="product-description">
|
||||
{hook h='displayLeoCartAttribute' product=$product}
|
||||
{hook h='displayLeoCartQuantity' product=$product}
|
||||
{hook h='displayLeoCartButton' product=$product}
|
||||
{block name='product_name'}
|
||||
<h1 class="h3 product-title" itemprop="name"><a href="{$product.url}">{$product.name|truncate:30:'...'}</a></h1>
|
||||
{/block}
|
||||
<div class="product_desc">
|
||||
{$product.description_short|strip_tags|truncate:60:'...'}
|
||||
</div>
|
||||
{block name='product_price_and_shipping'}
|
||||
{if $product.show_price}
|
||||
<div class="product-price-and-shipping">
|
||||
{if $product.has_discount}
|
||||
{hook h='displayProductPriceBlock' product=$product type="old_price"}
|
||||
|
||||
<span class="regular-price">{$product.regular_price}</span>
|
||||
{if $product.discount_type === 'percentage'}
|
||||
<span class="discount-percentage">{$product.discount_percentage}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{hook h='displayProductPriceBlock' product=$product type="before_price"}
|
||||
|
||||
<span itemprop="price" class="price">{$product.price}</span>
|
||||
|
||||
{hook h='displayProductPriceBlock' product=$product type='unit_price'}
|
||||
|
||||
{hook h='displayProductPriceBlock' product=$product type='weight'}
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
{if $ordered_features}
|
||||
{foreach from=$ordered_features item=feature}
|
||||
<tr>
|
||||
{cycle values='comparison_feature_odd,comparison_feature_even' assign='classname'}
|
||||
<td class="{$classname} feature-name" >
|
||||
<strong>{$feature.name|escape:'html':'UTF-8'}</strong>
|
||||
</td>
|
||||
{foreach from=$products item=product name=for_products}
|
||||
{assign var='product_id' value=$product.id}
|
||||
{assign var='feature_id' value=$feature.id_feature}
|
||||
{if isset($product_features[$product_id])}
|
||||
{assign var='tab' value=$product_features[$product_id]}
|
||||
<td class="{$classname} comparison_infos product-{$product.id}">{if (isset($tab[$feature_id]))}{$tab[$feature_id]|escape:'html':'UTF-8'}{/if}</td>
|
||||
{else}
|
||||
<td class="{$classname} comparison_infos product-{$product.id}"></td>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="{$products|@count}" class="text-center">{l s='No features to compare' mod='leofeature'}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{hook h='displayLeoProducReviewCompare' list_product=$list_product}
|
||||
</table>
|
||||
</div> <!-- end products_block -->
|
||||
{else}
|
||||
<p class="alert alert-warning">{l s='There are no products selected for comparison.' mod='leofeature'}</p>
|
||||
{/if}
|
||||
<ul class="footer_link">
|
||||
<li>
|
||||
<a class="button lnk_view btn btn-outline btn-sm" href="{$urls.base_url}">
|
||||
<i class="material-icons"></i>
|
||||
<span>{l s='Continue Shopping' mod='leofeature'}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
{/block}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<tr class="new">
|
||||
<td>
|
||||
<a href="javascript:void(0)" class="view-wishlist-product" data-name-wishlist="{$wishlist->name}" data-id-wishlist="{$wishlist->id}">
|
||||
<i class="material-icons"></i>
|
||||
{$wishlist->name}
|
||||
</a>
|
||||
<div class="leo-view-wishlist-product-loading leo-view-wishlist-product-loading-{$wishlist->id} cssload-speeding-wheel"></div>
|
||||
</td>
|
||||
<td class="wishlist-numberproduct wishlist-numberproduct-{$wishlist->id}">0</td>
|
||||
<td>0</td>
|
||||
<td class="wishlist-datecreate">{$wishlist->date_add}</td>
|
||||
<td><a class="view-wishlist" data-token="{$wishlist->token}" target="_blank" href="{$url_view_wishlist}" title="{l s='View' mod='leofeature'}">{l s='View' mod='leofeature'}</a></td>
|
||||
<td>
|
||||
<label class="form-check-label">
|
||||
<input class="default-wishlist form-check-input" data-id-wishlist="{$wishlist->id}" type="checkbox" {$checked}>
|
||||
</label>
|
||||
</td>
|
||||
<td><a class="delete-wishlist" data-id-wishlist="{$wishlist->id}" href="javascript:void(0)" title="{l s='Delete' mod='leofeature'}"><i class="material-icons"></i></a></td>
|
||||
</tr>
|
||||
|
||||
103
modules/leofeature/views/templates/front/leo_wishlist_view.tpl
Normal file
@@ -0,0 +1,103 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{extends file=$layout}
|
||||
|
||||
{block name='content'}
|
||||
<section id="main">
|
||||
<div id="view_wishlist">
|
||||
{if isset($current_wishlist)}
|
||||
<h2>{l s='Wishlist' mod='leofeature'} "{$current_wishlist.name}"</h2>
|
||||
{if $wishlists}
|
||||
<p>
|
||||
{l s='Other wishlists of ' mod='leofeature'}{$current_wishlist.firstname} {$current_wishlist.lastname} :
|
||||
{foreach from=$wishlists item=wishlist_item name=i}
|
||||
<a href="{$view_wishlist_url}{if $leo_is_rewrite_active}?{else}&{/if}token={$wishlist_item.token}" title="{$wishlist_item.name}" rel="nofollow">{$wishlist_item.name}</a>
|
||||
{if !$smarty.foreach.i.last}
|
||||
/
|
||||
{/if}
|
||||
{/foreach}
|
||||
</p>
|
||||
{/if}
|
||||
<section id="products">
|
||||
<div class="leo-wishlist-product products row">
|
||||
{if $products && count($products) >0}
|
||||
{foreach from=$products item=product_item name=for_products}
|
||||
{assign var='product' value=$product_item.product_info}
|
||||
{assign var='wishlist' value=$product_item.wishlist_info}
|
||||
<div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12 product-miniature js-product-miniature leo-wishlistproduct-item leo-wishlistproduct-item-{$wishlist.id_wishlist_product} product-{$product.id_product}" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="thumbnail-container clearfix">
|
||||
<div class="product-image">
|
||||
{block name='product_thumbnail'}
|
||||
<a href="{$product.url}" target="_blank" class="thumbnail product-thumbnail">
|
||||
<img class="img-fluid"
|
||||
src = "{$product.cover.bySize.home_default.url}"
|
||||
alt = "{$product.cover.legend}"
|
||||
data-full-size-image-url = "{$product.cover.large.url}"
|
||||
>
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
{block name='product_flags'}
|
||||
<ul class="product-flags">
|
||||
{foreach from=$product.flags item=flag}
|
||||
<li class="product-flag {$flag.type}">{$flag.label}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/block}
|
||||
</div>
|
||||
<div class="product-description">
|
||||
{hook h='displayLeoCartAttribute' product=$product}
|
||||
{hook h='displayLeoCartQuantity' product=$product}
|
||||
{hook h='displayLeoCartButton' product=$product}
|
||||
{block name='product_name'}
|
||||
<h1 class="h3 product-title" itemprop="name"><a href="{$product.url}" target="_blank">{$product.name|truncate:30:'...'}</a></h1>
|
||||
{/block}
|
||||
{block name='product_price_and_shipping'}
|
||||
{if $product.show_price}
|
||||
<div class="product-price-and-shipping">
|
||||
{if $product.has_discount}
|
||||
{hook h='displayProductPriceBlock' product=$product type="old_price"}
|
||||
<span class="regular-price">{$product.regular_price}</span>
|
||||
{if $product.discount_type === 'percentage'}
|
||||
<span class="discount-percentage">{$product.discount_percentage}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{hook h='displayProductPriceBlock' product=$product type="before_price"}
|
||||
<span itemprop="price" class="price">{$product.price}</span>
|
||||
{hook h='displayProductPriceBlock' product=$product type='unit_price'}
|
||||
{hook h='displayProductPriceBlock' product=$product type='weight'}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
<div class="wishlist-product-info">
|
||||
<input class="form-control wishlist-product-quantity wishlist-product-quantity-{$wishlist.id_wishlist_product}" type="{if $show_button_cart}hidden{else}number{/if}" data-min=1 value="{$wishlist.quantity}">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<strong>{l s='Priority' mod='leofeature'}: </strong>
|
||||
{if $wishlist.priority == 0}{l s='High' mod='leofeature'}{/if}
|
||||
{if $wishlist.priority == 1}{l s='Medium' mod='leofeature'}{/if}
|
||||
{if $wishlist.priority == 2}{l s='Low' mod='leofeature'}{/if}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="alert alert-warning col-xl-12">{l s='No products' mod='leofeature'}</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{else}
|
||||
<div class="alert alert-warning col-xl-12">{l s='Wishlist does not exist' mod='leofeature'}</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{/block}
|
||||
|
||||
49
modules/leofeature/views/templates/front/modal.tpl
Normal file
@@ -0,0 +1,49 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<div class="modal leo-modal leo-modal-cart fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<!--
|
||||
<div class="vertical-alignment-helper">
|
||||
-->
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title h6 text-xs-center leo-warning leo-alert">
|
||||
<i class="material-icons">info_outline</i>
|
||||
{l s='You must enter a quantity' mod='leofeature'}
|
||||
</h4>
|
||||
|
||||
<h4 class="modal-title h6 text-xs-center leo-info leo-alert">
|
||||
<i class="material-icons">info_outline</i>
|
||||
{l s='The minimum purchase order quantity for the product is ' mod='leofeature'}<strong class="alert-min-qty"></strong>
|
||||
</h4>
|
||||
|
||||
<h4 class="modal-title h6 text-xs-center leo-block leo-alert">
|
||||
<i class="material-icons">block</i>
|
||||
{l s='There are not enough products in stock' mod='leofeature'}
|
||||
</h4>
|
||||
</div>
|
||||
<!--
|
||||
<div class="modal-body">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
100
modules/leofeature/views/templates/front/modal_review.tpl
Normal file
@@ -0,0 +1,100 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<div class="modal leo-modal leo-modal-review fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<!--
|
||||
<div class="vertical-alignment-helper">
|
||||
-->
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title h2 text-xs-center">
|
||||
|
||||
{l s='Write a review' mod='leofeature'}
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
{if isset($product_modal_review) && $product_modal_review}
|
||||
<div class="product-info clearfix col-xs-12 col-sm-6">
|
||||
<img class="img-fluid" src="{$productcomment_cover_image}" alt="{$product_modal_review->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product_modal_review->name}</strong>
|
||||
</p>
|
||||
{$product_modal_review->description_short nofilter}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="new_review_form_content col-xs-12 col-sm-6">
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
{if isset($criterion.name) && $criterion.name != ''}<label>{$criterion.name|escape:'html':'UTF-8'}:</label>{/if}
|
||||
<div class="star_content">
|
||||
<input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_review_criterion|round}]" value="1" />
|
||||
<input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_review_criterion|round}]" value="2" />
|
||||
<input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_review_criterion|round}]" value="3" />
|
||||
<input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_review_criterion|round}]" value="4" />
|
||||
<input class="star not_uniform" type="radio" name="criterion[{$criterion.id_product_review_criterion|round}]" value="5" checked="checked" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<form class="form-new-review" action="#" method="post">
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="new_review_title">{l s='Title' mod='leofeature'} <sup class="required">*</sup></label>
|
||||
<input type="text" class="form-control" id="new_review_title" required="" name="new_review_title">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="new_review_content">{l s='Comment' mod='leofeature'} <sup class="required">*</sup></label>
|
||||
<textarea type="text" class="form-control" id="new_review_content" required="" name="new_review_content"></textarea>
|
||||
</div>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="new_review_customer_name">{l s='Your name' mod='leofeature'} <sup class="required">*</sup></label>
|
||||
<input type="text" class="form-control" id="new_review_customer_name" required="" name="new_review_customer_name">
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="form-control-label"><sup>*</sup> {l s='Required fields' mod='leofeature'}</label>
|
||||
<input id="id_product_review" name="id_product_review" type="hidden" value='{$product_modal_review->id}' />
|
||||
</div>
|
||||
<button class="btn btn-primary form-control-submit leo-fake-button pull-xs-right" type="submit">
|
||||
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{l s='Close' mod='leofeature'}</button>
|
||||
<button type="button" class="leo-modal-review-bt btn btn-primary">
|
||||
|
||||
<span class="leo-modal-review-loading cssload-speeding-wheel"></span>
|
||||
<span class="leo-modal-review-bt-text">
|
||||
{l s='Submit' mod='leofeature'}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
67
modules/leofeature/views/templates/front/notification.tpl
Normal file
@@ -0,0 +1,67 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
<div class="leo-notification" style="width: {$width_notification}; {$vertical_position}; {$horizontal_position}">
|
||||
</div>
|
||||
<div class="leo-temp leo-temp-success">
|
||||
<div class="notification-wrapper">
|
||||
<div class="notification notification-success">
|
||||
{*
|
||||
<span class="notification-title"><i class="material-icons"></i></span>
|
||||
*}
|
||||
<strong class="noti product-name"></strong>
|
||||
<span class="noti noti-update">{l s='The product has been updated in your shopping cart' mod='leofeature'}</span>
|
||||
<span class="noti noti-delete">{l s='The product has been removed from your shopping cart' mod='leofeature'}</span>
|
||||
<span class="noti noti-add"><strong class="noti-special"></strong> {l s='Product successfully added to your shopping cart' mod='leofeature'}</span>
|
||||
<span class="notification-close">X</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="leo-temp leo-temp-error">
|
||||
<div class="notification-wrapper">
|
||||
<div class="notification notification-error">
|
||||
{*
|
||||
<span class="notification-title"><i class="material-icons"></i></span>
|
||||
*}
|
||||
|
||||
<span class="noti noti-update">{l s='Error updating' mod='leofeature'}</span>
|
||||
<span class="noti noti-delete">{l s='Error deleting' mod='leofeature'}</span>
|
||||
<span class="noti noti-add">{l s='Error adding. Please go to product detail page and try again' mod='leofeature'}</span>
|
||||
|
||||
<span class="notification-close">X</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="leo-temp leo-temp-warning">
|
||||
<div class="notification-wrapper">
|
||||
<div class="notification notification-warning">
|
||||
{*
|
||||
<span class="notification-title"><i class="material-icons"></i></span>
|
||||
*}
|
||||
<span class="noti noti-min">{l s='The minimum purchase order quantity for the product is' mod='leofeature'} <strong class="noti-special"></strong></span>
|
||||
<span class="noti noti-max">{l s='There are not enough products in stock' mod='leofeature'}</span>
|
||||
|
||||
<span class="notification-close">X</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="leo-temp leo-temp-normal">
|
||||
<div class="notification-wrapper">
|
||||
<div class="notification notification-normal">
|
||||
{*
|
||||
<span class="notification-title"><i class="material-icons"></i></span>
|
||||
*}
|
||||
<span class="noti noti-check">{l s='You must enter a quantity' mod='leofeature'}</span>
|
||||
|
||||
<span class="notification-close">X</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
28
modules/leofeature/views/templates/front/price_attribute.tpl
Normal file
@@ -0,0 +1,28 @@
|
||||
{*
|
||||
* @Module Name: Leo Feature
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @description: Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*}
|
||||
{if $product_price_attribute.show_price}
|
||||
{if $product_price_attribute.has_discount}
|
||||
{hook h='displayProductPriceBlock' product=$product_price_attribute type="old_price"}
|
||||
<span class="sr-only">{l s='Regular price' mod='leofeature'}</span>
|
||||
<span class="regular-price">{$product_price_attribute.regular_price}</span>
|
||||
{if $product_price_attribute.discount_type === 'percentage'}
|
||||
<span class="discount-percentage discount-product">{$product_price_attribute.discount_percentage}</span>
|
||||
{elseif $product_price_attribute.discount_type === 'amount'}
|
||||
<span class="discount-amount discount-product">{$product_price_attribute.discount_amount_to_display}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{hook h='displayProductPriceBlock' product=$product_price_attribute type="before_price"}
|
||||
|
||||
<span class="sr-only">{l s='Price' mod='leofeature'}</span>
|
||||
<span itemprop="price" class="price">{$product_price_attribute.price}</span>
|
||||
|
||||
{hook h='displayProductPriceBlock' product=$product_price_attribute type='unit_price'}
|
||||
|
||||
{hook h='displayProductPriceBlock' product=$product_price_attribute type='weight'}
|
||||
{/if}
|
||||
35
modules/leofeature/views/templates/hook/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 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;
|
||||