- Posts: 165
- Thank you received: 3
Do not want default value to show in filter
- jschroeder
-
Topic Author
- Offline
Less
More
12 years 9 months ago - 12 years 9 months ago #137402
by jschroeder
Do not want default value to show in filter was created by jschroeder
-- url of the page with the problem -- :
67.43.0.213/
-- HikaShop version -- :2.2.3
-- Joomla version -- : 3.2.1
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message
Hi, I have a problem. I have a filter on my site right now called "test" under the section of the top of my page called "Quick Search". It is a filter based off of my custom fields. The problem I am having is in the backend of the site I have a selection of mattress types called, gel, firm, pillowtop, etc.
The problem I am having is i have to have this field required in the backend of the site, so I made a default title called N/A and left the value blank so it would require this field. However on the frontend of the website it shows this value. I do not want N/A shown on the frontend of the website. I want the default selection to be set to "all" by default.
How can I accomplish this? I have tried for hours to figure this out and cannot.
Thanks,
Josh
-- HikaShop version -- :2.2.3
-- Joomla version -- : 3.2.1
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message
Hi, I have a problem. I have a filter on my site right now called "test" under the section of the top of my page called "Quick Search". It is a filter based off of my custom fields. The problem I am having is in the backend of the site I have a selection of mattress types called, gel, firm, pillowtop, etc.
The problem I am having is i have to have this field required in the backend of the site, so I made a default title called N/A and left the value blank so it would require this field. However on the frontend of the website it shows this value. I do not want N/A shown on the frontend of the website. I want the default selection to be set to "all" by default.
How can I accomplish this? I have tried for hours to figure this out and cannot.
Thanks,
Josh
Last edit: 12 years 9 months ago by jschroeder.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
12 years 9 months ago #137547
by Mohamed Thelji
Replied by Mohamed Thelji on topic Do not want default value to show in filter
Hi Josh,
The solution will probably be to :
- Set the "Default value" option of your custom field to "All"
- Go to the page "Hikasohp->Display->Custom Fields" and set the "required" option of your custom field to YES.
The solution will probably be to :
- Set the "Default value" option of your custom field to "All"
- Go to the page "Hikasohp->Display->Custom Fields" and set the "required" option of your custom field to YES.
Please Log in or Create an account to join the conversation.
- jschroeder
-
Topic Author
- Offline
Less
More
- Posts: 165
- Thank you received: 3
12 years 9 months ago - 12 years 9 months ago #137597
by jschroeder
Replied by jschroeder on topic Do not want default value to show in filter
Hi thanks for the answer, but this will not work for what I am trying to do. I attached a screenshot of the custom fields for you to see.
On the backend I already have the field set to required. Yes, it makes the field required, but If I do not add the option N/A on the backend it autoselects the default value. In my case if I do not have N/A as the default option with a blank value it will autoselect one of my my filter values as a default value which cannot happen. The default value needs to be blank until my client selects an option, that way when you click save in the backend it says field required and will not let you save the product until you fill this out.
If you do what you are saying it saves the product with whatever the default value is which cannot happen.
I understand if you remove the N/A with the blank default value that it will auto select "All" in the front end, but this will just not work with what I am trying to do. Also, I cannot just name the value to "all" either this will not work because all needs to actually be all products and if you do that the word all would show up twice in the dropdown.
How can I get this to happen?
Thanks,
Josh
On the backend I already have the field set to required. Yes, it makes the field required, but If I do not add the option N/A on the backend it autoselects the default value. In my case if I do not have N/A as the default option with a blank value it will autoselect one of my my filter values as a default value which cannot happen. The default value needs to be blank until my client selects an option, that way when you click save in the backend it says field required and will not let you save the product until you fill this out.
If you do what you are saying it saves the product with whatever the default value is which cannot happen.
I understand if you remove the N/A with the blank default value that it will auto select "All" in the front end, but this will just not work with what I am trying to do. Also, I cannot just name the value to "all" either this will not work because all needs to actually be all products and if you do that the word all would show up twice in the dropdown.
How can I get this to happen?
Thanks,
Josh
Last edit: 12 years 9 months ago by jschroeder.
Please Log in or Create an account to join the conversation.
12 years 9 months ago #137771
by nicolas
Replied by nicolas on topic Do not want default value to show in filter
Hi,
I think that you can do that by adding the code:
before the code:
in the file administrator/components/com_hikashop/classes/filter.php
I think that you can do that by adding the code:
Code:
if(empty($val[0]) && $field->field_required) continue;
Code:
$html.='<OPTION '.$selectedItem.' name="'.$filter->filter_data.'" value="'.$val[0].'">'.JText::_($val[1]).'</OPTION>';
Please Log in or Create an account to join the conversation.
Time to create page: 0.169 seconds