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

This commit is contained in:
vAugagneur
2013-04-16 11:35:33 +02:00
25 changed files with 101 additions and 647 deletions
@@ -116,6 +116,8 @@
{if isset($params.color) && isset($tr.color)}
</span>
{/if}
{/block}
{block name="close_td"}
</td>
{/block}
{/foreach}
+5 -5
View File
@@ -1079,12 +1079,12 @@ class CartRuleCore extends ObjectModel
if (!CartRule::isFeatureActive() || !Validate::isLoadedObject($context->cart))
return;
$result = Db::getInstance()->executeS('
$sql = '
SELECT cr.*
FROM '._DB_PREFIX_.'cart_rule cr
LEFT JOIN '._DB_PREFIX_.'cart_rule_shop crs ON cr.id_cart_rule = crs.id_cart_rule
LEFT JOIN '._DB_PREFIX_.'cart_rule_carrier crca ON cr.id_cart_rule = crca.id_cart_rule
'.($context->cart->id_carrier ? 'INNER JOIN '._DB_PREFIX_.'carrier c ON (c.id_reference = crca.id_carrier AND c.deleted = 0)' : '').'
'.($context->cart->id_carrier ? 'LEFT JOIN '._DB_PREFIX_.'carrier c ON (c.id_reference = crca.id_carrier AND c.deleted = 0)' : '').'
LEFT JOIN '._DB_PREFIX_.'cart_rule_country crco ON cr.id_cart_rule = crco.id_cart_rule
WHERE cr.active = 1
AND cr.code = ""
@@ -1108,7 +1108,7 @@ class CartRuleCore extends ObjectModel
'.($context->customer->id ? 'OR 0 < (
SELECT cg.id_group
FROM '._DB_PREFIX_.'customer_group cg
LEFT JOIN '._DB_PREFIX_.'cart_rule_group crg ON cg.id_group = crg.id_group
LEFT JOIN '._DB_PREFIX_.'cart_rule_group crg ON (cg.id_group = crg.id_group AND cg.id_group = '.(int)$context->customer->id_default_group.')
WHERE cr.id_cart_rule = crg.id_cart_rule
AND cg.id_customer = '.(int)$context->customer->id.' LIMIT 1
)' : '').'
@@ -1122,8 +1122,8 @@ class CartRuleCore extends ObjectModel
)
)
AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$context->cart->id.')
ORDER BY priority');
ORDER BY priority';
$result = Db::getInstance()->executeS($sql);
if ($result)
{
$cart_rules = ObjectModel::hydrateCollection('CartRule', $result);
+14 -18
View File
@@ -600,25 +600,14 @@ class AdminModulesControllerCore extends AdminController
foreach ($modules as $name)
{
$full_report = null;
if ($key == 'update')
{
if (ConfigurationTest::test_dir('modules/'.$name, true, $full_report))
Tools::deleteDirectory('../modules/'.$name.'/');
else
{
$module = Module::getInstanceByName(urldecode($name));
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded : ", $module->displayName)).$full_report;
continue;
}
}
// If Addons module, download and unzip it before installing it
if (!file_exists('../modules/'.$name.'/'.$name.'.php'))
if (!file_exists('../modules/'.$name.'/'.$name.'.php') || $key == 'update')
{
$filesList = array(
array('type' => 'addonsNative', 'file' => Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 'loggedOnAddons' => 0),
array('type' => 'addonsBought', 'file' => Module::CACHE_FILE_CUSTOMER_MODULES_LIST, 'loggedOnAddons' => 1),
);
foreach ($filesList as $f)
if (file_exists(_PS_ROOT_DIR_.$f['file']))
{
@@ -628,12 +617,19 @@ class AdminModulesControllerCore extends AdminController
foreach ($xml->module as $modaddons)
if ($name == $modaddons->name && isset($modaddons->id) && ($this->logged_on_addons || $f['loggedOnAddons'] == 0))
{
$download_ok = false;
if ($f['loggedOnAddons'] == 0)
if (file_put_contents('../modules/'.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id)))))
$this->extractArchive('../modules/'.$modaddons->name.'.zip', false);
if ($f['loggedOnAddons'] == 1 && $this->logged_on_addons)
if (file_put_contents('../modules/'.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons))))))
$this->extractArchive('../modules/'.$modaddons->name.'.zip', false);
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id)))))
$download_ok = true;
elseif ($f['loggedOnAddons'] == 1 && $this->logged_on_addons)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons))))))
$download_ok = true;
if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version');
else
if(!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
}
}
}
-1
View File
@@ -347,7 +347,6 @@ class OrderControllerCore extends ParentOrderController
$this->context->smarty->assign(
array(
'free_shipping' => false, // Deprecated since a cart rule can be applied the specific carriers only
'is_guest' => (isset($this->context->customer->is_guest) ? $this->context->customer->is_guest : 0)
));
}
+12 -2
View File
@@ -316,7 +316,7 @@ class OrderOpcControllerCore extends ParentOrderController
// If a rule offer free-shipping, force hidding shipping prices
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule)
if ($rule['free_shipping'])
if ($rule['free_shipping'] && !$rule['carrier_restriction'])
{
$free_shipping = true;
break;
@@ -498,9 +498,19 @@ class OrderOpcControllerCore extends ParentOrderController
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
$oldMessage = Message::getMessageByCartId((int)($this->context->cart->id));
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule)
{
if ($rule['free_shipping'] && !$rule['carrier_restriction'])
{
$free_shipping = true;
break;
}
}
$vars = array(
'free_shipping' => false, // Deprecated since a cart rule can be applied the specific carriers only
'free_shipping' => $free_shipping,
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
'giftAllowed' => (int)(Configuration::get('PS_GIFT_WRAPPING')),
+16 -4
View File
@@ -30,6 +30,8 @@
class FreeOrder extends PaymentModule
{
public $active = 1;
public $name = 'free_order';
public $displayName = 'free_order';
}
class ParentOrderControllerCore extends FrontController
@@ -454,15 +456,15 @@ class ParentOrderControllerCore extends FrontController
}
protected function _assignCarrier()
{
{
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
$carriers = $this->context->cart->simulateCarriersOutput();
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
$this->setDefaultCarrierSelection($delivery_option_list);
$this->context->smarty->assign(array(
$this->context->smarty->assign(array(
'address_collection' => $this->context->cart->getAddressCollection(),
'delivery_option_list' => $delivery_option_list,
'carriers' => $carriers,
@@ -497,8 +499,18 @@ class ParentOrderControllerCore extends FrontController
$this->link_conditions .= '?content_only=1';
else
$this->link_conditions .= '&content_only=1';
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule)
{
if ($rule['free_shipping'] && !$rule['carrier_restriction'])
{
$free_shipping = true;
break;
}
}
$this->context->smarty->assign(array(
'free_shipping' => $free_shipping,
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
'giftAllowed' => (int)(Configuration::get('PS_GIFT_WRAPPING')),
+1 -1
View File
@@ -95,7 +95,7 @@ class Datas
),
'shop_activity' => array(
'name' => 'activity',
'default' => 1,
'default' => 0,
'validate' => 'isInt',
),
'shop_country' => array(
+22 -21
View File
@@ -227,28 +227,29 @@ class InstallControllerHttpConfigure extends InstallControllerHttp
{
// List of activities
$list_activities = array(
$this->l('Lingerie and Adult'),
$this->l('Animals and Pets'),
$this->l('Art and Culture'),
$this->l('Babies'),
$this->l('Beauty and Personal Care'),
$this->l('Cars'),
$this->l('Computer Hardware and Software'),
$this->l('Download'),
$this->l('Fashion and accessories'),
$this->l('Flowers, Gifts and Crafts'),
$this->l('Food and beverage'),
$this->l('HiFi, Photo and Video'),
$this->l('Home and Garden'),
$this->l('Home Appliances'),
$this->l('Jewelry'),
$this->l('Mobile and Telecom'),
$this->l('Services'),
$this->l('Shoes and accessories'),
$this->l('Sports and Entertainment'),
$this->l('Travel'),
1 => $this->l('Lingerie and Adult'),
2 => $this->l('Animals and Pets'),
3 => $this->l('Art and Culture'),
4 => $this->l('Babies'),
5 => $this->l('Beauty and Personal Care'),
6 => $this->l('Cars'),
7 => $this->l('Computer Hardware and Software'),
8 => $this->l('Download'),
9 => $this->l('Fashion and accessories'),
10 => $this->l('Flowers, Gifts and Crafts'),
11 => $this->l('Food and beverage'),
12 => $this->l('HiFi, Photo and Video'),
13 => $this->l('Home and Garden'),
14 => $this->l('Home Appliances'),
15 => $this->l('Jewelry'),
16 => $this->l('Mobile and Telecom'),
17 => $this->l('Services'),
18 => $this->l('Shoes and accessories'),
19 => $this->l('Sports and Entertainment'),
20 => $this->l('Travel'),
);
sort($list_activities);
asort($list_activities);
$this->list_activities = $list_activities;
// Countries list
-1
View File
@@ -557,7 +557,6 @@ class InstallModelInstall extends InstallAbstractModel
'graphvisifire',
'graphxmlswfcharts',
'gridhtml',
'gsitemap',
'homefeatured',
'homeslider',
'pagesnotfound',
+1 -1
View File
@@ -26,7 +26,7 @@ var default_iso = '<?php echo $this->session->shop_country ?>';
<select id="infosActivity" name="shop_activity" class="chosen">
<option value="0" style="font-weight: bold" <?php if (!$this->session->shop_activity): ?>selected="selected"<?php endif; ?>><?php echo $this->l('Please choose your main activity') ?></option>
<?php foreach ($this->list_activities as $i => $activity): ?>
<option value="<?php echo $i ?>" <?php if ($this->session->shop_activity == $i): ?>selected="selected"<?php endif; ?>><?php echo $activity ?></option>
<option value="<?php echo $i ?>" <?php if (isset($this->session->shop_activity) && $this->session->shop_activity == $i): ?>selected="selected"<?php endif; ?>><?php echo $activity ?></option>
<?php endforeach; ?>
<option value="0"><?php echo $this->l('Other activity...') ?></option>
</select>
+4 -3
View File
@@ -31,9 +31,10 @@
var imageWidth = $(this).get(0).offsetWidth;
var imageHeight = $(this).get(0).offsetHeight;
noalt = $(this).attr("alt");
attr = typeof($(this).attr("rel")) != 'undefined' ? "rel" : "alt";
noalt = $(this).attr(attr);
var bigimage = noalt;
$(this).attr("alt", '');
$(this).attr(attr, '');
if($("div.zoomdiv").get().length == 0)
$(this).after("<div class='zoomdiv'><img class='bigimg' src='"+bigimage+"'/></div>");
@@ -67,7 +68,7 @@
$("div.zoomdiv").get(0).scrollLeft = (scrollx) * scalex ;
});
}, function() {
$(this).attr("alt", noalt);
$(this).attr(attr, noalt);
$("div.zoomdiv").hide();
$(document.body).unbind("mousemove");
$(".lenszoom").remove();
+2 -2
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockadvertising</name>
<displayName><![CDATA[Block advertising]]></displayName>
<displayName><![CDATA[Bloc publicit&eacute;]]></displayName>
<version><![CDATA[0.5]]></version>
<description><![CDATA[Adds an advertisement block to selected sections of your e-commerce webiste.]]></description>
<description><![CDATA[Ajoute un bloc affichant une publicit&eacute;]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[advertising_marketing]]></tab>
<is_configurable>1</is_configurable>
+2 -5
View File
@@ -116,8 +116,7 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
</dl>
{/if}
<p {if $products}class="hidden"{/if} id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
{if $discounts|@count > 0}
<table id="vouchers">
<table id="vouchers"{if $discounts|@count == 0} style="display:none;"{/if}>
<tbody>
{foreach from=$discounts item=discount}
{if $discount.value_real > 0}
@@ -132,11 +131,9 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
</td>
</tr>
{/if}
{/foreach}
{/foreach}
</tbody>
</table>
{/if}
<p id="cart-prices">
<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span>
<span>{l s='Shipping' mod='blockcart'}</span>
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>gsitemap</name>
<displayName><![CDATA[Google sitemap]]></displayName>
<version><![CDATA[1.9]]></version>
<description><![CDATA[Generate your Google sitemap file.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[seo]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
-19
View File
@@ -1,19 +0,0 @@
<?php
include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/gsitemap.php');
if (substr(Tools::encrypt('gsitemap/cron'), 0, 10) != Tools::getValue('token') || !Module::isInstalled('gsitemap'))
die('Bad token');
$gsitemap = new Gsitemap();
if (!defined('_PS_BASE_URL_'))
define('_PS_BASE_URL_', Tools::getShopDomain(true));
if (!defined('_PS_BASE_URL_SSL_'))
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
$context = Context::getContext();
$context->link = new Link();
echo $gsitemap->generateSitemapIndex();
-460
View File
@@ -1,460 +0,0 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_'))
exit;
class Gsitemap extends Module
{
private $_html = '';
private $_postErrors = array();
public function __construct()
{
$this->name = 'gsitemap';
$this->tab = 'seo';
$this->version = '1.9';
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Google sitemap');
$this->description = $this->l('Generate your Google sitemap file.');
if (!defined('GSITEMAP_FILE'))
define('GSITEMAP_FILE', dirname(__FILE__).'/../../sitemap.xml');
}
public function uninstall()
{
file_put_contents(GSITEMAP_FILE, '');
return parent::uninstall();
}
private function _postValidation()
{
file_put_contents(GSITEMAP_FILE, '');
if (!($fp = fopen(GSITEMAP_FILE, 'w')))
$this->_postErrors[] = sprintf($this->l('Cannot create %ssitemap.xml file..'), realpath(dirname(__FILE__.'/../..')).'/');
else
fclose($fp);
}
private function getUrlWith($url, $key, $value)
{
if (empty($value))
return $url;
if (strpos($url, '?') !== false)
return $url.'&'.$key.'='.$value;
return $url.'?'.$key.'='.$value;
}
private function _postProcess()
{
Configuration::updateValue('GSITEMAP_ALL_CMS', (int)Tools::getValue('GSITEMAP_ALL_CMS'));
Configuration::updateValue('GSITEMAP_ALL_PRODUCTS', (int)Tools::getValue('GSITEMAP_ALL_PRODUCTS'));
if (Shop::isFeatureActive())
$res = $this->generateSitemapIndex();
else
$res = $this->generateSitemap(Configuration::get('PS_SHOP_DEFAULT'), GSITEMAP_FILE);
$this->_html .= '<h3 class="'. ($res ? 'conf confirm' : 'alert error') .'" style="margin-bottom: 20px">';
$this->_html .= $res ? $this->l('Sitemap file generated.') : $this->l('Error while creating sitemap file.');
$this->_html .= '</h3>';
}
/**
* Generate sitemap index to reference the sitemap of each shop
*
* @return bool
*/
public function generateSitemapIndex()
{
$xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
</sitemapindex>
XML;
$xml = new SimpleXMLElement($xmlString);
$sql = 'SELECT s.id_shop, su.domain, su.domain_ssl, CONCAT(su.physical_uri, su.virtual_uri) as uri
FROM '._DB_PREFIX_.'shop s
INNER JOIN '._DB_PREFIX_.'shop_url su ON s.id_shop = su.id_shop AND su.main = 1
WHERE s.active = 1
AND s.deleted = 0
AND su.active = 1';
if (!$result = Db::getInstance()->executeS($sql))
return false;
$res = true;
foreach ($result as $row)
{
$info = pathinfo(GSITEMAP_FILE);
$filename = $info['filename'].'-'.$row['id_shop'].'.'.$info['extension'];
$replaceUrl = array('http://'.$row['domain'].$row['uri'], ((Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$row['domain_ssl'].$row['uri']);
$last = $this->generateSitemap($row['id_shop'], $info['dirname'].'/'.$filename, $replaceUrl);
if ($last)
{
$this->_addSitemapIndexNode($xml, 'http://'.$row['domain'].(($row['uri']) ? $row['uri'] : '/').$filename, date('Y-m-d'));
}
$res &= $last;
}
$fp = fopen(GSITEMAP_FILE, 'w');
fwrite($fp, $xml->asXML());
fclose($fp);
return $res && file_exists(GSITEMAP_FILE);
}
/**
* Generate a sitemap for a shop
*
* @param int $id_shop
* @param string $filename
* @return bool
*/
private function generateSitemap($id_shop, $filename = '', $replace_url = array())
{
$langs = Language::getLanguages();
$shop = new Shop($id_shop);
if (!$shop->id)
return false;
$xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
</urlset>
XML;
$xml = new SimpleXMLElement($xmlString);
if (Configuration::get('PS_REWRITING_SETTINGS') && count($langs) > 1)
foreach($langs as $lang)
{
$this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__.$lang['iso_code'].'/', '1.00', 'daily', date('Y-m-d'));
}
else
$this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__, '1.00', 'daily', date('Y-m-d'));
/* Product Generator */
$sql = 'SELECT p.id_product, pl.link_rewrite, DATE_FORMAT(IF(ps.date_upd,ps.date_upd,ps.date_add), \'%Y-%m-%d\') date_upd, pl.id_lang, cl.`link_rewrite` category, ean13, i.id_image, il.legend legend_image, (
SELECT MIN(level_depth)
FROM '._DB_PREFIX_.'product p2
'.Shop::addSqlAssociation('product', 'p2').'
LEFT JOIN '._DB_PREFIX_.'category_product cp2 ON p2.id_product = cp2.id_product
LEFT JOIN '._DB_PREFIX_.'category c2 ON cp2.id_category = c2.id_category
WHERE p2.id_product = p.id_product AND product_shop.`active` = 1 AND c2.`active` = 1) AS level_depth
FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_shop ps ON (ps.id_product = p.id_product AND ps.id_shop = '.(int)$id_shop.')
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (ps.id_category_default = cl.id_category AND pl.id_lang = cl.id_lang AND cl.id_shop = '.(int)$id_shop.')
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)
LEFT JOIN '._DB_PREFIX_.'lang l ON (pl.id_lang = l.id_lang)
WHERE l.`active` = 1
AND ps.`active` = 1
AND ps.id_shop = '.(int)$id_shop.'
'.(Configuration::get('GSITEMAP_ALL_PRODUCTS') ? '' : 'HAVING level_depth IS NOT NULL').'
ORDER BY pl.id_product, pl.id_lang ASC';
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
// array used to know which product/image was already added (blacklist)
$done = null;
$sitemap = null;
// iterates on the products, to gather the image ids
while ($product = Db::getInstance()->nextRow($resource))
{
// if the product has not been added
$id_product = $product['id_product'];
if (!isset($done[$id_product]['added']))
{
// priority
if (($priority = 0.7 - ($product['level_depth'] / 10)) < 0.1)
$priority = 0.1;
// adds the product
$tmpLink = $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang']));
$sitemap = $this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($product['date_upd'], 0, 10));
// considers the product has added
$done[$id_product]['added'] = true;
}
// if the image has not been added
$id_image = $product['id_image'];
if (!isset($done[$id_product][$id_image]) && $id_image)
{
// adds the image
$this->_addSitemapNodeImage($sitemap, $product);
// considers the image as added
$done[$id_product][$id_image] = true;
}
}
/* Categories Generator */
if (Configuration::get('PS_REWRITING_SETTINGS'))
$categories = Db::getInstance()->executeS('
SELECT c.id_category, c.level_depth, link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, cl.id_lang
FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON c.id_category = cl.id_category
LEFT JOIN '._DB_PREFIX_.'lang l ON cl.id_lang = l.id_lang
WHERE l.`active` = 1 AND c.`active` = 1 AND c.id_category != 1
ORDER BY cl.id_category, cl.id_lang ASC');
else
$categories = Db::getInstance()->executeS(
'SELECT c.id_category, c.level_depth, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd
FROM '._DB_PREFIX_.'category c
ORDER BY c.id_category ASC');
foreach($categories as $category)
{
if (($priority = 0.9 - ($category['level_depth'] / 10)) < 0.1)
$priority = 0.1;
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ?
$this->context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang'])
: $this->context->link->getCategoryLink((int)$category['id_category']);
$this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($category['date_upd'], 0, 10));
}
/* CMS Generator */
if (Configuration::get('GSITEMAP_ALL_CMS') || !Module::isInstalled('blockcms'))
$sql_cms = '
SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms').
' FROM '._DB_PREFIX_.'cms_lang cl
LEFT JOIN '._DB_PREFIX_.'lang l ON (cl.id_lang = l.id_lang)
WHERE l.`active` = 1
ORDER BY cl.id_cms, cl.id_lang ASC';
else if (Module::isInstalled('blockcms'))
$sql_cms = '
SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms').
' FROM '._DB_PREFIX_.'cms_block_page b
LEFT JOIN '._DB_PREFIX_.'cms_lang cl ON (b.id_cms = cl.id_cms)
LEFT JOIN '._DB_PREFIX_.'lang l ON (cl.id_lang = l.id_lang)
WHERE l.`active` = 1
ORDER BY cl.id_cms, cl.id_lang ASC';
$cmss = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql_cms);
foreach($cmss as $cms)
{
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ?
$this->context->link->getCMSLink((int)$cms['id_cms'], $cms['link_rewrite'], false, (int)$cms['id_lang'])
: $this->context->link->getCMSLink((int)$cms['id_cms']);
$this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily');
}
/* Add classic pages (contact, best sales, new products...) */
$pages = array(
'supplier' => false,
'manufacturer' => false,
'new-products' => false,
'prices-drop' => false,
'stores' => false,
'authentication' => true,
'best-sales' => false,
'contact-form' => true);
// Don't show suppliers and manufacturers if they are disallowed
if (!Module::getInstanceByName('blockmanufacturer')->id && !Configuration::get('PS_DISPLAY_SUPPLIERS'))
unset($pages['manufacturer']);
if (!Module::getInstanceByName('blocksupplier')->id && !Configuration::get('PS_DISPLAY_SUPPLIERS'))
unset($pages['supplier']);
// Generate nodes for pages
if(Configuration::get('PS_REWRITING_SETTINGS'))
foreach ($pages as $page => $ssl)
foreach($langs as $lang)
$this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl, $lang['id_lang']), '0.5', 'monthly');
else
foreach($pages as $page => $ssl)
$this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl), '0.5', 'monthly');
$xml_string = $xml->asXML();
// Replace URL in XML strings by real shops URL
if ($replace_url)
$xml_string = str_replace(array(Tools::getShopDomain(true).__PS_BASE_URI__, Tools::getShopDomainSsl(true).__PS_BASE_URI__), $replace_url, $xml_string);
$fp = fopen($filename, 'w');
fwrite($fp, $xml_string);
fclose($fp);
return file_exists($filename);
}
private function _addSitemapIndexNode($xml, $loc, $last_mod)
{
$sitemap = $xml->addChild('sitemap');
$sitemap->addChild('loc', htmlspecialchars($loc));
$sitemap->addChild('lastmod', $last_mod);
return $sitemap;
}
private function _addSitemapNode($xml, $loc, $priority, $change_freq, $last_mod = NULL)
{
$sitemap = $xml->addChild('url');
$sitemap->addChild('loc', htmlspecialchars($loc));
$sitemap->addChild('priority', number_format($priority,1,'.',''));
if ($last_mod)
$sitemap->addChild('lastmod', $last_mod);
$sitemap->addChild('changefreq', $change_freq);
return $sitemap;
}
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');
}
private function _displaySitemap()
{
if (Shop::isFeatureActive())
{
$sql = 'SELECT s.id_shop, su.domain, su.domain_ssl, CONCAT(su.physical_uri, su.virtual_uri) as uri
FROM '._DB_PREFIX_.'shop s
INNER JOIN '._DB_PREFIX_.'shop_url su ON s.id_shop = su.id_shop AND su.main = 1
WHERE s.active = 1
AND s.deleted = 0
AND su.active = 1';
if (!$result = Db::getInstance()->executeS($sql))
return '';
$this->_html .= '<h2>'.$this->l('Sitemap index').'</h2>';
$this->_html .= '<p>'.$this->l('Your Google sitemap file is online at the following address:').'<br />
<a href="'.Tools::getShopDomain(true, true).__PS_BASE_URI__.'sitemap.xml" target="_blank"><b>'.Tools::getShopDomain(true, true).__PS_BASE_URI__.'sitemap.xml</b></a></p><br />';
$info = pathinfo(GSITEMAP_FILE);
foreach ($result as $shop)
{
$filename = $info['dirname'].'/'.$info['filename'].'-'.$shop['id_shop'].'.'.$info['extension'];
if (file_exists($filename) && filesize($filename))
{
$fp = fopen($filename, 'r');
$fstat = fstat($fp);
fclose($fp);
$xml = simplexml_load_file($filename);
$nbPages = count($xml->url);
$sitemap_uri = 'http://'.$shop['domain'].$shop['uri'].$info['filename'].'-'.$shop['id_shop'].'.'.$info['extension'];
$this->_html .= '<h2>'.$this->l('Sitemap for: ').$shop['domain'].$shop['uri'].'</h2>';
$this->_html .= '<p>'.$this->l('Your Google sitemap file is online at the following address:').'<br />
<a href="'.$sitemap_uri.'" target="_blank"><b>'.$sitemap_uri.'</b></a></p><br />';
$this->_html .= $this->l('Update:').' <b>'.utf8_encode(strftime('%A %d %B %Y %H:%M:%S',$fstat['mtime'])).'</b><br />';
$this->_html .= $this->l('Filesize:').' <b>'.number_format(($fstat['size']*.000001), 3).'MB</b><br />';
$this->_html .= $this->l('Indexed pages:').' <b>'.$nbPages.'</b><br /><br />';
}
}
}
elseif (file_exists(GSITEMAP_FILE) && filesize(GSITEMAP_FILE))
{
$fp = fopen(GSITEMAP_FILE, 'r');
$fstat = fstat($fp);
fclose($fp);
$xml = simplexml_load_file(GSITEMAP_FILE);
$nbPages = count($xml->url);
$this->_html .= '<p>'.$this->l('Your Google sitemap file is online at the following address:').'<br />
<a href="'.Tools::getShopDomain(true, true).__PS_BASE_URI__.'sitemap.xml" target="_blank"><b>'.Tools::getShopDomain(true, true).__PS_BASE_URI__.'sitemap.xml</b></a></p><br />';
$this->_html .= $this->l('Update:').' <b>'.utf8_encode(strftime('%A %d %B %Y %H:%M:%S',$fstat['mtime'])).'</b><br />';
$this->_html .= $this->l('Filesize:').' <b>'.number_format(($fstat['size']*.000001), 3).'MB</b><br />';
$this->_html .= $this->l('Indexed pages:').' <b>'.$nbPages.'</b><br /><br />';
}
}
private function _displayForm()
{
if (Tools::usingSecureMode())
$domain = Tools::getShopDomainSsl(true);
else
$domain = Tools::getShopDomain(true);
$this->_html .= '
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">
<div style="margin:0 0 20px 0;">
<input type="checkbox" name="GSITEMAP_ALL_PRODUCTS" id="GSITEMAP_ALL_PRODUCTS" style="vertical-align: middle;" value="1" '.(Configuration::get('GSITEMAP_ALL_PRODUCTS') ? 'checked="checked"' : '').' /> <label class="t" for="GSITEMAP_ALL_PRODUCTS">'.$this->l('Sitemap also includes products from inactive categories.').'</label>
</div>
<div style="margin:0 0 20px 0;">
<input type="checkbox" name="GSITEMAP_ALL_CMS" id="GSITEMAP_ALL_CMS" style="vertical-align: middle;" value="1" '.(Configuration::get('GSITEMAP_ALL_CMS') ? 'checked="checked"' : '').' /> <label class="t" for="GSITEMAP_ALL_CMS">'.$this->l('Sitemap also includes CMS pages not found in a CMS block.').'</label>
</div>
<input name="btnSubmit" class="button" type="submit"
value="'.((!file_exists(GSITEMAP_FILE)) ? $this->l('Generate a sitemap file.') : $this->l('Update the sitemap file.')).'" />
</form><br />
<h2>'.$this->l('Use cron job to re-build the sitemap:').'</h2>
<p>
<b>'.$domain.__PS_BASE_URI__.'modules/gsitemap/gsitemap-cron.php?&token='.substr(Tools::encrypt('gsitemap/cron'),0,10).'&GSITEMAP_ALL_CMS='.((int)Configuration::get('GSITEMAP_ALL_CMS')).'&GSITEMAP_ALL_PRODUCTS='.((int)Configuration::get('GSITEMAP_ALL_PRODUCTS')).'</b>
</p>';
}
public function getContent()
{
if (Tools::isSubmit('btnSubmit'))
{
$this->_postValidation();
if (!count($this->_postErrors))
$this->_postProcess();
else
foreach ($this->_postErrors as $err)
$this->_html .= '<div class="alert error">'.$err.'</div>';
}
$this->_html .= '
<fieldset>
<legend>'.$this->l('Search Engine Optimization (SEO).').'</legend>
<br />
'.$this->l('See').' <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156184&from=40318&rd=1" style="font-weight:bold;text-decoration:underline;" target="_blank">
'.$this->l('This page').'</a> '.$this->l('For more information').'
<br />';
$this->_displaySitemap();
$this->_displayForm();
$this->_html .= '</fieldset>';
return $this->_html;
}
}
-35
View File
@@ -1,35 +0,0 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

-35
View File
@@ -1,35 +0,0 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;
+1 -1
View File
@@ -70,7 +70,7 @@ $(document).ready(function() {
</script>
<h1>{if !isset($email_create)}{l s='Log in'}{else}{l s='Create an account'}{/if}</h1>
{if !isset($back) || $back != 'my-account'}{assign var='current_step' value='login'}{include file="$tpl_dir./order-steps.tpl"}{/if}
{include file="$tpl_dir./errors.tpl"}
{assign var='stateExist' value=false}
{if !isset($email_create)}
+2 -1
View File
@@ -424,7 +424,7 @@ function displayImage(domAAroundImgThumb, no_animation)
{
$('#bigpic').attr('src', newSrc);
if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled)
$(this).attr('alt', domAAroundImgThumb.attr('href'));
$('#bigpic').attr('rel', domAAroundImgThumb.attr('href'));
}
$('#views_block li a').removeClass('shown');
$(domAAroundImgThumb).addClass('shown');
@@ -528,6 +528,7 @@ $(document).ready(function()
//set jqZoom parameters if needed
if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled)
{
$('#bigpic').attr('rel', $('#bigpic').attr('src').replace('thickbox', 'large'));
$('img.jqzoom').jqueryzoom({
xzoom: 200, //zooming div default width(default width value is 200)
yzoom: 200, //zooming div default width(default height value is 200)
+15 -18
View File
@@ -116,27 +116,24 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
</dl>
{/if}
<p class="cart_block_no_products{if $products} hidden{/if}" id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
{if $discounts|@count > 0}
<table id="vouchers">
<table id="vouchers"{if $discounts|@count == 0} style="display:none;"{/if}>
<tbody>
{foreach from=$discounts item=discount}
{if $discount.value_real > 0}
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
<td class="quantity">1x</td>
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
<td class="delete">
{if strlen($discount.code)}
<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
{/if}
</td>
</tr>
{foreach from=$discounts item=discount}
{if $discount.value_real > 0}
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
<td class="quantity">1x</td>
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
<td class="delete">
{if strlen($discount.code)}
<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
{/if}
{/foreach}
</td>
</tr>
{/if}
{/foreach}
</tbody>
</table>
{/if}
</table>
<p id="cart-prices">
<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span>
<span>{l s='Shipping' mod='blockcart'}</span>
+1 -1
View File
@@ -170,7 +170,7 @@
</td>
<td>
<div class="delivery_option_price">
{if $option.total_price_with_tax && !$free_shipping}
{if $option.total_price_with_tax && (!isset($free_shipping) || (isset($free_shipping) && !$free_shipping))}
{if $use_taxes == 1}
{convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'}
{else}
+1 -1
View File
@@ -183,7 +183,7 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
<div id="image-block">
{if $have_image}
<span id="view_full_size">
<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}" {if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox_default')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}" />
<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}"{if $jqZoomEnabled} class="jqzoom"{/if} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}"/>
<span class="span_link">{l s='Maximize'}</span>
</span>
{else}