If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Sideboxes / Make Your Music Side Boxes Smarter - Verify Products Exist

Make Your Music Side Boxes Smarter - Verify Products Exist

Started by jbible on 16 Jan 2013, 12:54 AM · Views: 1,824

Results 1 to 2 of 2
16 Jan 2013, 12:54 AM
#1
jbible avatar

jbible

New Zenner

Join Date:
Apr 2008
Posts:
60
Plugin Contributions:
0

Post #1 by jbible

This change will make it so your music side boxes only display names associated with active products.

First run these SQL statements....

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Artists List - Verify Product Exist', 'PRODUCTS_ARTISTS_STATUS', '1', 'Verify that at least 1 product exists and is active for the artist name to show<br /><br />Note: When this feature is ON it can produce slower results on sites with a large number of products and/or artists<br />0= off 1= on', 3, 7, NULL, now(), NULL, 'cfg_select_option(array(\'0\', \'1\'), ');
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Record Company List - Verify Product Exist', 'PRODUCTS_RECORD_COMPANY_STATUS', '1', 'Verify that at least 1 product exists and is active for the artist name to show<br /><br />Note: When this feature is ON it can produce slower results on sites with a large number of products and/or record companies.<br />0= off 1= on', 3, 7, NULL, now(), NULL, 'cfg_select_option(array(\'0\', \'1\'), ');

in includes\modules\sideboxes\artists.php find

$artists_query = "select m.artists_id, m.artists_name
                            from " . TABLE_RECORD_ARTISTS . " m
                            order by artists_name";

replace with

if (PRODUCTS_ARTISTS_STATUS == '1') {
    $artists_query = "select distinct a.artists_id, a.artists_name from (" . TABLE_RECORD_ARTISTS . " a left join " . TABLE_PRODUCT_MUSIC_EXTRA . " pme on a.artists_id = pme.artists_id left join " . TABLE_PRODUCTS . " p on pme.products_id = p.products_id ) where p.products_status = 1 order by artists_name"; 
							
  } else {
    $artists_query = "select m.artists_id, m.artists_name
                            from " . TABLE_RECORD_ARTISTS . " m
                            order by artists_name";
  }

in includes\modules\sideboxes\record_companies.php find

$record_company_query = "select m.record_company_id, m.record_company_name
                            from " . TABLE_RECORD_COMPANY . " m
                            order by record_company_name";

replace with

if (PRODUCTS_RECORD_COMPANY_STATUS == '1') {
    $record_company_query = "select distinct r.record_company_id, r.record_company_name from (" . TABLE_RECORD_COMPANY . " r left join " . TABLE_PRODUCT_MUSIC_EXTRA . " pme on r.record_company_id = pme.record_company_id left join " . TABLE_PRODUCTS . " p on pme.products_id = p.products_id ) where p.products_status = 1 order by record_company_name"; 
							
  } else {
    $record_company_query = "select m.record_company_id, m.record_company_name
                            from " . TABLE_RECORD_COMPANY . " m
                            order by record_company_name";
  }

You could do the same thing for genres if you like as well. Dont have that handy because I dont currently use genres.

26 Mar 2013, 1:57 PM
#2
doooomed avatar

doooomed

Zen Follower

Join Date:
Jun 2009
Posts:
275
Plugin Contributions:
0

Post #2 by doooomed

Thanks for this...works great!