Author Topic: Limit Manufacturers Module to only published products  (Read 6106 times)

Tommy

  • Beginner
  • *
  • Posts: 2
Limit Manufacturers Module to only published products
« on: February 17, 2011, 03:24:24 am »
I searched and could not find any threads related to this, so perhaps I am the only one who wanted this change, but in case it is of use to others here it is.

I have the manufacturers list module on my site. I did not want to clutter up the list with manufacturers whose products we are currently out of. So I made a very simple modification to the SQL query which pulls the data. It now only lists manufacturers with published products. This could be easily modified to only show manufacturers with in-stock products, but we don't use the inventory features.

To make this change all you need to do is open the file mod_virtuemart_manufacturers.php and locate the following lines starting around line 44:
Code: [Select]
$query_all  = "SELECT m.manufacturer_id,m.mf_name FROM #__{vm}_manufacturer m
$query_all .= "ORDER BY m.mf_name ASC";

and replace it with this query:
Code: [Select]
$query_all  = "SELECT DISTINCT m.manufacturer_id, m.mf_name
FROM #__{vm}_manufacturer m
LEFT JOIN #__{vm}_product_mf_xref mx ON mx.manufacturer_id = m.manufacturer_id
LEFT JOIN #__{vm}_product p ON p.product_id = mx.product_id
WHERE p.product_publish = 'Y' ";
$query_all .= "ORDER BY m.mf_name ASC";

dimitrakopouloslakis

  • Beginner
  • *
  • Posts: 14
Re: Limit Manufacturers Module to only published products
« Reply #1 on: December 10, 2012, 19:22:07 pm »
Hi, very good post! Can this work to Virtuemart 2.0.14? What hack we have to do?
Thanks!

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 308
    • Audio Store
Re: Limit Manufacturers Module to only published products
« Reply #2 on: December 16, 2012, 08:39:43 am »
In my shop are so many manufacturers and original module does not work for me.
So I decided to make my own.  :)

When you click on the logo of the manufacturer, shows information about the manufacturer.
When you click on the name of the manufacturer, shows all products of this manufacturer.
Next to the name of each manufacturer are shown in brackets number of products available from this manufacturer.
If you click on the green checkbox caption only shows products that are in stock and can be purchased.

I have also done a search engine through which you can search by name of manufacturer.
Page break is also useful when the store presents many manufacturers.

Here's how it all looks:
http://www.vspc.bg/proizvoditeli

Link to all products of a particular manufacturer I've done in the page of each product.

Page maintained only in Bulgarian.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Flasher

  • Beginner
  • *
  • Posts: 37
Re: Limit Manufacturers Module to only published products
« Reply #3 on: March 11, 2013, 23:51:28 pm »
Hi. I want to do this same thing on my module but im on VM2. How can we do it caus ethe _mod_virtuemart_manufacturer.php is different!