'.$h1_content_top.'

'; $view .= '
'; 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 .= '

'.(${$filters['name']} ?? $filters['name']).'

'; //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 .= '
'; 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 = img_url.$attribute['full_path']; //URL TO SMALL IMAGE $IMG_large_id = img_url.$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) ? currency_code . number_format(floatval($product_price + $attribute_price), 2) : currency_code . number_format(floatval($product_price - $attribute_price), 2)) // If product price is not zero, format it : (($product_price != 0.00) ? currency_code . 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="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) ? currency_code.number_format($product_price,2) : '').''; if (isset($product['rrp']) && $product['rrp'] > 0){ $view .= ''.currency_code.number_format($product['rrp'],2).''; } $view .= ''; } $view .= '
'; } $view .= '
'; if ($current_page > 1) { $view .= 'Prev'; } if ($total_products > ($current_page * $num_products_on_each_page)){ $view .= 'Next'; } $view .= '
'; $view .= '
'; $view .= template_footer(); $view .= ' '; //OUTPUT echo $view; ?>