Forums / Templates, Stylesheets, Page Layout / Can't find a way to search by Model in Advanced Search - could somebody help please?

Can't find a way to search by Model in Advanced Search - could somebody help please?

Started by athens_collectibles on 13 Jul 2011, 7:00 PM · Views: 1,266

Results 1 to 4 of 4
13 Jul 2011, 7:00 PM
#1
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

Can't find a way to search by Model in Advanced Search - could somebody help please?

Hi,

I have spent most of the day trying to find a solution and experimenting but with no luck :(

I wonder if a kind soul could advise me. I'm nearly there but stuck.

The idea is to add an extra search field in the "Advanced Search" form. The field is the product's model, entered in the appropriate box when a product is listed. I'm using v1.3.9h and have so far changed the advanced_search.php file to include an entry for Model (I copied all the entries for Manufacturers and renamed them accordingly). The lines in red below show my added entries in the file.

  define('TEXT_SEARCH_IN_DESCRIPTION', 'Search in product descriptions');
  define('ENTRY_CATEGORIES', 'Search by category');
  define('ENTRY_INCLUDE_SUBCATEGORIES', 'Include subcategories');
  define('ENTRY_MANUFACTURERS', 'Search by manufacturer');
  define('ENTRY_MODELS', 'Search by model');
  define('ENTRY_PRICE_RANGE', 'Search by price range');
  define('ENTRY_PRICE_FROM', 'Price from:');
  define('ENTRY_PRICE_TO', 'Price to:');
  define('ENTRY_DATE_RANGE', 'Search by date added');
  define('ENTRY_DATE_FROM', 'Date from:');
  define('ENTRY_DATE_TO', 'Date to:');

  define('TEXT_SEARCH_HELP_LINK', 'Need help for a better search?');

  define('TEXT_ALL_CATEGORIES', 'All categories');
  define('TEXT_ALL_MANUFACTURERS', 'All manufacturers');
  define('TEXT_ALL_MODELS', 'All models');

  define('TABLE_HEADING_IMAGE', '');
  define('TABLE_HEADING_PRODUCTS', 'Product name');
  define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');
  define('TABLE_HEADING_MODEL', 'Model');
  define('TABLE_HEADING_QUANTITY', 'Quantity');
  define('TABLE_HEADING_PRICE', 'Price');
  define('TABLE_HEADING_WEIGHT', 'Weight');
  define('TABLE_HEADING_BUY_NOW', 'Buy now');

Next, I added the lines in red below the manufacturer list lines in the tpl_advanced_search_default.php

<fieldset class="manufacturerList">
    <legend><?php echo ENTRY_MANUFACTURERS; ?></legend>
    <?php echo zen_draw_pull_down_menu('manufacturers_id', zen_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)), PRODUCTS_MANUFACTURERS_STATUS), $sData['manufacturers_id']); ?>
<br class="clearBoth" />
</fieldset>
<br class="clearBoth" />

<fieldset class="modelList">
    <legend><?php echo ENTRY_MODELS; ?></legend>
    <?php echo zen_draw_pull_down_menu('[B]manufacturers_id[/B]', [B]zen_get_manufacturers[/B](array(array('id' => '', 'text' => TEXT_ALL_MODELS)), [B]PRODUCTS_MANUFACTURERS_STATUS[/B]), $sData['[B]manufacturers_id[/B]']); ?>
<br class="clearBoth" />
</fieldset>
<br class="clearBoth" />

Is there a way to replace the big bold parameters in the above code with the corresponding ones that will allow the "Search by model" to operate?

I wouldn't want to use add ons or extra side boxes for this facility. I also know that it's simple for the developers to provide an answer, which I couldn't find using the Developers Tool Kit or searching in the forum, the FAQs and the Wiki.

Please note that the above changes were made to my local installation and are not reflected in the live site.

Thanks in advance for any assistance and kind regards.

15 Jul 2011, 8:34 PM
#2
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

Re: Can't find a way to search by Model in Advanced Search - could somebody help please?

Any help please?

I believe that this is something easy for the ZC developers since "products_model" is a field of the "products" table in the database, or am I wrong because it doesn't have a unique id like the manufactures?

10 Sep 2011, 3:43 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Can't find a way to search by Model in Advanced Search - could somebody help please?

This is not just a matter of swapping a constant or variable name; zen_get_manufacturers() is a function that does some lookup and calculating to yield presumably an array of names. You would need to build a new function that did the appropriate work to give the model array.

11 Sep 2011, 11:14 AM
#4
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

Re: Can't find a way to search by Model in Advanced Search - could somebody help please?

Thank you Glenn, I thought it was something easy (swapping a constant or variable name as you said).

Building a function is beyond my abilities and, at the end of the day, it's not really that important to me, so I'll forget about it.

Again, thanks for replying and have a nice day.