Community Forums

[vQmod] - 1.4.x & 1.5.x Show Random products for modules

Put any free vQmod scripts here.
vQmod details

Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules

Postby shamshair » Mon Mar 12, 2012 8:03 am

*****************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

Postby 3antz » Sat Mar 24, 2012 4:07 am

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

Postby Klimskady » Sun Apr 15, 2012 10:19 pm

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

Postby Pr3W » Wed Dec 12, 2012 12:15 am

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
User avatar
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

Postby jty » Sun Dec 23, 2012 1:20 am

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

Postby xtr3mx7 » Thu Dec 27, 2012 3:43 pm

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

Postby HASHR » Sat Feb 16, 2013 7:51 pm

This worked perfectly for us! We appreciate it.
Cheers,
HASHR
Dropbox | http://my.cur.lv/dropbox
GoDaddy | 20% off with WOWBITCOIN code
Earn BTC | https://coinurl.com/index.php?ref=socialsales
User avatar
HASHR
 
Posts: 1
Joined: Sat Feb 16, 2013 7:37 pm

Re: [vQmod] - 1.4.x & 1.5.x Show Random products for modules

Postby scot » Tue Apr 09, 2013 4:37 pm

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

Postby labeshops » Wed May 01, 2013 4:12 pm

exactly what I needed for my specials! Works perfectly! Thanks.
labeshops
 
Posts: 2141
Joined: Wed Aug 03, 2011 8:41 pm
Location: Florida, USA

Previous

Return to vQmods

Who is online

Users browsing this forum: No registered users and 10 guests

Hosted by Arvixe Web Hosting