function start() { if (PHP_VERSION < 4.1) { global $_GET; } global $cPath, $cPath_array, $current_category_id; if (isset($_GET['cPath'])) { $cPath = $_GET['cPath']; } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) { $cPath = tep_get_product_path($_GET['products_id']); } else { $cPath = ''; } if (!empty($cPath)) { $cPath_array = tep_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = end($cPath_array); } else { $current_category_id = 0; } include 'includes/classes/category_tree.php'; return true; }
// infobox require DIR_WS_CLASSES . 'boxes.php'; // auto activate and expire banners require DIR_WS_FUNCTIONS . 'banner.php'; tep_activate_banners(); tep_expire_banners(); // auto expire special products require DIR_WS_FUNCTIONS . 'specials.php'; tep_expire_specials(); require DIR_WS_CLASSES . 'osc_template.php'; $oscTemplate = new oscTemplate(); // calculate category path if (isset($HTTP_GET_VARS['cPath'])) { $cPath = $HTTP_GET_VARS['cPath']; } elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) { $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']); } else { $cPath = ''; } if (tep_not_null($cPath)) { $cPath_array = tep_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[sizeof($cPath_array) - 1]; } else { $current_category_id = 0; } // include the breadcrumb class and start the breadcrumb trail require DIR_WS_CLASSES . 'breadcrumb.php'; $breadcrumb = new breadcrumb(); $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER); $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));
function calculate_tax_deduction($amount, $od_amount, $method) { global $customer_id, $order, $cc_id, $cart; //$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead. $coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'"); if (tep_db_num_rows($coupon_query) != 0) { $coupon_result = tep_db_fetch_array($coupon_query); $coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_result['coupon_code'] . "'"); $get_result = tep_db_fetch_array($coupon_get); if ($get_result['coupon_type'] != 'S') { //RESTRICTION-------------------------------- if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) { // What to do here. // Loop through all products and build a list of all product_ids, price, tax class // at the same time create total net amount. // then // for percentage discounts. simply reduce tax group per product by discount percentage // or // for fixed payment amount // calculate ratio based on total net // for each product reduce tax group per product by ratio amount. $products = $cart->get_products(); $valid_product = false; for ($i = 0; $i < sizeof($products); $i++) { $valid_product = false; $t_prid = tep_get_prid($products[$i]['id']); $cc_query = tep_db_query("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'"); $cc_result = tep_db_fetch_array($cc_query); if ($get_result['restrict_to_products']) { $pr_ids = split("[,]", $get_result['restrict_to_products']); for ($p = 0; $p < sizeof($pr_ids); $p++) { if ($pr_ids[$p] == $t_prid) { $valid_product = true; } } } if ($get_result['restrict_to_categories']) { // Tanaka 2005-4-30: Original Code /*$cat_ids = split("[,]", $get_result['restrict_to_categories']); for ($c = 0; $c < sizeof($cat_ids); $c++) { // Tanaka 2005-4-30: changed $products_id to $t_prid and changed $i to $c $cat_query = tep_db_query("select products_id from products_to_categories where products_id = '" . $t_prid . "' and categories_id = '" . $cat_ids[$c] . "'"); if (tep_db_num_rows($cat_query) !=0 ) $valid_product = true; }*/ // v5.13a Tanaka 2005-4-30: New code, this correctly identifies valid products in subcategories $cat_ids = split("[,]", $get_result['restrict_to_categories']); $my_path = tep_get_product_path($t_prid); $sub_cat_ids = split("[_]", $my_path); for ($iii = 0; $iii < count($sub_cat_ids); $iii++) { for ($ii = 0; $ii < count($cat_ids); $ii++) { if ($sub_cat_ids[$iii] == $cat_ids[$ii]) { $valid_product = true; continue 2; } } } } if ($valid_product) { $price_excl_vat = $products[$i]['final_price'] * $products[$i]['quantity']; //Fred - added $price_incl_vat = $this->product_price($t_prid); //Fred - added $valid_array[] = array('product_id' => $t_prid, 'products_price' => $price_excl_vat, 'products_tax_class' => $cc_result['products_tax_class_id']); //jason //Fred - changed from $products[$i]['final_price'] 'products_tax_class' => $cc_result['products_tax_class_id']); // $total_price += $price_incl_vat; //Fred - changed $total_price += $price_excl_vat; // changed } } if (sizeof($valid_array) > 0) { // if ($valid_product) { if ($get_result['coupon_type'] == 'P') { $ratio = $get_result['coupon_amount'] / 100; } else { $ratio = $od_amount / $total_price; } if ($get_result['coupon_type'] == 'S') { $ratio = 1; } if ($method == 'Credit Note') { $tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); if ($get_result['coupon_type'] == 'P') { $tod_amount = $od_amount / (100 + $tax_rate) * $tax_rate; } else { $tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount / 100; } $order->info['tax_groups'][$tax_desc] -= $tod_amount; $order->info['total'] -= $tod_amount; // need to modify total ...OLD $order->info['tax'] -= $tod_amount; //Fred - added } else { for ($p = 0; $p < sizeof($valid_array); $p++) { $tax_rate = tep_get_tax_rate($valid_array[$p]['products_tax_class'], $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($valid_array[$p]['products_tax_class'], $order->delivery['country']['id'], $order->delivery['zone_id']); if ($tax_rate > 0) { //Fred $tod_amount[$tax_desc] += ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; //OLD $tod_amount = $valid_array[$p]['products_price'] * $tax_rate / 100 * $ratio; // calc total tax Fred - added $order->info['tax_groups'][$tax_desc] -= $valid_array[$p]['products_price'] * $tax_rate / 100 * $ratio; $order->info['total'] -= $valid_array[$p]['products_price'] * $tax_rate / 100 * $ratio; // adjust total $order->info['tax'] -= $valid_array[$p]['products_price'] * $tax_rate / 100 * $ratio; // adjust tax -- Fred - added } } } } //NO RESTRICTION-------------------------------- } else { if ($get_result['coupon_type'] == 'F') { $tod_amount = 0; if ($method == 'Credit Note') { $tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tod_amount = $od_amount / (100 + $tax_rate) * $tax_rate; $order->info['tax_groups'][$tax_desc] -= $tod_amount; } else { // $ratio1 = $od_amount/$amount; // this produces the wrong ratipo on fixed amounts reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $ratio1 = $od_amount / ($amount - $order->info['tax_groups'][$key]); ////debug $tax_rate = tep_get_tax_rate_from_desc($key); $net = $tax_rate * $order->info['tax_groups'][$key]; if ($net > 0) { $god_amount = $order->info['tax_groups'][$key] * $ratio1; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } $order->info['total'] -= $tod_amount; //OLD $order->info['tax'] -= $tod_amount; //Fred - added } if ($get_result['coupon_type'] == 'P') { $tod_amount = 0; if ($method == 'Credit Note') { $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount / 100; $order->info['tax_groups'][$tax_desc] -= $tod_amount; } else { reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate_from_desc($key); $net = $tax_rate * $order->info['tax_groups'][$key]; if ($net > 0) { $god_amount = $order->info['tax_groups'][$key] * $get_result['coupon_amount'] / 100; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } $order->info['total'] -= $tod_amount; // have to modify total also $order->info['tax'] -= $tod_amount; } } } } return $tod_amount; }
$lc_align = 'center'; $lc_text = ' ' . $duedate . ' '; break; case 'PRODUCT_LIST_BUY_NOW': $valid_to_checkout = true; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock((int) $listing[$x]['products_id'], 1); if (tep_not_null($stock_check) && STOCK_ALLOW_CHECKOUT == 'false') { $valid_to_checkout = false; } } if ($valid_to_checkout == true) { $hide_add_to_cart = hide_add_to_cart(); $lc_text = ''; if ($hide_add_to_cart == 'false' && group_hide_show_prices() == 'true') { $lc_text = '<div class="col-sm-6 col-lg-6 no-margin-left product-listing-module-buy-now buy-btn-div"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'cPath', 'products_id')) . 'action=buy_now&products_id=' . $listing[$x]['products_id'] . '&cPath=' . tep_get_product_path($listing[$x]['products_id']) . $params) . '"><button class="product-listing-module-buy-now-button btn btn-success btn-block">' . IMAGE_BUTTON_BUY_NOW . '</button></a></div>'; } } $lc_text .= '</div>'; break; } $product_contents[] = $lc_text; } $lc_text = implode($product_contents); echo '<div class="product-listing-module-items"><div class="col-sm-4 col-lg-4 with-padding"><div class="thumbnail align-center" style="height: 460px;">' . $lc_text . '</div></div></div>'; $column++; if ($column >= COLUMN_COUNT) { $row++; $column = 0; } }
Copyright (c) 2003 osCommerce Released under the GNU General Public License */ $history = new box_order_history(); if (count($history->rows) > 0) { ?> <!-- order_history //--> <div class="well" > <div class="box-header small-margin-bottom small-margin-left"><?php echo BOX_HEADING_CUSTOMER_ORDERS; ?> </div> <?php foreach ($history->rows as $products) { // changes the cust_order into a buy_now action $customer_orders_string .= ' ' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a>' . ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'cPath', 'products_id')) . 'action=buy_now&products_id=' . $products['products_id'] . '&cPath=' . tep_get_product_path($products['products_id'])) . '">' . tep_image(DIR_WS_ICONS . 'cart.gif', ICON_CART) . '</a>' . ' '; } echo '<div style="margin-left:5px">' . $customer_orders_string . '</div>'; ?> <script> $('.box-product-categories-ul-top').addClass('list-unstyled list-indent-large'); $('.box-product-categories-ul').addClass('list-unstyled list-indent-large'); </script> </div> <!-- order_history_eof //--> <?php }
<tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS); new contentBoxHeading($info_box_contents); $row = 0; $col = 0; $info_box_contents = array(); while ($xsell = tep_db_fetch_array($xsell_query)) { $pf->loadProduct($xsell['products_id'], $languages_id); $xsell_price = $pf->getPriceStringShort(); $s_buy_now = ''; $hide_add_to_cart = hide_add_to_cart(); if ($hide_add_to_cart == 'false' && group_hide_show_prices() == 'true') { $s_buy_now = '<br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action', 'cPath', 'products_id')) . 'action=buy_now&products_id=' . $xsell['products_id'] . '&cPath=' . tep_get_product_path($xsell['products_id']), 'NONSSL') . '">' . tep_template_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>'; } $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] . '</a><br>' . cre_products_blurb($xsell['products_id']) . $xsell_price . $s_buy_now . '</center>'); $col++; if ($col > 2) { $col = 0; $row++; } } // Modify to avoid display if no X-Sells Defined - courtesy Halbert DMG // halbert mod - Don't show heading if no cross-sell items if ($num_products_xsell >= MIN_DISPLAY_XSELL && $num_products_xsell > 0) { new contentBox($info_box_contents, true, true); if (TEMPLATE_INCLUDE_CONTENT_FOOTER == 'true') { $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => tep_draw_separator('pixel_trans.gif', '100%', '1'));
$col++; ?> <td><table class="linkListing" width="100%" border="0" cellspacing="0" cellpadding="6"> <tr> <td width="20%" valign="top" align="center" class="smallText"> <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL'); ?> "><?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?> </a> </td> <td valign="top" align="left" class="smallText"> <b><a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL'); ?> "><?php echo $products['products_name']; ?> </a></b> <?php // Begin Wish List Code w/Attributes $attributes_addon_price = 0; // Now get and populate product attributes if ($_SESSION['customer_id'] > 0) { $wishlist_products_attributes_query = tep_db_query("select products_options_id as po, products_options_value_id as pov from " . TABLE_WISHLIST_ATTRIBUTES . " where customers_id='" . $_SESSION['customer_id'] . "' and products_id = '" . $products['products_id'] . "'"); while ($wishlist_products_attributes = tep_db_fetch_array($wishlist_products_attributes_query)) { $data1 = $wishlist_products_attributes['pov']; $data = unserialize(str_replace("\\", '', $data1)); if (array_key_exists('c', $data)) {
} else { if ($link_vars_get == '' && $link_vars_post != '') { $return_link_vars = $link_vars_post; } } } $nav_link = '<div class="margin-top large-margin-bottom pull-right"><a href="' . tep_href_link($navigation->path[$back]['page'], $return_link_vars, $navigation->path[$back]['mode']) . '"> <button class="btn btn-lg btn-success disabled" type="button">' . IMAGE_BUTTON_CONTINUE_SHOPPING . '</button></a></div>'; //$nav_link = '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_template_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; /***** fix end ****/ } } else { if (RETURN_CART == 'C' || isset($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'], 'wishlist')) { if (!stristr($_SERVER['HTTP_REFERER'], 'wishlist')) { $products = $cart->get_products(); $products = array_reverse($products); $cat = tep_get_product_path($products[0]['id']); $cat1 = 'cPath=' . $cat; if ($products == '') { $back = sizeof($navigation->path) - 2; if (isset($navigation->path[$back])) { $nav_link = '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_template_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; } } else { $nav_link = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cat1) . '">' . tep_template_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; } } else { $nav_link = '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_template_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; } } else { if (RETURN_CART == 'P') { $products = $cart->get_products();
<td class="main" align="left"> <?php if (BASKET_CART == 'cart') { echo '<a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'action=clear_cart', 'SSL') . '" onClick="var x=confirm(\'' . CLEAR_CART . '\'); if (x==false) { return false; }">' . tep_image_button('button_clear_cart.gif', IMAGE_CLEAR_CART); } else { echo '<a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'action=clear_cart', 'SSL') . '" onClick="var x=confirm(\'' . CLEAR_CART . '\'); if (x==false) { return false; }">' . tep_image_button('button_clear_basket.gif', IMAGE_CLEAR_BASKET); } ?> </a></td> <?php //BOF Bugfix #384 $back = sizeof($navigation->path) - 2; $count = count($products); if (isset($products[$count - 1]['id'])) { $continueButtonId = tep_get_product_path(str_replace(strstr($products[$count - 1]['id'], '{'), '', $products[$count - 1]['id'])); } if (isset($continueButtonId)) { ?> <td align="center" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $continueButtonId) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?> </td> <?php // if (isset($navigation->path[$back])) { } elseif (isset($navigation->path[$back])) { // ?> <td align="center" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>
function tep_get_url_data() { global $_SERVER, $REQUEST_TYPE, $_GET, $languages_id, $cPath; $url_data = array(); if ($REQUEST_TYPE == 'SSL') { $comparison_array = explode('/', HTTPS_SERVER . DIR_WS_HTTPS_CATALOG, 4); } else { $comparison_array = explode('/', HTTP_SERVER . DIR_WS_HTTP_CATALOG, 4); } $comparison = $comparison_array[3]; $parts = explode('?', str_replace($comparison, '', $_SERVER['REQUEST_URI']), 2); if (sizeof($parts) == 2) { $parameters = explode('&', $parts[1]); foreach ($parameters as $pair) { $pieces = explode('=', $pair); $_GET[$pieces[0]] = $pieces[1]; $url_data['get'][$pieces[0]] = $pieces[1]; } } $get_seo_item_query = tep_db_query("select categories_id, products_id, manufacturers_id, infopages_id from seo_urls where url = '" . $parts[0] . "' AND language_id = '" . (int) $languages_id . "'"); if (tep_db_num_rows($get_seo_item_query) > 0) { $get_seo_item = tep_db_fetch_array($get_seo_item_query); if ((int) $get_seo_item['categories_id'] > 0) { //categorie $category_query = tep_db_query("select categories_id, parent_id from categories where categories_id='" . $get_seo_item['categories_id'] . "'"); $category_array = tep_db_fetch_array($category_query); $cPath = tep_get_full_cpath($category_array['categories_id']); $current_category_id = $category_array['categories_id']; $url_data['get']['cPath'] = $cPath; $url_data['page'] = FILENAME_DEFAULT; } else { if ((int) $get_seo_item['products_id'] > 0) { //product $product_query = tep_db_query("select pd.products_id, pd.products_name from products_description pd, products_to_categories p2c, products p where p.products_id = pd.products_id and p.products_status = '1' and pd.products_id=p2c.products_id and pd.products_id='" . $get_seo_item['products_id'] . "'" . $parent_where_string); $product_array = tep_db_fetch_array($product_query); $cPath = tep_get_product_path($product_array['products_id']); $url_data['get']['products_id'] = $product_array['products_id']; $url_data['page'] = FILENAME_PRODUCT_INFO; } else { if ((int) $get_seo_item['manufacturers_id'] > 0) { //manufacturer if (strstr($get_seo_item['manufacturers_id'], '_')) { $seo_item_ids = explode('_', $get_seo_item['manufacturers_id']); $manufacturers_id = $seo_item_ids[0]; } else { $manufacturers_id = $get_seo_item['manufacturers_id']; } $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from manufacturers where manufacturers_id='" . $manufacturers_id . "'"); $manufacturers_array = tep_db_fetch_array($manufacturers_query); if (isset($seo_item_ids[1])) { $filter_query = tep_db_query('SELECT categories_name FROM categories_description WHERE categories_id = "' . (int) $seo_item_ids[1] . '" AND language_id = "' . (int) $languages_id . '"'); $filter = tep_db_fetch_array($filter_query); $_GET['filter_id'] = $seo_item_ids[1]; } $url_data['get']['manufacturers_id'] = $manufacturers_array['manufacturers_id']; $url_data['page'] = FILENAME_DEFAULT; } else { if ((int) $get_seo_item['infopages_id'] > 0) { $test_query = tep_db_query("select it.infopages_id from infopages i, infopages_text it where i.infopages_id = it.infopages_id AND i.infopages_id = '" . $get_seo_item['infopages_id'] . "'"); $infopages_array = tep_db_fetch_array($test_query); $url_data['get']['page'] = $infopages_array['infopages_id']; $url_data['page'] = FILENAME_INFOPAGE; } } } } } return $url_data; }
$item_class .= ' lastofrow'; } if ($display_class == 'grid') { $product_width = 100 / PRODUCT_LISTING_GRID_COLUMNS; $extra_style = ' style="width:' . $product_width . '%;' . tep_get_product_style($listing['products_id']) . '"'; } else { if (tep_get_product_style($listing['products_id']) != '') { $extra_style = ' style="' . tep_get_product_style($listing['products_id']) . '"'; } else { $extra_style = ''; } } //DISCOUNT if (USE_PRICES_TO_QTY == 'false' && PRICE_BOOK == 'true') { //added here so this can be used add the whole page $cPath = tep_get_product_path($listing['products_id']); $discount_price = tep_get_discountprice($listing['products_price'], $customer_id, $customer_group, $listing['products_id'], $cPath, $listing['manufacturers_id']); $discount = false; if (PRICE_BOOK_STAR_PRODUCT_LISTING == 'true') { if ($discount_price['lowest']['discount'] > 0 && $listing['specials_new_products_price'] > $discount_price['lowest']['price']) { $discount = $discount_price['lowest']['discount']; } } } //END DISCOUNT ?> <div class="product<?php echo $item_class; ?> "<?php echo $extra_style;
$new10 = tep_db_query("select distinct \r\n p.products_id,\r\n pd.products_name, \r\n if (isnull(pg.customers_group_price), p.products_price, pg.customers_group_price) as products_price,\r\n p.products_image \r\n from (" . TABLE_PRODUCTS . " p \r\n left join " . TABLE_PRODUCTS_GROUPS . " pg on p.products_id = pg.products_id and pg.customers_group_id = '" . $customer_group_id . "'),\r\n " . TABLE_SPECIALS . " s,\r\n " . TABLE_PRODUCTS_DESCRIPTION . " pd\r\n where \r\n p.products_status = '1'\r\n and p.products_id = s.products_id\r\n and pd.products_id = p.products_id\r\n and pd.language_id = '" . $languages_id . "' \r\n and s.status = '1' \r\n and p.products_group_access like '%" . $customer_group_id . "%'\r\n order by rand(), s.specials_date_added DESC limit " . MAX_DISPLAY_SPECIAL_PRODUCTS); //Eversun mod end for sppc and qty price breaks $row = 0; $col = 0; $num = 0; $buyitnow = ''; while ($default_specials_1a = tep_db_fetch_array($new10)) { $num++; if ($num == 1) { new contentBoxHeading($info_box_contents, tep_href_link(FILENAME_SPECIALS)); } $pf->loadProduct($default_specials_1a['products_id'], $languages_id); $products_price_s = $pf->getPriceStringShort(); $hide_add_to_cart = hide_add_to_cart(); if ($hide_add_to_cart == 'false' && group_hide_show_prices() == 'true') { $buyitnow = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'cPath', 'products_id')) . 'action=buy_now&products_id=' . $default_specials_1a['products_id'] . '&cPath=' . tep_get_product_path($default_specials_1a['products_id'])) . '">' . tep_template_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; } $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials_1a['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $default_specials_1a['products_image'], $default_specials_1a['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials_1a['products_id']) . '">' . $default_specials_1a['products_name'] . '</a><br>' . cre_products_blurb($default_specials_1a['products_id']) . $products_price_s . '<br>' . $buyitnow); $col++; if ($col > 2) { $col = 0; $row++; } } if ($num) { new contentBox($info_box_contents, true, true); if (TEMPLATE_INCLUDE_CONTENT_FOOTER == 'true') { $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => tep_draw_separator('pixel_trans.gif', '100%', '1')); new contentBoxFooter($info_box_contents); }
function calculate_credit($amount) { global $customer_id, $order, $cc_id; $od_amount = 0; if (isset($cc_id)) { $coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'"); if (tep_db_num_rows($coupon_query) != 0) { $coupon_result = tep_db_fetch_array($coupon_query); $this->coupon_code = $coupon_result['coupon_code']; $coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_result['coupon_code'] . "'"); $get_result = tep_db_fetch_array($coupon_get); $c_deduct = $get_result['coupon_amount']; if ($get_result['coupon_type'] == 'S') { $c_deduct = $order->info['shipping_cost']; } if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) { if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) { for ($i = 0; $i < sizeof($order->products); $i++) { if ($get_result['restrict_to_products']) { $pr_ids = preg_split("[,]", $get_result['restrict_to_products']); for ($ii = 0; $ii < count($pr_ids); $ii++) { if ($pr_ids[$ii] == tep_get_prid($order->products[$i]['id'])) { if ($get_result['coupon_type'] == 'P') { $pr_c = $this->product_price($order->products[$i]['id']); $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100; $od_amount = $od_amount + $pod_amount; } else { $od_amount = $c_deduct; } } } } else { $cat_ids = preg_split("[,]", $get_result['restrict_to_categories']); for ($i = 0; $i < sizeof($order->products); $i++) { $my_path = tep_get_product_path(tep_get_prid($order->products[$i]['id'])); $sub_cat_ids = preg_split("[_]", $my_path); for ($iii = 0; $iii < count($sub_cat_ids); $iii++) { for ($ii = 0; $ii < count($cat_ids); $ii++) { if ($sub_cat_ids[$iii] == $cat_ids[$ii]) { if ($get_result['coupon_type'] == 'P') { $pr_c = $this->product_price($order->products[$i]['id']); $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100; $od_amount = $od_amount + $pod_amount; } else { $od_amount = $c_deduct; } } } } } } } } else { if ($get_result['coupon_type'] != 'P') { $od_amount = $c_deduct; } else { $od_amount = $amount * $get_result['coupon_amount'] / 100; } } } } if ($od_amount > $amount) { $od_amount = $amount; } } return $od_amount; }
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) { global $request_type, $session_started, $SID, $spider_flag; if (!tep_not_null($page)) { $page = FILENAME_DEFAULT; } $link = ''; $redirect_url = ''; $categories_id = ''; $products_id = ''; $categories_parameters = ''; $sections_id = ''; $information_id = ''; $sections_parameters = ''; $news_id = ''; $news_parameters = ''; $cname = ''; $sname = ''; $nname = ''; $rname = ''; $mname = ''; $product_type_id = 0; if (basename($page) == FILENAME_CATEGORIES) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'cPath') { $categories_id = $param_value; } elseif ($param_name == 'categories_id') { $categories_id = $param_value; } elseif ($param_name == 'products_id') { $products_id = $param_value; } elseif ($param_name == 'tPath') { $product_type_id = $param_value; } else { $categories_parameters .= (tep_not_null($categories_parameters) ? '&' : '') . $param; } if ($param_name == 'cName') { $cname = $param_value; # if (substr($cname, -1)=='/') $cname = substr($cname, 0, -1); # if (substr($cname, 0, 1)=='/') $cname = substr($cname, 1); } } if (tep_not_null($products_id) && empty($categories_id)) { $categories_id = tep_get_product_path($products_id); } $current_category_id = 0; if (tep_not_null($categories_id)) { $last_id = end(explode('_', $categories_id)); $parent_categories = array($last_id); tep_get_parents($parent_categories, $last_id); $parent_categories = array_reverse($parent_categories); reset($parent_categories); while (list(, $category_id) = each($parent_categories)) { $categories_path_query = tep_db_query("select categories_path, products_types_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int) $category_id . "' limit 1"); if (tep_db_num_rows($categories_path_query) > 0) { $categories_path = tep_db_fetch_array($categories_path_query); if (tep_not_null($categories_path['categories_path'])) { $link .= $categories_path['categories_path'] . '/'; } else { $link .= $category_id . '/'; } $current_category_id = $category_id; $product_type_id = $categories_path['products_types_id']; } } } if (empty($categories_id) && empty($products_id) && tep_not_null($cname)) { $link .= $cname; } $parameters = $categories_parameters; } elseif (basename($page) == FILENAME_PRODUCT_INFO) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'products_id') { $products_id = $param_value; } else { $categories_parameters .= (tep_not_null($categories_parameters) ? '&' : '') . $param; } } if (tep_not_null($products_id)) { $link .= $products_id . '.html'; } $parameters = $categories_parameters; } elseif (basename($page) == FILENAME_SPECIALS) { $params = explode("&", $parameters); $year = ''; $month = ''; $week = ''; reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'tPath') { $tpath = $param_value; } elseif ($param_name == 'year') { $year = (int) $param_value; } elseif ($param_name == 'month') { $month = (int) $param_value; } elseif ($param_name == 'week') { $week = (int) $param_value; } elseif ($param_name == 'view') { $specials_view = $param_value; } else { $types_parameters .= (tep_not_null($types_parameters) ? '&' : '') . $param; } } $link .= 'specials/'; if (tep_not_null($tpath)) { $types_path_query = tep_db_query("select specials_types_path from " . TABLE_SPECIALS_TYPES . " where specials_types_id = '" . (int) $tpath . "' limit 1"); $types_path = tep_db_fetch_array($types_path_query); if (tep_not_null($types_path['specials_types_path'])) { $link .= $types_path['specials_types_path'] . '/'; if ($specials_view == 'rss') { $link = substr($link, 0, -1) . '.rss'; $types_parameters = ''; $add_session_id = false; } elseif ($year > 2000 && $year <= date('Y')) { $link .= $year . '/'; if ($month > 0 && $month <= 12) { $m_array = array('', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'); // $link .= $m_array[(int)$month] . '/'; $link .= sprintf('%02d', (int) $month) . '/'; if ($week > 0 && $week <= 53) { $link .= (int) $week . '/'; } } } } } $parameters = $types_parameters; } elseif (basename($page) == FILENAME_REVIEWS) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'tPath') { $tpath = $param_value; } elseif ($param_name == 'view') { $reviews_view = $param_value; } else { $types_parameters .= (tep_not_null($types_parameters) ? '&' : '') . $param; } if ($param_name == 'reviews_id') { $reviews_id = $param_value; } } $link .= 'reviews/'; if (empty($tpath) && $reviews_id > 0) { $review_type_query = tep_db_query("select reviews_types_id from " . TABLE_REVIEWS . " where reviews_id = '" . (int) $reviews_id . "'"); $review_type = tep_db_fetch_array($review_type_query); $tpath = $review_type['reviews_types_id']; } if (tep_not_null($tpath)) { $types_path_query = tep_db_query("select reviews_types_path from " . TABLE_REVIEWS_TYPES . " where reviews_types_id = '" . (int) $tpath . "' limit 1"); $types_path = tep_db_fetch_array($types_path_query); if (tep_not_null($types_path['reviews_types_path'])) { $link .= $types_path['reviews_types_path'] . '/'; if ($reviews_view == 'rss') { $link = substr($link, 0, -1) . '.rss'; $types_parameters = ''; $add_session_id = false; } } } $parameters = $types_parameters; } elseif (basename($page) == FILENAME_BOARDS) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'tPath') { $tpath = $param_value; } elseif ($param_name == 'boards_id') { $boards_id = $param_value; } elseif ($param_name == 'view') { $boards_view = $param_value; } else { $types_parameters .= (tep_not_null($types_parameters) ? '&' : '') . $param; } } $link .= 'boards/'; if (empty($tpath) && $boards_id > 0) { $board_type_query = tep_db_query("select boards_types_id from " . TABLE_BOARDS . " where boards_id = '" . (int) $boards_id . "'"); $board_type = tep_db_fetch_array($board_type_query); $tpath = $board_type['boards_types_id']; } if (tep_not_null($tpath)) { $types_path_query = tep_db_query("select boards_types_path from " . TABLE_BOARDS_TYPES . " where boards_types_id = '" . (int) $tpath . "' limit 1"); $types_path = tep_db_fetch_array($types_path_query); if (tep_not_null($types_path['boards_types_path'])) { $link .= $types_path['boards_types_path'] . '/'; if ($boards_view == 'rss') { $link = substr($link, 0, -1) . '.rss'; $types_parameters = ''; $add_session_id = false; } elseif (tep_not_null($boards_id)) { $link .= $boards_id . '.html'; } } } $parameters = $types_parameters; } elseif (basename($page) == FILENAME_HOLIDAY) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'hPath') { $hpath = $param_value; } else { $types_parameters .= (tep_not_null($types_parameters) ? '&' : '') . $param; } } $link .= 'new_year/' . (tep_not_null($hpath) ? $hpath . '/' : ''); $parameters = $types_parameters; } elseif (basename($page) == FILENAME_MANUFACTURERS) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'manufacturers_id') { $manufacturers_id = $param_value; } else { $manufacturers_parameters .= (tep_not_null($manufacturers_parameters) ? '&' : '') . $param; } } $link .= 'publishers/'; if (tep_not_null($manufacturers_id)) { $manufacturers_path_query = tep_db_query("select manufacturers_id, manufacturers_path from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int) $manufacturers_id . "' limit 1"); $manufacturers_path = tep_db_fetch_array($manufacturers_path_query); $link .= (tep_not_null($manufacturers_path['manufacturers_path']) ? $manufacturers_path['manufacturers_path'] : $manufacturers_path['manufacturers_id']) . '.html'; } $parameters = $manufacturers_parameters; } elseif (basename($page) == FILENAME_SERIES) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'series_id') { $series_id = $param_value; } elseif ($param_name == 'tPath') { $product_type_id = $param_value; } else { $series_parameters .= (tep_not_null($series_parameters) ? '&' : '') . $param; } } $link .= 'series/'; if (tep_not_null($series_id)) { $series_path_query = tep_db_query("select series_id, series_path from " . TABLE_SERIES . " where series_id = '" . (int) $series_id . "' limit 1"); $series_path = tep_db_fetch_array($series_path_query); $link .= (tep_not_null($series_path['series_path']) ? $series_path['series_path'] : $series_path['series_id']) . '.html'; } $parameters = $series_parameters; } elseif (basename($page) == FILENAME_AUTHORS) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'authors_id') { $authors_id = $param_value; } else { $authors_parameters .= (tep_not_null($authors_parameters) ? '&' : '') . $param; } } $link .= 'authors/'; if (tep_not_null($authors_id)) { $authors_path_query = tep_db_query("select authors_id, authors_path from " . TABLE_AUTHORS . " where authors_id = '" . (int) $authors_id . "' limit 1"); $authors_path = tep_db_fetch_array($authors_path_query); $link .= (tep_not_null($authors_path['authors_path']) ? $authors_path['authors_path'] : $authors_path['authors_id']) . '.html'; } $parameters = $authors_parameters; } elseif (basename($page) == FILENAME_FOREIGN) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'products_id') { $products_id = $param_value; } else { $products_parameters .= (tep_not_null($products_parameters) ? '&' : '') . $param; } } $link .= 'foreign/'; if (tep_not_null($products_id)) { $link .= $products_id . '.html'; } $parameters = $products_parameters; } elseif (basename($page) == FILENAME_DEFAULT) { $params = explode("&", $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'sPath') { $sections_id = $param_value; } elseif ($param_name == 'info_id') { $information_id = $param_value; } else { $sections_parameters .= (tep_not_null($sections_parameters) ? '&' : '') . $param; } if ($param_name == 'sName') { $sname = $param_value; # if (substr($cname, -1)=='/') $cname = substr($cname, 0, -1); # if (substr($cname, 0, 1)=='/') $cname = substr($cname, 1); } } $current_section_id = 0; if (tep_not_null($sections_id)) { $sections_array = explode('_', $sections_id); if (sizeof($sections_array) == 1) { $last_id = end($sections_array); $parent_sections = array($last_id); tep_get_parents($parent_sections, $last_id, TABLE_SECTIONS); $parent_sections = array_reverse($parent_sections); } else { $parent_sections = $sections_array; } reset($parent_sections); while (list(, $section_id) = each($parent_sections)) { if ($section_id > 0) { $sections_path_query = tep_db_query("select sections_path from " . TABLE_SECTIONS . " where sections_id = '" . (int) $section_id . "' limit 1"); $sections_path = tep_db_fetch_array($sections_path_query); if (tep_not_null($sections_path['sections_path'])) { $link .= $sections_path['sections_path'] . '/'; } $current_section_id = $section_id; } } } if (sizeof($sections_array) > 1 && tep_not_null($information_id)) { $information_path_query = tep_db_query("select i2s.information_default_status, i.information_path, i.information_redirect from " . TABLE_INFORMATION . " i, " . TABLE_INFORMATION_TO_SECTIONS . " i2s where i.information_id = '" . (int) $information_id . "' and i.information_id = i2s.information_id limit 1"); } else { $information_path_query = tep_db_query("select i2s.information_default_status, i.information_path, i.information_redirect from " . TABLE_INFORMATION . " i, " . TABLE_INFORMATION_TO_SECTIONS . " i2s where" . (tep_not_null($information_id) ? " i.information_id = '" . (int) $information_id . "'" : " i2s.information_default_status = '1'") . " and i.information_id = i2s.information_id and i2s.sections_id = '" . (int) $current_section_id . "' limit 1"); } $information_path = tep_db_fetch_array($information_path_query); if (tep_not_null($information_path['information_redirect'])) { $redirect_url = $information_path['information_redirect']; } if ($information_path['information_default_status'] != '1' && tep_not_null($information_path['information_path'])) { $link .= $information_path['information_path'] . '.html'; } elseif (empty($sections_id) && empty($information_path) && tep_not_null($sname)) { $link .= $sname; } $parameters = $sections_parameters; } elseif (basename($page) == FILENAME_NEWS) { $link .= 'news/'; $params = explode('&', $parameters); reset($params); while (list(, $param) = each($params)) { list($param_name, $param_value) = explode('=', $param); if ($param_name == 'news_id') { $news_id = $param_value; } if ($param_name == 'year') { $news_year = $param_value; } if ($param_name == 'month') { $news_month = $param_value; } if ($param_name == 'view') { $news_view = $param_value; } if ($param_name == 'type') { $news_type = $param_value; } if ($param_name == 'tPath') { $news_path = $param_value; } if (!in_array($param_name, array('news_id', 'year', 'month', 'view', 'type', 'tPath'))) { $news_parameters .= (tep_not_null($news_parameters) ? '&' : '') . $param; } if ($param_name == 'nName') { $nname = $param_value; # if (substr($cname, -1)=='/') $cname = substr($cname, 0, -1); # if (substr($cname, 0, 1)=='/') $cname = substr($cname, 1); } $parameters = $news_parameters; } if (tep_not_null($news_path)) { $nInfo_query = tep_db_query("select news_types_path, news_types_path as news_date from " . TABLE_NEWS_TYPES . " where news_types_id = '" . (int) $news_path . "'"); } else { $nInfo_query = tep_db_query("select date_format(date_added, '%Y/%m') as news_date from " . TABLE_NEWS . " where news_id = '" . (int) $news_id . "' limit 1"); } $nInfo = tep_db_fetch_array($nInfo_query); if (tep_not_null($news_id)) { $link .= $nInfo['news_date'] . '/' . $news_id . '.html'; $parameters = $news_parameters; } elseif ($news_view == 'rss') { $link .= (tep_not_null($nInfo['news_types_path']) ? $nInfo['news_types_path'] : $news_type) . '.rss'; $parameters = ''; $add_session_id = false; } elseif (tep_not_null($news_path)) { $news_type_query = tep_db_query("select news_types_path from " . TABLE_NEWS_TYPES . " where news_types_id = '" . (int) $news_path . "'"); $news_type = tep_db_fetch_array($news_type_query); $link .= $news_type['news_types_path'] . '/'; $parameters = $news_parameters; } else { if (tep_not_null($news_year)) { $link .= $news_year . '/'; if (tep_not_null($news_month)) { $link .= $news_month . '/'; } } } if (empty($news_id) && empty($news_year) && empty($news_month) && tep_not_null($nname)) { $link .= $nname; } } if ($page != FILENAME_DEFAULT && $page != DIR_WS_ONLINE_STORE && $page != DIR_WS_ONLINE_STORE) { $params = explode('&', $parameters); $temp_parameters = ''; reset($params); while (list(, $param) = each($params)) { list($param_name) = explode('=', $param); if (!in_array($param_name, array('cPath', 'sPath', 'tPath', 'pName', 'nName', 'cName', 'sName', 'info_id', 'iName', 'tName', 'mName', 'rName'))) { if (basename($page) == FILENAME_PRODUCT_INFO && $param_name == 'products_id') { } else { $temp_parameters .= (tep_not_null($temp_parameters) ? '&' : '') . $param; } } } # if (tep_not_null($temp_parameters)) $parameters = $temp_parameters; } if (in_array(basename($page), array(FILENAME_CATEGORIES, FILENAME_PRODUCT_INFO, FILENAME_SPECIALS, FILENAME_MANUFACTURERS, FILENAME_DEFAULT, FILENAME_NEWS, FILENAME_SERIES, FILENAME_AUTHORS, FILENAME_REVIEWS, FILENAME_FOREIGN, FILENAME_BOARDS, FILENAME_HOLIDAY))) { if (!in_array(basename($page), array(FILENAME_DEFAULT, FILENAME_NEWS, FILENAME_BOARDS, FILENAME_HOLIDAY))) { if (basename($page) == FILENAME_PRODUCT_INFO && tep_not_null($products_id) || basename($page) == FILENAME_CATEGORIES && tep_not_null($categories_id) || basename($page) == FILENAME_SERIES && tep_not_null($series_id)) { if (basename($page) == FILENAME_CATEGORIES && tep_not_null($categories_id)) { $product_type_info_query = tep_db_query("select products_types_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int) $categories_id . "'"); $product_type_info = tep_db_fetch_array($product_type_info_query); $product_type_id = $product_type_info['products_types_id']; } elseif (basename($page) == FILENAME_SERIES && tep_not_null($series_id)) { $product_type_info_query = tep_db_query("select products_types_id from " . TABLE_SERIES . " where series_id = '" . (int) $series_id . "'"); $product_type_info = tep_db_fetch_array($product_type_info_query); $product_type_id = $product_type_info['products_types_id']; } else { $product_type_info_query = tep_db_query("select products_types_id from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'"); $product_type_info = tep_db_fetch_array($product_type_info_query); $product_type_id = $product_type_info['products_types_id']; } } $product_type_info_query = tep_db_query("select products_types_path from " . TABLE_PRODUCTS_TYPES . " where " . ((int) $product_type_id == 0 ? "products_types_default_status = '1'" : "products_types_id = '" . (int) $product_type_id . "'") . ""); $product_type_info = tep_db_fetch_array($product_type_info_query); $product_type_path = $product_type_info['products_types_path']; $link = $product_type_path . '/' . $link; } $page = ''; } $page = preg_replace('/^index\\.[a-z0-9]{3,5}/i', '', $page); if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); $separator = '&'; } else { $link .= $page; $separator = '?'; } // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined if ($add_session_id == true && $session_started == true) { if (tep_not_null($SID)) { $_sid = $SID; } elseif ($request_type == 'NONSSL' && $connection == 'SSL' && ENABLE_SSL == true || $request_type == 'SSL' && $connection == 'NONSSL') { $_sid = tep_session_name() . '=' . tep_session_id(); } } $other_server_check = substr($link, 0, 4) == 'http'; if (tep_not_null($_sid) && $spider_flag == false && basename($page) != FILENAME_REDIRECT) { $link .= $separator . $_sid; } if (tep_not_null($redirect_url)) { $link = $redirect_url; if (!$other_server_check && tep_not_null($_sid)) { $link .= $separator . $_sid; } } if (substr($link, 0, 1) == '/') { $link = substr($link, 1); } $link = str_replace('&', '&', $link); // $link = str_replace('&', '&', $link); while (strpos($link, '&&')) { $link = str_replace('&&', '&', $link); } while (strpos($link, '?&')) { $link = str_replace('?&', '?', $link); } while (substr($link, -1) == '&' || substr($link, -1) == '?') { $link = substr($link, 0, -1); } while (strpos($link, '//')) { $link = str_replace('//', '/', $link); } if ($other_server_check) { $link = preg_replace('/(http[s]?):\\//i', '$1://', $link); } if ($other_server_check == false) { if ($connection == 'SSL' && ENABLE_SSL == true) { $link = HTTPS_SERVER . DIR_WS_CATALOG . $link; } else { $link = HTTP_SERVER . DIR_WS_CATALOG . $link; } } if ($connection != 'NONSSL' && $connection != 'SSL') { die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />'); } return $link; }
<div class="well"> <div class="box-header small-margin-bottom small-margin-left"><?php echo BOX_HEADING_WISHLIST; ?> </div> <script type="text/javascript"><!-- function popupWindowWishlist(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=425,height=475,screenX=150,screenY=150,top=150,left=150') } //--></script> <?php if (count($wishlist->rows) < 1) { foreach ($wishlist->rows as $product_id) { $products = $pf->loadProduct($product_id, $languages_id); echo '' . "\n" . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL') . '">' . $products['products_name'] . '</a>' . "\n" . '' . "\n" . '' . "\n" . '<b><a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action', 'cPath', 'products_id')) . 'action=buy_now&products_id=' . $products['products_id'] . '&cPath=' . tep_get_product_path($products['products_id']), 'NONSSL') . '">' . BOX_TEXT_MOVE_TO_CART . '</a> |' . "\n" . '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=remove_wishlist&pid=' . $products['products_id'], 'NONSSL') . '">' . BOX_TEXT_DELETE . '</a></b>' . "\n" . tep_draw_separator('pixel_black.gif', '100%', '1') . tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5') . '' . '' . "\n"; } } else { echo BOX_WISHLIST_EMPTY . "\n"; } echo '<a href="' . tep_href_link(FILENAME_WISHLIST, '', 'NONSSL') . '"><u> ' . BOX_HEADING_CUSTOMER_WISHLIST . '</u> [+]</a>' . "\n"; echo '<br><a href="' . tep_href_link(FILENAME_WISHLIST_HELP, '', 'NONSSL') . '"><u> ' . BOX_HEADING_CUSTOMER_WISHLIST_HELP . '</u> [?]</a>' . "\n"; // Normal link echo $customer_wishlist_string; ?> </div> <?php } ?> <!-- wishlist eof//-->
// include validation functions (right now only email address) require 'includes/functions/validations.php'; // auto activate and expire banners require 'includes/functions/banner.php'; tep_activate_banners(); tep_expire_banners(); // auto expire special products require 'includes/functions/specials.php'; tep_expire_specials(); require 'includes/classes/osc_template.php'; $oscTemplate = new oscTemplate(); // calculate category path if (isset($_GET['cPath'])) { $cPath = $_GET['cPath']; } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) { $cPath = tep_get_product_path($_GET['products_id']); } else { $cPath = ''; } if (!empty($cPath)) { $cPath_array = tep_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[sizeof($cPath_array) - 1]; } else { $current_category_id = 0; } // include category tree class require 'includes/classes/category_tree.php'; // include the breadcrumb class and start the breadcrumb trail require 'includes/classes/breadcrumb.php'; $breadcrumb = new breadcrumb();
public function calculate_credit($amount) { global $temp_orders_id, $currencies, $currency; $return = array(); $return['coupon_amount'] = 0; $return['coupon_text'] = ''; $temp_data = Checkout::get_all_data_from_temp_db($temp_orders_id); foreach ($temp_data[$temp_orders_id]['orders_total'] as $key => $data) { if ($data['class'] == 'shipping') { $shipping_cost = $data['value']; } if ($data['class'] == 'order_total') { $order_total = $data['value']; } } if (isset($temp_data[$temp_orders_id]['orders']['coupon_id']) && $temp_data[$temp_orders_id]['orders']['coupon_id'] > 0) { $coupon_query = tep_db_query("select coupon_code, coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, restrict_to_zones, coupon_type from coupons where coupon_id = '" . $temp_data[$temp_orders_id]['orders']['coupon_id'] . "'"); $coupon_result = tep_db_fetch_array($coupon_query); //percent if ($coupon_result['coupon_type'] == 'P' && ($coupon_result['restrict_to_products'] != '' || $coupon_result['restrict_to_categories'] != '')) { $coupon_result['coupon_amount'] = substr($coupon_result['coupon_amount'], 0, -1); $return['coupon_text'] = number_format($coupon_result['coupon_amount']) . '% ' . Translate('op') . ' '; } else { if ($coupon_result['coupon_type'] == 'P') { $coupon_result['coupon_amount'] = substr($coupon_result['coupon_amount'], 0, -1); $return['coupon_text'] = number_format($coupon_result['coupon_amount']) . '%'; } else { if ($coupon_result['restrict_to_products'] != '' || $coupon_result['restrict_to_categories'] != '') { $return['coupon_text'] = ' ' . Translate('op') . ' '; } } } if ($coupon_result['coupon_minimum_order'] <= $order_total) { if ($coupon_result['restrict_to_products'] != '' || $coupon_result['restrict_to_categories'] != '' || $coupon_result['restrict_to_zones'] != '') { $used_restricted_categories = array(); foreach ($temp_data[$temp_orders_id]['orders_products'] as $order_products_id => $products_data) { if ($coupon_result['restrict_to_categories'] != '') { /****************************/ /* RESTRICT TO CATEGORIES */ /****************************/ $cat_ids = preg_split("/[,]/", $coupon_result['restrict_to_categories']); $my_path = tep_get_product_path($products_data['products_id']); $sub_cat_ids = preg_split("/[_]/", $my_path); for ($iii = 0; $iii < count($sub_cat_ids); $iii++) { //loop through all category IDs from the product for ($ii = 0; $ii < count($cat_ids); $ii++) { //Loop through all restricted category IDs if ($sub_cat_ids[$iii] == $cat_ids[$ii]) { //Check if there are similar category IDs if ($coupon_result['coupon_type'] == 'P') { //Percent $pr_c = $products_data['final_price'] * $products_data['products_quantity']; $pod_amount = round($pr_c * 10) / 10 * $coupon_result['coupon_amount'] / 100; $return['coupon_amount'] = $return['coupon_amount'] + $pod_amount; $used_restricted_categories[] = $cat_ids[$ii]; continue 2; } else { //Fixed amount $return['coupon_amount'] = $coupon_result['coupon_amount']; //No shipping costs if ($coupon_result['coupon_type'] == 'S') { $return['coupon_text'] = Translate('Gratis verzending'); $return['coupon_amount'] = $shipping_cost; } if ($coupon_result['coupon_type'] == 'S' && $coupon_result['coupon_amount'] > 0) { $return['coupon_amount'] = $shipping_cost + $coupon_result['coupon_amount']; } continue 2; } } } } } if ($coupon_result['restrict_to_products'] != '') { /****************************/ /* RESTRICT TO PRODUCTS */ /****************************/ $pr_ids = preg_split("/[,]/", $coupon_result['restrict_to_products']); for ($ii = 0; $ii < count($pr_ids); $ii++) { //Loop through restricted products_ids if ($pr_ids[$ii] == $products_data['products_id']) { if ($coupon_result['coupon_type'] == 'P') { //Percent $pr_c = $products_data['final_price'] * $products_data['products_quantity']; $pod_amount = round($pr_c * 10) / 10 * $coupon_result['coupon_amount'] / 100; $return['coupon_amount'] = $return['coupon_amount'] + $pod_amount; $return['coupon_text'] .= $products_data['products_name'] . ', '; } else { //fixed amount $return['coupon_text'] .= $products_data['products_name'] . ', '; $return['coupon_amount'] = $coupon_result['coupon_amount']; //No shipping costs if ($coupon_result['coupon_type'] == 'S') { $return['coupon_text'] = Translate('Gratis verzending'); $return['coupon_amount'] = $shipping_cost; } if ($coupon_result['coupon_type'] == 'S' && $coupon_result['coupon_amount'] > 0) { $return['coupon_amount'] = $shipping_cost + $coupon_result['coupon_amount']; } } } } } if ($coupon_result['restrict_to_zones'] != '') { /************************/ /* RESTRICT TO ZONES */ /************************/ $zones_ids = preg_split("/[,]/", $coupon_result['restrict_to_zones']); for ($ii = 0; $ii < count($zones_ids); $ii++) { //Loop through restricted zone_ids if (parent::checkZone($zones_ids[$ii], $temp_data[$temp_orders_id]['orders']['delivery_country'])) { if ($coupon_result['coupon_type'] == 'P') { //Percent $pr_c = $products_data['final_price'] * $products_data['products_quantity']; $pod_amount = round($pr_c * 10) / 10 * $coupon_result['coupon_amount'] / 100; $return['coupon_amount'] = $return['coupon_amount'] + $pod_amount; } else { //fixed amount $return['coupon_amount'] = $coupon_result['coupon_amount']; //No shipping costs if ($coupon_result['coupon_type'] == 'S') { $return['coupon_text'] = Translate('Gratis verzending'); $return['coupon_amount'] = $shipping_cost; } if ($coupon_result['coupon_type'] == 'S' && $coupon_result['coupon_amount'] > 0) { $return['coupon_amount'] = $shipping_cost + $coupon_result['coupon_amount']; } } } } } } $used_restricted_categories = array_unique($used_restricted_categories); foreach ($used_restricted_categories as $cat_id) { $return['coupon_text'] .= tep_get_categories_name($cat_id) . ', '; } } else { //not restricted to products, categories or zones //percent if ($coupon_result['coupon_type'] == 'P') { $return['coupon_amount'] = $amount * ($coupon_result['coupon_amount'] / 100); } //No shipping costs if ($coupon_result['coupon_type'] == 'S') { $return['coupon_text'] = Translate('Gratis verzending'); $return['coupon_amount'] = $shipping_cost; } if ($coupon_result['coupon_type'] == 'S' && $coupon_result['coupon_amount'] > 0) { $return['coupon_amount'] = $shipping_cost + $coupon_result['coupon_amount']; } //fixed amount if ($coupon_result['coupon_type'] == 'G') { $return['coupon_amount'] = $amount; } } if ($coupon_result['coupon_type'] == 'P' && ($coupon_result['restrict_to_products'] || $coupon_result['restrict_to_categories'])) { $return['coupon_text'] = substr($return['coupon_text'], 0, -2); } else { if (strlen($return['coupon_text']) > 2 && ($coupon_result['restrict_to_products'] || $coupon_result['restrict_to_categories'])) { $return['coupon_text'] = substr($return['coupon_text'], 0, -2); } } } else { //coupon minimum order is more then order total $return['errors'] = Translate('Om de kortingscode te gebruiken moet uw bestelling een minimum bedrag hebben van') . ' ' . $currencies->format($coupon_result['coupon_minimum_order']); } if ($coupon_result['coupon_type'] != 'S') { if ($return['coupon_amount'] > $amount) { $return['coupon_amount'] = $amount; } } } $return['coupon_amount'] = tep_round($return['coupon_amount'], $currencies->currencies[$currency]['decimal_places']); return $return; }