2
« : Апреля 13, 2017, 05:38:39 pm »
$sql_op = 'select DISTINCT P_variant.variantID, P_variant.name name_var, P_opt.optionID optionID, P_opt.name opt_name, P_val.* from ' . PRODUCT_OPTIONS_VAL_TABLE . ' as P_variant LEFT JOIN ' . PRODUCT_OPTIONS_V_TABLE . ' as P_val on (P_val.variantID=P_variant.variantID) LEFT JOIN ' . PRODUCT_OPTIONS_TABLE . ' as P_opt on (P_val.optionID=P_opt.optionID) order by P_variant.sort_order';
$q = db_query($sql_op); $filtr_options=array();
while ($frow = db_assoc_q($q))
$filtr_options[$frow['opt_name']][] = $frow;
$smarty->assign("filtr_options", $filtr_options);
$options = db_arAll("select o.* from " . PRODUCT_OPTIONS_TABLE . ' as o, ' . PRODUCT_OPTIONS_VAL_TABLE . ' as ov where ov.optionID=o.optionID group by o.optionID order by o.sort_order');
$options_list = array();
foreach ($options as $val) {
$t = db_arAll("select * from " . PRODUCT_OPTIONS_VAL_TABLE . " as ov where ov.optionID=" . $val['optionID'] . " order by ov.sort_order");
foreach ($t as $key => $v) {
$sql = "select `price_surplus`,`default`,`picture` from " . PRODUCT_OPTIONS_V_TABLE . " as pov where " . $v['variantID'] . "=pov.variantID and pov.productID=" . $_GET['productID'];
$m = db_assoc($sql);
$t[$key]['price_surplus'] = $m['price_surplus'];
$t[$key]['default'] = $m['default'];
$t[$key]['picture'] = $m['picture'];
вот мой кусок кода.. кстати тут что-то с текстовым редактором , хотел вставить код но кнопка не активна..