Jump to content
Trip

[Module] Customers who bought this item also bought

Recommended Posts

I have made some changes to your module, which I listed below:

1. Add a separate css file to aid formatting and formatted it to look better.
2. Add a view button, which links to the product.
3. Add code to enable translations in the backoffice>translations tab.
4. Advanced the version number to 0.2

Formattiing is currently for my website so colours probably wont match.

Formatting checked in FF3, IE7 and IE6



Product title length can be altered by editing the tpl file and changing the truncate code.

Edit:

There is some customisation that is possible with this module to fit into your own themes as follows.

1. Change the number of products shown. (edit productsalsobuy.php file and change the following code.

        ORDER BY RAND() LIMIT 3


Alter the 3 to however many you want to display.)
2. Change the size of the image. (edit productsalsobuy.tpl file and alter the following code.

                

Change the -home.jpg to -medium.jpg to make the image smaller.

productsalsobuy.zip

Share this post


Link to post
Share on other sites

Hehe,
nice work jhnstcks.
Now it really rocks. Thank you to put salt in the soup :)
Best regards, trip

Share this post


Link to post
Share on other sites

There is one thing about this module Trip, the product titles are the full product name that was bought including any attributes e.g. t-shirt large black. Is it possible to remove the atttributes or is that because of the order details?

Share this post


Link to post
Share on other sites

Hi all and thanks for the replies.
@jhnstcks: At the moment I am not at home. I try to have a look at the code the next weekend.
Greetings, trip

Share this post


Link to post
Share on other sites

hi there...

i have tried to install your modifed module and get a hack attemp error? Could you point me in the right direction? Do i have to install the original module first?

Share this post


Link to post
Share on other sites

Hi little duck,
no, the v2 version is the nicer one and should work stand alone. I don't understand why there might be a hack attempt.
Maybe I will release a new version the next days.
Regards, trip

Share this post


Link to post
Share on other sites

Well it builds up over time, if you have had no customers yet then it wont show anything, because there isnt anything to show.

Try some test purchases yourself and see if it works.

Share this post


Link to post
Share on other sites

Yep thanks alot...

I have been making test rorders and it has started to work.. Marvelous.

I have even done a bit of css and image work to blend it with the site.

Nice work on this module well recomended...

Upsell Upsell Upsell.... :)



Excellent module for anyone`s site well worth the install... :)

Share this post


Link to post
Share on other sites

HI there

Thanks for the great module once again. Quick question?

If you look at my clients site here: http://www.alphabincare.com/product.php?id_product=50

I wish to know if it is possible to change the layout so that the Customer Bought block is at the bottom after the More Info section on the product page?

Hope that is good English.. lol...

If I could get some help with this simple or maybe complex issue I would sure appreciate it.

:)

Share this post


Link to post
Share on other sites
HI there

Thanks for the great module once again. Quick question?

If you look at my clients site here: http://www.alphabincare.com/product.php?id_product=50

I wish to know if it is possible to change the layout so that the Customer Bought block is at the bottom after the More Info section on the product page?

Hope that is good English.. lol...

If I could get some help with this simple or maybe complex issue I would sure appreciate it.

:)


Yes that is possible but I think that would require to make a new hook and alter the module coding aswell.

Share this post


Link to post
Share on other sites

Hi Little Duck Solutions,

I just cut and paste {$HOOK_PRODUCT_FOOTER} after <!-- description and features --> block in product.tpl and it seems to work, now the module is at the bottom.

Share this post


Link to post
Share on other sites

Hi there,

Thanks for code tips. Yes all works fine now and the module is at the bottom of the page. My client is very happy.

Keep up the good work... Excellent module. :)

Share this post


Link to post
Share on other sites

Whooops,
in my shop it isn't translating neither ;( ---
I am not an expert on Prestashop translation feature, if someone has more experience maybe he or she can post a fix.
Regards, trip

Share this post


Link to post
Share on other sites

Hi LeGastronome,

I found the bug. You've to change every mod='Products also bought' to mod='productsalsobuy' in the productsalsobuy.tpl
I've fixed that in the new version V0.4 and also added the product price and an "add to cart" button.
Regards, trip

Share this post


Link to post
Share on other sites

Hi all,

Very nice module, Thank You.

Is it possable to convert the module to get "random Products" instead of "others bought", the reason is that we are a new site and have not sold anything (we will have to many items in stock to go through them and buy so they show on the module).

So I was wondering if the module could be converted ?

If so how ?

If it requires major alterations to do this could the author/builder of the module quote me a price for the work? (contact via pm)

All the best,
And thanks again,
Cerberus22

P.S running v03 of the module

Share this post


Link to post
Share on other sites

thank you Trip for this module

I tested with v1.1.0.5 and v1.2.02 and it works well
No slowdown seen with 1200 orders over 700 clients
see here a example
You can find the french translation in file attachments

fr.php

Share this post


Link to post
Share on other sites

The module doesnt work for me. Im using PS 1.2.1 but nothing appears on the productpage after installing.

Hu?

Share this post


Link to post
Share on other sites

Hi kdk,
I haven't tested in 1.2.1 but the 0.4 version is only showing products, when you already sold related products.
I'll upload the 0.5 version later which was kindly supported by cerberus22.
This will display products randomly when there are no related products sold yet.
If you don't like this behaviour you should stick with the 0.4
If this really is not working with the 1.2.1 / 1.2.2 I can look if I can fix it. Unfortunately 1.2.1 is for several reasons no option for me at the moment
but I think I have a test installation somewhere.
The problem is, that I am really busy at the moment. I actually have some more modules here waiting and also some modifications designed for the german market, but without complaining - I was hoping to get more resonance. Ok, maybe people don't like my pants but even a backlink at the end of the internet will improve my seo and could help me a lot.
Ok, anyways - I said and I really think charging people for small enhacements is the wrong way but it would boost the will of doing something for the community if you have the feeling that someone who likes your stuff maybe takes one minute to drop a line on his blog or somewhere else.
Regards, trip

Share this post


Link to post
Share on other sites
Hi kdk,
it would boost the will of doing something for the community if you have the feeling that someone who likes your stuff maybe takes one minute to drop a line on his blog or somewhere else.
Regards, trip


Hi Trip,

I've just installed your module and it worked with 1.2.2 - really good work and very useful for a serious shop! Thank you :) Please don't be disheartened, keep up the good work, your efforts are much appreciated *thumbs up*.

Share this post


Link to post
Share on other sites

This is awesome module.. Thanks for the updates Trip.

For some reason the prices displayed with the products ignores the TAX and any Specials with the products displayed.

I had to remove this line "{displayWtPrice p=$product.price}" to hide the prices, as it's not the correct nor the FINAL Price.

Hope, someone could findout how to display the correct prices.

Thumbs UP!

Share this post


Link to post
Share on other sites

Ok, the tax thing I can not test at the moment. Usually the script reads the price which is stored in the db.
This worked fine for me so far. Maybe they changed it in Ps > 1.1 or you have special configuration as it seems that it es working for other people.
I included a small fix here which should display the price reduction. It does not take price reduction by time period into account so if you have special prices with limited time don't use it.
If someone has ecotax or whatever I have not thought of ... it is not implented but the script is not to hard to understand.
So this is a very rough hack - it calcultes the reduction in the template. Maybe there are better ways of doing it but I can not spend to much time on this now.
Regards and have fun, trip

productsalsobuy_6.zip

Share this post


Link to post
Share on other sites

Hello everyone. I have a problem here, hope that someone can give me advise.
I have intall V4, removed the border and changed the colour. It looks very nice, it's a great module. But some pages works well some doesn't, i don't why. have attached two screen print, one is working fine and the other one is not. I suspect those went wrong is those stock already sold out, i tried adjusting the size but it's still the same. Or is it the size of the original photo? Does anyone know how to fix this problem? Can anyone help me please...

11796_zcP3Hii09YasVyzeMeFb_t

11797_HI2rdEg9PTNrFmEkPQkR_t

Share this post


Link to post
Share on other sites

Hello !

Nice module, just what im looking for ! Great work ;)

Just a problem for me :

The disabled products are visible on the list. Its possible to doesn't show her ?


Thk :P

Share this post


Link to post
Share on other sites

Ok, I actually was going to bed at the moment and I am getting a feeling on how it is to build a software which suits every need :) ...
Usually the skript checked the active status but I missed to implement it in the getRandomProducts() function.
Sorry for that.
The fix is

  private function getRandomProducts($id_lang)
   {
       global $link, $cookie;
       $result = Db::getInstance()->ExecuteS('
       SELECT * FROM '._DB_PREFIX_.'product
       LEFT JOIN '._DB_PREFIX_.'product_lang  ON ('._DB_PREFIX_.'product_lang.id_product = '._DB_PREFIX_.'product.id_product  AND '._DB_PREFIX_.'product_lang.id_lang = '.$id_lang.')
       LEFT JOIN '._DB_PREFIX_.'image ON ('._DB_PREFIX_.'image.id_product = '._DB_PREFIX_.'product.id_product AND '._DB_PREFIX_.'image.cover = 1)    
       WHERE  '._DB_PREFIX_.'product.active = 1
       ORDER BY RAND() LIMIT '.Configuration::get('PAB_PIC_QUANT').'

       ');

       return $result;


   }



Just add the

WHERE  '._DB_PREFIX_.'product.active = 1

at the right position and as far as my superfast test goes, it should work.
Regards, trip

Share this post


Link to post
Share on other sites

Little error on the tpl files (for translate)

Line 28 :

{l s='Add to cart' mod='homefeatured'}

change by 

{l s='Add to cart' mod='productsalsobuy'}

Share this post


Link to post
Share on other sites

Is it possible to move this module down under the information module?

Also a nice add on would to be able to control what products show, so that in new products the module would not be empty.

I am running Version 1.2.4.0

Thank you for this module

Share this post


Link to post
Share on other sites

how make:
nondisplay if is out of stock
thx

and sry for my eng

Share this post


Link to post
Share on other sites

I have a question regarding the tax display. We use this module and our price is not displayed correctly. How do I make the price display including tax? Currently its showing the excluding tax price.

Share this post


Link to post
Share on other sites

Hi daklock,
I've updated to Version 0.8 which has better compatibility with Presta 1.2.x.
Sorry that I missed the point but my shop runs on 1.1 without tax rates. The price is now calculated
with tax rates but there is no "tax included" or something else showing up besides the price. AFAIK might this be problematic in some countries with high unemployed advocates like germany.
So you should edit the productsalsobuy.tpl for something like that

   {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product.price}  19.6 % tax included 
{


and edit the css to change the size of the div.
Actually I couldn't figure our how to access or pass the $priceDisplay variable to the template and besides that I have some other things todo also ;)
Regards, trip

Share this post


Link to post
Share on other sites

Hi,

What is the last version please?

productsalsobuy5.zip
productsalsobuyv8.zip
productsalsobuy_v3.zip
productsalsobuy_v4.zip

?

Thanks ;)



Edit :

How do for not display the block when there are not articles "also bought" ?

Share this post


Link to post
Share on other sites

Hi PS 9.3
When you use presta 1.2.X I would use v8 for best results. The module displays automatically random products if there are no articles "also bought".
If you want it to disappear you can comment out (add /* and */ ) the following at the bottom of productsalsobuy.php

       /*        
       if(sizeof($relatedProducts)==0)
       {

       $relatedProducts = $this->getRandomProducts($id_lang);
       $rel_products = array();


       if ($relatedProducts)
           foreach ($relatedProducts AS $relProduct)
               $rel_products[] = Product::getProductProperties($id_lang, $relProduct);
           $report = "error";
           $smarty->assign('title', 'Customers who bought this item also bought:');

           $smarty->assign('product', $rel_products);
           return $this->display(__FILE__, 'productsalsobuy.tpl');

       }
       */


Regards, trip

Share this post


Link to post
Share on other sites

I have downloaded productsalsobuyv8.zip
But in this version, the module displays no articles when there are no articles "also bought".
Could you send me or upload again the correct version please?
I use PS v1.4
Thanks for your prompt reply

Share this post


Link to post
Share on other sites

I have tried other versions.
It seems that they displayed correctly articles "also bought" but in wrong display (not aligned / price not with VAT / no pictures / ....)
With your version 8, it displays anything !
Maybe it doest not work in localhost or/and with PS v1.4 ?

13412_EzIEDMVrs9FGJ2Kn3Qph_t

Share this post


Link to post
Share on other sites

Hi PS93,
I've downloaded the v8 version now 2 times and ran it on my localhost 1.2.4 server without probs. Maybe I did something wrong that it works but I can not copy your problem. I tested it with SEO Urls on and off, with diffferent currencies and with different configurations. I don't know where the problem might be.
Sorry when it is not working for you but I give this away for free without warranty.
Regards, trip

Share this post


Link to post
Share on other sites

Thanks for your prompt reply.
Could you send me your module again + css file particularly please?

Share this post


Link to post
Share on other sites

Guys, there is a css file attached already, the problem is that the tpl file isn't using the correct way to call it,

delete the first line in the .tpl file and add this

<link href="{$module_dir}productsalsobuy.css" rel="stylesheet" type="text/css" media="all" />

Share this post


Link to post
Share on other sites

Thanks, captain.
I "fixed" v8 version.
Regards, trip

Share this post


Link to post
Share on other sites

Nice, it is correct Iamcaptain !
But I have another problem : it doesnt display any products even if there are already articles bought...!

The problem is in the SQL request below :

private function getRandomProducts($id_lang)
   {
       global $link, $cookie;
       $result = Db::getInstance()->ExecuteS('
       SELECT * FROM '._DB_PREFIX_.'product
       LEFT JOIN '._DB_PREFIX_.'product_lang  ON ('._DB_PREFIX_.'product_lang.id_product = '._DB_PREFIX_.'product.id_product  AND '._DB_PREFIX_.'product_lang.id_lang = '.$id_lang.')
       LEFT JOIN '._DB_PREFIX_.'image ON ('._DB_PREFIX_.'image.id_product = '._DB_PREFIX_.'product.id_product AND '._DB_PREFIX_.'image.cover = 1)    
       [b]WHERE '._DB_PREFIX_.'product.active = 1
       AND '._DB_PREFIX_.'product.quantity > 0[/b]
       ORDER BY RAND() LIMIT '.Configuration::get('PAB_PIC_QUANT').'        
       ');

       return $result;


   }



=> This code displays anything !



   private function getRandomProducts($id_lang)
   {
       global $link, $cookie;
       $result = Db::getInstance()->ExecuteS('
       SELECT * FROM '._DB_PREFIX_.'product
       LEFT JOIN '._DB_PREFIX_.'product_lang  ON ('._DB_PREFIX_.'product_lang.id_product = '._DB_PREFIX_.'product.id_product  AND '._DB_PREFIX_.'product_lang.id_lang = '.$id_lang.')
       LEFT JOIN '._DB_PREFIX_.'image ON ('._DB_PREFIX_.'image.id_product = '._DB_PREFIX_.'product.id_product AND '._DB_PREFIX_.'image.cover = 1)    
       ORDER BY RAND() LIMIT '.Configuration::get('PAB_PIC_QUANT').'
       ');

       return $result;


   }



=> This code (from v5) displays some articles but there are some errors which are display also :


Notice: Undefined index: rate in D:\wamp\www\prestashop\classes\Product.php on line 1915

Notice: Undefined index: rate in D:\wamp\www\prestashop\classes\Product.php on line 1930

Notice: Undefined index: rate in D:\wamp\www\prestashop\classes\Product.php on line 1915

Notice: Undefined index: rate in D:\wamp\www\prestashop\classes\Product.php on line 1930

Notice: Undefined index: rate in D:\wamp\www\prestashop\classes\Product.php on line 1915

Notice: Undefined index: rate in D:\wamp\www\prestashop\classes\Product.php on line 1930



Any idea?

Share this post


Link to post
Share on other sites

At the moment I can not maintain the code. I have to admit maybe it wasn't perfect but every day answering posts like why is this not working here, can you do this or that is time consuming and after some months and many different versions I actually lost the overview what every version does and for which environment it was build.
Now I switched to the new version of PS and will modify the module to my needs.
The problem is it is one thing to do something for your shop or to release it public. The experience with this module is, that I don't have the time and the nerves to support it properly.
Greetz, trip

Share this post


Link to post
Share on other sites

Hello Trip,

I completely understand your frame of mind. I already had the same problem with my modules. I'll send you a PM about a proposition to ease you.

Share this post


Link to post
Share on other sites

Thanks for your reply.
Sorry for disturbing you !
I use now, the last version of PS (1.5)
Is it possible to upload your last version please?
Many thanks

Share this post


Link to post
Share on other sites

Trip,
many thanks for your this module. I use it in my shop 1.2.4 and it works like a charm. People will understand if you dont have time to reply. Keep the download link alive. Perhaps someone will improve it. Like I said, it works for me.
Take care

Share this post


Link to post
Share on other sites

Maybe I missed it. Anybody got the link for productsalsobuyv8.zip. Thank you.

Share this post


Link to post
Share on other sites

Would also know the download link for this version.
I have a earlier version on 1.2.4 and runs well.

Best regards.

ysco..

Share this post


Link to post
Share on other sites

He many thanks for the fast response jolvil ;)


Best regards,

Edit: he buddy maybe it`s me but i don`t see version v8 ?
I have version v6 thats why i want version v8 ;)

ysco..

Share this post


Link to post
Share on other sites

Thanks guys but I don't see the download link for V8 either. If someone can send it to me that would be great.

Have a great day

Share this post


Link to post
Share on other sites

I have v8 on another computer that I don't have access to at this time. If no-one else can upload a copy when I get back to my other computer I'll upload it.

Or I can zip up a live version from a site I was working on, it's a little different to the v8 official release with some cosmetic changes to suit the site I installed it for. :)

Share this post


Link to post
Share on other sites

Hello Zenith:

If you can upload the version with cosmetic changes that would be great. Thanks

Share this post


Link to post
Share on other sites

Thank you and I will install and let you know.

Have a great day

Share this post


Link to post
Share on other sites

Thanks Zenith:

Love your modified version 8. Works like a charm. No problem about install or other issues on my site. Using 1.2.5 version.

Thanks again for your effort

m

Share this post


Link to post
Share on other sites

Oucch i stick with version v6 on 1.2.4 cause v8 is screwing the whole layout.
I replaced v8 with version v6 but it stays messy, well i am glad that i tested it first on my test server lol.

ysco..

Share this post


Link to post
Share on other sites

Yes modified V8 screws the layout at least on firefox under Ubuntu, welcome to my world, Zenith

Share this post


Link to post
Share on other sites

I did the cosmetic changes on Firefox, can someone post a screenshot of the problem please, I'd love to see as I used the default Presta CSS and layout ....

Share this post


Link to post
Share on other sites

Yeah OK, that's not my modified version. I thought the issue was with my version.

Share this post


Link to post
Share on other sites

I don't know what you uploaded there but if you don't mind, you should delete the link to a broken version so others do not download it.
Enhancements are appreciated therefore the project is now hosted on sourceforge but please not this way,
Thanks in advance, trip

Share this post


Link to post
Share on other sites

It's a modified v8 that I did for a clients site as no-one could find your v8 download. What I uploaded works fine, there is nothing wrong with it. It is the original v8 that has the layout problems, not my modified version. This is the reason client asked me to fix the layout for their site.

You are welcome to use the layout from my modified version, but it does not have Buy Now or View buttons, it is a simplified template version that uses the Presta CSS.

Share this post


Link to post
Share on other sites

on localhost i have this error:

Notice: Undefined index: rate in C:\wamp\www\classes\Product.php on line 1914

Notice: Undefined index: rate in C:\wamp\www\classes\Product.php on line 1929

Notice: Undefined index: id_image in C:\wamp\www\classes\Product.php on line 1889


any idea to correct it ?

Share this post


Link to post
Share on other sites

@SmartiesKiller
What version of PrestaShop do you use ? On which page theses messages appear ?

@Zenith
Can you contribute to enhance this module with your changes. I give you an access to SourceForge if you want.

Share this post


Link to post
Share on other sites

Hi,

Great module - thanks!

Worked out of the box from the first link on sourceforge.

One question though.

It seems to make products that have never been purchased appear in the 'Also Bought' section.

This isn't a problem, just something I thought was worth mentioning as Item A on my website has no relevance to Item B on the website, although it makes it look like someone bought them together.

Its no biggy, not really bothered - its dynamic cross selling product information at the end of the day.

Thanks

Dan

Share this post


Link to post
Share on other sites

I think this is the way it works.... It just seems to randomise products in your category.

See my post above...

A confirmation from the creator would be good...

Dan

Share this post


Link to post
Share on other sites

I've just noticed that not only does the module show any product whether it is related to the item being looked at it also shows items restricted to certain groups when not logged in.

A better explanation:

I have items I use for testing in a category called 'Admin Products'. Only I have access to this category and have to be logged in to see it, within this category it has one item, 'Admin Product'

I was on my site, not logged in (no Admin Category was showing in navigation bar) but on looking at an item, 'Admin Product' showed in the 'Customers Also Bought' section.

This is a slight worry as if I had items in my shop that i really dont want guest customers to see (for trade only) they would be able to see it, they cant access it but its still there...

Share this post


Link to post
Share on other sites

Hi, I have problem with 404 images and product. Please help me. Thanx

Check image.

20725_8xEEXtJtqR9UviCVsGd0_t

Share this post


Link to post
Share on other sites

i would like to see this under "same category" as well. The version of productcategory that comes with the default theme is very buggy. Do you know if this module will have a 3rd option to show items in the same category? That would be a wonderful addition to this great module!

Share this post


Link to post
Share on other sites

hi, is there any way to position the "also bought" below product details?

Thanks
Paolo

Share this post


Link to post
Share on other sites

It's an excellent module. Thank you very much.

I have one problem: When I make the translation (to Danish) in backend the translations in backend (of the module) comes out right - BUT in frontend the headline of Others bought doesn't translate. Can anyone help?

Share this post


Link to post
Share on other sites

in the template change

    {l s='Others bought'}


to

    {l s='Others bought' mod='productsalsobuy'}

Share this post


Link to post
Share on other sites