Do not want default value to show in filter

  • Posts: 165
  • Thank you received: 3
10 years 11 months ago #137402

-- 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

Last edit: 10 years 11 months ago by jschroeder.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 11 months ago #137547

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.

Please Log in or Create an account to join the conversation.

  • Posts: 165
  • Thank you received: 3
10 years 11 months ago #137597

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

Attachments:
Last edit: 10 years 11 months ago by jschroeder.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #137771

Hi,

I think that you can do that by adding the code:

if(empty($val[0]) && $field->field_required) continue;
before the code:
$html.='<OPTION '.$selectedItem.' name="'.$filter->filter_data.'" value="'.$val[0].'">'.JText::_($val[1]).'</OPTION>';
in the file administrator/components/com_hikashop/classes/filter.php

Please Log in or Create an account to join the conversation.

Time to create page: 0.072 seconds
Powered by Kunena Forum