Support Forums

Default Category Question

This is a discussion on Default Category Question within the Technical Support forums, part of the Technical Support Forums category; Hello. When placing an order, when it is time to choose the category, the very first category is automatically selected ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 11-02-2009, 02:31 PM   #1
Member
 
Join Date: May 2007
Posts: 45
Rep Power: 20
tom11011 is on a distinguished road
Default Default Category Question

Hello.

When placing an order, when it is time to choose the category, the very first category is automatically selected by default. I would like to change this to something that says "Choose" or similar instead of my first category name.

I was thinking maybe I could just create a category called choose and make it invisible but obvoiusly that is not the best way.
__________________
Aircraft For Sale
tom11011 is offline  
Old 11-02-2009, 02:41 PM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

edit the step 1 template and add an option to the dropdown with the verbage you would like.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 11-02-2009, 02:56 PM   #3
Member
 
Join Date: May 2007
Posts: 45
Rep Power: 20
tom11011 is on a distinguished road
Default

Hi thank you.

I found the template but how to edit is a little beyond me. I've posted the contents here if you can help.

Code:
{*$Revision: 165 $*}
<div id="step1">
<!-- Step 1 of Checkout -->
{literal}
<script Language="JavaScript" type="text/javascript">
<!--
function checkform(frm)
{
        {/literal}
        {foreach from=$required item="entry"}
        {literal}
        if(frm.category.value=={/literal}{$entry.id}{literal}){
                alert("{/literal}{$smarty.const.LANG_JS_SELECT_DIF_CAT}{literal}");
                frm.category.focus();
                return (false);
        }
        {/literal}
        {/foreach}
        {literal}
return (true);
}
//-->
</script>
{/literal}
<p>{$smarty.const.LANG_CATEGORY} <span class="notcompleted">» {$smarty.const.LANG_VERIFY_PACKAGE} » {$smarty.const.LANG_DETAILS} » {$smarty.const.LANG_IMAGES} » {$smarty.const.LANG_CONFIRM} </span></p>
<form action="usercheckout.php" method="post" name="addlisting" onSubmit="return checkform(this)">
        <fieldset>
                <legend>{$smarty.const.LANG_STEP_ONE}</legend>
                <table width="100%">
                        <tr>
                                <td>
                                        <label for="category">{$smarty.const.LANG_ADD_LISTING_SELECT_CAT}{$smarty.const.LANG_COLON}</label>
                                </td>
                        </tr>
                        <tr>
                                <td>
                                        <select name="category" id="category">
                                                {foreach from=$getcats item=cat}
                                                <option {if $cat.parent_id == 0}class="parent" {/if}value="{$cat.id}"{if $category==$cat.id} SELECTED{/if}>{$cat.name}</option>
                                                {/foreach}
                                        </select>
                                </td>
                        </tr>
                        <tr>
                                <td>
                                        <p class="continue"><input type="submit" name="Submit" value="{$smarty.const.LANG_ADD_LISTING_CONTINUE}" /></p>
                                </td>
                        </tr>
                </table>
        <input type="hidden" name="step" value="2" />
        <input type="hidden" name="listingid" value="{$listingid}" />
        </fieldset>
</form>
</div>
__________________
Aircraft For Sale
tom11011 is offline  
Old 11-02-2009, 03:05 PM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

How would you rate your skills with html because in essence thats all you are doing here? If your html is week I suggest readin some tutorials to get up to speed on that, then after that spend some time at smarty.net and learn what smarty is and how it works and is represented within html. Failure to spend a little tim grasping the basics of smarty will cause you a lot of headaches.

find where the select is declared.....

Code:
<select name="category" id="category">
{foreach from=$getcats item=cat}
<option {if $cat.parent_id == 0}class="parent" {/if}value="{$cat.id}"{if $category==$cat.id} SELECTED{/if}>{$cat.name}</option>
{/foreach}
</select>
right below the opening select tag and above the smarty foreach is where you define your option.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 11-02-2009, 03:05 PM   #5
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 136
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Something like:
Code:
<select name="category" id="category">
<option value="" selected="selected">Please select a category</option>
                                                {foreach from=$getcats item=cat}
                                                <option {if $cat.parent_id == 0}class="parent" {/if}value="{$cat.id}"{if $category==$cat.id} SELECTED{/if}>{$cat.name}</option>
                                                {/foreach}
                                        </select>
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 11-02-2009, 03:24 PM   #6
Member
 
Join Date: May 2007
Posts: 45
Rep Power: 20
tom11011 is on a distinguished road
Default

Ok, thank you. That does work but it is missing some logic if it is accidentally chosen.

For example, if a category is chosen that has a sub category and you don't allow listings in the main category, you get a nice message "Please select another category. This category cannot have ads placed in it".
__________________
Aircraft For Sale
tom11011 is offline  
Old 11-02-2009, 03:27 PM   #7
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by tom11011
Ok, thank you. That does work but it is missing some logic if it is accidentally chosen.

For example, if a category is chosen that has a sub category and you don't allow listings in the main category, you get a nice message "Please select another category. This category cannot have ads placed in it".
The logic happens at the script level which means the logic cant be applied until the form (ie step one) has an option (ie category) selected and submitted to the script.

php is a server side script, it runs on the server it cant evaluate anything until its sent to the server.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 11-02-2009, 03:28 PM   #8
Member
 
Join Date: May 2007
Posts: 45
Rep Power: 20
tom11011 is on a distinguished road
Default

Actually, I think the default looks good just blank and that's how I left it. Feel free to answer if you want but I consider it working now. Should they choose continue with a blank entry, they can just page backward.

Thanks again.
__________________
Aircraft For Sale
tom11011 is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Category Drop-Down Question MrGForce Technical Support 0 08-15-2009 07:44 AM
View Selected Category and Sub Category during checkout process? Kazza Technical Support 4 10-27-2008 09:02 AM
Category Question willy928 Technical Support 1 06-07-2008 08:03 PM
How to align custom category images with category links. michael Templates, HTML, CSS, and Design Help 5 02-22-2007 12:42 PM


All times are GMT -4. The time now is 04:07 AM.


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