'.($catalog_h2 ?? 'Catalog').' ('.$query_total.')

'.($catalog_p ?? '').'

'; if (isset($success_msg)){ $view .= '

'.$success_msg.'

'; } $view .= '

'.($products_filters_h2 ?? 'Filter Products').'

'; if (count($categories) > 0){ //BUILD UP FILTERS BASED ON CATEGORY ASSIGNMENTS foreach ($categories as $filters){ if ($filters['parent_id'] == '0' && $filters['status'] == 1 && $filters['filter'] == 1){ $view .= '
'; //Iterate through categories for subfilters foreach ($categories as $subfilter){ if ($filters['rowID'] == $subfilter['parent_id'] && $subfilter['status'] == 1 && $subfilter['filter'] == 1){ $view .= '
'; } } $view .= '
'; } } $view .= ''; } $view .= '
'; //ADD CATEGORIES $view .= '
'; foreach ($categories as $categorie){ if ($categorie['parent_id'] == '0' && $categorie['status'] == 1 && $categorie['filter'] != 1){ $weburl = url('index.php?page=products&category='.$categorie['rowID'].''); $view .= ''.(${$categorie['name']} ?? $categorie['name']).''; } } $view .= '
'; if (isset($_GET['category'])){ $view .= '
'; foreach ($categories as $categorie){ if ($categorie['parent_id'] == $_GET['category'] && $categorie['status'] == 1 && $categorie['filter'] != 1){ $weburl = url('index.php?page=productsnew&category='.$categorie['rowID'].''); $view .= ''.(${$categorie['name']} ?? $categorie['name']).''; } } $view .= '
'; } $view .= '
'; $view .= '
'; foreach ($products as $product){ // Ensure product price is a numeric value $product_price = isset($product['price']) && $product['price'] > 0 ? floatval($product['price']) : 0.00; //SHOW LARGE PICTURE $view .= '
'.(${$product['productname']} ?? $product['productname']).' '; //CHECK IF CONFIGURATION SETTING IS FOUND AND NOT EMPTY => USE GROUP TO DISPLAY IMAGES if (isset($product['configurations']) && isset($product['config_setting']) && $product['config_setting'] != ''){ //GET THE CONFIG_SETTING GROuP AND DISPLAY foreach ($product['configurations'] as $config){ //MATCH ASSIGNMENT WITH CONFIG SETTING if($config['assignment'] == $product['config_setting']){ $view .= '
'; //GET ALL RELATED ATTRIBUTES foreach ($config['attributes'] as $attribute){ $option_id = $attribute['attribute_id']; // ID of the LARGE IMAGE $IMG_small_id = $attribute['full_path']; //URL TO SMALL IMAGE $IMG_large_id = $attribute['alternative_media_full_path']; //URL TO LARGE IMAGE // Ensure attribute price is a numeric value $attribute_price = isset($attribute['price']) ? floatval($attribute['price']) : 0.00; $option_price = isset($attribute['price']) // If price modifier is 1, add prices; otherwise, subtract ? ((isset($attribute['price_modifier']) && $attribute['price_modifier'] == 1) ? number_format(floatval($product_price + $attribute_price), 2) : number_format(floatval($product_price - $attribute_price), 2)) // If product price is not zero, format it : (($product_price != 0.00) ? number_format(floatval($product_price), 2) : ''); $view .= '
'; } $view .= '
'; } } } else { //SHOW SMALL IMAGE $view .= '
'; } //Stock status $stock_status = (isset($product['quantity']) && $product['quantity'] != 0) ? $product_on_stock : $out_of_stock; $style = ($stock_status == $product_on_stock) ? 'style="background-color: green;"' : 'style="background-color:gray;font-weight: lighter;"'; $view .= '

'.$stock_status.'

'; /*if (free_shipment_indicator){ $shipment = freeShipment($product_price,'span'); $view .= $shipment; }*/ $option_id =''; $view .=' '.(${$product['productname']} ?? $product['productname']).''; if (isset($product_price)){ $view .= ''.(($product_price != 0.00) ? number_format($product_price,2) : '').''; if (isset($product['rrp']) && $product['rrp'] > 0){ $view .= ''.number_format($product['rrp'],2).''; } $view .= ''; } $view .= '
'; } $view .= '
'; $view .= '
'; $view .= ''; $view.=''; //OUTPUT echo $view; template_footer(); ?>