function olc_format_price_order($price_string, $price_special, $currency, $show_currencies = 1) { if (doubleval($price_string) != 0) { include DIR_FS_INC . 'olc_get_currency_parameters.inc.php'; if ($calculate_currencies == TRUE_STRING_S) { $price_string = $price_string * CURRENCY_VALUE; } // round price $price_string = olc_precision($price_string, CURRENCY_DECIMAL_PLACES); if ($price_special == '1') { $price_string = number_format($price_string, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT); if ($show_currencies == 1) { $price_string = CURRENCY_SYMBOL_LEFT . $price_string . CURRENCY_SYMBOL_RIGHT; } } //1,00 -> 1,-- global $is_print_version, $is_pdf; if ($is_print_version) { if ($is_pdf) { $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT_PDF; } else { $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT; } } else { $s = CURRENCY_DECIMAL_ZEROES_DASHES; } $price_string = str_replace(CURRENCY_DECIMAL_ZEROES, $s, $price_string); } else { $price_string = EMPTY_STRING; } return $price_string; }
function calculate_credit($amount) { global $order, $customer_id, $payment; $od_amount = 0; $od_pc = $this->percentage; $do = false; if ($amount > $this->minimum) { $table = split("[,]", MODULE_ORDER_TOTAL_PAYMENT_DISC_TYPE); for ($i = 0; $i < count($table); $i++) { if ($payment == $table[$i]) { $do = true; } } if ($do) { // Calculate tax reduction if necessary if ($this->calculate_tax == TRUE_STRING_S) { // Calculate main tax reduction $tod_amount = olc_precision($order->info['tax'] * 10) / 10 * $od_pc / 100; $order->info['tax'] = $order->info['tax'] - $tod_amount; // Calculate tax group deductions reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = olc_precision($value * 10) / 10 * $od_pc / 100; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } $od_amount = olc_precision($amount * 10) / 10 * $od_pc / 100; $od_amount = $od_amount + $tod_amount; } } return $od_amount; }
function olc_format_price_graduated($price_string, $price_special, $calculate_currencies, $products_tax_class) { if ((int) $price_string == 0) { $price_string = EMPTY_STRING; } else { include DIR_FS_INC . 'olc_get_currency_parameters.inc.php'; if ($calculate_currencies == TRUE_STRING_S) { $price_string = $price_string * CURRENCY_VALUE; } // add tax if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { $products_tax = olc_get_tax_rate($products_tax_class); $price_string = olc_add_tax($price_string, $products_tax); } // round price $price_string = olc_precision($price_string, CURRENCY_DECIMAL_PLACES); if ($price_special == '1') { $price_string = number_format($price_string, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT); $price_string = CURRENCY_SYMBOL_LEFT . $price_string . CURRENCY_SYMBOL_RIGHT; } //1,00 -> 1,-- global $is_print_version, $is_pdf; if ($is_print_version) { if ($is_pdf) { $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT_PDF; } else { $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT; } } else { $s = CURRENCY_DECIMAL_ZEROES_DASHES; } $price_string = str_replace(CURRENCY_DECIMAL_ZEROES, $s, $price_string); } return $price_string; }
function olc_format_special_price($special_price, $standard_price, $price_special, $calculate_currencies, $quantity, $products_tax) { if (doubleval($special_price) != 0) { include DIR_FS_INC . 'olc_get_currency_parameters.inc.php'; $standard_price = $standard_price * $quantity; $special_price = str_replace(CURRENCY_DECIMAL_POINT, DOT, $special_price); $special_price = $special_price * $quantity; if ($calculate_currencies == TRUE_STRING_S) { $special_price = $special_price * CURRENCY_VALUE; $standard_price = $standard_price * CURRENCY_VALUE; } // round price $special_price = olc_precision($special_price, CURRENCY_DECIMAL_PLACES); if ($price_special) { if ($standard_price < 0) { $standard_price = -$standard_price; $standard_price = str_replace(CURRENCY_DECIMAL_POINT, DOT, $standard_price); } $standard_price = number_format($standard_price, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT); $special_price = number_format($special_price, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT); $special_price = sprintf(TEMPLATE_SPECIAL_PRICE, trim(CURRENCY_SYMBOL_LEFT . $standard_price . CURRENCY_SYMBOL_RIGHT), trim(CURRENCY_SYMBOL_LEFT . $special_price . CURRENCY_SYMBOL_RIGHT)); } //1,00 -> 1,-- global $is_print_version, $is_pdf; if ($is_print_version) { if ($is_pdf) { $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT_PDF; } else { $s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT; } } else { $s = CURRENCY_DECIMAL_ZEROES_DASHES; } $special_price = str_replace(CURRENCY_DECIMAL_ZEROES, $s, $special_price); } else { $special_price = EMPTY_STRING; } return $special_price; }
function olc_round($number, $precision) { include_once DIR_FS_INC . 'olc_precision.inc.php'; return olc_precision($number, $precision); /* if (strpos($number, '.') && (strlen(substr($number, strpos($number, '.')+1)) > $precision)) { $number = substr($number, 0, strpos($number, '.') + 1 + $precision + 1); if (substr($number, -1) >= 5) { if ($precision > 1) { $number = substr($number, 0, -1) + ('0.' . str_repeat(0, $precision-1) . '1'); } elseif ($precision == 1) { $number = substr($number, 0, -1) + 0.1; } else { $number = substr($number, 0, -1) + 1; } } else { $number = substr($number, 0, -1); } } return $number; */ }
function walk($item1) { global $filelayout, $filelayout_count, $modelsize; global $active, $inactive, $langcode, $default_these, $deleteit, $zero_qty_inactive; global $epdlanguage_id, $price_with_tax, $replace_quotes; global $default_images, $default_image_manufacturer, $default_image_product, $default_image_category; global $separator, $max_categories; // first we clean up the row of data // chop blanks from each end $item1 = ltrim(rtrim($item1)); // blow it into an array, splitting on the tabs $items = explode($separator, $item1); // make sure all non-set things are set to ''; // and strip the quotes from the start and end of the stings. // escape any special chars for the database. foreach ($filelayout as $key => $value) { $i = $filelayout[$key]; if (isset($items[$i]) == false) { $items[$i] = ''; } else { // Check to see if either of the magic_quotes are turned on or off; // And apply filtering accordingly. if (function_exists('ini_get')) { //echo "Getting ready to check magic quotes<br/>"; if (ini_get('magic_quotes_runtime') == 1) { // The magic_quotes_runtime are on, so lets account for them // check if the last character is a quote; // if it is, chop off the quotes. if (substr($items[$i], -1) == '"') { $items[$i] = substr($items[$i], 2, strlen($items[$i]) - 4); } // now any remaining doubled double quotes should be converted to one doublequote $items[$i] = str_replace('\\"\\"', """, $items[$i]); if ($replace_quotes) { $items[$i] = str_replace('\\"', """, $items[$i]); $items[$i] = str_replace("\\'", "'", $items[$i]); } } else { // no magic_quotes are on // check if the last character is a quote; // if it is, chop off the 1st and last character of the string. if (substr($items[$i], -1) == '"') { $items[$i] = substr($items[$i], 1, strlen($items[$i]) - 2); } // now any remaining doubled double quotes should be converted to one doublequote $items[$i] = str_replace('""', """, $items[$i]); if ($replace_quotes) { $items[$i] = str_replace('"', """, $items[$i]); $items[$i] = str_replace(APOS, "'", $items[$i]); } } } } } /* if ( $items['v_status'] == $deleteit ){ // they want to delete this product. echo "Deleting product " . $items['v_products_model'] . " from the database<br/>"; // Get the id // kill in the products_to_categories // Kill in the products table return; // we're done deleteing! } */ // now do a query to get the record's current contents $sql = "SELECT\n\t\tp.products_id as v_products_id,\n\t\tp.products_model as v_products_model,\n\t\tp.products_image as v_products_image,\n\t\tp.products_price as v_products_price,\n\t\tp.products_weight as v_products_weight,\n\t\tp.products_date_added as v_date_added,\n p.products_date_available as v_date_avail,\n\t\tp.products_tax_class_id as v_tax_class_id,\n\t\tp.products_quantity as v_products_quantity,\n\t\tp.manufacturers_id as v_manufacturers_id,\n\t\tsubc.categories_id as v_categories_id\n\t\tFROM\n\t\t" . TABLE_PRODUCTS . " as p,\n\t\t" . TABLE_CATEGORIES . " as subc,\n\t\t" . TABLE_PRODUCTS_TO_CATEGORIES . " as ptoc\n\t\tWHERE\n\t\tp.products_id = ptoc.products_id AND\n\t\tp.products_model = '" . $items[$filelayout['v_products_model']] . "' AND\n\t\tptoc.categories_id = subc.categories_id\n\t\t"; $result = olc_db_query($sql); $row = olc_db_fetch_array($result); while ($row) { // OK, since we got a row, the item already exists. // Let's get all the data we need and fill in all the fields that need to be defaulted to the current values // for each language, get the description and set the vals foreach ($langcode as $key => $lang) { //echo "Inside defaulting loop"; //echo "key is $key<br/>"; //echo "langid is " . $lang['id'] . HTML_BR; // $sql2 = "SELECT products_name, products_description // FROM ".TABLE_PRODUCTS_DESCRIPTION." // WHERE // products_id = " . $row['v_products_id'] . " AND // language_id = '" . $lang['id'] . "' // "; $sql2 = "SELECT *\n\t\t\t\tFROM " . TABLE_PRODUCTS_DESCRIPTION . "\n\t\t\t\tWHERE\n\t\t\t\t\tproducts_id = " . $row['v_products_id'] . " AND\n\t\t\t\t\tlanguage_id = '" . $lang['id'] . "'\n\t\t\t\t"; $result2 = olc_db_query($sql2); $row2 = olc_db_fetch_array($result2); // Need to report from ......_name_1 not ..._name_0 $row['v_products_name_' . $lang['id']] = $row2['products_name']; $row['v_products_description_' . $lang['id']] = $row2['products_description']; $row['v_products_short_description_' . $lang['id']] = $row2['products_short_description']; $row['v_products_url_' . $lang['id']] = $row2['products_url']; // support for Linda's Header Controller 2.0 here if (isset($filelayout['v_products_meta_title_' . $lang['id']])) { $row['v_products_meta_title_' . $lang['id']] = $row2['products_meta_title']; $row['v_products_meta_description_' . $lang['id']] = $row2['products_meta_description']; $row['v_products_meta_keywords_' . $lang['id']] = $row2['products_meta_keywords']; } // end support for Header Controller 2.0 } // start with v_categories_id // Get the category description // set the appropriate variable name // if parent_id is not null, then follow it up. $thecategory_id = $row['v_categories_id']; for ($categorylevel = 1; $categorylevel < $max_categories + 1; $categorylevel++) { if ($thecategory_id) { $sql2 = "SELECT categories_name\n\t\t\t\t\tFROM " . TABLE_CATEGORIES_DESCRIPTION . "\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tcategories_id = " . $thecategory_id . " AND\n\t\t\t\t\t\tlanguage_id = " . $epdlanguage_id; $result2 = olc_db_query($sql2); $row2 = olc_db_fetch_array($result2); // only set it if we found something $temprow['v_categories_name_' . $categorylevel] = $row2['categories_name']; // now get the parent id if there was one $sql3 = "SELECT parent_id\n\t\t\t\t\tFROM " . TABLE_CATEGORIES . "\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tcategories_id = " . $thecategory_id; $result3 = olc_db_query($sql3); $row3 = olc_db_fetch_array($result3); $theparent_id = $row3['parent_id']; if ($theparent_id != '') { // there was a parent id, lets set thecategoryid to get the next level $thecategory_id = $theparent_id; } else { // we have found the top level category for this item, $thecategory_id = false; } } else { $temprow['v_categories_name_' . $categorylevel] = ''; } } // temprow has the old style low to high level categories. $newlevel = 1; // let's turn them into high to low level categories for ($categorylevel = $max_categories + 1; $categorylevel > 0; $categorylevel--) { if ($temprow['v_categories_name_' . $categorylevel] != '') { $row['v_categories_name_' . $newlevel++] = $temprow['v_categories_name_' . $categorylevel]; } } if ($row['v_manufacturers_id'] != '') { $sql2 = "SELECT manufacturers_name\n\t\t\t\tFROM " . TABLE_MANUFACTURERS . "\n\t\t\t\tWHERE\n\t\t\t\tmanufacturers_id = " . $row['v_manufacturers_id']; $result2 = olc_db_query($sql2); $row2 = olc_db_fetch_array($result2); $row['v_manufacturers_name'] = $row2['manufacturers_name']; } //elari - //We check the value of tax class and title instead of the id //Then we add the tax to price if $price_with_tax is set to true $row_tax_multiplier = olc_get_tax_class_rate($row['v_tax_class_id']); $row['v_tax_class_title'] = olc_get_tax_class_title($row['v_tax_class_id']); if ($price_with_tax) { $row['v_products_price'] = $row['v_products_price'] + olc_precision($row['v_products_price'] * $row_tax_multiplier / 100, 2); } // now create the internal variables that will be used // the $$thisvar is on purpose: it creates a variable named what ever was in $thisvar and sets the value foreach ($default_these as $thisvar) { ${$thisvar} = $row[$thisvar]; } $row = olc_db_fetch_array($result); } // this is an important loop. What it does is go thru all the fields in the incoming file and set the internal vars. // Internal vars not set here are either set in the loop above for existing records, or not set at all (null values) // the array values are handled separatly, although they will set variables in this loop, we won't use them. foreach ($filelayout as $key => $value) { ${$key} = $items[$value]; } // so how to handle these? we shouldn't built the array unless it's been giving to us. // The assumption is that if you give us names and descriptions, then you give us name and description for all applicable languages foreach ($langcode as $lang) { //echo "Langid is " . $lang['id'] . HTML_BR; $l_id = $lang['id']; if (isset($filelayout['v_products_name_' . $l_id])) { //we set dynamically the language values $v_products_name[$l_id] = $items[$filelayout['v_products_name_' . $l_id]]; $v_products_description[$l_id] = $items[$filelayout['v_products_description_' . $l_id]]; $v_products_short_description[$l_id] = $items[$filelayout['v_products_short_description_' . $l_id]]; $v_products_url[$l_id] = $items[$filelayout['v_products_url_' . $l_id]]; // support for Linda's Header Controller 2.0 here if (isset($filelayout['v_products_meta_title_' . $l_id])) { $v_products_meta_title[$l_id] = $items[$filelayout['v_products_meta_title_' . $l_id]]; $v_products_meta_description[$l_id] = $items[$filelayout['v_products_meta_description_' . $l_id]]; $v_products_meta_keywords[$l_id] = $items[$filelayout['v_products_meta_keywords_' . $l_id]]; } // end support for Header Controller 2.0 } } //elari... we get the tax_clas_id from the tax_title //on screen will still be displayed the tax_class_title instead of the id.... if (isset($v_tax_class_title)) { $v_tax_class_id = olc_get_tax_title_class_id($v_tax_class_title); } //we check the tax rate of this tax_class_id $row_tax_multiplier = olc_get_tax_class_rate($v_tax_class_id); //And we recalculate price without the included tax... //Since it seems display is made before, the displayed price will still include tax //This is same problem for the tax_clas_id that display tax_class_title if ($price_with_tax) { $v_products_price = olc_precision($v_products_price / (1 + $row_tax_multiplier * $price_with_tax / 100), 2); } // if they give us one category, they give us all 6 categories unset($v_categories_name); // default to not set. if (isset($filelayout['v_categories_name_1'])) { $newlevel = 1; for ($categorylevel = 6; $categorylevel > 0; $categorylevel--) { if ($items[$filelayout['v_categories_name_' . $categorylevel]] != '') { $v_categories_name[$newlevel++] = $items[$filelayout['v_categories_name_' . $categorylevel]]; } } while ($newlevel < $max_categories + 1) { $v_categories_name[$newlevel++] = ''; // default the remaining items to nothing } } if (ltrim(rtrim($v_products_quantity)) == '') { $v_products_quantity = 1; } if ($v_date_avail == '') { $v_date_avail = "CURRENT_TIMESTAMP"; } else { // we put the quotes aolc_precision it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes aolc_precision it. $v_date_avail = '"' . $v_date_avail . '"'; } if ($v_date_added == '') { $v_date_added = "CURRENT_TIMESTAMP"; } else { // we put the quotes aolc_precision it here because we can't put them into the query, because sometimes // we will use the "current_timestamp", which can't have quotes aolc_precision it. $v_date_added = '"' . $v_date_added . '"'; } // default the stock if they spec'd it or if it's blank $v_db_status = '1'; // default to active if ($v_status == $inactive) { // they told us to deactivate this item $v_db_status = '0'; } if ($zero_qty_inactive && $v_products_quantity == 0) { // if they said that zero qty products should be deactivated, let's deactivate if the qty is zero $v_db_status = '0'; } if ($v_manufacturer_id == '') { $v_manufacturer_id = "NULL"; } if (trim($v_products_image) == '') { $v_products_image = $default_image_product; } if (strlen($v_products_model) > $modelsize) { echo "<font color='red'>" . strlen($v_products_model) . $v_products_model . "... ERROR! - Too many characters in the model number.<br/>\n\t\t\t12 is the maximum on a standard OSC install.<br/>\n\t\t\tYour maximum product_model length is set to {$modelsize}<br/>\n\t\t\tYou can either shorten your model numbers or increase the size of the field in the database.</font>"; die; } // OK, we need to convert the manufacturer's name into id's for the database if (isset($v_manufacturers_name) && $v_manufacturers_name != '') { $sql = "SELECT man.manufacturers_id\n\t\t\tFROM " . TABLE_MANUFACTURERS . " as man\n\t\t\tWHERE\n\t\t\t\tman.manufacturers_name = '" . $v_manufacturers_name . APOS; $result = olc_db_query($sql); $row = olc_db_fetch_array($result); if ($row != '') { foreach ($row as $item) { $v_manufacturer_id = $item; } } else { // to add, we need to put stuff in categories and categories_description $sql = "SELECT MAX( manufacturers_id) max FROM " . TABLE_MANUFACTURERS; $result = olc_db_query($sql); $row = olc_db_fetch_array($result); $max_mfg_id = $row['max'] + 1; // default the id if there are no manufacturers yet if (!is_numeric($max_mfg_id)) { $max_mfg_id = 1; } // Uncomment this query if you have an older 2.2 codebase /* $sql = INSERT_INTO.TABLE_MANUFACTURERS."( manufacturers_id, manufacturers_name, manufacturers_image ) VALUES ( $max_mfg_id, '$v_manufacturers_name', '$default_image_manufacturer' )"; */ // Comment this query out if you have an older 2.2 codebase $sql = INSERT_INTO . TABLE_MANUFACTURERS . "(\n\t\t\t\tmanufacturers_id,\n\t\t\t\tmanufacturers_name,\n\t\t\t\tmanufacturers_image,\n\t\t\t\tdate_added,\n\t\t\t\tlast_modified\n\t\t\t\t) VALUES (\n\t\t\t\t{$max_mfg_id},\n\t\t\t\t'{$v_manufacturers_name}',\n\t\t\t\t'{$default_image_manufacturer}',\n\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\tCURRENT_TIMESTAMP\n\t\t\t\t)"; $result = olc_db_query($sql); $v_manufacturer_id = $max_mfg_id; } } // if the categories names are set then try to update them if (isset($v_categories_name_1)) { // start from the highest possible category and work our way down from the parent $v_categories_id = 0; $theparent_id = 0; for ($categorylevel = $max_categories + 1; $categorylevel > 0; $categorylevel--) { $thiscategoryname = $v_categories_name[$categorylevel]; if ($thiscategoryname != '') { // we found a category name in this field // now the subcategory $sql = "SELECT cat.categories_id\n\t\t\t\t\tFROM " . TABLE_CATEGORIES . " as cat,\n\t\t\t\t\t " . TABLE_CATEGORIES_DESCRIPTION . " as des\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tcat.categories_id = des.categories_id AND\n\t\t\t\t\t\tdes.language_id = {$epdlanguage_id} AND\n\t\t\t\t\t\tcat.parent_id = " . $theparent_id . " AND\n\t\t\t\t\t\tdes.categories_name = '" . $thiscategoryname . APOS; $result = olc_db_query($sql); $row = olc_db_fetch_array($result); if ($row != '') { foreach ($row as $item) { $thiscategoryid = $item; } } else { // to add, we need to put stuff in categories and categories_description $sql = "SELECT MAX( categories_id) max FROM " . TABLE_CATEGORIES; $result = olc_db_query($sql); $row = olc_db_fetch_array($result); $max_category_id = $row['max'] + 1; if (!is_numeric($max_category_id)) { $max_category_id = 1; } $sql = INSERT_INTO . TABLE_CATEGORIES . "(\n\t\t\t\t\t\tcategories_id,\n\t\t\t\t\t\tcategories_image,\n\t\t\t\t\t\tparent_id,\n\t\t\t\t\t\tsort_order,\n\t\t\t\t\t\tdate_added,\n\t\t\t\t\t\tlast_modified\n\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t{$max_category_id},\n\t\t\t\t\t\t'{$default_image_category}',\n\t\t\t\t\t\t{$theparent_id},\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tCURRENT_TIMESTAMP\n\t\t\t\t\t\t,CURRENT_TIMESTAMP\n\t\t\t\t\t\t)"; $result = olc_db_query($sql); $sql = INSERT_INTO . TABLE_CATEGORIES_DESCRIPTION . "(\n\t\t\t\t\t\t\tcategories_id,\n\t\t\t\t\t\t\tlanguage_id,\n\t\t\t\t\t\t\tcategories_name\n\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t{$max_category_id},\n\t\t\t\t\t\t\t'{$epdlanguage_id}',\n\t\t\t\t\t\t\t'{$thiscategoryname}'\n\t\t\t\t\t\t)"; $result = olc_db_query($sql); $thiscategoryid = $max_category_id; } // the current catid is the next level's parent $theparent_id = $thiscategoryid; $v_categories_id = $thiscategoryid; // keep setting this, we need the lowest level category id later } } } if ($v_products_model != "") { // products_model exists! array_walk($items, 'print_el'); // First we check to see if this is a product in the current db. $result = olc_db_query("SELECT products_id FROM " . TABLE_PRODUCTS . " WHERE (products_model = '" . $v_products_model . "')"); if (olc_db_num_rows($result) == 0) { // insert into products $sql = "SHOW TABLE STATUS LIKE '" . TABLE_PRODUCTS . APOS; $result = olc_db_query($sql); $row = olc_db_fetch_array($result); $max_product_id = $row['Auto_increment']; if (!is_numeric($max_product_id)) { $max_product_id = 1; } $v_products_id = $max_product_id; echo "<font color='green'> !New Product!</font><br/>"; $query = INSERT_INTO . TABLE_PRODUCTS . " (\n\t\t\t\t\tproducts_image,\n\t\t\t\t\tproducts_model,\n\t\t\t\t\tproducts_price,\n\t\t\t\t\tproducts_status,\n\t\t\t\t\tproducts_last_modified,\n\t\t\t\t\tproducts_date_added,\n\t\t\t\t\tproducts_date_available,\n\t\t\t\t\tproducts_tax_class_id,\n\t\t\t\t\tproducts_weight,\n\t\t\t\t\tproducts_quantity,\n\t\t\t\t\tmanufacturers_id)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t'{$v_products_image}',"; // unmcomment these lines if you are running the image mods /* $query .= . $v_products_mimage . '", "' . $v_products_bimage . '", "' . $v_products_subimage1 . '", "' . $v_products_bsubimage1 . '", "' . $v_products_subimage2 . '", "' . $v_products_bsubimage2 . '", "' . $v_products_subimage3 . '", "' . $v_products_bsubimage3 . '", "' */ $query .= "\t\t\t\t'{$v_products_model}',\n\t\t\t\t\t\t\t\t'{$v_products_price}',\n\t\t\t\t\t\t\t\t'{$v_db_status}',\n\t\t\t\t\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\t\t\t\t\t{$v_date_added},\n\t\t\t\t\t\t\t\t{$v_date_avail},\n\t\t\t\t\t\t\t\t'{$v_tax_class_id}',\n\t\t\t\t\t\t\t\t'{$v_products_weight}',\n\t\t\t\t\t\t\t\t'{$v_products_quantity}',\n\t\t\t\t\t\t\t\t'{$v_manufacturer_id}')\n\t\t\t\t\t\t\t"; $result = olc_db_query($query); } else { // existing product, get the id from the query // and update the product data $row = olc_db_fetch_array($result); $v_products_id = $row['products_id']; echo "<font color='black'> Updated</font><br/>"; $row = olc_db_fetch_array($result); $query = 'SQL_UPDATE ' . TABLE_PRODUCTS . ' SET products_price="' . $v_products_price . '" ,products_image="' . $v_products_image; // uncomment these lines if you are running the image mods /* $query .= '" ,products_mimage="'.$v_products_mimage. '" ,products_bimage="'.$v_products_bimage. '" ,products_subimage1="'.$v_products_subimage1. '" ,products_bsubimage1="'.$v_products_bsubimage1. '" ,products_subimage2="'.$v_products_subimage2. '" ,products_bsubimage2="'.$v_products_bsubimage2. '" ,products_subimage3="'.$v_products_subimage3. '" ,products_bsubimage3="'.$v_products_bsubimage3; */ $query .= '", products_weight="' . $v_products_weight . '", products_tax_class_id="' . $v_tax_class_id . '", products_date_available= ' . $v_date_avail . ', products_date_added= ' . $v_date_added . ', products_last_modified=CURRENT_TIMESTAMP , products_quantity="' . $v_products_quantity . '" ,manufacturers_id=' . $v_manufacturer_id . ' , products_status=' . $v_db_status . ' WHERE (products_id = "' . $v_products_id . '")'; $result = olc_db_query($query); } // the following is common in both the updating an existing product and creating a new product if (isset($v_products_name)) { foreach ($v_products_name as $key => $name) { if ($name != '') { $sql = "SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " WHERE\n\t\t\t\t\t\t\tproducts_id = {$v_products_id} AND\n\t\t\t\t\t\t\tlanguage_id = " . $key; $result = olc_db_query($sql); if (olc_db_num_rows($result) == 0) { // nope, this is a new product description $result = olc_db_query($sql); $sql = INSERT_INTO . TABLE_PRODUCTS_DESCRIPTION . "\n\t\t\t\t\t\t\t\t(products_id,\n\t\t\t\t\t\t\t\tlanguage_id,\n\t\t\t\t\t\t\t\tproducts_name,\n\t\t\t\t\t\t\t\tproducts_description,\n products_short_description,\n\t\t\t\t\t\t\t\tproducts_url)\n\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t'" . $v_products_id . "',\n\t\t\t\t\t\t\t\t\t" . $key . ",\n\t\t\t\t\t\t\t\t\t'" . $name . "',\n\t\t\t\t\t\t\t\t\t'" . $v_products_description[$key] . "',\n '" . $v_products_short_description[$key] . "',\n\t\t\t\t\t\t\t\t\t'" . $v_products_url[$key] . "'\n\t\t\t\t\t\t\t\t\t)"; // support for Linda's Header Controller 2.0 if (isset($v_products_meta_title)) { // override the sql if we're using Linda's contrib $sql = INSERT_INTO . TABLE_PRODUCTS_DESCRIPTION . "\n\t\t\t\t\t\t\t\t\t(products_id,\n\t\t\t\t\t\t\t\t\tlanguage_id,\n\t\t\t\t\t\t\t\t\tproducts_name,\n products_description,\n\t\t\t\t\t\t\t\t\tproducts_short_description,\n\t\t\t\t\t\t\t\t\tproducts_url,\n\t\t\t\t\t\t\t\t\tproducts_meta_title,\n\t\t\t\t\t\t\t\t\tproducts_meta_description,\n\t\t\t\t\t\t\t\t\tproducts_meta_keywords)\n\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t'" . $v_products_id . "',\n\t\t\t\t\t\t\t\t\t\t" . $key . ",\n\t\t\t\t\t\t\t\t\t\t'" . $name . "',\n\t\t\t\t\t\t\t\t\t\t'" . $v_products_description[$key] . "',\n '" . $v_products_short_description[$key] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $v_products_url[$key] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $v_products_meta_title[$key] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $v_products_meta_description[$key] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $v_products_meta_keywords[$key] . "')"; } // end support for Linda's Header Controller 2.0 $result = olc_db_query($sql); } else { // already in the description, let's just update it $sql = SQL_UPDATE . TABLE_PRODUCTS_DESCRIPTION . " SET\n\t\t\t\t\t\t\t\tproducts_name='{$name}',\n\t\t\t\t\t\t\t\tproducts_description='" . $v_products_description[$key] . "',\n products_short_description='" . $v_products_short_description[$key] . "',\n products_url='" . $v_products_url[$key] . "'\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tproducts_id = '{$v_products_id}' AND\n\t\t\t\t\t\t\t\tlanguage_id = '{$key}'"; // support for Lindas Header Controller 2.0 if (isset($v_products_meta_title)) { // override the sql if we're using Linda's contrib $sql = SQL_UPDATE . TABLE_PRODUCTS_DESCRIPTION . " SET\n\t\t\t\t\t\t\t\t\tproducts_name = '{$name}',\n\t\t\t\t\t\t\t\t\tproducts_description = '" . $v_products_description[$key] . "',\n products_short_description = '" . $v_products_short_description[$key] . "',\n\t\t\t\t\t\t\t\t\tproducts_url = '" . $v_products_url[$key] . "',\n\t\t\t\t\t\t\t\t\tproducts_meta_title = '" . $v_products_meta_title[$key] . "',\n\t\t\t\t\t\t\t\t\tproducts_meta_description = '" . $v_products_meta_description[$key] . "',\n\t\t\t\t\t\t\t\t\tproducts_meta_keywords = '" . $v_products_meta_keywords[$key] . "'\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tproducts_id = '{$v_products_id}' AND\n\t\t\t\t\t\t\t\t\tlanguage_id = '{$key}'"; } // end support for Linda's Header Controller 2.0 $result = olc_db_query($sql); } } } } if (isset($v_categories_id)) { //find out if this product is listed in the category given $result_incategory = olc_db_query('SELECT ' . TABLE_PRODUCTS_TO_CATEGORIES . '.products_id, ' . TABLE_PRODUCTS_TO_CATEGORIES . '.categories_id FROM ' . TABLE_PRODUCTS_TO_CATEGORIES . ' WHERE ' . TABLE_PRODUCTS_TO_CATEGORIES . '.products_id=' . $v_products_id . ' AND ' . TABLE_PRODUCTS_TO_CATEGORIES . '.categories_id=' . $v_categories_id); if (olc_db_num_rows($result_incategory) == 0) { // nope, this is a new category for this product $res1 = olc_db_query('INSERT INTO ' . TABLE_PRODUCTS_TO_CATEGORIES . ' (products_id, categories_id) VALUES ("' . $v_products_id . '", "' . $v_categories_id . '")'); } else { // already in this category, nothing to do! } } // for the separate prices per customer module $ll = 1; if (isset($v_customer_price_1)) { if ($v_customer_group_id_1 == '' and $v_customer_price_1 != '') { echo "<font color=red>ERROR - v_customer_group_id and v_customer_price must occur in pairs</font>"; die; } // they spec'd some prices, so clear all existing entries $result = olc_db_query(' DELETE FROM ' . TABLE_PRODUCTS_GROUPS . ' WHERE products_id = ' . $v_products_id); // and insert the new record if ($v_customer_price_1 != '') { $result = olc_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_1 . ', ' . $v_customer_price_1 . ', ' . $v_products_id . ', ' . $v_products_price . ' )'); } if ($v_customer_price_2 != '') { $result = olc_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_2 . ', ' . $v_customer_price_2 . ', ' . $v_products_id . ', ' . $v_products_price . ' )'); } if ($v_customer_price_3 != '') { $result = olc_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_3 . ', ' . $v_customer_price_3 . ', ' . $v_products_id . ', ' . $v_products_price . ' )'); } if ($v_customer_price_4 != '') { $result = olc_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_4 . ', ' . $v_customer_price_4 . ', ' . $v_products_id . ', ' . $v_products_price . ' )'); } } // VJ product attribs begin if (isset($v_attribute_options_id_1)) { $attribute_rows = 1; // master row count $languages = olc_get_languages(); // product options count $attribute_options_count = 1; $v_attribute_options_id_var = 'v_attribute_options_id_' . $attribute_options_count; while (isset(${$v_attribute_options_id_var}) && !empty(${$v_attribute_options_id_var})) { // remove product attribute options linked to this product before proceeding further // this is useful for removing attributes linked to a product $attributes_clean_query = DELETE_FROM . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $v_products_id . "' and options_id = '" . (int) ${$v_attribute_options_id_var} . APOS; olc_db_query($attributes_clean_query); $attribute_options_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int) ${$v_attribute_options_id_var} . APOS; $attribute_options_values = olc_db_query($attribute_options_query); // option table update begin if ($attribute_rows == 1) { // insert into options table if no option exists if (olc_db_num_rows($attribute_options_values) <= 0) { for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_options_name_var = 'v_attribute_options_name_' . $attribute_options_count . '_' . $lid; if (isset(${$v_attribute_options_name_var})) { $attribute_options_insert_query = INSERT_INTO . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int) ${$v_attribute_options_id_var} . "', '" . (int) $lid . "', '" . ${$v_attribute_options_name_var} . "')"; $attribute_options_insert = olc_db_query($attribute_options_insert_query); } } } else { // update options table, if options already exists for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_options_name_var = 'v_attribute_options_name_' . $attribute_options_count . '_' . $lid; if (isset(${$v_attribute_options_name_var})) { $attribute_options_update_lang_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int) ${$v_attribute_options_id_var} . "' and language_id ='" . (int) $lid . APOS; $attribute_options_update_lang_values = olc_db_query($attribute_options_update_lang_query); // if option name doesn't exist for particular language, insert value if (olc_db_num_rows($attribute_options_update_lang_values) <= 0) { $attribute_options_lang_insert_query = INSERT_INTO . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int) ${$v_attribute_options_id_var} . "', '" . (int) $lid . "', '" . ${$v_attribute_options_name_var} . "')"; $attribute_options_lang_insert = olc_db_query($attribute_options_lang_insert_query); } else { // if option name exists for particular language, update table $attribute_options_update_query = SQL_UPDATE . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . ${$v_attribute_options_name_var} . "' where products_options_id ='" . (int) ${$v_attribute_options_id_var} . "' and language_id = '" . (int) $lid . APOS; $attribute_options_update = olc_db_query($attribute_options_update_query); } } } } } // option table update end // product option values count $attribute_values_count = 1; $v_attribute_values_id_var = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count; while (isset(${$v_attribute_values_id_var}) && !empty(${$v_attribute_values_id_var})) { $attribute_values_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int) ${$v_attribute_values_id_var} . APOS; $attribute_values_values = olc_db_query($attribute_values_query); // options_values table update begin if ($attribute_rows == 1) { // insert into options_values table if no option exists if (olc_db_num_rows($attribute_values_values) <= 0) { for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_values_name_var = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid; if (isset(${$v_attribute_values_name_var})) { $attribute_values_insert_query = INSERT_INTO . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int) ${$v_attribute_values_id_var} . "', '" . (int) $lid . "', '" . ${$v_attribute_values_name_var} . "')"; $attribute_values_insert = olc_db_query($attribute_values_insert_query); } } // insert values to pov2po table $attribute_values_pov2po_query = INSERT_INTO . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int) ${$v_attribute_options_id_var} . "', '" . (int) ${$v_attribute_values_id_var} . "')"; $attribute_values_pov2po = olc_db_query($attribute_values_pov2po_query); } else { // update options table, if options already exists for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_values_name_var = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid; if (isset(${$v_attribute_values_name_var})) { $attribute_values_update_lang_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int) ${$v_attribute_values_id_var} . "' and language_id ='" . (int) $lid . APOS; $attribute_values_update_lang_values = olc_db_query($attribute_values_update_lang_query); // if options_values name doesn't exist for particular language, insert value if (olc_db_num_rows($attribute_values_update_lang_values) <= 0) { $attribute_values_lang_insert_query = INSERT_INTO . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int) ${$v_attribute_values_id_var} . "', '" . (int) $lid . "', '" . ${$v_attribute_values_name_var} . "')"; $attribute_values_lang_insert = olc_db_query($attribute_values_lang_insert_query); } else { // if options_values name exists for particular language, update table $attribute_values_update_query = SQL_UPDATE . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . ${$v_attribute_values_name_var} . "' where products_options_values_id ='" . (int) ${$v_attribute_values_id_var} . "' and language_id = '" . (int) $lid . APOS; $attribute_values_update = olc_db_query($attribute_values_update_query); } } } } } // options_values table update end // options_values price update begin $v_attribute_values_price_var = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count; if (isset(${$v_attribute_values_price_var}) && ${$v_attribute_values_price_var} != '') { $attribute_prices_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $v_products_id . "' and options_id ='" . (int) ${$v_attribute_options_id_var} . "' and options_values_id = '" . (int) ${$v_attribute_values_id_var} . APOS; $attribute_prices_values = olc_db_query($attribute_prices_query); $attribute_values_price_prefix = ${$v_attribute_values_price_var} < 0 ? '-' : '+'; // options_values_prices table update begin // insert into options_values_prices table if no price exists if (olc_db_num_rows($attribute_prices_values) <= 0) { $attribute_prices_insert_query = INSERT_INTO . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix) values ('" . (int) $v_products_id . "', '" . (int) ${$v_attribute_options_id_var} . "', '" . (int) ${$v_attribute_values_id_var} . "', '" . (int) ${$v_attribute_values_price_var} . "', '" . $attribute_values_price_prefix . "')"; $attribute_prices_insert = olc_db_query($attribute_prices_insert_query); } else { // update options table, if options already exists $attribute_prices_update_query = SQL_UPDATE . TABLE_PRODUCTS_ATTRIBUTES . " set options_values_price = '" . ${$v_attribute_values_price_var} . "', price_prefix = '" . $attribute_values_price_prefix . "' where products_id = '" . (int) $v_products_id . "' and options_id = '" . (int) ${$v_attribute_options_id_var} . "' and options_values_id ='" . (int) ${$v_attribute_values_id_var} . APOS; $attribute_prices_update = olc_db_query($attribute_prices_update_query); } } // options_values price update end $attribute_values_count++; $v_attribute_values_id_var = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count; } $attribute_options_count++; $v_attribute_options_id_var = 'v_attribute_options_id_' . $attribute_options_count; } $attribute_rows++; } // VJ product attribs end } else { // this record was missing the product_model array_walk($items, 'print_el'); echo "<p class=smallText>No products_model field in record. This line was not imported <br/>"; echo HTML_BR; } // end of row insertion code }
function olc_format_special_price_export($special_price, $price, $price_special, $calculate_currencies, $quantity, $products_tax, $add_tax, $currency) { // calculate currencies global $currency; // calculate currencies $currencies_query = olc_db_query("SELECT symbol_left,\n symbol_right,\n decimal_places,\n decimal_point,\n thousands_point,\n value\n FROM " . TABLE_CURRENCIES . " WHERE\n code = '" . $currency . APOS); $currencies_value = olc_db_fetch_array($currencies_query); $currencies_data = array(); $currencies_data = array('SYMBOL_LEFT' => $currencies_value['symbol_left'], 'SYMBOL_RIGHT' => $currencies_value['symbol_right'], 'DECIMAL_PLACES' => $currencies_value['decimal_places'], 'DEC_POINT' => $currencies_value['decimal_point'], 'THD_POINT' => $currencies_value['thousands_point'], 'VALUE' => $currencies_value['value']); if ($add_tax == '0') { $products_tax = ''; } //$special_price= (olc_add_tax($special_price,$products_tax))*$quantity; //$price= (olc_add_tax($price,$products_tax))*$quantity; $price = $price * $quantity; $special_price = $special_price * $quantity; if ($calculate_currencies == TRUE_STRING_S) { $special_price = $special_price * $currencies_data['VALUE']; $price = $price * $currencies_data['VALUE']; } // round price $special_price = olc_precision($special_price, $currencies_data['DECIMAL_PLACES']); $price = olc_precision($price, $currencies_data['DECIMAL_PLACES']); /* if ($price_special=='1') { $price=number_format($price,$currencies_data['DECIMAL_PLACES'], $currencies_data['DEC_POINT'], $currencies_data['THD_POINT']); $special_price=number_format($special_price,$currencies_data['DECIMAL_PLACES'], $currencies_data['DEC_POINT'], $currencies_data['THD_POINT']); $special_price ='<font color="ff0000"><s>'. $currencies_data['SYMBOL_LEFT'].BLANK.$price.BLANK.$currencies_data['SYMBOL_RIGHT'].' </s></font>'. $currencies_data['SYMBOL_LEFT']. BLANK.$special_price.BLANK.$currencies_data['SYMBOL_RIGHT']; } */ return $special_price; }
function adjust_price_to_net(&$price) { global $export_data; $tax_rate = $this->tax_rates[$export_data[P_TAX]]; $price = olc_precision($price / ((100 + $tax_rate) / 100), PRICE_PRECISION); }
new_page(); } } } if ($not_print_packing_slip) { $total_items = sizeof($total_price); $total_price_classes = array_keys($total_price); $add_tax_id = $total_items > 1; if ($add_tax_id) { asort($total_price); } if ($add_tax_id) { asort($total_tax[$i]); $max_tax_id_len = 0; for ($i = 0; $i < $total_items; $i++) { $tax = olc_precision($total_price_classes[$i], $tax_decimal_places); if ($tax_decimal_places) { $tax = number_format($tax, $tax_decimal_places, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT); } $max_tax_id_len = max($max_tax_id_len, strlen($tax)); $total_tax[$i] = $tax; } } else { $i = (int) $total_price_classes[0]; $add_tax_id = $i != 0; $max_tax_id_len = strlen($i); } $max_text_len = 0; $tax = EMPTY_STRING; $price_name = EMPTY_STRING; $price_value = EMPTY_STRING;
function olcFormatSpecialGraduated($pID, $sPrice, $pPrice, $format, $vpeStatus = 0, $pID) { if ($pPrice == 0) { return $this->olcFormat($sPrice, $format, 0, false, $vpeStatus); } if ($discount = $this->olcCheckDiscount($pID)) { $sPrice -= $sPrice / 100 * $discount; } if ($format) { if ($sPrice != $pPrice) { $price = '<span class="productOldPrice">' . MSRP . $this->olcFormat($pPrice, $format) . '</span><br/>' . YOUR_PRICE . $this->checkAttributes($pID) . $this->olcFormat($sPrice, $format); } else { $price = FROM . $this->olcFormat($sPrice, $format); } if ($vpeStatus == 0) { return $price; } else { return array('formated' => $price, 'plain' => $sPrice); } } else { return olc_precision($sPrice, $this->currencies[$this->actualCurr]['decimal_places']); } }
for ($i = 0, $n = sizeof($order->products) - 1; $i <= $n; $i++) { $current_product = $order->products[$i]; $qty = $current_product[$qty_text]; $model = $current_product[$model_text]; $name = BLANK . $current_product[$name_text] . BLANK; $name_len = strlen($name); $tax = $current_product[$tax_text]; $price = $current_product[$price_text]; $final_price = $current_product[$final_price_text]; $total_price[$tax] .= $final_price; if (NOT_NO_TAX_RAISED) { if (CUSTOMER_SHOW_PRICE_TAX) { $price = olc_add_tax($price, $tax); $final_price = olc_add_tax($final_price, $tax); } $tax = olc_precision($tax, $tax_precision); $tax = number_format($tax, $tax_precision, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT); } $pdf->SetFont($pdf->font, NO_FORMAT, 10); $pdf->SetY($Y_Table_Position); $current_product_attributes = $current_product['attributes']; $attributes = sizeof($current_product_attributes); if ($attributes) { if (($item_count + $attributes) % $items_per_page == 0) { new_page(); } } $field = 0; Make_Cell($i + 1 . DOT, RIGHT, false); if (true) { Make_Cell($qty, RIGHT, false);