function payment($module = '') { global $payment, $language, $PHP_SELF; if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) { // BOF Separate Pricing Per Customer, next line original code // $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); global $sppc_customer_group_id, $customer_id; if (!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } $customer_payment_query = tep_db_query("select IF(c.customers_payment_allowed <> '', c.customers_payment_allowed, cg.group_payment_allowed) as payment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id = '" . $customer_group_id . "'"); if ($customer_payment = tep_db_fetch_array($customer_payment_query)) { if (tep_not_null($customer_payment['payment_allowed'])) { $temp_payment_array = explode(';', $customer_payment['payment_allowed']); $installed_modules = explode(';', MODULE_PAYMENT_INSTALLED); for ($n = 0; $n < sizeof($installed_modules); $n++) { // check to see if a payment method is not de-installed if (in_array($installed_modules[$n], $temp_payment_array)) { $payment_array[] = $installed_modules[$n]; } } // end for loop $this->modules = $payment_array; } else { $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); } } else { // default $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); } // EOF Separate Pricing Per Customer $include_modules = array(); if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); } else { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); $include_modules[] = array('class' => $class, 'file' => $value); } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { include DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file']; include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } // if there is only one payment method, select it as default because in // checkout_confirmation.php the $payment variable is being assigned the // $_POST['payment'] value which will be empty (no radio button selection possible) if (tep_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) { $payment = $include_modules[0]['class']; } if (tep_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) { $this->form_action_url = $GLOBALS[$module]->form_action_url; } } }
function execute() { global $cart, $new_products_id_in_cart, $currencies, $oscTemplate; $cart_contents_string = ''; if ($cart->count_contents() > 0) { $cart_contents_string = NULL; $products = $cart->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $i++) { $cart_contents_string .= '<li'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= ' class="newItemInCart"'; } $cart_contents_string .= '>'; $cart_contents_string .= $products[$i]['quantity'] . ' x '; $cart_contents_string .= '<a href="' . tep_href_link('product_info.php', 'products_id=' . $products[$i]['id']) . '">'; $cart_contents_string .= $products[$i]['name']; $cart_contents_string .= '</a></li>'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { tep_session_unregister('new_products_id_in_cart'); } } $cart_contents_string .= '<li class="text-right"><hr>' . $currencies->format($cart->show_total()) . '</li>'; } else { $cart_contents_string .= '<p>' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</p>'; } ob_start(); include 'includes/modules/boxes/templates/shopping_cart.php'; $data = ob_get_clean(); $oscTemplate->addBlock($data, $this->group); }
function getTaxRate($class_id, $country_id = -1, $zone_id = -1) { // LINE ADDED: Bugfix 0000036 global $customer_zone_id, $customer_country_id; if ($country_id == -1 && $zone_id == -1) { if (!tep_session_is_registered('customer_id')) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } if (isset($this->tax_rates[$class_id][$country_id][$zone_id]['rate']) == false) { $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int) $country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int) $zone_id . "') and tr.tax_class_id = '" . (int) $class_id . "' group by tr.tax_priority"); if (tep_db_num_rows($tax_query)) { $tax_multiplier = 1.0; while ($tax = tep_db_fetch_array($tax_query)) { $tax_multiplier *= 1.0 + $tax['tax_rate'] / 100; } $tax_rate = ($tax_multiplier - 1.0) * 100; } else { $tax_rate = 0; } $this->tax_rates[$class_id][$country_id][$zone_id]['rate'] = $tax_rate; } return $this->tax_rates[$class_id][$country_id][$zone_id]['rate']; }
function getSiteLanguage($get = null) { $default = array('dir' => 'dutch', 'id' => '1', 'code' => 'nl'); if (!tep_session_is_registered('language') || isset($_GET['language'])) { if (!tep_session_is_registered('language')) { tep_session_register('language'); tep_session_register('languages_id'); tep_session_register('languages_code'); } include DIR_WS_CLASSES . 'language.php'; $lng = new language(); if (isset($_GET['language']) && tep_not_null($_GET['language'])) { $lng->set_language($_GET['language']); } else { $lng->get_browser_language(); if (empty($lng)) { $lng->set_language(DEFAULT_LANGUAGE); } } $default = array('dir' => $lng->language['directory'], 'id' => $lng->language['id'], 'code' => $lng->language['code']); } if ($get && isset($default[$get])) { return $default[$get]; } return $default; }
function execute() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $oscTemplate, $customer_id, $order_id; if (tep_session_is_registered('customer_id')) { $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int) $customer_id . "'"); $global = tep_db_fetch_array($global_query); if ($global['global_product_notifications'] != '1') { if (isset($HTTP_GET_VARS['action']) && $HTTP_GET_VARS['action'] == 'update') { if (isset($HTTP_POST_VARS['notify']) && is_array($HTTP_POST_VARS['notify']) && !empty($HTTP_POST_VARS['notify'])) { $notify = array_unique($HTTP_POST_VARS['notify']); foreach ($notify as $n) { if (is_numeric($n) && $n > 0) { $check_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int) $n . "' and customers_id = '" . (int) $customer_id . "' limit 1"); if (!tep_db_num_rows($check_query)) { tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . (int) $n . "', '" . (int) $customer_id . "', now())"); } } } } } $products_displayed = array(); $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { if (!isset($products_displayed[$products['products_id']])) { $products_displayed[$products['products_id']] = tep_draw_checkbox_field('notify[]', $products['products_id']) . ' ' . $products['products_name']; } } $products_notifications = implode('<br />', $products_displayed); ob_start(); include DIR_WS_MODULES . 'content/' . $this->group . '/templates/product_notifications.php'; $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } } }
public function output($step = 0) { global $temp_orders_id, $currencies; $html = ''; if (tep_session_is_registered('customer_id')) { $amount = $this->calculate_amount(); if ($amount > 0) { if (!empty($temp_orders_id)) { $selected_query = tep_db_query('SELECT value FROM temp_orders_total WHERE class="' . $this->type . '" AND orders_id = "' . $temp_orders_id . '"'); $selected = tep_db_fetch_array($selected_query); } if ($this->config['status'] == 'true') { $html .= '<label class="control-label" for="' . $this->type . '" style="display:block;">'; $html .= '<div class="' . $this->type . '_item clearfix">'; $html .= '<input type="checkbox" name="' . $this->type . '" value="' . $id . '" id="' . $this->type . '"' . (isset($selected['value']) ? ' checked=checked' : '') . ' />'; $html .= '<div class="' . $this->type . '_title"> ' . $currencies->format($amount) . ' ' . Translate($this->config['title']) . '</div>'; if (!empty($this->config['description'])) { $html .= '<div class="' . $this->type . '_description"> ' . Translate($this->config['description']) . '</div>'; } $html .= '</div>'; $html .= '</label>'; } } } return $html; }
function execute() { global $customer_id, $languages_id, $PHP_SELF, $oscTemplate; if (tep_session_is_registered('customer_id')) { // retreive the last x products purchased $orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int) $customer_id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX); if (tep_db_num_rows($orders_query)) { $product_ids = ''; while ($orders = tep_db_fetch_array($orders_query)) { $product_ids .= (int) $orders['products_id'] . ','; } $product_ids = substr($product_ids, 0, -1); $customer_orders_string = '<ul class="list-unstyled">'; $products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int) $languages_id . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { $customer_orders_string .= '<li><span class="pull-right"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id']) . '"><span class="glyphicon glyphicon-shopping-cart"></span></a></span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a></li>'; } $customer_orders_string .= '</ul>'; if ($this->group == 'boxes_footer') { $data = '<div class="col-sm-3 col-lg-2">' . ' <div class="footerbox order-history">' . ' <h2>' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</h2>'; } else { $data = '<div class="panel panel-default">' . ' <div class="panel-heading">' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</div>'; } $data .= ' <div class="panel-body">' . $customer_orders_string . '</div>'; $data .= '</div>'; if ($this->group == 'boxes_footer') { $data .= '</div>'; } $oscTemplate->addBlock($data, $this->group); } } }
function RequireLoginValidForPage($aRetPage) { global $PHP_SELF, $in_login, $login_id, $aADMPages; $aThisPage = basename($PHP_SELF); //print( "$login_id<br>" ); $aRetPage = str_replace($aThisPage, 'default.php', $aRetPage); if (empty($in_login)) { if (!tep_session_is_registered('login_id')) { header('Location: login.php?in_login=yes&retpage=' . urlencode($aRetPage) . "\n"); } else { $aSQL = "select allowed_pages from administrators where ( administrator_id = '{$login_id}' )"; $aRes = tep_db_query($aSQL); if ($aVal = tep_db_fetch_array($aRes)) { $aPages = $aVal['allowed_pages']; if (trim($aPages != '*')) { $aAllowedPages = explode('|', $aPages); $aCurrentPageBox = $aADMPages[$aThisPage]; //print( "$aThisPage, $aCurrentPageBox<br>" ); if ($aCurrentPageBox != '*') { if (!in_array($aCurrentPageBox, $aAllowedPages)) { header('Location: login.php?' . urlencode($aRetPage) . "\n"); } } } } } } }
function execute() { global $cart, $new_products_id_in_cart, $currencies, $oscTemplate; $cart_contents_string = ''; if ($cart->count_contents() > 0) { $cart_contents_string = '<ul class="shoppingCartList">'; $products = $cart->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $i++) { $cart_contents_string .= '<li'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= ' class="newItemInCart"'; } $cart_contents_string .= '>'; $cart_contents_string .= $products[$i]['quantity'] . ' x '; $cart_contents_string .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">'; $cart_contents_string .= $products[$i]['name']; $cart_contents_string .= '</a></li>'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { tep_session_unregister('new_products_id_in_cart'); } } $cart_contents_string .= '<li class="text-right"><hr>' . $currencies->format($cart->show_total()) . '</li>' . '</ul>'; } else { $cart_contents_string .= '<p>' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</p>'; } $data = '<div class="panel panel-default">' . ' <div class="panel-heading"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_SHOPPING_CART_BOX_TITLE . '</a></div>' . ' <div class="panel-body">' . $cart_contents_string . '</div>' . '</div>'; $oscTemplate->addBlock($data, $this->group); }
function isEnabled() { global $cart; if (!tep_session_is_registered('customer_id') && $cart->count_contents() > 0 && MODULE_CONTENT_PWA_LOGIN_STATUS == 'True') { return $this->enabled; } }
function execute() { global $HTTP_GET_VARS, $customer_id, $PHP_SELF, $request_type, $oscTemplate; if (isset($HTTP_GET_VARS['products_id'])) { if (tep_session_is_registered('customer_id')) { $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . (int) $customer_id . "'"); $check = tep_db_fetch_array($check_query); $notification_exists = $check['count'] > 0 ? true : false; } else { $notification_exists = false; } $notif_contents = ''; if ($notification_exists == true) { $notif_contents = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify_remove', $request_type) . '"><span class="glyphicon glyphicon-remove"></span> ' . sprintf(MODULE_BOXES_PRODUCT_NOTIFICATIONS_BOX_NOTIFY_REMOVE, tep_get_products_name($HTTP_GET_VARS['products_id'])) . '</a>'; } else { $notif_contents = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify', $request_type) . '"><span class="glyphicon glyphicon-envelope"></span> ' . sprintf(MODULE_BOXES_PRODUCT_NOTIFICATIONS_BOX_NOTIFY, tep_get_products_name($HTTP_GET_VARS['products_id'])) . '</a>'; } $data = NULL; if ($this->group == 'boxes_product_page') { $data .= '<div class="col-sm-4 product_box">'; } $data .= '<div class="panel panel-default">' . ' <div class="panel-heading">' . '<a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL') . '">' . MODULE_BOXES_PRODUCT_NOTIFICATIONS_BOX_TITLE . '</a></div>' . ' <div class="panel-body">' . $notif_contents . '</div>' . '</div>'; if ($this->group == 'boxes_product_page') { $data .= '</div>'; } $oscTemplate->addBlock($data, $this->group); } }
function tep_update_whos_online() { global $customer_id; if (tep_session_is_registered('customer_id')) { $wo_customer_id = $customer_id; $customer_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'"); $customer = tep_db_fetch_array($customer_query); $wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname']; } else { $wo_customer_id = ''; $wo_full_name = 'Guest'; } $wo_session_id = tep_session_id(); $wo_ip_address = tep_get_ip_address(); $wo_last_page_url = tep_db_prepare_input(getenv('REQUEST_URI')); $current_time = time(); $xx_mins_ago = $current_time - 900; // remove entries that have expired tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'"); $stored_customer_query = tep_db_query("select session_id from " . TABLE_WHOS_ONLINE . " where session_id = '" . tep_db_input($wo_session_id) . "' limit 1"); if (tep_db_num_rows($stored_customer_query) > 0) { tep_db_query("update " . TABLE_WHOS_ONLINE . " set customer_id = '" . (int) $wo_customer_id . "', full_name = '" . tep_db_input($wo_full_name) . "', ip_address = '" . tep_db_input($wo_ip_address) . "', time_last_click = '" . tep_db_input($current_time) . "', last_page_url = '" . tep_db_input($wo_last_page_url) . "' where session_id = '" . tep_db_input($wo_session_id) . "'"); } else { tep_db_query("insert into " . TABLE_WHOS_ONLINE . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values ('" . (int) $wo_customer_id . "', '" . tep_db_input($wo_full_name) . "', '" . tep_db_input($wo_session_id) . "', '" . tep_db_input($wo_ip_address) . "', '" . tep_db_input($current_time) . "', '" . tep_db_input($current_time) . "', '" . tep_db_input($wo_last_page_url) . "')"); } }
function userLoginCheck() { global $navigation, $login_account_number; if (!tep_session_is_registered('login_account_number') || !tep_not_null($login_account_number)) { $navigation->set_snapshot(); tep_redirect(get_href_link(PAGE_LOGIN, '', 'SSL')); } }
function add_session($class, $message, $type = 'error') { global $messageToStack; if (!tep_session_is_registered('messageToStack')) { tep_session_register('messageToStack'); $messageToStack = array(); } $messageToStack[] = array('class' => $class, 'text' => $message, 'type' => $type); }
function pre_confirmation_check() { global $cartID, $cart; if (empty($cart->cartID)) { $cartID = $cart->cartID = $cart->generate_cart_id(); } if (!tep_session_is_registered('cartID')) { tep_session_register('cartID'); } }
function check() { global $customer_id; $check_query = tep_db_query("select date_added from " . TABLE_ACTION_RECORDER . " where module = 'ar_contact_us' and (" . (tep_session_is_registered('customer_id') ? "customer_id = '" . (int) $customer_id . "' or " : "") . " identifier = '" . tep_db_input($this->_identifier) . "') and date_added >= date_sub(now(), interval " . (int) $this->_min_minutes . " minute) and success = 1 order by date_added desc limit 1"); if (tep_db_num_rows($check_query)) { return false; } else { return true; } }
function execute() { global $PHP_SELF, $oscTemplate, $customer_id; if (tep_not_null(MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_ID)) { if (MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_JS_PLACEMENT != 'Header') { $this->group = 'footer_scripts'; } $header = '<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push([\'_setAccount\', \'' . tep_output_string(MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_ID) . '\']); _gaq.push([\'_trackPageview\']);' . "\n"; if (MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_EC_TRACKING == 'True' && basename($PHP_SELF) == FILENAME_CHECKOUT_SUCCESS && tep_session_is_registered('customer_id')) { $order_query = tep_db_query("select orders_id, billing_city, billing_state, billing_country from " . TABLE_ORDERS . " where customers_id = '" . (int) $customer_id . "' order by date_purchased desc limit 1"); if (tep_db_num_rows($order_query) == 1) { $order = tep_db_fetch_array($order_query); $totals = array(); $order_totals_query = tep_db_query("select value, class from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order['orders_id'] . "'"); while ($order_totals = tep_db_fetch_array($order_totals_query)) { $totals[$order_totals['class']] = $order_totals['value']; } $header .= ' _gaq.push([\'_addTrans\', \'' . (int) $order['orders_id'] . '\', // order ID - required \'' . tep_output_string(STORE_NAME) . '\', // store name \'' . (isset($totals['ot_total']) ? $this->format_raw($totals['ot_total'], DEFAULT_CURRENCY) : 0) . '\', // total - required \'' . (isset($totals['ot_tax']) ? $this->format_raw($totals['ot_tax'], DEFAULT_CURRENCY) : 0) . '\', // tax \'' . (isset($totals['ot_shipping']) ? $this->format_raw($totals['ot_shipping'], DEFAULT_CURRENCY) : 0) . '\', // shipping \'' . tep_output_string_protected($order['billing_city']) . '\', // city \'' . tep_output_string_protected($order['billing_state']) . '\', // state or province \'' . tep_output_string_protected($order['billing_country']) . '\' // country ]);' . "\n"; $order_products_query = tep_db_query("select op.products_id, pd.products_name, op.final_price, op.products_quantity from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_LANGUAGES . " l where op.orders_id = '" . (int) $order['orders_id'] . "' and op.products_id = pd.products_id and l.code = '" . tep_db_input(DEFAULT_LANGUAGE) . "' and l.languages_id = pd.language_id"); while ($order_products = tep_db_fetch_array($order_products_query)) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_LANGUAGES . " l where p2c.products_id = '" . (int) $order_products['products_id'] . "' and p2c.categories_id = cd.categories_id and l.code = '" . tep_db_input(DEFAULT_LANGUAGE) . "' and l.languages_id = cd.language_id limit 1"); $category = tep_db_fetch_array($category_query); $header .= ' _gaq.push([\'_addItem\', \'' . (int) $order['orders_id'] . '\', // order ID - required \'' . (int) $order_products['products_id'] . '\', // SKU/code - required \'' . tep_output_string($order_products['products_name']) . '\', // product name \'' . tep_output_string($category['categories_name']) . '\', // category \'' . $this->format_raw($order_products['final_price']) . '\', // unit price - required \'' . (int) $order_products['products_quantity'] . '\' // quantity - required ]);' . "\n"; } $header .= ' _gaq.push([\'_trackTrans\']); //submits transaction to the Analytics servers' . "\n"; } } $header .= ' (function() { var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true; ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s); })(); </script>' . "\n"; $oscTemplate->addBlock($header, $this->group); } }
function execute() { global $customer_id, $cart, $new_products_id_in_cart, $currencies, $oscTemplate; /* ** Altered for CCGV ** $cart_contents_string = ''; */ if (tep_session_is_registered('customer_id')) { $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int) $customer_id . "'"); $gv_result = tep_db_fetch_array($gv_query); if ($gv_result['amount'] > 0) { $gv_contents_string = '<div class="ui-widget-content infoBoxContents"><div style="float:left;">' . VOUCHER_BALANCE . '</div><div style="float:right;">' . $currencies->format($gv_result['amount']) . '</div><div style="clear:both;"></div>'; $gv_contents_string .= '<div style="text-align:center; width:100%; margin:auto;"><a href="' . tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></div></div>'; } } if (tep_session_is_registered('gv_id')) { $gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'"); $coupon = tep_db_fetch_array($gv_query); $gv_contents_string = '<div style="text-align:center; width:100%; margin:auto;">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</div>'; } if (tep_session_is_registered('cc_id') && $cc_id) { $coupon_query = tep_db_query("select * from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'"); $coupon = tep_db_fetch_array($coupon_query); $coupon_desc_query = tep_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $cc_id . "' and language_id = '" . $languages_id . "'"); $coupon_desc = tep_db_fetch_array($coupon_desc_query); $text_coupon_help = sprintf("%s", $coupon_desc['coupon_name']); $gv_contents_string = '<div style="text-align:center; width:100%; margin:auto;">' . CART_COUPON . $text_coupon_help . '<br>' . '</div>'; } /* ** EOF alterations for CCGV ** */ if ($cart->count_contents() > 0) { $cart_contents_string = NULL; $products = $cart->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $i++) { $cart_contents_string .= '<li'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { $cart_contents_string .= ' class="newItemInCart"'; } $cart_contents_string .= '>'; $cart_contents_string .= $products[$i]['quantity'] . ' x '; $cart_contents_string .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">'; $cart_contents_string .= $products[$i]['name']; $cart_contents_string .= '</a></li>'; if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) { tep_session_unregister('new_products_id_in_cart'); } } $cart_contents_string .= '<li class="text-right"><hr>' . $currencies->format($cart->show_total()) . '</li>'; } else { $cart_contents_string .= '<p>' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</p>'; } ob_start(); include DIR_WS_MODULES . 'boxes/templates/shopping_cart.php'; $data = ob_get_clean(); $oscTemplate->addBlock($data, $this->group); }
function pre_confirmation_check() { global $cartID, $cart, $order_total_modules, $order_totals, $order; if (empty($cart->cartID)) { $cartID = $cart->cartID = $cart->generate_cart_id(); } if (!tep_session_is_registered('cartID')) { tep_session_register('cartID'); } order_process($send_mail = false, $status = $this->order_status); }
function tep_doautologin() { global $HTTP_COOKIE_VARS, $cart, $cart_cs, $cart_fv, $cart_pr, $customer_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id; global $navigation; if (isset($HTTP_COOKIE_VARS['osC_AutoCookieLogin'])) { $ip_address = tep_get_ip_address(); $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where md5(CONCAT(customers_id,customers_email_address,customers_password,'" . $ip_address . "'))= '" . $HTTP_COOKIE_VARS['osC_AutoCookieLogin'] . "'"); if (tep_db_num_rows($check_customer_query)) { $check_customer = tep_db_fetch_array($check_customer_query); if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $check_customer['customers_id'] . "' and address_book_id = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; if (!tep_session_is_registered('customer_id')) { tep_session_register('customer_id'); } if (!tep_session_is_registered('customer_default_address_id')) { tep_session_register('customer_default_address_id'); } if (!tep_session_is_registered('customer_first_name')) { tep_session_register('customer_first_name'); } if (!tep_session_is_registered('customer_country_id')) { tep_session_register('customer_country_id'); } if (!tep_session_is_registered('customer_zone_id')) { tep_session_register('customer_zone_id'); } tep_autologincookie(true); // Save cookie tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int) $customer_id . "'"); $cart->restore_contents(); // restore cart contents $cart_cs->restore_contents(); $cart_fv->restore_contents(); $cart_pr->restore_contents(); if (sizeof($navigation->snapshot) > 0) { $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']); $navigation->clear_snapshot(); tep_redirect($origin_href); } else { // tep_redirect(tep_href_link(FILENAME_DEFAULT)); tep_redirect(substr(tep_href_link(getenv('REQUEST_URI')), strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG))); } } } }
function execute() { global $oscTemplate; $data = '<div id="headerShortcutsTop" class="btn-group">' . ' ' . tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'btn btn-default', tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); if (tep_session_is_registered('customer_id')) { $data .= tep_draw_button(HEADER_TITLE_LOGOFF, 'btn btn-default', tep_href_link(FILENAME_LOGOFF, '', 'SSL')); } else { $data .= tep_draw_button(HEADER_TITLE_LOGIN, 'btn btn-default', tep_href_link(FILENAME_LOGIN, '', 'SSL')); } $data .= '</div>'; $oscTemplate->addBlock($data, $this->group); }
function after_process() { global $customer_id, $insert_id, $zp_code, $order; if (tep_session_is_registered('zp_code')) { tep_session_unregister('zp_code'); } tep_session_register('zp_code'); $code = md5(md5(microtime()) . md5(rand(0, 100000))); $zp_code = base64_encode($code . '-' . $customer_id . '-' . $insert_id . '-' . $order->info['total']); // echo $zp_code; // die(); return false; }
function execute() { global $PHP_SELF, $oscTemplate, $customer_id, $lng, $languages_id; if (MODULE_HEADER_TAGS_GOOGLE_ADWORDS_CONVERSION_JS_PLACEMENT != 'Footer') { $this->group = 'header_tags'; } if ($PHP_SELF == FILENAME_CHECKOUT_SUCCESS && tep_session_is_registered('customer_id')) { $order_query = tep_db_query("select orders_id, currency, currency_value from " . TABLE_ORDERS . " where customers_id = '" . (int) $customer_id . "' order by date_purchased desc limit 1"); if (tep_db_num_rows($order_query) == 1) { $order = tep_db_fetch_array($order_query); $order_subtotal_query = tep_db_query("select value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order['orders_id'] . "' and class='ot_subtotal'"); $order_subtotal = tep_db_fetch_array($order_subtotal_query); if (!isset($lng) || isset($lng) && !is_object($lng)) { include DIR_WS_CLASSES . 'language.php'; $lng = new language(); } $language_code = 'en'; foreach ($lng->catalog_languages as $lkey => $lvalue) { if ($lvalue['id'] == $languages_id) { $language_code = $lkey; break; } } $conversion_id = (int) MODULE_HEADER_TAGS_GOOGLE_ADWORDS_CONVERSION_ID; $conversion_language = tep_output_string_protected($language_code); $conversion_format = (int) MODULE_HEADER_TAGS_GOOGLE_ADWORDS_CONVERSION_FORMAT; $conversion_color = tep_output_string_protected(MODULE_HEADER_TAGS_GOOGLE_ADWORDS_CONVERSION_COLOR); $conversion_label = tep_output_string_protected(MODULE_HEADER_TAGS_GOOGLE_ADWORDS_CONVERSION_LABEL); $conversion_value = $this->format_raw($order_subtotal['value'], $order['currency'], $order['currency_value']); $output = <<<EOD <script> /* <![CDATA[ */ var google_conversion_id = {$conversion_id}; var google_conversion_language = "{$conversion_language}"; var google_conversion_format = "{$conversion_format}"; var google_conversion_color = "{$conversion_color}"; var google_conversion_label = "{$conversion_label}"; var google_conversion_value = {$conversion_value}; /* ]]> */ </script> <script src="//www.googleadservices.com/pagead/conversion.js"></script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/{$conversion_id}/?value={$conversion_value}&label={$conversion_label}&guid=ON&script=0"/> </div> </noscript> EOD; $oscTemplate->addBlock($output, $this->group); } } }
function shipping($module = '') { global $language, $PHP_SELF; if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) { // BOF Separate Pricing Per Customer, next line original code // $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); global $sppc_customer_group_id, $customer_id; if (!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } $customer_shipment_query = tep_db_query("select IF(c.customers_shipment_allowed <> '', c.customers_shipment_allowed, cg.group_shipment_allowed) as shipment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id = '" . $customer_group_id . "'"); if ($customer_shipment = tep_db_fetch_array($customer_shipment_query)) { if (tep_not_null($customer_shipment['shipment_allowed'])) { $temp_shipment_array = explode(';', $customer_shipment['shipment_allowed']); $installed_modules = explode(';', MODULE_SHIPPING_INSTALLED); for ($n = 0; $n < sizeof($installed_modules); $n++) { // check to see if a shipping module is not de-installed if (in_array($installed_modules[$n], $temp_shipment_array)) { $shipment_array[] = $installed_modules[$n]; } } // end for loop $this->modules = $shipment_array; } else { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); } } else { // default $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); } // EOF Separate Pricing Per Customer $include_modules = array(); if (tep_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) { $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1)); } else { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); $include_modules[] = array('class' => $class, 'file' => $value); } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { include DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file']; include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } } }
function execute() { global $oscTemplate, $customer_id, $customer_first_name; $content_width = MODULE_CONTENT_CUSTOMER_GREETING_CONTENT_WIDTH; if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { $customer_greeting = sprintf(MODULE_CONTENT_CUSTOMER_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link('products_new.php')); } else { $customer_greeting = sprintf(MODULE_CONTENT_CUSTOMER_GREETING_GUEST, tep_href_link('login.php', '', 'SSL'), tep_href_link('create_account.php', '', 'SSL')); } ob_start(); include 'includes/modules/content/' . $this->group . '/templates/customer_greeting.php'; $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); }
function execute() { global $oscTemplate, $customer_id; $content_width = (int) MODULE_CONTENT_FOOTER_ACCOUNT_CONTENT_WIDTH; if (tep_session_is_registered('customer_id')) { $account_content = '<li><a href="' . tep_href_link('account.php', '', 'SSL') . '">' . MODULE_CONTENT_FOOTER_ACCOUNT_BOX_ACCOUNT . '</a></li>' . '<li><a href="' . tep_href_link('address_book.php', '', 'SSL') . '">' . MODULE_CONTENT_FOOTER_ACCOUNT_BOX_ADDRESS_BOOK . '</a></li>' . '<li><a href="' . tep_href_link('account_history.php', '', 'SSL') . '">' . MODULE_CONTENT_FOOTER_ACCOUNT_BOX_ORDER_HISTORY . '</a></li>' . '<li><br><a class="btn btn-danger btn-sm btn-block" role="button" href="' . tep_href_link('logoff.php', '', 'SSL') . '"><i class="fa fa-sign-out"></i> ' . MODULE_CONTENT_FOOTER_ACCOUNT_BOX_LOGOFF . '</a></li>'; } else { $account_content = '<li><a href="' . tep_href_link('create_account.php', '', 'SSL') . '">' . MODULE_CONTENT_FOOTER_ACCOUNT_BOX_CREATE_ACCOUNT . '</a></li>' . '<li><br><a class="btn btn-success btn-sm btn-block" role="button" href="' . tep_href_link('login.php', '', 'SSL') . '"><i class="fa fa-sign-in"></i> ' . MODULE_CONTENT_FOOTER_ACCOUNT_BOX_LOGIN . '</a></li>'; } ob_start(); include 'includes/modules/content/' . $this->group . '/templates/account.php'; $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); }
function execute() { global $customer_id, $oscTemplate; if ($this->group == 'boxes_footer') { $data = '<div class="col-sm-3 col-lg-2">' . ' <div class="footerbox account">' . ' <h2>' . MODULE_BOXES_ACCOUNT_BOX_TITLE . '</h2>' . ' <ul class="list-unstyled">'; } else { $data = '<div class="panel panel-default">' . ' <div class="panel-heading">' . MODULE_BOXES_ACCOUNT_BOX_TITLE . '</div>' . ' <div class="panel-body">' . ' <ul class="list-unstyled">'; } if (tep_session_is_registered('customer_id')) { $data .= ' <li><a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . MODULE_BOXES_ACCOUNT_BOX_ACCOUNT . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . MODULE_BOXES_ACCOUNT_BOX_ADDRESS_BOOK . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '">' . MODULE_BOXES_ACCOUNT_BOX_ORDER_HISTORY . '</a></li>' . ' <li><br><a class="btn btn-danger btn-sm" role="button" href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '"><i class="glyphicon glyphicon-log-out"></i> ' . MODULE_BOXES_ACCOUNT_BOX_LOGOFF . '</a></li>'; } else { $data .= ' <li><a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . MODULE_BOXES_ACCOUNT_BOX_CREATE_ACCOUNT . '</a></li>' . ' <li><br><a class="btn btn-success btn-sm" role="button" href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"><i class="glyphicon glyphicon-log-in"></i> ' . MODULE_BOXES_ACCOUNT_BOX_LOGIN . '</a></li>'; } $data .= ' </ul>' . ' </div>' . '</div>'; $oscTemplate->addBlock($data, $this->group); }
function execute() { global $oscTemplate; if (tep_session_is_registered('customer_id')) { $login_link = tep_href_link('logoff.php'); $login_title = MODULE_BOXES_INFORMATION_ACCOUNT_BOX_TITLE_LOGOFF; $acc_link = tep_href_link('account.php'); $acc_title = MODULE_BOXES_INFORMATION_ACCOUNT_BOX_MY_ACCOUNT; } else { $login_link = tep_href_link('login.php'); $login_title = MODULE_BOXES_INFORMATION_ACCOUNT_BOX_TITLE_LOGIN; $acc_link = tep_href_link('create_account.php'); $acc_title = MODULE_BOXES_INFORMATION_ACCOUNT_BOX_CREATE_ACCOUNT; } $data = '<div class="footer-box col-xs-3">' . ' <h4>' . MODULE_BOXES_INFORMATION_ACCOUNT_BOX_TITLE . '</h4>' . ' <ul>' . ' <li><a href="' . $login_link . '">' . $login_title . '</a></li>' . ' <li><a href="' . $acc_link . '">' . $acc_title . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . MODULE_BOXES_INFORMATION_ACCOUNT_BOX_SHIPPING . '</a></li>' . ' </ul>' . '</div>'; $oscTemplate->addBlock($data, $this->group); }
function execute() { global $oscTemplate; if (tep_session_is_registered('customer_id')) { $login_link = tep_href_link('logoff.php'); $login_title = MODULE_BOXES_MAIN_MENU_FOOTER_BOX_TITLE_LOGOFF; $acc_link = tep_href_link('account.php'); $acc_title = MODULE_BOXES_MAIN_MENU_FOOTER_BOX_MY_ACCOUNT; } else { $login_link = tep_href_link('login.php'); $login_title = MODULE_BOXES_MAIN_MENU_FOOTER_BOX_TITLE_LOGIN; $acc_link = tep_href_link('create_account.php'); $acc_title = MODULE_BOXES_MAIN_MENU_FOOTER_BOX_CREATE_ACCOUNT; } $data = '<div class="footer-box col-xs-3">' . ' <h4>' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_TITLE . '</h4>' . ' <ul>' . ' <li><a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_DEFAULT . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_PRODUCTS_NEW . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_SPECIALS) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_SPECIALS . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_MANUFACTURERS) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_MANUFACTURERS . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_TOPSELLERS_PRODUCTS) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_BESTSELLERS . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_REVIEWS) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_REVIEWS . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_CONTACT_US . '</a></li>' . ' <li><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' . MODULE_BOXES_MAIN_MENU_FOOTER_BOX_ADVANCED_SEARCH . '</a></li>' . ' </ul>' . '</div>'; $oscTemplate->addBlock($data, $this->group); }
function after_process() { global $customer_id, $insert_id, $order_totals, $rx_code, $currency, $currencies; if (tep_session_is_registered('op_code')) { tep_session_unregister('op_code'); } tep_session_register('op_code'); $ot_total_value = 0; for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { if ($order_totals[$i]['code'] == 'ot_total') { $ot_total_value = str_replace(',', '.', round($order_totals[$i]['value'], $currencies->get_decimal_places($currency))); break; } } $code = md5(md5(microtime()) . md5(rand(0, 100000))); $op_code = base64_encode($code . '-' . $customer_id . '-' . $insert_id . '-' . $ot_total_value); return false; }