[vQmod] - 1.4.x & 1.5.x Show Random products for modules
29 posts
• Page 2 of 2 • 1, 2
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
*****************Thanks A Lot For this great sharing*********************
- shamshair
- Posts: 5
- Joined: Thu Dec 22, 2011 7:12 pm
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Hi Q, thanks for the free mod. Is there a way to only show products which are available in stock?
- 3antz
- Posts: 140
- Joined: Sun Oct 02, 2011 10:52 am
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
Thanks for this Q!.
- Klimskady
- Posts: 160
- Joined: Mon Jun 06, 2011 11:57 pm
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
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.
Mauro G. Jr
-

Pr3W - Posts: 1
- Joined: Wed Dec 12, 2012 12:06 am
- Location: Brasil
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
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
- jty
- Posts: 1163
- Joined: Sat Aug 30, 2008 12:19 am
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
thanks for the share Q, works perfectly on 1.5.4 

- xtr3mx7
- Posts: 43
- Joined: Sun Jul 12, 2009 5:02 pm
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
This worked perfectly for us! We appreciate it.
Cheers,
HASHR
Cheers,
HASHR
Dropbox | http://my.cur.lv/dropbox
GoDaddy | 20% off with WOWBITCOIN code
Earn BTC | https://coinurl.com/index.php?ref=socialsales
GoDaddy | 20% off with WOWBITCOIN code
Earn BTC | https://coinurl.com/index.php?ref=socialsales
-

HASHR - Posts: 1
- Joined: Sat Feb 16, 2013 7:37 pm
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
AWESOME! "Latest" Works on 1.5.5.1 Thank You!
- scot
- Posts: 12
- Joined: Fri Jan 20, 2012 8:13 pm
Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules
exactly what I needed for my specials! Works perfectly! Thanks.
Running Opencart v1.5.2.2 with multi-stores from http://www.labeshops.com including Sexy Clothing, Lingerie & Shoes, Adult Halloween Costumes Gothic Jewelry, Clothing, Shoes Spiritual Supplies for all Paths, Sterling Silver Jewelry & more and Egyptian God Statues = Hosted by Midphase
- labeshops
- Posts: 2141
- Joined: Wed Aug 03, 2011 8:41 pm
- Location: Florida, USA
29 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 10 guests













