Page 2 of 3
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Mon Mar 12, 2012 4:03 pm
by shamshair
*****************Thanks A Lot For this great sharing*********************
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Sat Mar 24, 2012 12:07 pm
by 3antz
Hi Q, thanks for the free mod. Is there a way to only show products which are available in stock?
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Mon Apr 16, 2012 6:19 am
by Klimskady
Thanks for this Q!.
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Wed Dec 12, 2012 8:15 am
by Pr3W
3antz wrote:Hi Q, thanks for the free mod. Is there a way to only show products which are available in stock?
I have the same doubt.
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Sun Dec 23, 2012 9:20 am
by jty
3antz wrote:Hi Q, thanks for the free mod. Is there a way to only show products which are available in stock?
in stock is controlled by the field p.quantity
so, to only show products in stock we need to add p.quantity > 0 somewhere
to do it without touching the getProduct function in model (because it's use elsewhere for other purposes, I added p.quantity > 0 into the latest.php controller file like this. Look for the words "here" in the following code.
Code: Select all
$results = $this->model_catalog_product->getProducts($data);
// randomise latest - from
// http://forum.opencart.com/viewtopic.php?f=131&t=32570&start=20
srand((float)microtime() * 1000000);
shuffle($results);
$results = array_slice($results, 0, $setting['limit']);
//
foreach ($results as $result) {
// here
if ($result['quantity'] > 0) {
// end here
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
} else {
$image = false;
}
// blaa blaa blaa code deleted
$this->data['products'][] = array(
'product_id' => $result['product_id'],
// blaa blaa blaa code deleted
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
);
// here
}
// end here
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/latest.tpl')) {
// blaa blaa blaa code deleted
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Thu Dec 27, 2012 11:43 pm
by xtr3mx7
thanks for the share Q, works perfectly on 1.5.4

Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Sun Feb 17, 2013 3:51 am
by HASHR
This worked perfectly for us! We appreciate it.
Cheers,
HASHR
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Wed Apr 10, 2013 12:37 am
by scot
AWESOME! "Latest" Works on 1.5.5.1 Thank You!
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Thu May 02, 2013 12:12 am
by labeshops
exactly what I needed for my specials! Works perfectly! Thanks.
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Fri Jul 19, 2013 8:06 pm
by qixbix
perfect - thankkss

Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Mon Jul 22, 2013 9:54 pm
by bobmartinusa
Qphoria wrote:Created vqmods for random latest, featured, bestsellers, and specials using the new no-strain method
What does "no-strain" mean?
Normally items are randomized by using the "rand()" mysql command. The problem with this is that the more products you have, the more items that must be randomized on the database. If you have a lot of products, it puts a large strain on the database having to randomize them all first, then only grabbing 10 of them.
So this mod uses a better method. It will pull more than the limit set and randomize them with php which is much faster and less intensive. Then return only the limit requested. Removing strain from the database.
One of the best mods for opencart and in my opinion it has to be added to the core files of opencart.
I installed in 1.5.5.1 and it works like a breeze
method of installing :
1) Download the file that you want ( I installed all)
2) just copy and paste in the xml folder of your vqmod in site installation directory.
Done...............Enjoy
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Sun Sep 01, 2013 12:39 am
by therugworld
This module works great - 1.5.3 - randomly shows products in the module out of the chosen products in the back end module settings.
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Tue Nov 12, 2013 8:43 am
by teknology3d
Works great! Thanks!
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Mon Nov 18, 2013 3:54 am
by matte2k
Using 1.5.5.1 All work great but I think "home", were I have both bestseller, feature and specials module, load a couple of seconds slower now then before!
Should it be like that?
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Wed Nov 27, 2013 7:59 am
by stokeyblokey
I have not noticed any difference on my site with just the Specials randomized matte2k...
Thanks Qphoria for a great little bit of code, working flawlessly in OC1.5.6 with the additional stock check added in
Stokey
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Sun Jan 05, 2014 6:05 am
by MaviATES
Qphoria wrote:Created vqmods for random latest, featured, bestsellers, and specials using the new no-strain method
What does "no-strain" mean?
Normally items are randomized by using the "rand()" mysql command. The problem with this is that the more products you have, the more items that must be randomized on the database. If you have a lot of products, it puts a large strain on the database having to randomize them all first, then only grabbing 10 of them.
So this mod uses a better method. It will pull more than the limit set and randomize them with php which is much faster and less intensive. Then return only the limit requested. Removing strain from the database.
Thanks a lot it works v1.5.6

Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Wed Mar 26, 2014 6:57 pm
by stokeyblokey
Can Qphoria or anyone tell me how to include the stock check (like the code provided by jty) into the Featured products module?
I have tried but get undefined index errors and no products show up in the front-end of the store, just the empty Featured box...
I suspect this will involve a bit more coding than I am capable of!
Cheers,
Stokey
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Fri Jun 27, 2014 4:20 pm
by Goncharenko
Can anyone confirm this works with the latest version?
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Mon Jun 30, 2014 9:17 pm
by Qphoria
Goncharenko wrote:Can anyone confirm this works with the latest version?
It does
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Posted: Sat Aug 02, 2014 1:20 pm
by applesmiles
works perfectly for 1.5.4 thanks
