in stock is controlled by the field p.quantity3antz wrote:Hi Q, thanks for the free mod. Is there a way to only show products which are available in stock?
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
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
exactly what I needed for my specials! Works perfectly! Thanks.
Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.
One of the best mods for opencart and in my opinion it has to be added to the core files of opencart.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.
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
This module works great - 1.5.3 - randomly shows products in the module out of the chosen products in the back end module settings.
http://www.TheRugWorld.co.uk - Rugs, Carpet, Vinyl & Laminates! FREE UK Delivery - Worldwide Shipping!
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
Thanks Qphoria for a great little bit of code, working flawlessly in OC1.5.6 with the additional stock check added in
Stokey
Stokey
Thanks a lot it works v1.5.6Qphoria 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.
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
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
Stokey
Who is online
Users browsing this forum: No registered users and 54 guests