Filter characteristic id

  • Posts: 915
  • Thank you received: 71
  • Hikashop Business
6 months 4 days 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: 2064
  • Thank you received: 280
  • MODERATOR
6 months 4 days 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: 6 months 4 days ago by Philip.

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

  • Posts: 915
  • Thank you received: 71
  • Hikashop Business
6 months 4 days 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: 6 months 4 days ago by kyratn.

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

  • Posts: 65077
  • Thank you received: 9449
  • MODERATOR
6 months 3 days 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.072 seconds
Powered by Kunena Forum