Make and Model for auto web sites.

This is a discussion on Make and Model for auto web sites. within the v3.0 Questions & Support forums, part of the v3.0.x Help & Support category; I know this will be simpler to implement in the next version but if anyone would like to add this ...


Go Back   68 Classifieds Forums > Archives > v3.0.x Help & Support > v3.0 Questions & Support

 
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-02-2006, 06:43 PM
igor81's Avatar
Junior Member
 
Join Date: Apr 2006
Location: Croatia
Posts: 26
Rep Power: 12
Default Make and Model for auto web sites.

I know this will be simpler to implement in the next version but if anyone would like to add this in V3.0.14 here is a step by step.

1.Enter administration and create all the car brands (make) as independent categories.

2.Create in extra fields as many model fields as there are makes, each make field is tied to a category (ex:field "Ford Model" in extra fields is linked to field "Ford" in edit categories).

3. Once the database fields are connected, create two dynamic fields in your search page and name them make and model.

4. I used a filterselect javascript to activate the model field, it only displays models for the currently selected make, if no model is selected then it is dormant.

Here is the actual code (I put this in search.tpl):

<form name="search" id="search" method="get" action="searchresults.php">
<script src="includes/filterSelect.js"></script>
<script language="JavaScript">
auto_enable_disable = true;
handle_events_on_filter = true;
</script>
<td align="left" class="formleft" width=50>Make:</td>
<td class="formright" width=175><select name="make" onChange="filterSelect(model,this)">
<!-- // Makes // -->
<option value="">All Makes</option>
<option value="1">Alfa Romeo</option>
<option value="2">Audi</option>
<option value="3">BMW</option>
etc.... </select>
</td>

*Note that the option value must match the "id" field in the
categories table otherwise it will give you wrong results.

<td align="left" class="formleft" width=50>Model:</td>
<td class="formright" width=175><select name="model" disabled="true">
<option value="" filter="">All Models</option>

<!-- // Alfa Romeo Models // -->
<option value="GTA" filter="19">GTA</option>
<option value="Spider" filter="19">Spider</option>
etc...
</select>
</td>
<td class="pformstrip" width=50 align=middle><input type="submit" name="Submit" value="{$smarty.const.LANG_SEARCH_BUTTON}" />
</form>

5. Since we are calling searchresults.php, we must make changes in there so that the right results are displayed.

Find and replace this line: if(substr($objItem,0,3)=="opt" && $objValue<>"")

with: if($objItem=="model" && $objValue<>"") to find the models

Finally replace this line:
$sSQL .= ( empty($_REQUEST['type']) ) ? '': " AND p.section LIKE '%".safeAddSlashes($_REQUEST['type'])."%'";

with:
$sSQL .= ( empty($_REQUEST['make']) ) ? '': " AND p.section LIKE '%".safeAddSlashes($_REQUEST['make'])."%'";

This will get the right make and you are done.

  #2  
Old 04-07-2006, 02:59 AM
Chaslie's Avatar
Moderator
 
Join Date: Mar 2006
Location: Great Ocean Road - Australia
Posts: 698
Rep Power: 25
Default

This is a great mod!

Now if we wanted to add a 'count' to each of the 'models', is this possible and how might we go about it?

eg:

FORD
- Escort(34)
- Explorer (2)
- Fiesta (23) ...etc
__________________
Chaslie
V3.1.10 dev
AUSCITY

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals

HTML Help
W3 Schools
  #3  
Old 04-16-2006, 09:26 AM
igor81's Avatar
Junior Member
 
Join Date: Apr 2006
Location: Croatia
Posts: 26
Rep Power: 12
Default

Sorry for the really late reply Chaslie.

Would you like to display something like (category) Make --> (subcategory) Model ?

The model in my mod is an extra field not a subcat but I am sure I could create a workaround with sql.
  #4  
Old 04-16-2006, 06:45 PM
Chaslie's Avatar
Moderator
 
Join Date: Mar 2006
Location: Great Ocean Road - Australia
Posts: 698
Rep Power: 25
Default

No the way you have yours working and how it is being displayed is fine. Just wondering if a model 'count' can be included or added and displayed like this:

FORD
- Escort(34)
- Explorer (2)
- Fiesta (23) ...etc
__________________
Chaslie
V3.1.10 dev
AUSCITY

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals

HTML Help
W3 Schools
  #5  
Old 04-18-2006, 05:24 PM
igor81's Avatar
Junior Member
 
Join Date: Apr 2006
Location: Croatia
Posts: 26
Rep Power: 12
Default

Been a bit ofline busy. I will try and find a way to do this some time soon.
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 06:09 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22