Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap

Conflicts:
	admin-dev/themes/default/css/modules.css
	admin-dev/themes/default/template/controllers/carts/helpers/view/view.tpl
	admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl
	admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl
	admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl
	admin-dev/themes/default/template/controllers/products/images.tpl
	admin-dev/themes/default/template/controllers/products/prices.tpl
	admin-dev/themes/default/template/helpers/form/form.tpl
	admin-dev/themes/default/template/helpers/list/list_header.tpl
	classes/Autoload.php
	classes/Carrier.php
	classes/Product.php
	classes/ProductSale.php
	classes/Tools.php
	classes/Validate.php
	classes/tax/TaxRulesTaxManager.php
	controllers/admin/AdminPPreferencesController.php
	controllers/admin/AdminPerformanceController.php
	install-dev/install_version.php
	js/admin_carrier_wizard.js
	modules/blockcategories/blockcategories.php
	modules/blocklayered/blocklayered.php
	modules/statsequipment/statsequipment.php
	modules/statsproduct/statsproduct.php
	modules/watermark/watermark.php
	themes/default/address.tpl
	themes/default/authentication.tpl
	themes/default/category.tpl
	themes/default/contact-form.tpl
	themes/default/css/history.css
	themes/default/header.tpl
	themes/default/js/cart-summary.js
	themes/default/js/product.js
	themes/default/mobile/order-detail.tpl
	themes/default/modules/blocksearch/blocksearch.tpl
	themes/default/modules/productcomments/productcomments.tpl
	themes/default/order-carrier.tpl
	themes/default/order-detail.tpl
	themes/default/order-opc-new-account.tpl
	themes/default/product.tpl
This commit is contained in:
Kevin Granger
2013-11-21 17:43:51 +01:00
167 changed files with 7261 additions and 861 deletions
+2 -2
View File
@@ -62,8 +62,8 @@
{foreach from=$datas key='index' item='data' name='datas'}
{ldelim}
"index": {$index},
"value": "{$data.value|addslashes|replace: '\\\'':'\''}",
"truncatedValue": "{$data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\''}"
"value": "{Tools::nl2br($data.value|addslashes|replace: '\\\'':'\'')}",
"truncatedValue": "{Tools::nl2br($data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\'')}"
{rdelim}{if !$smarty.foreach.datas.last},{/if}
{/foreach}]
{rdelim}{if !$smarty.foreach.customization.last},{/if}
+1 -1
View File
@@ -303,4 +303,4 @@ class BlockCart extends Module
'PS_BLOCK_CART_XSELL_LIMIT' => Tools::getValue('PS_BLOCK_CART_XSELL_LIMIT', Configuration::get('PS_BLOCK_CART_XSELL_LIMIT'))
);
}
}
}
+5 -6
View File
@@ -230,12 +230,11 @@ function initLayered()
function paginationButton() {
$('#pagination a').not(':hidden').each(function () {
if ($(this).attr('href').search(/&|\?p=/) == -1) {
var page = 1;
}
else {
var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1');
}
if ($(this).attr('href').search(/[&|\?]p=/) == -1)
var page = 1;
else
var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1');
var location = window.location.href.replace(/#.*$/, '');
$(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
});
+2 -2
View File
@@ -29,7 +29,7 @@
<input type="hidden" name="controller" value="search" />
<input type="hidden" name="orderby" value="position" />
<input type="hidden" name="orderway" value="desc" />
<input class="search_query" type="search" id="search_query_top" name="search_query" placeholder="{l s='Search' mod='blocksearch'}" value="{if isset($smarty.get.search_query)}{Tools::htmlentitiesUTF8($smarty.get.search_query)|stripslashes}{/if}" />
<input class="search_query" type="search" id="search_query_top" name="search_query" placeholder="{l s='Search' mod='blocksearch'}" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" />
</form>
</div>
{else}
@@ -41,7 +41,7 @@
<input type="hidden" name="controller" value="search" />
<input type="hidden" name="orderby" value="position" />
<input type="hidden" name="orderway" value="desc" />
<input class="search_query" type="text" id="search_query_top" name="search_query" value="{if isset($smarty.get.search_query)}{Tools::htmlentitiesUTF8($smarty.get.search_query)|stripslashes}{/if}" />
<input class="search_query" type="text" id="search_query_top" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" />
<input type="submit" name="submit_search" value="{l s='Search' mod='blocksearch'}" class="button" />
</p>
</form>
+16 -7
View File
@@ -33,7 +33,7 @@ class BlockSearch extends Module
{
$this->name = 'blocksearch';
$this->tab = 'search_filter';
$this->version = 1.2;
$this->version = 1.3;
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -53,6 +53,7 @@ class BlockSearch extends Module
public function hookdisplayMobileTopSiteMap($params)
{
$this->smarty->assign(array('hook_mobile' => true, 'instantsearch' => false));
$params['hook_mobile'] = true;
return $this->hookTop($params);
}
@@ -80,24 +81,32 @@ public function hookDisplayMobileHeader($params)
public function hookRightColumn($params)
{
if (Tools::getValue('search_query') || !$this->isCached('blocksearch.tpl', $this->getCacheId()))
{
$this->calculHookCommon($params);
$this->smarty->assign('blocksearch_type', 'block');
$this->smarty->assign(array(
'blocksearch_type' => 'block',
'search_query' => (string)Tools::getValue('search_query')
)
);
}
return $this->display(__FILE__, 'blocksearch.tpl', Tools::getValue('search_query') ? null : $this->getCacheId());
}
public function hookTop($params)
{
if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top.tpl', $this->getCacheId('blocksearch-top')))
$key = $this->getCacheId('blocksearch-top'.((!isset($params['hook_mobile']) || !$params['hook_mobile']) ? '' : '-hook_mobile'));
if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top.tpl', $key))
{
$this->calculHookCommon($params);
$this->smarty->assign('blocksearch_type', 'top');
$this->smarty->assign(array(
'blocksearch_type' => 'top',
'search_query' => (string)Tools::getValue('search_query')
)
);
}
return $this->display(__FILE__, 'blocksearch-top.tpl', Tools::getValue('search_query') ? null : $this->getCacheId('blocksearch-top'));
return $this->display(__FILE__, 'blocksearch-top.tpl', Tools::getValue('search_query') ? null : $key);
}
/**
+1 -1
View File
@@ -32,7 +32,7 @@
<input type="hidden" name="controller" value="search" />
<input type="hidden" name="orderby" value="position" />
<input type="hidden" name="orderway" value="desc" />
<input class="search_query" type="text" id="search_query_block" name="search_query" value="{if isset($smarty.get.search_query)}{Tools::htmlentitiesUTF8($smarty.get.search_query)|stripslashes}{/if}" />
<input class="search_query" type="text" id="search_query_block" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" />
<input type="submit" id="search_button" class="button_mini" value="{l s='Go!' mod='blocksearch'}" />
</p>
</form>
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blocksearch</name>
<displayName><![CDATA[Quick search block]]></displayName>
<version><![CDATA[1.2]]></version>
<version><![CDATA[1.3]]></version>
<description><![CDATA[Adds a quick search field to your website.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[search_filter]]></tab>
+1 -1
View File
@@ -37,7 +37,7 @@ class blocksharefb extends Module
$this->tab = 'front_office_features';
else
$this->tab = 'Blocks';
$this->version = '1.0';
$this->version = '1.1';
parent::__construct();
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blocksharefb</name>
<displayName><![CDATA[Facebook sharing block.]]></displayName>
<version><![CDATA[1.0]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Allows customers to share your products -- or website content -- on Facebook. ]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[front_office_features]]></tab>
+1 -1
View File
@@ -36,7 +36,7 @@ class BlockSpecials extends Module
{
$this->name = 'blockspecials';
$this->tab = 'pricing_promotion';
$this->version = '0.9';
$this->version = '1.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blockspecials</name>
<displayName><![CDATA[Specials block]]></displayName>
<version><![CDATA[0.9]]></version>
<version><![CDATA[1.0]]></version>
<description><![CDATA[Adds a block displaying current product specials.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[pricing_promotion]]></tab>
+2 -4
View File
@@ -52,7 +52,7 @@ class Blocktopmenu extends Module
{
$this->name = 'blocktopmenu';
$this->tab = 'front_office_features';
$this->version = 1.6;
$this->version = 1.7;
$this->author = 'PrestaShop';
$this->bootstrap = true;
@@ -337,7 +337,7 @@ class Blocktopmenu extends Module
switch (substr($item, 0, strlen($value[1])))
{
case 'CAT':
$this->getCategory((int)$id);
$this->getCategory($id, $id_lang, $id_shop);
break;
case 'PRD':
@@ -452,9 +452,7 @@ class Blocktopmenu extends Module
if (isset($children) && count($children))
foreach ($children as $child)
{
$this->getCategoryOption((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']);
}
}
private function getCategory($id_category, $id_lang = false, $id_shop = false)
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blocktopmenu</name>
<displayName><![CDATA[Top horizontal menu]]></displayName>
<version><![CDATA[1.6]]></version>
<version><![CDATA[1.7]]></version>
<description><![CDATA[Add a new horizontal menu to the top of your e-commerce website.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
+14 -8
View File
@@ -171,6 +171,8 @@ class WishList extends ObjectModel
*/
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())
@@ -178,14 +180,18 @@ class WishList extends ObjectModel
else
$shop_restriction = '';
if (!Validate::isUnsignedId($id_customer))
die (Tools::displayError());
return (Db::getInstance()->executeS('
SELECT w.`id_wishlist`, w.`name`, w.`token`, w.`date_add`, w.`date_upd`, w.`counter`
FROM `'._DB_PREFIX_.'wishlist` w
WHERE `id_customer` = '.(int)($id_customer).'
'.$shop_restriction.'
ORDER BY w.`name` ASC'));
$cache_id = 'WhishList::getByIdCustomer_'.(int)$id_customer.'-'.(int)Shop::getContextShopID().'-'.(int)Shop::getContextShopGroupID();
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance()->executeS('
SELECT w.`id_wishlist`, w.`name`, w.`token`, w.`date_add`, w.`date_upd`, w.`counter`
FROM `'._DB_PREFIX_.'wishlist` w
WHERE `id_customer` = '.(int)($id_customer).'
'.$shop_restriction.'
ORDER BY w.`name` ASC');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
}
public static function refreshWishList($id_wishlist)
+3 -3
View File
@@ -58,7 +58,7 @@ function WishlistCart(id, action, id_product, id_product_attribute, quantity)
if($('#' + id).length != 0)
{
$('#' + id).slideUp('normal');
document.getElementById(id).innerHTML = data;
$('#' + id).html(data);
$('#' + id).slideDown('normal');
}
}
@@ -81,7 +81,7 @@ function WishlistChangeDefault(id, id_wishlist)
success: function(data)
{
$('#' + id).slideUp('normal');
document.getElementById(id).innerHTML = data;
$('#' + id).html(data);
$('#' + id).slideDown('normal');
}
});
@@ -147,7 +147,7 @@ function WishlistManage(id, id_wishlist)
success: function(data)
{
$('#' + id).hide();
document.getElementById(id).innerHTML = data;
$('#' + id).html(data);
$('#' + id).fadeIn('slow');
}
});
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>crossselling</name>
<displayName><![CDATA[Cross Selling]]></displayName>
<version><![CDATA[0.7]]></version>
<version><![CDATA[0.8]]></version>
<description><![CDATA[Customers who bought this product also bought:]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
+1 -4
View File
@@ -35,7 +35,7 @@ class CrossSelling extends Module
{
$this->name = 'crossselling';
$this->tab = 'front_office_features';
$this->version = 0.7;
$this->version = 0.8;
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -44,9 +44,6 @@ class CrossSelling extends Module
$this->displayName = $this->l('Cross Selling');
$this->description = $this->l('Customers who bought this product also bought:');
if (!$this->isRegisteredInHook('header'))
$this->registerHook('header');
}
public function install()
@@ -0,0 +1,11 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_0_8($object)
{
if (!$object->isRegisteredInHook('header'))
return $object->registerHook('header');
return true;
}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>dateofdelivery</name>
<displayName><![CDATA[Date of delivery]]></displayName>
<version><![CDATA[1.1]]></version>
<version><![CDATA[1.2]]></version>
<description><![CDATA[Displays an approximate date of delivery]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+1 -1
View File
@@ -35,7 +35,7 @@ class DateOfDelivery extends Module
{
$this->name = 'dateofdelivery';
$this->tab = 'shipping_logistics';
$this->version = '1.1';
$this->version = '1.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>feeder</name>
<displayName><![CDATA[RSS products feed.]]></displayName>
<version><![CDATA[0.3]]></version>
<version><![CDATA[0.4]]></version>
<description><![CDATA[Generate an RSS products feed.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
+1 -1
View File
@@ -35,7 +35,7 @@ class Feeder extends Module
{
$this->name = 'feeder';
$this->tab = 'front_office_features';
$this->version = 0.3;
$this->version = 0.4;
$this->author = 'PrestaShop';
$this->need_instance = 0;
+1 -1
View File
@@ -111,7 +111,7 @@ class HomeFeatured extends Module
{
$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
$nb = (int)Configuration::get('HOME_FEATURED_NBR');
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), "position");
$this->smarty->assign(array(
'products' => $products,
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>homeslider</name>
<displayName><![CDATA[Image slider for your homepage.]]></displayName>
<version><![CDATA[1.2.1]]></version>
<version><![CDATA[1.2.2]]></version>
<description><![CDATA[Adds an image slider to your homepage.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
+1 -1
View File
@@ -42,7 +42,7 @@ class HomeSlider extends Module
{
$this->name = 'homeslider';
$this->tab = 'front_office_features';
$this->version = '1.2.1';
$this->version = '1.2.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->secure_key = Tools::encrypt($this->name);
+2 -2
View File
@@ -101,9 +101,9 @@ class LoyaltyModule extends ObjectModel
{
$cartProductsNew['id_product'] = (int)$newProduct->id;
if ($taxesEnabled == PS_TAX_EXC)
$cartProductsNew['price'] = number_format($newProduct->getPrice(false, (int)$newProduct->getDefaultIdProductAttribute()), 2, '.', '');
$cartProductsNew['price'] = number_format($newProduct->getPrice(false, (int)$newProduct->getIdProductAttributeMostExpensive()), 2, '.', '');
else
$cartProductsNew['price_wt'] = number_format($newProduct->getPrice(true, (int)$newProduct->getDefaultIdProductAttribute()), 2, '.', '');
$cartProductsNew['price_wt'] = number_format($newProduct->getPrice(true, (int)$newProduct->getIdProductAttributeMostExpensive()), 2, '.', '');
$cartProductsNew['cart_quantity'] = 1;
$cartProducts[] = $cartProductsNew;
}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>loyalty</name>
<displayName><![CDATA[Customer loyalty and rewards]]></displayName>
<version><![CDATA[1.8]]></version>
<version><![CDATA[1.9]]></version>
<description><![CDATA[Provide a loyalty program to your customers.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[pricing_promotion]]></tab>
+2 -2
View File
@@ -42,7 +42,7 @@ class Loyalty extends Module
{
$this->name = 'loyalty';
$this->tab = 'pricing_promotion';
$this->version = '1.8';
$this->version = '1.9';
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -278,7 +278,7 @@ class Loyalty extends Module
$points = (int)LoyaltyModule::getNbPointsByPrice(
$product->getPrice(
Product::getTaxCalculationMethod() == PS_TAX_EXC ? false : true,
(int)$product->getDefaultIdProductAttribute()
(int)$product->getIdProductAttributeMostExpensive()
)
);
@@ -39,7 +39,7 @@ $(document).ready(function() {
if (typeof(productPrice) == 'undefined' || typeof(productPriceWithoutReduction) == 'undefined')
return;
var points = Math.round(productPrice / point_rate);
var points = {$points};
var total_points = points_in_cart + points;
var voucher = total_points * point_value;
if (!none_award && productPriceWithoutReduction != productPrice) {
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>mailalerts</name>
<displayName><![CDATA[Mail alerts]]></displayName>
<version><![CDATA[2.7]]></version>
<version><![CDATA[2.8]]></version>
<description><![CDATA[Sends e-mail notifications to customers and merchants.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
+3 -3
View File
@@ -46,7 +46,7 @@ class MailAlerts extends Module
{
$this->name = 'mailalerts';
$this->tab = 'administration';
$this->version = '2.7';
$this->version = '2.8';
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -256,7 +256,7 @@ class MailAlerts extends Module
$customization_text .= '---<br />';
}
$customization_text = rtrim($customization_text, '---<br />');
$customization_text = Tools::rtrimString($customization_text, '---<br />');
}
$items_table .=
@@ -321,7 +321,7 @@ class MailAlerts extends Module
'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',
'{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile,
'{invoice_other}' => $invoice->other,
'{order_name}' => sprintf('%06d', $order->id),
'{order_name}' => $order->reference,
'{shop_name}' => $configuration['PS_SHOP_NAME'],
'{date}' => $order_date_text,
'{carrier}' => (($carrier->name == '0') ? $configuration['PS_SHOP_NAME'] : $carrier->name),
+45 -29
View File
@@ -97,18 +97,24 @@ class ProductComment extends ObjectModel
if ($n != null && $n <= 0)
$n = 5;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT pc.`id_product_comment`,
(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment` AND pcu.`usefulness` = 1) as total_useful,
(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment`) as total_advice, '.
((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcuc WHERE pcuc.`id_product_comment` = pc.`id_product_comment` AND pcuc.id_customer = '.(int)$id_customer.') as customer_advice, ' : '').
((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_report` pcrc WHERE pcrc.`id_product_comment` = pc.`id_product_comment` AND pcrc.id_customer = '.(int)$id_customer.') as customer_report, ' : '').'
IF(c.id_customer, CONCAT(c.`firstname`, \' \', LEFT(c.`lastname`, 1)), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pc.title
FROM `'._DB_PREFIX_.'product_comment` 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_id = 'ProductComment::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_comment`,
(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment` AND pcu.`usefulness` = 1) as total_useful,
(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment`) as total_advice, '.
((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcuc WHERE pcuc.`id_product_comment` = pc.`id_product_comment` AND pcuc.id_customer = '.(int)$id_customer.') as customer_advice, ' : '').
((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_report` pcrc WHERE pcrc.`id_product_comment` = pc.`id_product_comment` AND pcrc.id_customer = '.(int)$id_customer.') as customer_report, ' : '').'
IF(c.id_customer, CONCAT(c.`firstname`, \' \', LEFT(c.`lastname`, 1)), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pc.title
FROM `'._DB_PREFIX_.'product_comment` 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);
}
/**
@@ -118,18 +124,24 @@ class ProductComment extends ObjectModel
*/
public static function getByCustomer($id_product, $id_customer, $get_last = false, $id_guest = false)
{
$results = Db::getInstance()->executeS('
SELECT *
FROM `'._DB_PREFIX_.'product_comment` 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' : '')
);
$cache_id = 'ProductComment::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_.'product_comment` 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)
$results = array_shift($results);
return $results;
if ($get_last && count($results))
$results = array_shift($results);
Cache::store($cache_id, $results);
}
return Cache::retrieve($cache_id);
}
/**
@@ -202,12 +214,16 @@ class ProductComment extends ObjectModel
if (!Validate::isUnsignedId($id_product))
die(Tools::displayError());
$validate = (int)Configuration::get('PRODUCT_COMMENTS_MODERATE');
if (($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT COUNT(`id_product_comment`) AS "nbr"
FROM `'._DB_PREFIX_.'product_comment` pc
WHERE `id_product` = '.(int)($id_product).($validate == '1' ? ' AND `validate` = 1' : ''))) === false)
return false;
return (int)($result['nbr']);
$cache_id = 'ProductComment::getCommentNumber_'.(int)$id_product.'-'.$validate;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(`id_product_comment`) AS "nbr"
FROM `'._DB_PREFIX_.'product_comment` pc
WHERE `id_product` = '.(int)($id_product).($validate == '1' ? ' AND `validate` = 1' : ''));
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
}
/**
@@ -159,26 +159,33 @@ class ProductCommentCriterion extends ObjectModel
$table = '_shop';
$alias = 'ps';
}
return Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pccl.`name`
FROM `'._DB_PREFIX_.'product_comment_criterion` pcc
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl
ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_product` pccp
ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = '.(int)$id_product.')
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_category` pccc
ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_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_comment_criterion_type = 1
)
AND pcc.active = 1
GROUP BY pcc.id_product_comment_criterion
');
$cache_id = 'ProductCommentCriterion::getByProduct_'.(int)$id_product.'-'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pccl.`name`
FROM `'._DB_PREFIX_.'product_comment_criterion` pcc
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl
ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_product` pccp
ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = '.(int)$id_product.')
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_category` pccc
ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_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_comment_criterion_type = 1
)
AND pcc.active = 1
GROUP BY pcc.id_product_comment_criterion
');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
}
/**
@@ -684,11 +684,14 @@ class ProductComments extends Module
{
require_once(dirname(__FILE__).'/ProductComment.php');
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
$average = ProductComment::getAverageGrade((int)Tools::getValue('id_product'));
$this->context->smarty->assign(array(
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'comments' => ProductComment::getByProduct((int)(Tools::getValue('id_product'))),
'criterions' => ProductCommentCriterion::getByProduct((int)(Tools::getValue('id_product')), $this->context->language->id),
'averageTotal' => round($average['grade']),
'nbComments' => (int)(ProductComment::getCommentNumber((int)(Tools::getValue('id_product'))))
));
+4 -1
View File
@@ -93,11 +93,13 @@ var moderation_active = {$moderation_active};
</div>
</div>
{if isset($product) && $product}
<!-- Fancybox -->
<div style="display: none;">
<div id="new_comment_form">
<form id="id_new_comment_form" action="#">
<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
{if isset($product) && $product}
<div class="product clearfix">
<img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
<div class="product_desc">
@@ -105,7 +107,7 @@ var moderation_active = {$moderation_active};
{$product->description_short}
</div>
</div>
{/if}
<div class="new_comment_form_content">
<h2>{l s='Write your review' mod='productcomments'}</h2>
@@ -156,3 +158,4 @@ var moderation_active = {$moderation_active};
</div>
</div>
<!-- End fancybox -->
{/if}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>productscategory</name>
<displayName><![CDATA[Products Category]]></displayName>
<version><![CDATA[1.4]]></version>
<version><![CDATA[1.5]]></version>
<description><![CDATA[Display products of the same category on the product page.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
@@ -34,7 +34,7 @@ class productsCategory extends Module
public function __construct()
{
$this->name = 'productscategory';
$this->version = '1.4';
$this->version = '1.5';
$this->author = 'PrestaShop';
$this->tab = 'front_office_features';
$this->need_instance = 0;
@@ -44,9 +44,6 @@ class productsCategory extends Module
$this->displayName = $this->l('Products Category');
$this->description = $this->l('Display products of the same category on the product page.');
if (!$this->isRegisteredInHook('header'))
$this->registerHook('header');
}
public function install()
@@ -0,0 +1,11 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_5($object)
{
if (!$object->isRegisteredInHook('header'))
return $object->registerHook('header');
return true;
}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>pscleaner</name>
<displayName><![CDATA[PrestaShop Cleaner]]></displayName>
<version><![CDATA[0.9]]></version>
<version><![CDATA[1.0]]></version>
<description><![CDATA[Check and fix functional integrity constraints and remove default data]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
+1 -1
View File
@@ -34,7 +34,7 @@ class PSCleaner extends Module
{
$this->name = 'pscleaner';
$this->tab = 'administration';
$this->version = '0.9';
$this->version = '1.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -93,6 +93,8 @@ class ReferralProgramModule extends ObjectModel
$cartRule->date_to = date('Y-m-d H:i:s', time() + 31536000); // + 1 year
$cartRule->code = $this->getDiscountPrefix().Tools::passwdGen(6);
$cartRule->name = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
if (empty($cartRule->name))
$cartRule->name = 'Referral reward';
$cartRule->id_customer = (int)$id_customer;
$cartRule->reduction_currency = (int)$id_currency;
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>referralprogram</name>
<displayName><![CDATA[Customer referral program]]></displayName>
<version><![CDATA[1.5.1]]></version>
<version><![CDATA[1.5.2]]></version>
<description><![CDATA[Integrate a referral program system into your shop.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[advertising_marketing]]></tab>
+1 -1
View File
@@ -33,7 +33,7 @@ class ReferralProgram extends Module
{
$this->name = 'referralprogram';
$this->tab = 'advertising_marketing';
$this->version = '1.5.1';
$this->version = '1.5.2';
$this->author = 'PrestaShop';
$this->bootstrap = true;
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>trackingfront</name>
<displayName><![CDATA[Tracking - Front office]]></displayName>
<version><![CDATA[1]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Enable your affiliates to access their own statistics.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+1 -1
View File
@@ -33,7 +33,7 @@ class TrackingFront extends Module
{
$this->name = 'trackingfront';
$this->tab = 'shipping_logistics';
$this->version = 1.0;
$this->version = 1.1;
$this->author = 'PrestaShop';
$this->need_instance = 0;
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>watermark</name>
<displayName><![CDATA[Watermark]]></displayName>
<version><![CDATA[0.3]]></version>
<version><![CDATA[0.4]]></version>
<description><![CDATA[Protect image by watermark.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
+3 -3
View File
@@ -43,7 +43,7 @@ class Watermark extends Module
{
$this->name = 'watermark';
$this->tab = 'administration';
$this->version = '0.3';
$this->version = '0.4';
$this->author = 'PrestaShop';
$this->bootstrap = true;
@@ -301,7 +301,7 @@ RewriteRule [0-9/]+/[0-9]+\\.jpg$ - [F]
),
array(
'type' => 'text',
'label' => $this->l('Watermark transparency (0-100)'),
'label' => $this->l('Watermark transparency (1-100)'),
'name' => 'transparency',
'class' => 'fixed-width-md',
),
@@ -427,4 +427,4 @@ RewriteRule [0-9/]+/[0-9]+\\.jpg$ - [F]
return $config_fields;
}
}
}