Jump to content

[FREE MODULE] Pele related products. Products related by tag


Enrique Gómez
 Share

Recommended Posts

Hola, Muchas gracias por la ayuda Enrique.

 

buscando un poco veo que productscategory.tpl tiene este código:

 

 

{if isset($categoryProducts) && count($categoryProducts) > 0 && $categoryProducts !== false}
<div class="clearfix blockproductscategory">
<h2 class="productscategory_h2">
{if $categoryProducts|@count == 1}
{l s='%s other product in the same category:' sprintf=[$categoryProducts|@count] mod='productscategory'}
{else}
{l s='%s other products in the same category:' sprintf=[$categoryProducts|@count] mod='productscategory'}
{/if}
</h2>
<div id="{if count($categoryProducts) > 5}productscategory{else}productscategory_noscroll{/if}">
{if count($categoryProducts) > 5}<a id="productscategory_scroll_left" title="{l s='Previous' mod='productscategory'}" href="javascript:{ldelim}{rdelim}">{l s='Previous' mod='productscategory'}</a>{/if}
<div id="productscategory_list">
<ul {if count($categoryProducts) > 5}style="width: {math equation="width * nbImages" width=107 nbImages=$categoryProducts|@count}px"{/if}>
{foreach from=$categoryProducts item='categoryProduct' name=categoryProduct}
<li {if count($categoryProducts) < 6}style="width:60px"{/if}>
<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)}" class="lnk_img" title="{$categoryProduct.name|htmlspecialchars}"><img src="{$link->getImageLink($categoryProduct.link_rewrite, $categoryProduct.id_image, 'medium_default')|escape:'html'}" alt="{$categoryProduct.name|htmlspecialchars}" /></a>
<p class="product_name">
<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)|escape:'html'}" title="{$categoryProduct.name|htmlspecialchars}">{$categoryProduct.name|truncate:14:'...'|escape:'html':'UTF-8'}</a>
</p>
{if $ProdDisplayPrice AND $categoryProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<p class="price_display">
<span class="price">{convertPrice price=$categoryProduct.displayed_price}</span>
</p>
{else}
<br />
{/if}
</li>
{/foreach}
</ul>
</div>
{if count($categoryProducts) > 5}<a id="productscategory_scroll_right" title="{l s='Next' mod='productscategory'}" href="javascript:{ldelim}{rdelim}">{l s='Next' mod='productscategory'}</a>{/if}
</div>
<script type="text/javascript">
$('#productscategory_list').trigger('goto', [{$middlePosition}-3]);
</script>
</div>
{/if}
 
y productscategory.js tiene el siguiente:
 
function pc_serialScrollFixLock(event, targeted, scrolled, items, position)
{
var leftArrow = position == 0 ? true : false;
var rightArrow = position + 5 >= $('#productscategory_list li:visible').length ? true : false;
 
$('a#productscategory_scroll_left').css('cursor', leftArrow ? 'default' : 'pointer').fadeTo(0, leftArrow ? 0 : 1);
$('a#productscategory_scroll_right').css('cursor', rightArrow ? 'default' : 'pointer').fadeTo(0, rightArrow ? 0 : 1).css('display', rightArrow ? 'none' : 'block');
 
return true;
}
 
$(document).ready(function()
{
$('#productscategory_list').serialScroll({
items: 'li',
prev: 'a#productscategory_scroll_left',
next: 'a#productscategory_scroll_right',
axis: 'x',
offset: 0,
stop: true,
onBefore: pc_serialScrollFixLock,
duration: 300,
step: 1,
lazy: true,
lock: false,
force: false,
cycle: false });
$('#productscategory_list').trigger( 'goto', 0);
});
 
Lo que ya no veo es como integrar ese código al tuyo de pele_relatedproducts_16
 
 
{if count($peleRelatedProducts) > 0}
<section class="page-product-box blockpeleproductsrelated">
<h3 class="peleproductsrelated_h3 page-product-heading">{l s='Related Products' mod='pele_relatedproducts'}</h3>
<div id="peleproductsrelated_list" class="clearfix">
<ul id="bxslider_pele" class="bxslider clearfix">
{foreach from=$peleRelatedProducts item='peleRelatedProduct' name=categoryProduct}
<li class="product-box item">
<a href="{$peleRelatedProduct.link}" class="lnk_img product-image" title="{$peleRelatedProduct.name|htmlspecialchars}"><img src="{$link->getImageLink($peleRelatedProduct.image.link_rewrite, $peleRelatedProduct.image.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{$peleRelatedProduct.name|htmlspecialchars}" /></a>
                
<h5 class="product-name">
<a href="{$peleRelatedProduct.link}" title="{$peleRelatedProduct.name|htmlspecialchars}">{escape:'html':'UTF-8'}</a>
</h5>
{*convertPrice price=$peleRelatedProduct.displayed_price*}
<br />
</li>
{/foreach}
</ul>
</div>
</section>
{/if}
 
 
<script type="text/javascript">
$(document).ready(function() {
if (!!$.prototype.bxSlider)
$('#bxslider_pele').bxSlider({
minSlides: 2,
maxSlides: 6,
slideWidth: 178,
slideMargin: 20,
pager: false,
nextText: '',
prevText: '',
moveSlides:1,
infiniteLoop:false,
hideControlOnEnd: true
});
});
</script>

Hola, Muchas gracias por la ayuda Enrique.

 

buscando un poco veo que productscategory.tpl tiene este código:

 

 

{if isset($categoryProducts) && count($categoryProducts) > 0 && $categoryProducts !== false}
<div class="clearfix blockproductscategory">
<h2 class="productscategory_h2">
{if $categoryProducts|@count == 1}
{l s='%s other product in the same category:' sprintf=[$categoryProducts|@count] mod='productscategory'}
{else}
{l s='%s other products in the same category:' sprintf=[$categoryProducts|@count] mod='productscategory'}
{/if}
</h2>
<div id="{if count($categoryProducts) > 5}productscategory{else}productscategory_noscroll{/if}">
{if count($categoryProducts) > 5}<a id="productscategory_scroll_left" title="{l s='Previous' mod='productscategory'}" href="javascript:{ldelim}{rdelim}">{l s='Previous' mod='productscategory'}</a>{/if}
<div id="productscategory_list">
<ul {if count($categoryProducts) > 5}style="width: {math equation="width * nbImages" width=107 nbImages=$categoryProducts|@count}px"{/if}>
{foreach from=$categoryProducts item='categoryProduct' name=categoryProduct}
<li {if count($categoryProducts) < 6}style="width:60px"{/if}>
<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)}" class="lnk_img" title="{$categoryProduct.name|htmlspecialchars}"><img src="{$link->getImageLink($categoryProduct.link_rewrite, $categoryProduct.id_image, 'medium_default')|escape:'html'}" alt="{$categoryProduct.name|htmlspecialchars}" /></a>
<p class="product_name">
<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)|escape:'html'}" title="{$categoryProduct.name|htmlspecialchars}">{$categoryProduct.name|truncate:14:'...'|escape:'html':'UTF-8'}</a>
</p>
{if $ProdDisplayPrice AND $categoryProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<p class="price_display">
<span class="price">{convertPrice price=$categoryProduct.displayed_price}</span>
</p>
{else}
<br />
{/if}
</li>
{/foreach}
</ul>
</div>
{if count($categoryProducts) > 5}<a id="productscategory_scroll_right" title="{l s='Next' mod='productscategory'}" href="javascript:{ldelim}{rdelim}">{l s='Next' mod='productscategory'}</a>{/if}
</div>
<script type="text/javascript">
$('#productscategory_list').trigger('goto', [{$middlePosition}-3]);
</script>
</div>
{/if}
 
y productscategory.js tiene el siguiente:
 
function pc_serialScrollFixLock(event, targeted, scrolled, items, position)
{
var leftArrow = position == 0 ? true : false;
var rightArrow = position + 5 >= $('#productscategory_list li:visible').length ? true : false;
 
$('a#productscategory_scroll_left').css('cursor', leftArrow ? 'default' : 'pointer').fadeTo(0, leftArrow ? 0 : 1);
$('a#productscategory_scroll_right').css('cursor', rightArrow ? 'default' : 'pointer').fadeTo(0, rightArrow ? 0 : 1).css('display', rightArrow ? 'none' : 'block');
 
return true;
}
 
$(document).ready(function()
{
$('#productscategory_list').serialScroll({
items: 'li',
prev: 'a#productscategory_scroll_left',
next: 'a#productscategory_scroll_right',
axis: 'x',
offset: 0,
stop: true,
onBefore: pc_serialScrollFixLock,
duration: 300,
step: 1,
lazy: true,
lock: false,
force: false,
cycle: false });
$('#productscategory_list').trigger( 'goto', 0);
});
 
Lo que ya no veo es como integrar ese código al tuyo de pele_relatedproducts_16
 
 
{if count($peleRelatedProducts) > 0}
<section class="page-product-box blockpeleproductsrelated">
<h3 class="peleproductsrelated_h3 page-product-heading">{l s='Related Products' mod='pele_relatedproducts'}</h3>
<div id="peleproductsrelated_list" class="clearfix">
<ul id="bxslider_pele" class="bxslider clearfix">
{foreach from=$peleRelatedProducts item='peleRelatedProduct' name=categoryProduct}
<li class="product-box item">
<a href="{$peleRelatedProduct.link}" class="lnk_img product-image" title="{$peleRelatedProduct.name|htmlspecialchars}"><img src="{$link->getImageLink($peleRelatedProduct.image.link_rewrite, $peleRelatedProduct.image.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{$peleRelatedProduct.name|htmlspecialchars}" /></a>
                
<h5 class="product-name">
<a href="{$peleRelatedProduct.link}" title="{$peleRelatedProduct.name|htmlspecialchars}">{escape:'html':'UTF-8'}</a>
</h5>
{*convertPrice price=$peleRelatedProduct.displayed_price*}
<br />
</li>
{/foreach}
</ul>
</div>
</section>
{/if}
 
 
<script type="text/javascript">
$(document).ready(function() {
if (!!$.prototype.bxSlider)
$('#bxslider_pele').bxSlider({
minSlides: 2,
maxSlides: 6,
slideWidth: 178,
slideMargin: 20,
pager: false,
nextText: '',
prevText: '',
moveSlides:1,
infiniteLoop:false,
hideControlOnEnd: true
});
});
</script>

Share this post


Link to post
Share on other sites

  • 2 months later...

Hello Enrique,

If I don't use the setting showed on the bottom of every admin products page ('Weight related products', 'Show random related products' and 'Limit number of related products'), there's a way to remove/hide them?

Share this post


Link to post
Share on other sites

I have simplified the module because a module of this nature must be simple, without overrides, without writing the admin tpl ..etc. it simply relates by tags and you can set the number of products globally, nothing more.

 

Hello Enrique,

If I don't use the setting showed on the bottom of every admin products page ('Weight related products', 'Show random related products' and 'Limit number of related products'), there's a way to remove/hide them?

You can uninstall the old, and install the new one. The new one only relates the products by tag and you can configure globally (via module config) the number of products

Share this post


Link to post
Share on other sites

It's fantastic this module!! Thanks!!

 

One question:

 

It's possible show related products by increasing price?

 

 

Es fantástico este módulo!!! Muchísimas gracias por tu aportación!!

 

Una pregunta, ¿se puede establecer que muestre los productos de menor a mayor precio?

Edited by olgadrom (see edit history)

Share this post


Link to post
Share on other sites

  • 1 month later...

Solved

I installed the module on the site: http://www.houseofperfumes.co.nz, and configured it.

At the back end, it shows enabled. I added the same tag to two products, but these are not showing in the related products.

The link to the product is :

http://houseofperfumes.co.nz/perfumes/4465-obsession-by-calvin-klein-75ml-edt.html

 

 

What could have gone wrong.

Edited by raunhar (see edit history)

Share this post


Link to post
Share on other sites

I installed the module on the site: http://www.houseofperfumes.co.nz, and configured it.

At the back end, it shows enabled. I added the same tag to two products, but these are not showing in the related products.

The link to the product is :

http://houseofperfumes.co.nz/perfumes/4465-obsession-by-calvin-klein-75ml-edt.html

 

 

What could have gone wrong.

it's weird.. try clear prestashop cache.

in modules>positions filter by pele and see if is it hooked in displayFooterProduct

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 2 weeks later...

+1 to numerous grateful users of your module. Very simple and useful contribution.

 

Experience: I've been using your module for about a year, and my PageLoadSpeed was about 8-13 seconds on some pages. (Never knew why one page is slower than another). And I was pretty sure it is server response time. Bought additional resources, and planned to move to VPS. And another day I disabled your module and PageSpeed rose up to 2 sec. Now, I noticed that you've upgraded the module since then and I decided to install the new version. The PageSpeed remained on the same good level (~2sec.). Thank you for update.

 

Problems: In case, when the product doesn't have a product image – your module won't pick the default dummy image (en_default_home_default.jpeg). Instead, it uses proprietary image (jpg.gif).

 

Thank you again for contribution.

 

--------------------------

http://dollaressay.com

Share this post


Link to post
Share on other sites

Hello, I can't to implement the carousel product for this module and the title appears all/fully... It appears like that:

screenshot.png

There is any way to fix this?!

Thanks in advance.

 

The module has the default prestashop 1.6 layout. You need to adapt the tpl to your theme. It's not easy but you need to find your_theme/modules/productscategory/productscategory.tpl  and adapt the layout to pele_relatedproducts_16.tpl and also to include the carousel script your them uses (flexslider..) as well.

Share this post


Link to post
Share on other sites

+1 to numerous grateful users of your module. Very simple and useful contribution.

 

Experience: I've been using your module for about a year, and my PageLoadSpeed was about 8-13 seconds on some pages. (Never knew why one page is slower than another). And I was pretty sure it is server response time. Bought additional resources, and planned to move to VPS. And another day I disabled your module and PageSpeed rose up to 2 sec. Now, I noticed that you've upgraded the module since then and I decided to install the new version. The PageSpeed remained on the same good level (~2sec.). Thank you for update.

 

Problems: In case, when the product doesn't have a product image – your module won't pick the default dummy image (en_default_home_default.jpeg). Instead, it uses proprietary image (jpg.gif).

 

Thank you again for contribution.

 

--------------------------

http://dollaressay.com

 

Sure, the original module didn't use the prestashop cache and it has also some other performance issues in case of high number of products in each tag.

 

Problems: In case, when the product doesn't have a product image – your module won't pick the default dummy image (en_default_home_default.jpeg). Instead, it uses proprietary image (jpg.gif).

Thanks for the feedback. I will take it into account

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Hola Enrique,

 

Quería preguntarte si era posible mostrar los productos en orden aleatorio, es decir, ami me salen todos los productos juntos de una categoría y después todos los productos juntos de otra categoría, quería que salgan uno o dos de una categoría después dos o tres más de otra categoría y así hasta hacer el máximo de productos que quiero mostrar. Seria como desordenar la array de productos que genere pero no se ni como ni donde, espero que me puedas ayudar.

 

Saludos.

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 weeks later...

Hola Enrique,

 

Quería preguntarte si era posible mostrar los productos en orden aleatorio, es decir, ami me salen todos los productos juntos de una categoría y después todos los productos juntos de otra categoría, quería que salgan uno o dos de una categoría después dos o tres más de otra categoría y así hasta hacer el máximo de productos que quiero mostrar. Seria como desordenar la array de productos que genere pero no se ni como ni donde, espero que me puedas ayudar.

 

Saludos.

Necesito ayuda!!!

Share this post


Link to post
Share on other sites

Hola Enrique.

 

Ante todo, muchas gracias por este módulo. 

 

Instalado en PS 1.6.1.11 va de lujo. Integrado en plantilla defecto a la primera. 

 

Solo me asaltan dos dudas.

 

1.- En la configuración, no me deja poner mas que el número de productos a mostrar......

 

¿No es posible configurar los tags? Quizá los toma de las meta de los otros productos, no lo sé.....

 

O si puede incluirse una característica que tenga en cuenta para mostrarlos (las "de serie", como el color o la composición, o precio, por poner un ejemplo).

 

2.- Se muestra bajo la descripción larga, bajo todos los datos...... Si quisiera que saliera justo bajo la foto de los productos y la descripción corta, justo antes de la "Ficha técnica", ¿Qué archivo modifico? SUpongo que es "subir" un DIV del módulo, pero he hecho pruebas, y no acierto.....

 

Es por probar si al estar los productos relacionados más "a la vista", las estadísticas mejoran. 

 

Muchas gracias de nuevo por el módulo, y por tu tiempo.

 

Saludos

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Hi guys, hi Enrique Gómez,

Installed the module and it does EXACTLY what i want it to do. THANK YOU!

Please help me, how can I move the module to be displayed JUST ABOVE the main picture of the product, instead of to display all the way at the bottom.
IE. NOW it is like this:

http://imgur.com/r68qbLN

And I want it to be on the TOP, like this: http://imgur.com/BPFPMyG

Share this post


Link to post
Share on other sites

Enrique, are you there mate?

 

Hi guys, hi Enrique Gómez,


Installed the module and it does EXACTLY what i want it to do. THANK YOU!

Please help me, how can I move the module to be displayed JUST ABOVE the main picture of the product, instead of to display all the way at the bottom.
IE. NOW it is like this:

http://imgur.com/r68qbLN

And I want it to be on the TOP, like this: http://imgur.com/BPFPMyG

 
Edited by vicbg (see edit history)

Share this post


Link to post
Share on other sites

Hi guys, hi Enrique Gómez,

 

Installed the module and it does EXACTLY what i want it to do. THANK YOU!

 

Please help me, how can I move the module to be displayed JUST ABOVE the main picture of the product, instead of to display all the way at the bottom.

IE. NOW it is like this:

http://imgur.com/r68qbLN

 

And I want it to be on the TOP, like this: http://imgur.com/BPFPMyG

 

the module hooks to hookfooter  you need to move this hook to the top in product.tpl

 

If you have more modules and obviously you don't want to put all of them above product , then you need to create a custom hook inside product.tpl and modify the module to use this new hook .

Share this post


Link to post
Share on other sites

the module hooks to hookfooter  you need to move this hook to the top in product.tpl

 

If you have more modules and obviously you don't want to put all of them above product , then you need to create a custom hook inside product.tpl and modify the module to use this new hook .

Thank you very much, kind sire, for your reply.

I will experiment, but I fear that I will need to do some learning before I am successful :)

P.S. If you have possibility, please let me know what the code should look like in the produc.tpl file and where should I put it.

Thanks again for your reply.

BR

Victor

Share this post


Link to post
Share on other sites

  • 7 months later...
  • 3 weeks later...

Congrats enrique !

I use it and customize it. But I've a little problem, I was able to add cart button and quick view like product_list, then I I'd like to disable button when product is not in stock or available for order like it is on product list.  Should you help me ?

<div class="button-container">
    {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
        {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
        {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($product.id_product_attribute) && $product.id_product_attribute}&amp;ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture}
        <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product-attribute="{$product.id_product_attribute|intval}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">
            <span>{l s='Add to cart'}</span>
        </a>
    {else}
        <span class="button ajax_add_to_cart_button btn btn-default disabled">
            <span>{l s='Add to cart'}</span>
        </span>
    {/if}
{/if}
</div>

best regards 

Share this post


Link to post
Share on other sites

  • 6 months later...
On 8/10/2013 at 1:33 PM, Enrique Gómez said:

This module relates the products by tag. You can configure globally the number of products showed in the carousel.
 
The layout is for the default prestashop theme.
 

Updated(10/10/2013)
Modified installation
 
Updated(29/11/2013)
Fixed some bugs
 
Updated(02/08/2014)
Compatibility 1.6
 

Updated(02/08/2014)
Compatibility 1.6

 

Updated(18/07/2016)
Simplified. No use of overrides, no write to tpl, no database changes.. simply relates products by tag

 

When the expected completion of work on a version for prestashop 1.7

?

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More