function xos_expire_specials() { global $smarty; $specials_query = xos_db_query("select specials_id, products_id, customers_group_id from " . TABLE_SPECIALS . " where status = '1' and now() > date_add(expires_date,interval 1 day) and expires_date > 0"); if (xos_db_num_rows($specials_query)) { while ($specials = xos_db_fetch_array($specials_query)) { xos_db_query("update " . TABLE_SPECIALS . " set expires_date = null, status = '0' where specials_id = '" . (int) $specials['specials_id'] . "'"); $specials_status_query = xos_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int) $specials['products_id'] . "'"); $specials_status = xos_db_fetch_array($specials_status_query); $products_prices = xos_get_product_prices($specials_status['products_price']); if (isset($products_prices[$specials['customers_group_id']]['special_status'])) { $products_prices[$specials['customers_group_id']]['special_status'] = '0'; xos_db_query("update " . TABLE_PRODUCTS . " set products_price = '" . serialize($products_prices) . "', products_last_modified = now() where products_id = '" . (int) $specials['products_id'] . "'"); } } $smarty->clearAllCache(); } }
// this file is based on: // osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // filename: xsell_products.php // // Released under the GNU General Public License //////////////////////////////////////////////////////////////////////////////// if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/modules/xsell_products.php') == 'overwrite_all')) { if (isset($_GET['p'])) { $xsell_query = xos_db_query("select distinct p.products_id, p.products_image, pd.products_name, pd.products_info, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where xp.products_id = '" . (int) $_GET['p'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_status = '1' and c.categories_or_pages_status = '1' order by xp.sort_order "); $num_products_xsell = xos_db_num_rows($xsell_query); if ($num_products_xsell > 0) { $xsell_products_array = array(); while ($xsell = xos_db_fetch_array($xsell_query)) { $products_prices = xos_get_product_prices($xsell['products_price']); $products_tax_rate = xos_get_tax_rate($xsell['products_tax_class_id']); $xsell_price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $xsell_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $xsell_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($xsell_product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); /* if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count=2, $n=$sizeof; $count<$n; $count++) { $qty = $array_keys[$count]; $xsell_price_breaks_array[]=array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); }
} // if(!$product_list_b) { // $table_heading_array[]=array('text' => $lc_text, // 'case' => $case); // } if (!empty($_GET['sort']) && substr($_GET['sort'], 0, 1) == $col) { $selected_none = false; } } if ($listing_split->number_of_rows > 0) { $rows = 0; $table_outer_array = array(); $listing_query = xos_db_query($listing_split->sql_query); while ($listing = xos_db_fetch_array($listing_query)) { $rows++; $products_prices = xos_get_product_prices($listing['products_price']); $products_tax_rate = xos_get_tax_rate($listing['products_tax_class_id']); $price_breaks = false; $price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); if ($sizeof > 2) { $price_breaks = true; $array_keys = array_keys($products_prices[$customer_group_id]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $qty = $array_keys[$count]; $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); } }
xos_db_query("insert into " . TABLE_REVIEWS . " (products_id, customers_id, customers_name, reviews_rating, date_added) values ('" . (int) $_GET['p'] . "', '" . (int) $_SESSION['customer_id'] . "', '" . xos_db_input($customer['customers_firstname']) . ' ' . xos_db_input($customer['customers_lastname']) . "', '" . xos_db_input($rating) . "', now())"); $insert_id = xos_db_insert_id(); xos_db_query("insert into " . TABLE_REVIEWS_DESCRIPTION . " (reviews_id, languages_id, reviews_text) values ('" . (int) $insert_id . "', '" . (int) $_SESSION['languages_id'] . "', '" . xos_db_input($review) . "')"); $smarty->clearCache(null, 'L3|cc_reviews'); $smarty->clearCache(null, 'L3|cc_product_reviews'); xos_redirect(xos_href_link(FILENAME_PRODUCT_REVIEWS, xos_get_all_get_params(array('action', 'rmp')) . 'rmp=0'), false); } } require DIR_FS_SMARTY . 'catalog/languages/' . $_SESSION['language'] . '/' . FILENAME_PRODUCT_REVIEWS_WRITE; $site_trail->add(NAVBAR_TITLE, xos_href_link(FILENAME_PRODUCT_REVIEWS, xos_get_all_get_params())); $add_header = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'function checkForm() {' . "\n" . ' var error = 0;' . "\n" . ' var error_message = "' . JS_ERROR . '";' . "\n\n" . ' var review = document.product_reviews_write.review.value;' . "\n\n" . ' if (review.length < ' . REVIEW_TEXT_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "* ' . JS_REVIEW_TEXT . '\\n";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n\n" . ' if ((document.product_reviews_write.rating[0].checked) || (document.product_reviews_write.rating[1].checked) || (document.product_reviews_write.rating[2].checked) || (document.product_reviews_write.rating[3].checked) || (document.product_reviews_write.rating[4].checked)) {' . "\n" . ' } else {' . "\n" . ' error_message = error_message + "* ' . JS_REVIEW_RATING . '\\n";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n\n" . ' if (error == 1) {' . "\n" . ' alert(error_message);' . "\n" . ' return false;' . "\n" . ' } else {' . "\n" . ' return true;' . "\n" . ' }' . "\n" . '}' . "\n" . '/* ]]> */' . "\n" . '</script>' . "\n"; require DIR_WS_INCLUDES . 'html_header.php'; require DIR_WS_INCLUDES . 'boxes.php'; require DIR_WS_INCLUDES . 'header.php'; require DIR_WS_INCLUDES . 'footer.php'; $products_prices = xos_get_product_prices($product_info['products_price']); $products_tax_rate = xos_get_tax_rate($product_info['products_tax_class_id']); $price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $qty = $array_keys[$count]; $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); } } } else { $product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
require DIR_WS_INCLUDES . 'html_header.php'; require DIR_WS_INCLUDES . 'boxes.php'; require DIR_WS_INCLUDES . 'header.php'; require DIR_WS_INCLUDES . 'footer.php'; if (CACHE_LEVEL > 2 && (isset($_COOKIE[session_name()]) && !isset($_GET[session_name()]) || SESSION_FORCE_COOKIE_USE == 'true')) { $smarty->caching = 1; $cache_id = 'L3|cc_products_new|' . $_SESSION['language'] . '-' . $_GET['lnc'] . '-' . $_GET[session_name()] . '-' . $session_started . '-' . SELECTED_TPL . '-' . $_SESSION['currency'] . '-' . $_SESSION['sppc_customer_group_id'] . '-' . $_SESSION['sppc_customer_group_show_tax'] . '-' . $_SESSION['sppc_customer_group_tax_exempt'] . '-' . $_GET['page']; } if (!$smarty->isCached(SELECTED_TPL . '/products_new.tpl', $cache_id)) { $products_new_query_raw = "select distinct p.products_id, p.products_delivery_time_id, pd.products_name, pd.products_p_unit, pd.products_info, p.products_model, p.products_quantity, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, mi.manufacturers_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS_INFO . " mi on (p.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int) $_SESSION['languages_id'] . "'), " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and c.categories_or_pages_id = p2c.categories_or_pages_id and p.products_status = '1' and p.products_date_added > '" . date("Y-m-d", mktime(1, 1, 1, date("m"), date("d") - INTERVAL_DAYS_BACK, date("Y"))) . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResultsBootstrap($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'p.products_id'); if ($products_new_split->number_of_rows > 0) { $products_new_query = xos_db_query($products_new_split->sql_query); $products_new_array = array(); while ($products_new = xos_db_fetch_array($products_new_query)) { $products_prices = xos_get_product_prices($products_new['products_price']); $products_tax_rate = xos_get_tax_rate($products_new['products_tax_class_id']); $price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $qty = $array_keys[$count]; $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); } } } else { $product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with XOS-Shop. If not, see <http://www.gnu.org/licenses/>. //------------------------------------------------------------------------------ // this file is based on: // osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // filename: specials.php // // Released under the GNU General Public License //////////////////////////////////////////////////////////////////////////////// if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/boxes/specials.php') == 'overwrite_all')) { if ($random_product = xos_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and s.status = '1' and s.customers_group_id = '" . $customer_group_id . "' order by p.products_date_added DESC limit " . MAX_RANDOM_SELECT_SPECIALS)) { $products_prices = xos_get_product_prices($random_product['products_price']); $products_tax_rate = xos_get_tax_rate($random_product['products_tax_class_id']); $specials_price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $specials_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $specials_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($specials_product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); /* if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count=2, $n=$sizeof; $count<$n; $count++) { $qty = $array_keys[$count]; $specials_price_breaks_array[]=array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); }
// this file is based on: // osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // filename: also_purchased_products.php // // Released under the GNU General Public License //////////////////////////////////////////////////////////////////////////////// if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/modules/also_purchased_products.php') == 'overwrite_all')) { if (isset($_GET['p'])) { $orders_query = xos_db_query("select p.products_id, p.products_image, pd.products_name, pd.products_info, p.products_tax_class_id, p.products_price from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and opa.products_id = '" . (int) $_GET['p'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int) $_GET['p'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_status = '1' group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED); $num_products_ordered = xos_db_num_rows($orders_query); if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) { $also_purchased_products_array = array(); while ($orders = xos_db_fetch_array($orders_query)) { $products_prices = xos_get_product_prices($orders['products_price']); $products_tax_rate = xos_get_tax_rate($orders['products_tax_class_id']); $orders_price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $orders_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $orders_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($orders_product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); /* if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count=2, $n=$sizeof; $count<$n; $count++) { $qty = $array_keys[$count]; $orders_price_breaks_array[]=array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); }
$languages = xos_get_languages(); if (!isset($pInfo->products_status)) { $pInfo->products_status = '1'; } switch ($pInfo->products_status) { case '0': $in_status = false; $out_status = true; break; case '1': default: $in_status = true; $out_status = false; } $customers_group_query = xos_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id"); $products_prices = xos_get_product_prices($pInfo->products_price); $update_gross_string = ''; $update_net_string = ''; $update_checked_string = ''; $customers_groups_array = array(); $error_groups = array(); if (isset($_GET['errGr'])) { $error_groups = explode(',', $_GET['errGr']); } $javascript = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n"; $javascript .= 'var tax_rates = new Array();' . "\n"; for ($i = 0, $n = sizeof($tax_rates_final_array); $i < $n; $i++) { if ($tax_rates_final_array[$i]['id'] > 0) { $javascript .= 'tax_rates["' . $tax_rates_final_array[$i]['id'] . '"] = ' . $tax_rates_final_array[$i]['value'] . ';' . "\n"; } }
} require DIR_FS_SMARTY . 'catalog/languages/' . $_SESSION['language'] . '/' . FILENAME_PRODUCT_REVIEWS_INFO; $site_trail->add(NAVBAR_TITLE, xos_href_link(FILENAME_PRODUCT_REVIEWS_INFO, xos_get_all_get_params(array('lnc', 'cur', 'tpl', 'x', 'y')))); require DIR_WS_INCLUDES . 'html_header.php'; require DIR_WS_INCLUDES . 'boxes.php'; require DIR_WS_INCLUDES . 'header.php'; require DIR_WS_INCLUDES . 'footer.php'; xos_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . (int) $_GET['r'] . "'"); if (CACHE_LEVEL > 2 && (isset($_COOKIE[session_name()]) && !isset($_GET[session_name()]) || SESSION_FORCE_COOKIE_USE == 'true')) { $smarty->caching = 1; $cache_id = 'L3|cc_product_reviews_info|' . $_SESSION['language'] . '-' . $_GET['lnc'] . '-' . $_GET[session_name()] . '-' . $session_started . '-' . SELECTED_TPL . '-' . $_SESSION['currency'] . '-' . $_SESSION['sppc_customer_group_id'] . '-' . $_SESSION['sppc_customer_group_show_tax'] . '-' . $_SESSION['sppc_customer_group_tax_exempt'] . '-' . $_GET['c'] . '-' . $_GET['m'] . '-' . $_GET['p'] . '-' . $_GET['r']; } if (!$smarty->isCached(SELECTED_TPL . '/product_reviews_info.tpl', $cache_id)) { $review = xos_db_fetch_array($review_query); $products_image_name = xos_get_product_images($review['products_image'], 'all'); $products_prices = xos_get_product_prices($review['products_price']); $products_tax_rate = xos_get_tax_rate($review['products_tax_class_id']); $price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $qty = $array_keys[$count]; $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); } } } else { $product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
function calculate($crrency_value = 1) { $this->total = 0; if (!is_array($this->contents)) { return 0; } $tax_address_query = xos_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) ($this->get_content_type() == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'"); $tax_address = xos_db_fetch_array($tax_address_query); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // products price $product_query = xos_db_query("select products_id, products_price, products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'"); if ($product = xos_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = $this->get_tax_rate($product['products_tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']); $products_prices = xos_get_product_prices($product['products_price']); if (isset($products_prices[$_SESSION['sppc_customer_group_id']][0])) { $products_prices[$_SESSION['sppc_customer_group_id']]['special_status'] == 1 && $products_prices[$_SESSION['sppc_customer_group_id']][0]['special'] > 0 ? $products_price = $products_prices[$_SESSION['sppc_customer_group_id']][0]['special'] : ($products_price = $products_prices[$_SESSION['sppc_customer_group_id']][0]['regular']); $sizeof = count($products_prices[$_SESSION['sppc_customer_group_id']]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[$_SESSION['sppc_customer_group_id']]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $quantity = $array_keys[$count]; if ($this->contents[$products_id]['qty'] >= $quantity) { $products_prices[$_SESSION['sppc_customer_group_id']]['special_status'] == 1 && $products_prices[$_SESSION['sppc_customer_group_id']][$quantity]['special'] > 0 ? $products_price = $products_prices[$_SESSION['sppc_customer_group_id']][$quantity]['special'] : ($products_price = $products_prices[$_SESSION['sppc_customer_group_id']][$quantity]['regular']); } } } } else { $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $products_price = $products_prices[0][0]['special'] : ($products_price = $products_prices[0][0]['regular']); $sizeof = count($products_prices[0]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[0]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $quantity = $array_keys[$count]; if ($this->contents[$products_id]['qty'] >= $quantity) { $products_prices[0]['special_status'] == 1 && $products_prices[0][$quantity]['special'] > 0 ? $products_price = $products_prices[0][$quantity]['special'] : ($products_price = $products_prices[0][$quantity]['regular']); } } } } $this->total += $this->add_tax($crrency_value * $products_price, $products_tax) * $qty; } // attributes price if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = xos_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $prid . "' and options_id = '" . (int) $option . "' and options_values_id = '" . (int) $value . "'"); $attribute_price = xos_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { $this->total += $qty * $this->add_tax($crrency_value * $attribute_price['options_values_price'], $products_tax); } else { $this->total -= $qty * $this->add_tax($crrency_value * $attribute_price['options_values_price'], $products_tax); } } } } $discount_query = xos_db_query("select customers_group_discount from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" . $_SESSION['sppc_customer_group_id'] . "'"); $discount = xos_db_fetch_array($discount_query); if ($discount['customers_group_discount'] > 0) { $this->total -= $this->total / 100 * $discount['customers_group_discount']; } }
new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $products_image_new_name, DIR_FS_CATALOG_IMAGES . 'products/extra_small/' . $products_image_new_name, EXTRA_SMALL_PRODUCT_IMAGE_MAX_WIDTH, EXTRA_SMALL_PRODUCT_IMAGE_MAX_HEIGHT, IMAGE_QUALITY, EXTRA_SMALL_PRODUCT_IMAGE_MERGE); new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $products_image_new_name, DIR_FS_CATALOG_IMAGES . 'products/small/' . $products_image_new_name, SMALL_PRODUCT_IMAGE_MAX_WIDTH, SMALL_PRODUCT_IMAGE_MAX_HEIGHT, IMAGE_QUALITY, SMALL_PRODUCT_IMAGE_MERGE); new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $products_image_new_name, DIR_FS_CATALOG_IMAGES . 'products/medium/' . $products_image_new_name, MEDIUM_PRODUCT_IMAGE_MAX_WIDTH, MEDIUM_PRODUCT_IMAGE_MAX_HEIGHT, IMAGE_QUALITY, MEDIUM_PRODUCT_IMAGE_MERGE); new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $products_image_new_name, DIR_FS_CATALOG_IMAGES . 'products/large/' . $products_image_new_name, $image_array[$i]['large_image_max_width'] == 'default' ? LARGE_PRODUCT_IMAGE_MAX_WIDTH : $image_array[$i]['large_image_max_width'], $image_array[$i]['large_image_max_height'] == 'default' ? LARGE_PRODUCT_IMAGE_MAX_HEIGHT : $image_array[$i]['large_image_max_height'], IMAGE_QUALITY, LARGE_PRODUCT_IMAGE_MERGE); } } elseif ($_POST['delete_product_image_' . $i] == 'true') { @unlink(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $_POST['current_product_image_' . $i]); @unlink(DIR_FS_CATALOG_IMAGES . 'products/extra_small/' . $_POST['current_product_image_' . $i]); @unlink(DIR_FS_CATALOG_IMAGES . 'products/small/' . $_POST['current_product_image_' . $i]); @unlink(DIR_FS_CATALOG_IMAGES . 'products/medium/' . $_POST['current_product_image_' . $i]); @unlink(DIR_FS_CATALOG_IMAGES . 'products/large/' . $_POST['current_product_image_' . $i]); unset($image_array[$i]); } } ksort($image_array); $products_price_array = xos_get_product_prices(stripslashes($_POST['price_array'])); $customers_group_query = xos_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id"); $prices_array = array(); while ($customers_group = xos_db_fetch_array($customers_group_query)) { if ($_POST['option'][$customers_group['customers_group_id']] || $customers_group['customers_group_id'] == 0) { $this_group_specials_error = false; $has_specials = false; $all_specials = true; $prices_array[$customers_group['customers_group_id']][0]['regular'] = number_format($_POST['products_price_' . $customers_group['customers_group_id']], 4, '.', ''); $prices_array[$customers_group['customers_group_id']][0]['regular'] < 0 ? $prices_array[$customers_group['customers_group_id']][0]['regular'] = number_format(0, 4, '.', '') : ''; $special_price_formated = number_format($_POST['products_special_price_' . $customers_group['customers_group_id']], 4, '.', ''); $prices_array[$customers_group['customers_group_id']][0]['regular'] > 0 ? $special_price_formated > 0 ? $prices_array[$customers_group['customers_group_id']][0]['special'] = $special_price_formated : '' : ''; if ($prices_array[$customers_group['customers_group_id']][0]['special'] > 0) { $product_special_status = xos_db_prepare_input($_POST['products_special_status_' . $customers_group['customers_group_id']]); $has_specials = true; } else {
function get_products($crrency_value = 1) { global $customer_group_id; if (!is_array($this->contents)) { return false; } $tax_address_query = xos_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) ($this->get_content_type() == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'"); $tax_address = xos_db_fetch_array($tax_address_query); $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = xos_db_query("select p.products_id, p.products_delivery_time_id, pd.products_name, pd.products_p_unit, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'"); if ($products = xos_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_tax = xos_get_tax_rate($products['products_tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']); $products_prices = xos_get_product_prices($products['products_price']); if (isset($products_prices[$customer_group_id][0])) { $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $products_price = $products_prices[$customer_group_id][0]['special'] : ($products_price = $products_prices[$customer_group_id][0]['regular']); $sizeof = count($products_prices[$customer_group_id]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $qty = $array_keys[$count]; if ($this->contents[$products_id]['qty'] >= $qty) { $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $products_price = $products_prices[$customer_group_id][$qty]['special'] : ($products_price = $products_prices[$customer_group_id][$qty]['regular']); } } } } else { $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $products_price = $products_prices[0][0]['special'] : ($products_price = $products_prices[0][0]['regular']); $sizeof = count($products_prices[0]); if ($sizeof > 2) { $array_keys = array_keys($products_prices[0]); for ($count = 2, $n = $sizeof; $count < $n; $count++) { $qty = $array_keys[$count]; if ($this->contents[$products_id]['qty'] >= $qty) { $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $products_price = $products_prices[0][$qty]['special'] : ($products_price = $products_prices[0][$qty]['regular']); } } } } $products_array[] = array('id' => $products_id, 'delivery_time_id' => $products['products_delivery_time_id'], 'name' => $products['products_name'], 'packaging_unit' => $products['products_p_unit'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => xos_add_tax($crrency_value * $products_price, $products_tax), 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => xos_add_tax($crrency_value * $products_price, $products_tax) + $this->attributes_price($products_id, $crrency_value, $products_tax), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''); } } return $products_array; }
} $categories_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.parent_id from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.categories_or_pages_id = cpd.categories_or_pages_id and cpd.language_id = '" . (int) $_SESSION['languages_id'] . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cpd.categories_or_pages_name"); while ($categories = xos_db_fetch_array($categories_query)) { $categories_string .= " or c.parent_id = '" . $categories['categories_or_pages_id'] . "'"; $categories_string = xos_get_categories_string($categories['categories_or_pages_id'], '', $categories_string); } return $categories_string; } $includes_categories = xos_get_categories_string($new_products_category_id, true); $new_products_query = xos_db_query("select distinct p.products_id, p.products_image, pd.products_name, pd.products_info, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_OR_PAGES . " c where c.categories_or_pages_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and (" . $includes_categories . ") and p.products_status = '1' and p.products_date_added > '" . date("Y-m-d", mktime(1, 1, 1, date("m"), date("d") - INTERVAL_DAYS_BACK, date("Y"))) . "' order by p.products_date_added desc, pd.products_name limit " . MAX_DISPLAY_NEW_PRODUCTS); } $num_new_products = xos_db_num_rows($new_products_query); if ($num_new_products > 0) { $new_products_array = array(); while ($new_products = xos_db_fetch_array($new_products_query)) { $products_prices = xos_get_product_prices($new_products['products_price']); $products_tax_rate = xos_get_tax_rate($new_products['products_tax_class_id']); $new_price_breaks_array = array(); if (isset($products_prices[$customer_group_id][0])) { $new_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate); $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $new_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($new_product_price_special = ''); $sizeof = count($products_prices[$customer_group_id]); /* if ($sizeof > 2) { $array_keys = array_keys($products_prices[$customer_group_id]); for ($count=2, $n=$sizeof; $count<$n; $count++) { $qty = $array_keys[$count]; $new_price_breaks_array[]=array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : ''); }