$surface = $minimum_surface; } // Get the grid prices $values = DB::getInstance()->ExecuteS('SELECT al.name, a.id_attribute_group FROM ' . _DB_PREFIX_ . 'attribute_lang AS al LEFT JOIN ' . _DB_PREFIX_ . 'attribute AS a ON ' . 'a.id_attribute = al.id_attribute WHERE (a.id_attribute = ' . $attribute_id . ' OR a.id_attribute = ' . (int) $request_attr_2 . ') AND al.id_lang = ' . (int) $cookie->id_lang); foreach ($values as $value) { if ($value['id_attribute_group'] == Configuration::get('AIMD_FIRST_DIMENSION_ID')) { $height = $value['name']; } else { if ($value['id_attribute_group'] == Configuration::get('AIMD_SECOND_DIMENSION_ID')) { $width = $value['name']; } } } // Check if grid price can be calculated if (isset($width) && isset($height)) { $grid_price = get_gridPrice((int) $request_product, $width, $height); if ($grid_price !== false) { if ($grid_price == 0) { die('Error->' . $module->l('This combination can\'t be made, please change the dimensions', 'ajax')); } } } else { $grid_price = 0; } // If more attributes $special_surface = 0; if (count($more_attributes)) { // Get the product attribute datas $result = DB::getInstance()->ExecuteS('SELECT COUNT(product.id_product_attribute) as number, product.id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute_combination as combination ' . 'LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute as product ON combination.id_product_attribute = product.id_product_attribute WHERE product.id_product = ' . $request_product . ' AND ' . 'combination.id_attribute IN (' . implode($more_attributes, ', ') . ') GROUP BY product.id_product_attribute HAVING number = ' . count($more_attributes)); foreach ($result as $row) { if ($row['number'] == count($more_attributes)) {
$width = $dimension['name']; } } } // Change surface to match format (default one is rectangle) $format = (int) DB::getInstance()->getValue('SELECT aimd_format FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . $idProduct); $formula = $GLOBALS['config_format'][$format]['surface_formula']; $surface = str_replace('x', $real_dimensions[0], str_replace('y', $real_dimensions[1], $formula)); if (isset($real_dimensions[2])) { $surface = str_replace('z', $real_dimensions[2], $surface); } $surface = eval('return ' . $surface . ';'); // Get the grid prices if ($width && $height) { // Get the grid prices $grid_price = get_gridPrice($idProduct, $width, $height); if ($grid_price !== false) { $grid_price *= $groupReduction; } } // Check surface against quantity $recalculated_surface = $surface; $global_surface = $surface; if ($minimum_surface_quantity == '1') { $recalculated_surface *= $quantity; if ($recalculated_surface < $minimum_surface) { $surface = $minimum_surface / $quantity; } } else { if ($recalculated_surface < $minimum_surface) { $surface = $minimum_surface;