SELECT * FROM ' . COUNTDOWN_OFFERS_TABLE . ' WHERE moduleID=' . $moduleID . ' ORDER BY sort_order'; $q = db_query($sql); $result = array(); while ($row = db_fetch_row($q)) { //get product name $sql = ' SELECT name ' . convert_prices() . ' FROM ' . PRODUCTS_TABLE . ' WHERE productID=' . (int) $row['productID']; $p = db_query($sql); if ($row1 = db_fetch_row($p)) { $row['name'] = $row1['name']; $row['price'] = $row1['price']; $price_row = priceRow($row1); $row['new_price'] = show_price(priceСostDiscount($price_row['Price_base'], $row['discount'])); $result[] = array_merge($row, $price_row); } } // debug($result); $smarty->assign("offers", $result); $smarty->assign("admin_sub_dpt", "catalog_countdown.tpl"); } } else { Redirect(ADMIN_FILE . "?dpt=catalog&sub=countdown&module=1"); } }
function priceСost($id, $price) { $set = dizSpecialSet($id); if (!empty($set['countdown'])) { $discount = (int) $_SESSION['special_set']['countdown_discount'][$id]; if (!empty($discount)) { $price = priceСostDiscount($price, $discount); } } return $price; }