Filter characteristic id

  • Posts: 1119
  • Thank you received: 114
5 years 6 months ago #297925

Hi,

How could i get each filter characteristic value id in product / filter.php view?

As each filter is added with "$html[$count]" i am not able to find it...



Thanks

Attachments:

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

  • Posts: 4486
  • Thank you received: 609
  • MODERATOR
5 years 6 months ago #297943

Hello,

You can get what you need around filters in $this->filters, you will have array with this kind of data inside :



Hope this will fit your needs.

Regards

Last edit: 5 years 6 months ago by Philip.

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

  • Posts: 1119
  • Thank you received: 114
5 years 6 months ago #297950

Hi,

Thanks for replay Philip.

Well yes, it gives array for filter_value if filter is by price. However if it's by characteristics it gives " string(0)".

I have looked into "administrator/components/com_hikashop/classes/filter.php and found this line:

if($filter->filter_data=='characteristic'){
			$characteristic_values=parent::getCharacteristics($filter, $datas);
			if(!empty($characteristic_values)){
				foreach($characteristic_values as $val){
					$checked=''; $deleteButton='';
					if(!empty($selected) && is_array($selected) && in_array($val->characteristic_id, $selected)){
						$checked='checked="checked"';
						if($type=='radio'){ $deleteButton='  '.parent::getDeleteButton($filter, $divName, '', $html, '', true, 'filter_'.$filter->filter_id.'_'.$val->characteristic_id.'_'.$divName); }
					}
					$html.='<span class="hikashop_filter_checkbox"><input '.$onClick.' '.$checked.' type="'.$type.'" name="filter_'.$filter->filter_namekey.$tab.'" value="'.$val->characteristic_id.'" id="filter_'.$filter->filter_id.'_'.$val->characteristic_id.'_'.$divName.'"/><label for="filter_'.$filter->filter_id.'_'.$val->characteristic_id.'_'.$divName.'">'.$val->characteristic_value.'</label>'.$deleteButton.'</span>'.$br;
				}
			}
		}




I think i miss some connection between characteristics...

So question is same. How can i get each filter characteristic value id?

Thanks for help.

Kind Regards

Attachments:
Last edit: 5 years 6 months ago by kyratn.

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
5 years 6 months ago #297953

Hi,

With that code you can get the characteristic values in product/filter.php:

$values = $this->filterTypeClass->getCharacteristics($filter, $datas);
It's basically the same as in the class with the line:
$characteristic_values=parent::getCharacteristics($filter, $datas);

The following user(s) said Thank You: kyratn

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

Time to create page: 0.073 seconds
Powered by Kunena Forum