git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7522 b9a71923-0436-4b27-9f14-aed3839534dd

This commit is contained in:
rGaillard
2011-07-06 10:10:43 +00:00
parent 9ff675b1e2
commit 69f2f09dc5
4695 changed files with 0 additions and 339293 deletions
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>crossselling</name>
<displayName>Cross Selling</displayName>
<version>0.1</version>
<description>Customers who bought this product also bought:</description>
<author>PrestaShop</author>
<tab>front_office_features</tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
</module>
-146
View File
@@ -1,146 +0,0 @@
<?php
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_CAN_LOAD_FILES_'))
exit;
class CrossSelling extends Module
{
private $_html;
public function __construct()
{
$this->name = 'crossselling';
$this->tab = 'front_office_features';
$this->version = 0.1;
$this->author = 'PrestaShop';
parent::__construct();
$this->displayName = $this->l('Cross Selling');
$this->description = $this->l('Customers who bought this product also bought:');
}
public function install()
{
if (!parent::install() OR
!$this->registerHook('productFooter') OR
!$this->registerHook('header') OR
!Configuration::updateValue('CROSSSELLING_DISPLAY_PRICE', 0))
return false;
return true;
}
public function uninstall()
{
if (!parent::uninstall() OR
!Configuration::deleteByName('CROSSSELLING_DISPLAY_PRICE'))
return false;
return true;
}
public function getContent()
{
$this->_html = '';
if (Tools::isSubmit('submitCross') AND Tools::getValue('displayPrice') != 0 AND Tools::getValue('displayPrice') != 1)
$this->_html .= $this->displayError('Invalid displayPrice');
elseif (Tools::isSubmit('submitCross'))
{
Configuration::updateValue('CROSSSELLING_DISPLAY_PRICE', Tools::getValue('displayPrice'));
$this->_html .= $this->displayConfirmation($this->l('Settings updated succesfully'));
}
$this->_html .= '
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
<label>'.$this->l('Display price on products').'</label>
<div class="margin-form">
<input type="radio" name="displayPrice" id="display_on" value="1" '.(Configuration::get('CROSSSELLING_DISPLAY_PRICE') ? 'checked="checked" ' : '').'/>
<label class="t" for="display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
<input type="radio" name="displayPrice" id="display_off" value="0" '.(!Configuration::get('CROSSSELLING_DISPLAY_PRICE') ? 'checked="checked" ' : '').'/>
<label class="t" for="display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
<p class="clear">'.$this->l('Show the price on the products in the block.').'</p>
</div>
<center><input type="submit" name="submitCross" value="'.$this->l('Save').'" class="button" /></center>
</fieldset>
</form>';
return $this->_html;
}
public function hookHeader()
{
Tools::addCSS(($this->_path).'crossselling.css', 'all');
}
/**
* Returns module content for left column
*/
public function hookProductFooter($params)
{
global $smarty, $cookie, $link;
$orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT o.id_order
FROM '._DB_PREFIX_.'orders o
LEFT JOIN '._DB_PREFIX_.'order_detail od ON (od.id_order = o.id_order)
WHERE o.valid = 1 AND od.product_id = '.(int)$params['product']->id);
if (sizeof($orders))
{
$list = '';
foreach ($orders AS $order)
$list .= (int)$order['id_order'].',';
$list = rtrim($list, ',');
$orderProducts = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default)
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)($cookie->id_lang).' AND cl.id_lang = '.(int)($cookie->id_lang).'
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
ORDER BY RAND()
LIMIT 10');
$taxCalc = Product::getTaxCalculationMethod();
foreach ($orderProducts AS &$orderProduct)
{
$orderProduct['image'] = $link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium');
$orderProduct['link'] = $link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']);
if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2))
$orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL);
elseif (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND $taxCalc == 1)
$orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL);
}
$smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0),
'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE')));
}
return $this->display(__FILE__, 'crossselling.tpl');
}
}
-59
View File
@@ -1,59 +0,0 @@
{*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if isset($orderProducts) && count($orderProducts)}
<div id="crossselling">
<script type="text/javascript">var middle = {$middlePosition_crossselling};</script>
<script type="text/javascript" src="{$content_dir}modules/crossselling/js/crossselling.js"></script>
<h2 class="productscategory_h2">{l s='Customers who bought this product also bought:' mod='crossselling'}</h2>
<div id="{if count($orderProducts) > 5}crossselling{else}crossselling_noscroll{/if}">
{if count($orderProducts) > 5}<a id="crossselling_scroll_left" title="{l s='Previous' mod='crossselling'}" href="javascript:{ldelim}{rdelim}">{l s='Previous' mod='crossselling'}</a>{/if}
<div id="crossselling_list">
<ul {if count($orderProducts) > 5}style="width: {math equation="width * nbImages" width=107 nbImages=$orderProducts|@count}px"{/if}>
{foreach from=$orderProducts item='orderProduct' name=orderProduct}
<li {if count($orderProducts) < 6}style="width: {math equation="width / nbImages" width=94 nbImages=$orderProducts|@count}%"{/if}>
<a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}">
<img src="{$orderProduct.image}" alt="{$orderProduct.name|htmlspecialchars}" />
</a><br/>
<a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}">
{$orderProduct.name|truncate:15:'...'|escape:'htmlall':'UTF-8'}
</a><br />
{if $crossDisplayPrice AND $orderProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<span class="price_display">
<span class="price">{convertPrice price=$orderProduct.displayed_price}</span>
</span><br />
{else}
<br />
{/if}
<a title="{l s='View' mod='crossselling'}" href="{$orderProduct.link}" class="button_small">{l s='View' mod='crossselling'}</a><br />
</li>
{/foreach}
</ul>
</div>
{if count($orderProducts) > 5}<a id="crossselling_scroll_right" title="{l s='Next' mod='crossselling'}" href="javascript:{ldelim}{rdelim}">{l s='Next' mod='crossselling'}</a>{/if}
</div>
</div>
{/if}
-16
View File
@@ -1,16 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{crossselling}prestashop>crossselling_a1892c39b2598b4f30f9cc92c59f1aa5'] = 'Cross-Selling';
$_MODULE['<{crossselling}prestashop>crossselling_ef2b66b0b65479e08ff0cce29e19d006'] = 'Kunden, die dieses Produkt gekauft haben, kauften auch ...';
$_MODULE['<{crossselling}prestashop>crossselling_e316b4398212d473f7f53c7728fe1c37'] = 'Einstellungen erfolgreich aktualisiert';
$_MODULE['<{crossselling}prestashop>crossselling_f4f70727dc34561dfde1a3c529b6205c'] = 'Einstellungen';
$_MODULE['<{crossselling}prestashop>crossselling_b6bf131edd323320bac67303a3f4de8a'] = 'Preis auf Produkten anzeigen ';
$_MODULE['<{crossselling}prestashop>crossselling_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Aktiviert';
$_MODULE['<{crossselling}prestashop>crossselling_b9f5c797ebbf55adccdd8539a65a0241'] = 'Deaktiviert';
$_MODULE['<{crossselling}prestashop>crossselling_70f9a895dc3273d34a7f6d14642708ec'] = 'Preise auf den Produkten im Block anzeigen.';
$_MODULE['<{crossselling}prestashop>crossselling_c9cc8cce247e49bae79f15173ce97354'] = 'Speichern';
$_MODULE['<{crossselling}prestashop>crossselling_dd1f775e443ff3b9a89270713580a51b'] = 'Kunden, die dieses Produkt gekauft haben, kauften auch:';
$_MODULE['<{crossselling}prestashop>crossselling_4351cfebe4b61d8aa5efa1d020710005'] = 'Zurück';
$_MODULE['<{crossselling}prestashop>crossselling_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Weiter';
-5
View File
@@ -1,5 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
-16
View File
@@ -1,16 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{crossselling}prestashop>crossselling_a1892c39b2598b4f30f9cc92c59f1aa5'] = 'Ventas cruzadas';
$_MODULE['<{crossselling}prestashop>crossselling_ef2b66b0b65479e08ff0cce29e19d006'] = 'Los clientes que compraron este producto también han comprado...';
$_MODULE['<{crossselling}prestashop>crossselling_e316b4398212d473f7f53c7728fe1c37'] = 'Actualización de los parámetros';
$_MODULE['<{crossselling}prestashop>crossselling_f4f70727dc34561dfde1a3c529b6205c'] = 'Parámetros';
$_MODULE['<{crossselling}prestashop>crossselling_b6bf131edd323320bac67303a3f4de8a'] = 'Mostrar el precio del producto';
$_MODULE['<{crossselling}prestashop>crossselling_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activado';
$_MODULE['<{crossselling}prestashop>crossselling_b9f5c797ebbf55adccdd8539a65a0241'] = 'Desactivado';
$_MODULE['<{crossselling}prestashop>crossselling_70f9a895dc3273d34a7f6d14642708ec'] = 'Mostrar el precio del producto en el bloque';
$_MODULE['<{crossselling}prestashop>crossselling_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar';
$_MODULE['<{crossselling}prestashop>crossselling_dd1f775e443ff3b9a89270713580a51b'] = 'Los clientes que compraron este producto también han comprado:';
$_MODULE['<{crossselling}prestashop>crossselling_4351cfebe4b61d8aa5efa1d020710005'] = 'Anterior';
$_MODULE['<{crossselling}prestashop>crossselling_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Siguiente';
-16
View File
@@ -1,16 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{crossselling}prestashop>crossselling_a1892c39b2598b4f30f9cc92c59f1aa5'] = 'Ventes croisées';
$_MODULE['<{crossselling}prestashop>crossselling_ef2b66b0b65479e08ff0cce29e19d006'] = 'Les clients qui ont acheté ce produit ont également acheté...';
$_MODULE['<{crossselling}prestashop>crossselling_e316b4398212d473f7f53c7728fe1c37'] = 'Paramètres mis à jour';
$_MODULE['<{crossselling}prestashop>crossselling_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres';
$_MODULE['<{crossselling}prestashop>crossselling_b6bf131edd323320bac67303a3f4de8a'] = 'Afficher le prix du produit';
$_MODULE['<{crossselling}prestashop>crossselling_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_MODULE['<{crossselling}prestashop>crossselling_b9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_MODULE['<{crossselling}prestashop>crossselling_70f9a895dc3273d34a7f6d14642708ec'] = 'Afficher le prix du produit dans le block';
$_MODULE['<{crossselling}prestashop>crossselling_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
$_MODULE['<{crossselling}prestashop>crossselling_dd1f775e443ff3b9a89270713580a51b'] = 'Précédent';
$_MODULE['<{crossselling}prestashop>crossselling_4351cfebe4b61d8aa5efa1d020710005'] = 'Voir';
$_MODULE['<{crossselling}prestashop>crossselling_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Suivant';
-16
View File
@@ -1,16 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{crossselling}prestashop>crossselling_a1892c39b2598b4f30f9cc92c59f1aa5'] = 'Vendita incrociata';
$_MODULE['<{crossselling}prestashop>crossselling_ef2b66b0b65479e08ff0cce29e19d006'] = 'I clienti che hanno acquistato questo prodotto hanno anche comprato ...';
$_MODULE['<{crossselling}prestashop>crossselling_e316b4398212d473f7f53c7728fe1c37'] = 'Impostazioni aggiornate con successo';
$_MODULE['<{crossselling}prestashop>crossselling_f4f70727dc34561dfde1a3c529b6205c'] = 'Impostazioni';
$_MODULE['<{crossselling}prestashop>crossselling_b6bf131edd323320bac67303a3f4de8a'] = 'Mostra prezzo sui prodotti';
$_MODULE['<{crossselling}prestashop>crossselling_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Attivato';
$_MODULE['<{crossselling}prestashop>crossselling_b9f5c797ebbf55adccdd8539a65a0241'] = 'Disattivato';
$_MODULE['<{crossselling}prestashop>crossselling_70f9a895dc3273d34a7f6d14642708ec'] = 'Mostra il prezzo sui prodotti nel blocco.';
$_MODULE['<{crossselling}prestashop>crossselling_c9cc8cce247e49bae79f15173ce97354'] = 'Salva';
$_MODULE['<{crossselling}prestashop>crossselling_dd1f775e443ff3b9a89270713580a51b'] = 'I clienti che hanno acquistato questo prodotto hanno acquistato anche:';
$_MODULE['<{crossselling}prestashop>crossselling_4351cfebe4b61d8aa5efa1d020710005'] = 'Precedente';
$_MODULE['<{crossselling}prestashop>crossselling_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Successivo';
-65
View File
@@ -1,65 +0,0 @@
/*
* 2007-2011 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-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
var cs_serialScrollNbImagesDisplayed;
var cs_serialScrollNbImages;
var cs_serialScrollActualImagesIndex;
function cs_serialScrollFixLock(event, targeted, scrolled, items, position)
{
serialScrollNbImages = $('#crossselling_list li:visible').length;
serialScrollNbImagesDisplayed = 5;
var leftArrow = position == 0 ? true : false;
var rightArrow = position + serialScrollNbImagesDisplayed >= serialScrollNbImages ? true : false;
$('a#crossselling_scroll_left').css('cursor', leftArrow ? 'default' : 'pointer').css('display', leftArrow ? 'none' : 'block').fadeTo(0, leftArrow ? 0 : 1);
$('a#crossselling_scroll_right').css('cursor', rightArrow ? 'default' : 'pointer').fadeTo(0, rightArrow ? 0 : 1).css('display', rightArrow ? 'none' : 'block');
return true;
}
$(document).ready(function(){
//init the serialScroll for thumbs
cs_serialScrollNbImages = $('#crossselling_list li').length;
cs_serialScrollNbImagesDisplayed = 5;
cs_serialScrollActualImagesIndex = 0;
$('#crossselling_list').serialScroll({
items:'li',
prev:'a#crossselling_scroll_left',
next:'a#crossselling_scroll_right',
axis:'x',
offset:0,
stop:true,
onBefore:cs_serialScrollFixLock,
duration:300,
step: 1,
lazy:true,
lock: false,
force:false,
cycle:false
});
$('#crossselling_list').trigger( 'goto', [middle-3] );
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 731 B