Originally Posted by
Fireflyz
Thanks! exactly what I was looking for.
Is there a way to exclude certain attributes?
Way way back people wanted to know if there was a way to exclude certain attributes from the filter while leaving some on.
I would like to brain storm on this and see if anyone can develop on my idea to see how to implement it in php.
As far as I can see there are 2 main areas of code that control how attributes are called and displayed by the template module:
In includes/modules/pages/product_filter_result/header_php.php
PHP Code:
$enable_attribute_filter = true ;
if(sizeof($option_ids)>0){
for($i=0;$i<sizeof($option_ids);$i++){
if(!(empty($option_values[$i])))
{
$where_str .= " AND pa.options_id = ".$option_ids[$i];
$where_str .= " AND pa.options_values_id = ".$option_values[$i];
}
}
}
if($enable_attribute_filter){
$where_str .= " AND p.products_id = pa.products_id ";
}
But then I realised that in the process of loading the attribute dropdown menus this statement is probably irrelevant since this file controls the search/filter results and how they are displayed and not the selection of dropdown menus, its all done AFTER the sidebox has already been loaded with all the various filter options.
So I took a look at the actual tpl file.
PHP Code:
/*start attributes drop down*************************************************/
if(SHOW_ATTRIBUTES){
$option_names = $db->Execute("SELECT products_options_id,products_options_name FROM ". TABLE_PRODUCTS_OPTIONS);
while (!$option_names->EOF) {
$options_array = array (array("id"=> "", "text" => $option_names->fields['products_options_name']));
$option_names_values = $db->Execute("select pov.products_options_values_id, pov.products_options_values_name from ". TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS." povp,".TABLE_PRODUCTS_OPTIONS_VALUES." pov where povp.products_options_values_id = pov.products_options_values_id AND povp.products_options_id =".$option_names->fields['products_options_id']);
while (!$option_names_values->EOF) {
$options_array = array_pad($options_array,sizeof($options_array )+1,array("id"=>$option_names_values->fields['products_options_values_id'],"text"=>$option_names_values->fields['products_options_values_name']));
$option_names_values->MoveNext();
}
$content .= zen_draw_pull_down_menu('options_'.$option_names->fields['products_options_id'], $options_array, (isset($_GET['options_'.$option_names->fields['products_options_id']]) ? $_GET['options_'.$option_names->fields['products_options_id']] : ''), '') . zen_hide_session_id();
$option_names->MoveNext();
}
}
/*end attributes drop down*************************************************/
Ah ha! so from here we can see that this part of the code has functions that read through the attributes we have set up and sees their "option name ID" as is displayed on admin>>catalog>>Attribute controller>>product options on the left side under ID column.
So the lowest ID option would be displayed first (in my case www.majesticsilver.co.uk/store) its Colour.
Wouldnt it be great if we could break into this process and tell the template instead of calling up ALL the attributes one by one to say start from attribute ID 10, thereby masking attributes 1 to 9.
Im not a programmer but cant we put an IF statement to enclose the whole process to say that
IF ($option_names_values >10){
only then start to call up the attributes.
borrowing from the code in header_php.php
if(sizeof($option_ids)>0){
why not say instead
if(sizeof($option_ids)>10){
maybe that statement would work best
but its clear that the Attributes ID are called as an array and incremented one by one as the function loops around until all attribute IDs are called up and displayed.
All Im suggesting is cant we make this process start from a certain ID number thereby masking all the lower ID numbers in effect allowing us to be somewhat selective about which attributes to display.
Im no programmer and I did try to play around with the code but seems futile exercise. Can anyone good with PHP follow up on my idea and suggest how I can revise the code in the above files to produce the desired results.
Any input would be greatly appreciated!
Bookmarks