Hi,
I received a task to insert one more condition into filtering proces of this script.
Since i am not coder i really need help on this.
here is a piece of a bit larger script that i think is handling filtering proces:
if($next_conds){
foreach($next_conds as $next_cond){
if($next_cond['type']=='SKIP' ){
if($compare_features){
foreach($compare_features as $compare_feature){
if(!empty($compare_features2) && $next_cond['feature2']){
foreach($compare_features2 as $compare_feature2){
if($next_cond['feature'] == $compare_feature['id_feature'] && $next_cond['feature2'] == $compare_feature2['id_feature']){
$json['js'] = array('type'=>'SKIP','pop_text'=>Pcconfig::translate($next_cond['pop_text']));
}
}
}else{
if($next_cond['feature'] == $compare_feature['id_feature']){
$json['js'] = array('type'=>'SKIP','pop_text'=>Pcconfig::translate($next_cond['pop_text']));
}
}
}
}
}
if($next_cond['type']=='PREFER'){
foreach($a_products as $a_product){
$current_features = $a_product['features'];
if($current_features){
foreach($current_features as $c_feature){
if($compare_features){
foreach($compare_features as $compare_feature){
if(!empty($compare_features2) && $next_cond['feature2']){
foreach($compare_features2 as $compare_feature2){
if($compare_feature['id_feature'] == $c_feature['id_feature'] && $next_cond['feature'] == $compare_feature['id_feature'] && $next_cond['feature2'] == $compare_feature2['id_feature']){
$product_quantity[$a_product['id_product']] = $next_cond['yes_value'];
}
}
}else{
if($compare_feature['id_feature'] == $c_feature['id_feature'] && $next_cond['feature'] == $compare_feature['id_feature']){
$product_quantity[$a_product['id_product']] = $next_cond['yes_value'];
}
}
}
}
}
}
}
}
if($next_cond['type']=='SUM'){
$watt = 0;
foreach($selected as $selectkey => $selectp){
if($selectp>0){
$selectprod = new Product($selectp);
$selectprod_features =$selectprod->getFeatures();
if($selectprod_features){
foreach($selectprod_features as $s_feature){
if($s_feature['id_feature'] == $next_cond['feature']){
$f_values = FeatureValue::getFeatureValueLang($s_feature['id_feature_value']);
if($f_values){
foreach($f_values as $f_value){
if($f_value['id_lang'] == $cookie->id_lang){
$watt = $watt + $f_value['value']*$selected_quan[$selectkey];
}
}
}
}
}
}
}
}
$af_products = $a_products;
$a_products = array();
foreach($af_products as $af_key => $af_product){
$current_features = $af_product['features'];
if($current_features){
foreach($current_features as $c_feature){
if($c_feature['id_feature'] == $next_cond['feature'] && $c_feature['value'] < $watt){
unset($af_products[$af_key]);
}
}
}
}
$a_products = my_array_unique($af_products);
}
}
}
Now part of filtering that is called "PREFER" has certain "yes_value"
I must insert a code in case if this yes_value == 0 so that product wich meet this yes_value gets ignored.
Anyone care to help me on this one?
(Do i need to paste entire script or is this enough?)
Thank you in advance!
V