// Merge -> revision 8149

This commit is contained in:
rMalie
2011-08-22 16:22:16 +00:00
parent 53d9b1343b
commit 08a8ffdcf9
18 changed files with 103 additions and 34 deletions
+1 -1
View File
@@ -959,7 +959,7 @@ class CartCore extends ObjectModel
$price = Product::getPriceStatic((int)($product['id_product']), true, (int)($product['id_product_attribute']), 2, NULL, false, true, $product['cart_quantity'], false, ((int)($this->id_customer) ? (int)($this->id_customer) : NULL), (int)($this->id), ((int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL));
$total_price = Tools::ps_round($price, 2) * (int)($product['cart_quantity']);
if (!$withTaxes)
$total_price = Tools::ps_round($total_price / (1 + ($product['rate'] / 100)), 2);
$total_price = Tools::ps_round($total_price / (1 + ((float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100)), 2);
}
$order_total += $total_price;
}
+2 -2
View File
@@ -128,11 +128,11 @@ class FrontControllerCore
$this->context->smarty->ps_language = $this->context->language;
$protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://';
$useSSL = (isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()?true:false;
$useSSL = ((isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()) ? true : false;
$protocol_content = ($useSSL) ? 'https://' : 'http://';
$link = new Link($protocol_link, $protocol_content);
$this->context->link = $link;
if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed))
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
+16 -7
View File
@@ -420,22 +420,30 @@ class OrderCore extends ObjectModel
$group_reduction = 1;
if ($row['group_reduction'] > 0)
$group_reduction = $row['group_reduction'] / 100;
$group_reduction = 1 - $row['group_reduction'] / 100;
if ($row['reduction_percent'])
if ($row['reduction_percent'] != 0)
{
if ($this->_taxCalculationMethod == PS_TAX_EXC)
$row['product_price'] = $row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01 * $group_reduction);
$row['product_price'] = ($row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01));
else
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01 * $group_reduction), 2);
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01)), 2);
}
if ($row['reduction_amount'])
if ($row['reduction_amount'] != 0)
{
if ($this->_taxCalculationMethod == PS_TAX_EXC)
$row['product_price'] = $row['product_price'] - ($row['reduction_amount'] / (1 + $row['tax_rate'] / 100)) * $group_reduction;
$row['product_price'] = ($row['product_price'] - ($row['reduction_amount'] / (1 + $row['tax_rate'] / 100)));
else
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['reduction_amount'] * $group_reduction, 2);
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['reduction_amount']), 2);
}
if ($row['group_reduction'] > 0)
{
if ($this->_taxCalculationMethod == PS_TAX_EXC)
$row['product_price'] = $row['product_price'] * $group_reduction;
else
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2);
}
if (($row['reduction_percent'] OR $row['reduction_amount'] OR $row['group_reduction']) AND $this->_taxCalculationMethod == PS_TAX_EXC)
@@ -453,6 +461,7 @@ class OrderCore extends ObjectModel
$row['total_price'] = $row['product_quantity'] * $row['product_price'];
}
/**
* Get order products
*
+1 -1
View File
@@ -222,7 +222,7 @@ abstract class PaymentModuleCore extends Module
if (!empty($product['ecotax']))
$ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, false);
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, true, false);
$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], $this->context->shop->getID(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']);
$unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00;
+10
View File
@@ -3050,8 +3050,18 @@ class ProductCore extends ObjectModel
return true;
}
/**
* Checks if the product is in at least one of the submited categories
*
* @param int $id_product
* @param array $categories array of category arrays
* @return boolean is the product in at least one category
*/
public static function idIsOnCategoryId($id_product, $categories)
{
if (!((int)$id_product > 0) || !is_array($categories) || empty($categories))
return false;
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product`='.(int)($id_product).' AND `id_category` IN(';
foreach ($categories AS $category)
$sql .= (int)($category['id_category']).',';
+1 -1
View File
@@ -88,7 +88,7 @@ class ProductDownloadCore extends ObjectModel
public function __construct($id_product_download = NULL)
{
parent::__construct($id_product_download);
// TODO check if the file is present on hard drive
// @TODO check if the file is present on hard drive
}
public function delete($deleteFile=false)
+7 -5
View File
@@ -224,12 +224,14 @@ class ToolsCore
*/
public static function usingSecureMode()
{
if (empty($_SERVER['HTTPS'])) {
if(!empty($_SERVER['SSL']))
$_SERVER['HTTPS'] = $_SERVER['SSL'];
if (isset($_SERVER['HTTPS']))
return ($_SERVER['HTTPS'] == 1 || strtolower($_SERVER['HTTPS']) == 'on');
// $_SERVER['SSL'] exists only in some specific configuration
if (isset($_SERVER['SSL']))
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
return false;
}
return !(empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off');
}
/**
* Get the current url prefix protocol (https/http)
+3 -1
View File
@@ -13,4 +13,6 @@ AND `id_lang` = (
LIMIT 1
);
ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0';
UPDATE `PREFIX_order_detail`set `product_price` = `product_price` /( 1-(`group_reduction`/100));
+7
View File
@@ -46,6 +46,10 @@ $(document).ready(function(){
});
$('#categories-treeview li#1 span').trigger('click');
$('#categories-treeview li#1').children('div').remove();
$('#categories-treeview li#1').
removeClass('collapsable lastCollapsable').
addClass('last static');
$('#expand_all').click( function () {
expandAllCategories();
@@ -127,6 +131,9 @@ function expandAllCategories()
// if no category to expand, no action
if (!needExpandAllCategories())
return;
// force to open main category
if ($('li#1').is('.expandable'))
$('li#1').children('span.folder').trigger('click');
readyToExpand = true;
if (setCategoryToExpand())
interval = setInterval(openCategory, 10);
+3
View File
@@ -135,6 +135,9 @@
// handle toggle event
function toggler() {
// Added by Prestashop
if ($(this).parent().is('.static'))
return;
$(this)
.parent()
// swap classes for hitarea
+4
View File
@@ -171,6 +171,10 @@ function reloadContent(params_plus)
return false;
});
ajaxCart.overrideButtonsInThePage();
if(typeof(reloadProductComparison) == 'function') {
reloadProductComparison();
}
}
});
ajaxQueries.push(ajaxQuery);
+2 -1
View File
@@ -1247,7 +1247,8 @@ class BlockLayered extends Module
'nArray' => $nArray = (int)Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int)Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50)
);
$this->context->smarty->assign($pagination_infos);
$this->context->smarty->assign('comparator_max_item', (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'));
$this->context->smarty->assign('products', $products);
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>dibs</name>
<displayName><![CDATA[DIBS]]></displayName>
<version><![CDATA[1.0]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[DIBS payment API]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[payments_gateways]]></tab>
+12 -3
View File
@@ -79,6 +79,7 @@ class dibs extends PaymentModule
* @var array
*/
public static $dibs_subscription_link = array(
'fr' => 'http://www.dibspayment.com/order/fr_request/',
'en' => 'http://www.dibspayment.com/order/uk_request_2eng',
'da' => 'http://www.dibs.dk/bestil/internet/',
'sv' => 'http://www.dibs.se/bestall/internet/',
@@ -89,7 +90,7 @@ class dibs extends PaymentModule
{
$this->name = 'dibs';
$this->tab = 'payments_gateways';
$this->version = '1.0';
$this->version = '1.1';
$this->author = 'PrestaShop';
parent::__construct();
@@ -116,6 +117,13 @@ class dibs extends PaymentModule
$this->warning = $this->l('For security reasons, you must set key #1 and key #2 used by MD5 control of DIBS API.');
if (!self::$ID_MERCHANT OR self::$ID_MERCHANT === '')
$this->warning = $this->l('You have to set your merchant ID to use DIBS API.');
/* For 1.4.3 and less compatibility */
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
if (!Configuration::get('PS_OS_PAYMENT'))
foreach ($updateConfig as $u)
if (!Configuration::get($u) && defined('_'.$u.'_'))
Configuration::updateValue($u, constant('_'.$u.'_'));
}
public function install()
@@ -183,8 +191,9 @@ class dibs extends PaymentModule
private function _displayPresentation()
{
$href = '';
if (isset(dibs::$dibs_subscription_link[Configuration::get('PS_LANG_DEFAULT')]))
$href = dibs::$dibs_subscription_link[Configuration::get('PS_LANG_DEFAULT')];
$langIsoCode = Language::getIsoById(Configuration::get('PS_LANG_DEFAULT'));
if (isset(dibs::$dibs_subscription_link[$langIsoCode]))
$href = dibs::$dibs_subscription_link[$langIsoCode];
else
$href = dibs::$dibs_subscription_link['en'];
$out = '
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

+26 -8
View File
@@ -37,7 +37,7 @@ class Gsitemap extends Module
{
$this->name = 'gsitemap';
$this->tab = 'seo';
$this->version = '1.6';
$this->version = '1.7';
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -234,7 +234,7 @@ XML;
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_shop ='.$shopID.')
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (p.id_category_default = cl.id_category AND pl.id_lang = cl.id_lang AND cl.id_shop = '.$shopID.')
LEFT JOIN '._DB_PREFIX_.'image i ON p.id_product = i.id_product
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = pl.id_lang)
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image)
LEFT JOIN '._DB_PREFIX_.'lang l ON (pl.id_lang = l.id_lang)
WHERE l.`active` = 1
AND p.`active` = 1
@@ -243,7 +243,22 @@ XML;
ORDER BY pl.id_product, pl.id_lang ASC';
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
$tmp = null;
$res = null;
foreach($products AS $product)
{
if ($tmp == $product['id_product'])
$res[$tmp]['images'] []= array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
else
{
$tmp = $product['id_product'];
$res[$tmp] = $product;
unset($res[$tmp]['id_image'], $res[$tmp]['legend_image']);
$res[$tmp]['images'] []= array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
}
}
foreach ($res as $product)
{
if (($priority = 0.7 - ($product['level_depth'] / 10)) < 0.1)
$priority = 0.1;
@@ -316,12 +331,15 @@ XML;
private function _addSitemapNodeImage($xml, $product)
{
$image = $xml->addChild('image', null, 'http://www.google.com/schemas/sitemap-image/1.1');
$image->addChild('loc', htmlspecialchars($this->context->link->getImageLink($product['link_rewrite'], (int)$product['id_product'].'-'.(int)$product['id_image'])), 'http://www.google.com/schemas/sitemap-image/1.1');
$legend_image = preg_replace('/(&+)/i', '&amp;', $product['legend_image']);
$image->addChild('caption', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
$image->addChild('title', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
foreach ($product['images'] as $img)
{
$image = $xml->addChild('image', null, 'http://www.google.com/schemas/sitemap-image/1.1');
$image->addChild('loc', htmlspecialchars($this->context->link->getImageLink($product['link_rewrite'], (int)$product['id_product'].'-'.(int)$img['id_image'])), 'http://www.google.com/schemas/sitemap-image/1.1');
$legend_image = preg_replace('/(&+)/i', '&amp;', $img['legend_image']);
$image->addChild('caption', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
$image->addChild('title', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
}
}
private function _displaySitemap()
+2 -2
View File
@@ -79,7 +79,7 @@ class StatsLive extends Module
*/
private function getVisitorsOnline()
{
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
{
$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, pt.name as page
FROM `'._DB_PREFIX_.'connections` c
@@ -90,7 +90,7 @@ class StatsLive extends Module
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
'.$this->sqlShopRestriction(false, 'c').'
AND cp.`time_end` IS NULL
AND cp.`time_start` > '.strtotime('-15 minutes').'
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
GROUP BY c.id_connections
ORDER BY c.date_add DESC';
}
+5 -1
View File
@@ -25,6 +25,10 @@
*/
$('document').ready(function(){
reloadProductComparison();
});
reloadProductComparison = function() {
$('a.cmp_remove').click(function(){
var idProduct = $(this).attr('rel').replace('ajax_id_product_', '');
@@ -75,4 +79,4 @@ $('document').ready(function(){
});
}
});
});
}