Filter by additional fields (display only)

  • Posts: 77
  • Thank you received: 1
8 years 8 months ago #233576

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8

Hello, I need help.
The task to create a filter by brand , series and model
(example www.aks.ua/catalog/zaryadnoye-ustroistvo-noutbuk/ )



Series depends on the brand , the model of the series

The solution I see this:
Created custom fields table with brands , then created a table with the product series for the first brand (Acer), to the display conditions set " display only " > Select the field with the brands > Select brand the Acer , then similarly done with a table with lots of brand number 2 (Apple).





Well, sort of logical that the product you specify the brand number 1 (Acer), there is a table with lots for the brand or the brand of the number 2, and there is a series for him , but for some reason , the reality is not so - choose brend1 , nothing happens , the brand number 2 - the same , but when I install 2 brand values ​​that appear at once both fields series :




I do not understand what that is a bug ?
and yes, for some reason , even if their fill , they are not saved .


when viewing the page's source code , it is clear that the value is "display: none;" for inactive values ​​, but in my case I do not understand why it is like to remove it , and is not for everyone , but only when the selected dependent on the value of this field



By the way if it is manually removed from the page ( in the visual code editor ) , the field appears and you can even set the value that can be saved !

Tell me how to solve the problem?

Last edit: 8 years 8 months ago by Denys.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 8 months ago #233589

Hi,

I'm not sure what is the problem, since I didn't understand everything in your message, but from what I can see you're not going the correct road for what you want to do.
What you need is to create only three custom product field:
- One with all the brands in it like you already have
- One with all the series of all the brands in it
- One with all the models of all the series of all the brands in it
Then, in each product, you need to select the brand, serie, model corresponding to the product.
And then, you create three filters, one for each custom field, and you turn on the "dynamic display" setting of each filter.
That way, when the customer selects a brand in the brands filter, the page will update and he will see only the series and models of that brand. And when he selects a model in the models filter, the page will update and he will see only the models of that serie

Because the way you're trying to do it won't work as you can't assign filters to different custom fields and you don't want to have one model filter for each serie displayed on the frontend at the same time.

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

  • Posts: 77
  • Thank you received: 1
8 years 8 months ago #233682

I'm sorry, I take translation of Google translator .

I was so originally wanted to do , but one product can be of two different series , and suitable to different models . Thus, when selecting one of the series will be displayed in the filter model does not correspond to the series. For example, if I choose Acer1 series , the field will be a model in the filter clears the displayed 4 models (Acer1, Acer11, Acer2, Acer22).



By this I began to look for other solutions . Tell me how to remove the filter from the model not sootvetsvuyushie series, because I can not set the model specifically for the series.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 8 months ago #233700

Hi,

I don't understand your question.

Having to select several modules or several series in the custom products is not a problem either. Just use the type "multiple dropdown" in your custom product field.

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

  • Posts: 77
  • Thank you received: 1
8 years 8 months ago #233736

Оne product may comprise two (or more) series, each series of the models . for example, the product brand - Acer, the two series - Aspire and Ferrari. At the Aspire model - "1200" and " 1300 " . In a series of models of Ferrari - "2000" and " 2100" . These values ​​have a single product . If the product filter to select a series of "Ferrari " , the model of the field value is " 1200 , 1300 , 2000, 2100" . And it's not right , because when you select the series "Ferrari " in the field model should be a model , " 2000 and 2100" . How to Add a model to the series?

Last edit: 8 years 8 months ago by Denys.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 8 months ago #233816

Hi,

Ok, I see what you mean.
Well, the system isn't made to handle that case.
Then it would require a custom plugin to be developed to enforce the rule "no model of other series than the selected serie". Because the rule in the system is "no model of other series than the series of the products displayed on the listing".
Such plugin would have to implement the trigger onBeforeProductListingLoad:
www.hikashop.com/support/documentation/6...reProductListingLoad

I can also recommend you to contact the Cherry Picker developer and see if such case is handled by their filtering solution:
extensions.joomla.org/extension/cherry-picker-for-hikashop
It would be a cheaper alternative than developing a custom plugin to handle that.

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

  • Posts: 77
  • Thank you received: 1
8 years 7 months ago #234798

thanks for the answer
I still would like to try the standard methods. What do you think, can happen if we make the "custom_field" with a value of "multiple"?



Tell me how to change the code so that multiple values are stored. Now they are just putting in the admin panel but not saved
<tr id="custom_field" <?php echo $fieldsetFields; ?> >
	<td class="key">
	 <?php echo JText::_( 'FIELDS' ); ?>
		</td>
		<td>
			<select name="data[filter][custom_field]" multiple>
				<?php
				       if(!empty($this->fields)){
						foreach($this->fields as $key => $field){
					?>
					<option <?php if(@$this->element->filter_options['custom_field'] == $field->field_namekey) 
echo "selected=\"selected\""; ?> value='<?php echo $field->field_namekey; ?>' ><?php echo $key; ?></option>
						<?php }
							} ?>
							</select>
						</td>
					<tr/>

I think all of you should get if the filter to add more tables for which is set to "display only".

Last edit: 8 years 7 months ago by Denys.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 7 months ago #234927

Hi,

If you make that change you'll have to change the filtering system to handle multiple values. Just adding multiple in the select field won't help.
You'll have to modify the code of the file administrator/components/com_hikashop/classes/filter.php to handle that.
First, in the saveForm function to handle the several values of the select and implode them with a column for example. Then, you would have to modify the complex queries relative to the custom fields in that same file.

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

Time to create page: 0.069 seconds
Powered by Kunena Forum