Jump to content

[Module] UPDATED - Related Products v0.1


CYTechnologies
 Share

Recommended Posts

  • 3 weeks later...

Hi
Has this been tested on 1.2.2.0 at all. I have installed it and when I go to a product without any tags I get the error

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\prestashop1220\modules\cyrelatedproducts\cyrelatedproducts.php on line 62

and when I do add tags it all works but the page formatting is all over the place both with a modified theme and the original Prestashop one

Thanks

Share this post


Link to post
Share on other sites

There's no error message now, still having problems with page layout which I will fix, I think that could be due to my products having customization options and they clash with the placing of your information.

Good little module, thanks for the quick update

Share this post


Link to post
Share on other sites

Hi,
I have improved the page layout for me, especially on pages with customisation fields by adding
after the {/foreach} line of code, I also added a
after the {/if} to make the description start neatly under the picture.

You might want to test this yourself and include in your code if you think worthwhile, I have tested the code on 1.2.2.0 and 1.2.3.0.

Regards

Share this post


Link to post
Share on other sites

  • 5 months later...
  • 2 months later...

Hi CYTechnologies

Many many thanks for this.
Could you explain to me how display it like "in the same category" and above it (inverse "related products" and "in the same category"

Thaks again

regards

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 2 months later...

This is a Brilliant Module in theory. Thank for all the good work. I really like where this is going.

I would just like to make a suggestion to make the module complete - perhaps someone has already done this?


How could you limit the number of results that are displayed? - if for example 50 products share the same tag then the module, as it is in it's current form, bombards the page with 50 products - is there a way to limit this to say 3 related products?


Maybe a loop should be added somewhere to make this happen a defined number of times? My programming skills are limited hence I am not sure where to start. I look forward to suggestions.


Otherwise this is a great module! Keep up the good work! :o)

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Hi CYTech!
First of all thank you to share your module, it helps me a lot. I was wondering how you would do to get the rewrited URL on the related product, right now it is like www.shop.com?product=... I have done something which work on my shop. I have edited the .php file and use the rewrite link (the one you call in the link rewrite image function) and add the product id and the ".html" at the end. But I am sure that it is not the right way to do it. If someone needs it I can post my code. Thanks in advance!

Share this post


Link to post
Share on other sites

  • 2 months later...

Good Morning All,

I haven't been around in a long time due to being slammed with work and life, however I wanted to give an update on this module. I am updating it to work with the latest version of PrestaShop as well as coming out with a newer version to provide greater customization. I will update this thread again when the new version is available. Happy Coding! :)

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Thanks for the module is realemte good.
I have just one question.
I can show the category to which the product? I think this would be helpful for everyone …

thanks!

Share this post


Link to post
Share on other sites

CYTechnologies, I believe that the module now works perfectly.
I tried it on my test store and had no problems to make it work.

I really appreciate it and this new version of your module is going to provide a lot of things at all!

Thank you very much for everything!

Until next time

Sorry for my English, I speak Spanish ; )

Share this post


Link to post
Share on other sites

Hi 24,

Attached to this reply is a new version of the module for you to test, let me know if it works well for you.

If it does I will update the main release to include this update.

To install - first remove the CY Related Products module from your store, then re-install the new version. :-)




Cy, will this new ver work with PS 1.2.5?


Regards,

Share this post


Link to post
Share on other sites

  • 1 month later...

Hello CY! I love this module, it works beautifully on my website. I was able to customize it very nicely to suit my product page. However, do you think you can help with a small problem? Other people are wondering the same thing: how do you limit the number of related products showing?
Thanks and I look forward to your response!

Share this post


Link to post
Share on other sites

Hello Tinyhands,

I'm very glad you like the module :)

Give this a try.

1. ADD this code:

$cy_related_products = array_slice($cy_related_products, 0, 3);



2. BEFORE this code:

$smarty->assign('cyRelatedProducts', $cy_related_products);
return $this->display(__FILE__, 'cyrelatedproducts.tpl');



This can be found in the file cyrelatedproducts/cyrelatedproducts.php and it is around line 106.

Change the 3 to any limit you want, let me know! :)

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Hello!
Thanks to Aaron for developing this module, it's fantastic! :-)
I have updated it to work with Prestashop 1.4, and I also have added a parameter to control the max number of items showed. I hope you'll find it useful!

Cheers!

¡Hola!

Muchas gracias a Aaron por desarrollar este módulo, ¡es fantástico! :-)
Lo he actualizado para que funcione con Prestashop 1.4 y he añadido un parámetro para controlar el número máximo de elementos que se muestran. ¡Espero que os resulte útil!

¡Saludos!

cyrelatedproducts.zip

  • Like 2

Share this post


Link to post
Share on other sites

Hey Midiman,

Thank you for the updates to the module, I will check it out and if all is well put it up for download on my site. (Will give credit of course :) )

Lm59 - you might want to add a clear to the 'layout' since it looks like the items are floating left.

You can use:
after the items loop to see if that helps at all. :)

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Hello!

I've been asked if it is possible to put this module in another hook. You can do it just adding the following code in cyrelatedproducts.php:

  public function hookProductFooter($params){
  return $this->hookProductTabContent($params);
}


You can use hookProductFooter or the hook you like. After adding the code, you shoul go to admin->modules->positions and set the module to appear in the position you like (ProductFooter in this example), and you also have to delete the module from the ProductTab and ProductTabContent hooks. They are hidden hooks, so you should check the "Show hidden hooks" before...

Hope this helps! (and sorry for my terrible english :))

hola!

Me han preguntado por email si es posible poner este módulo en otra posición. Para ello sólo hay que añadir el siguiente código en cyrelatedproducts.php:

  public function hookProductFooter($params){
  return $this->hookProductTabContent($params);
}


Puedes utilizar hookProductFooter o cualquier otro que prefieras. Después de añadir el código, debes ir a administracion->módulos->posiciones y activar el múdulo en el nuevo hook, así como desactivarlo en los hooks ProductTab y ProductTabContent. Estos hooks están ocultos, así que no olvides seleccionar primero la opción "Mostrar los hook invisbles"

Espero que os sirva! :)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks midiman, it works great!!
Thanks a lot!!

If you put a scroll buttons with more products like http://www.vistoenpantalla.com/camiseta_nino_bart_monopatin-ref_20169.html it will be a perfect module.

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

Gracias midiman, funciona perfecto!!
Muchisimas gracias!!

Si pones unos botones de scroll para poder poner mas productos como se puede ver en: http://www.vistoenpantalla.com/camiseta_nino_bart_monopatin-ref_20169.html será el módulo perfecto.

Share this post


Link to post
Share on other sites

Thanks!
I think it's a good idea from ojosdehumanoide, but I don't need that fucntionality now and I haven't got enoght time to develop it, sorry :)
ojosdehumanoide has found a little error in cyrelatedproducts.php: the assingnment of the default value for the number of items to show shouldn't be placed in the __construct() function, but in the install() one. I attach the new cyrelatedproducts.php with both changes for the laziest ones :P


Gracias!
Creo que es una buena idea por parte de ojosdehumanoide, pero en este momento no necesito esa funcionalidad y no dispongo de tiempo para desarrollarla, lo siento :)
ojosdehumanoide me señalo ayer que había un pequeño fallo en cyrelatedproducts.php: la asignación del valor por defecto del número de elementos que se mostrarán no debe estar en la función __construct(), sino en install(). Adjunto el nuevo archivo cyrelatedproducts.php con los dos ultimos cambios para los más perezosos :P

Saludos!

cyrelatedproducts.php

Share this post


Link to post
Share on other sites

Thanks midiman for both fixes(and for the lazy ones php ;-) ) and thanks to cytechnologies for this great module.

Cytechnologies, do You think that is possible the change i've said?? I think that changes will make a better module for all prestashop community.

Thanks again!!

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

Gracias midiman por ambos cambios (y por la versión para vagos ;-)) y gracias a cytechnologies por este gran módulo.

Cytechnologies, crees que es posible realizar los cambios que dije?? Creo que estos cambios harán un mejor módulo para la comunidad prestashopera.

Gracias de nuevo!!

Share this post


Link to post
Share on other sites

  • 1 month later...

Hello,

If you are using the module midiman I believe he added a limit box in the configuration, my suggestion would be put 1000 to show them all. :D

However, if you only want to show say 10 and have a link that opens a new page, you could possibly adjust the module to show a link for the first tag that directs the user to a search page?

To answer your question, there is no show all currently on the module. If I get some time I can try and add one.

Share this post


Link to post
Share on other sites

thank you for your reply, as you say, I'm using the midiman's version for ps 1.4, but I want to use a search page for show all products.
I tried to add in cyrelatedproducts.tpl :

getPageLink('search.php')}?tag={$tag.name|urlencode}" title="View {$tag.name|htmlspecialchars}">Show all


but that does not work...
do you have an idea?

Share this post


Link to post
Share on other sites

Hi

Is there some way you can put related products just in one direction? I have a product I would like it to appear in almost 100 products, the problem is that if I see that product the 100 products will appear as related products.

Thanks
Gonzalo

Share this post


Link to post
Share on other sites

  • 1 month later...

Hi,

First of all, it's really a great and very useful module. Thanks to all the developers. I have a question about it:

I installed the scrolled version of cyrelatedproducts and the list appears in a tab next to the "data sheet" tab. The customer has to click the tab to see the r.products list. But i want the customer to see the related products directly (not in a tab) below the viewed product and he/she be able to "add to cart" the related product. The related products will be listed like in a "category". I'll try to attach two screenshots below to express myself clearly :). How can make that happen?

49128_f42fbNDVUb3EUVXR35rc_t

49129_lYjBm0pNNLT14UkTRvVA_t

Share this post


Link to post
Share on other sites

@finlander,

Thanks for your reply very much. I did a little search on "associated products modules" but couldn't find any satisfying solutions. I've found only one "paid" module similar to cyrelatedproducts but it's not better than cy's. If anyone has a solution about what I need, please don't hesitate to PM me. This is an example of what I exactly need.

Share this post


Link to post
Share on other sites

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

Hi,

This module (+scroll format) seems very cool but after installation,

i always have the same message : "There are no related products at this time."

I created some tags... nothing.

Anyone have an idea ?

I search actively, but i'm not an expert with Prestashop.

Thanks,

Fabien

Share this post


Link to post
Share on other sites

So... I've copied the files .tpl and .css in my theme repertory (for test and modify),

I don't know if it's linked and I don't know why, related products are emerged...

Sorry. It seems Worked fine ! Thanks for your attention.

 

Fabien

 

EDIT : work too with multiple tags.

Share this post


Link to post
Share on other sites

Thanks for getting back to me promptly Finlander.

 

By original module do you mean 'Product Category' ? It's not like the modification you made where it offers a Related Product Tab, and how it uses identical tags to pop-up.

 

With your version did you run into the problem where the last product with the slider is cut off half-way?

Share this post


Link to post
Share on other sites

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

I have tried with some versions of the module (from this forum thread) but I do not get it installed.

I'm using PS 1.4.4.1.

Once uncompressed on the /modules folder I go to the Modules pages on the BO but I can not see it on the modules list (with all tabs expanded, of course).

For some reason, PS seems to recognize it in some way, because the config.xml appears (if i delete it manually and reload the modules list page, it is re-created).

 

One thing I've seen inside the.php file is the tab on the BO is assigned with:

$this->tab = "Products";

 

and other modules I have installed checks the PS version to do that:

if(version_compare(_PS_VERSION_, '1.4.0.0') >= 0)

$this->tab = 'front_office_features';

else

$this->tab = 'Products';

I have tried to change this, but with no luck.

I am the only one with this problem??

There is another related products (by tag or whatever) module??

 

Thank you in advance

Share this post


Link to post
Share on other sites

Hi guys!

 

I'm developer and new to prestashop platform.

 

I was running into with the same problem in Prestashop 1.4.6.2, "there are no related...". After some debugging and struggling with the lack of API documentation i've found a fix.

 

1. Open module file cyrelatedproducts.php

2. Update on line 57 to.

 

$product = new Product($id_product,true);

 

As you will see, there is a second argument which should be TRUE.

 

Cheers!

Share this post


Link to post
Share on other sites

  • 4 weeks later...

hy bmxer and finlander , i am using presta 1.4.6.2 and after I did what bmxer said cause i had the "there are no related..." it shows the products but no picture just some text and an error:

Strict Standards: Non-static method LinkCore::getProductLink() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\presta\modules\cyrelatedproducts\cyrelatedproducts.php on line 78

i will also post a print screen so you understand better .

 

ALSO i get this instead of the images

<img width="80" height="80" src="<br /> <b>Notice</b>: Undefined index: images in <b>C:\xampp\htdocs\presta\tools\smarty\compile\97401e53f0e01f42dd08fc212bceb14f71d306dd.file.cyrelatedproducts.tpl.php</b> on line <b>32</b><br /> http://localhost/presta/img/p/5-13-medium.jpg">

If i turn off error display all work another question is how do i limit de number to 5 for example of displayed items

pict1u.gif

 

Uploaded with ImageShack.us

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 1 month later...
  • 1 month later...

Installed this module on PS 1.4.7.3 and working fine. But i would like to change the following:

 

Related products show up under a tab. I would like to see them directly, not under a tab, e.g. over the tabs area. Any idea if that's easily done...?

  • Like 1

Share this post


Link to post
Share on other sites

  • 2 months later...
  • 1 month later...

Hey! I installed the module and it doesn't show any related products. I've tried to debug and it seems it doesn't extracts any tags for the product to find similars.

 

$product_tags = $product->tags;

is an empty array although there are tags for the product. I have Prestashop 1.4.3

Share this post


Link to post
Share on other sites

  • 4 weeks later...

I fixed it:

$product_tags = Tag::getProductTags($id_product);

 

hey websku, i have changed that code accordingly but it leads to a server error when i try to load my page, any help ? thanks !

am using the newest version of prestashop, 1.5.1

  • Like 1

Share this post


Link to post
Share on other sites

  • 2 weeks later...

How to display random related products:

I am not a PHP expert, just press random keys in random places and got it working

overwrite existing cyrelatedproducts.php

or edit it:

in line 125 & 126

$cy_related_products = array_slice($cy_related_products, 0, (int)(Configuration::get('NUM_REL_PRODS')));
$smarty->assign('cyRelatedProducts', $cy_related_products);

 

change it to:

$cy_related_products = array_slice($cy_related_products, 0, (int)(Configuration::get('NUM_REL_PRODS')));
if ($cy_related_products) {
shuffle($cy_related_products);
array_splice($cy_related_products, ($nb ? $nb : 10));
}
$smarty->assign('cyRelatedProducts', $cy_related_products);

cyrelatedproducts.php

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 2 weeks later...
  • 4 weeks later...