function is_set($code) { if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) { return true; } else { return false; } }
function quote($method = '') { global $order, $cart, $shipping_weight, $shipping_num_boxes; if (MODULE_SHIPPING_TABLE4_MODE == 'price') { $order_total = $cart->show_total(); } else { $order_total = $shipping_weight; } $table4_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE4_COST); $size = sizeof($table4_cost); for ($i = 0, $n = $size; $i < $n; $i += 2) { if ($order_total <= $table4_cost[$i]) { $shipping = $table4_cost[$i + 1]; break; } } if (MODULE_SHIPPING_TABLE4_MODE == 'weight') { $shipping = $shipping * $shipping_num_boxes; } $this->quotes = array('id' => $this->code, 'module' => Translate('table4 titel'), 'methods' => array(array('id' => $this->code, 'title' => Translate('table4 omschrijving'), 'cost' => $shipping + MODULE_SHIPPING_TABLE4_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; }
function buildBlocks() { if (defined('TEMPLATE_BLOCK_GROUPS') && tep_not_null(TEMPLATE_BLOCK_GROUPS)) { $tbgroups_array = explode(';', TEMPLATE_BLOCK_GROUPS); foreach ($tbgroups_array as $group) { $module_key = 'MODULE_' . strtoupper($group) . '_INSTALLED'; if (defined($module_key) && tep_not_null(constant($module_key))) { $modules_array = explode(';', constant($module_key)); foreach ($modules_array as $module) { $class = basename($module, '.php'); if (!class_exists($class)) { if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/' . $group . '/' . $module)) { include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/' . $group . '/' . $module; } if (file_exists(DIR_WS_MODULES . $group . '/' . $class . '.php')) { include DIR_WS_MODULES . $group . '/' . $class . '.php'; } } if (class_exists($class)) { $mb = new $class(); if ($mb->isEnabled()) { $mb->execute(); } } } } } } }
public function buildLink($page, $valuepair, &$url, &$added_qs, $parameters) { if (false === array_key_exists(1, $valuepair) || $valuepair[0] != $this->dependency || false !== strpos(urldecode($valuepair[1]), '{') || !tep_not_null($valuepair[1])) { return false; } if (!isset(usu::$registry->vars[$valuepair[0]][$valuepair[1]])) { if (false === $this->acquire($valuepair[1], $fullpath = false)) { return false; } } else { usu::$performance['queries_saved']++; } $reg_item = usu::$registry->vars[$valuepair[0]][$valuepair[1]]; switch (true) { case $page == FILENAME_PRODUCT_INFO && false === strpos($valuepair[1], '{'): $url = $this->linkCreate(FILENAME_PRODUCT_INFO, $reg_item['link_text'], '-p-', $valuepair[1]); break; case $page == FILENAME_PRODUCT_REVIEWS: $url = $this->linkCreate(FILENAME_PRODUCT_REVIEWS, $reg_item['link_text'], '-pr-', $valuepair[1]); break; case $page == FILENAME_PRODUCT_REVIEWS_INFO: $url = $this->linkCreate(FILENAME_PRODUCT_REVIEWS_INFO, $reg_item['link_text'], '-pri-', $valuepair[1]); break; default: $added_qs[filter_var($valuepair[0], FILTER_SANITIZE_STRING)] = usu::cleanse($valuepair[1]); break; } # end switch }
function tep_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); $banners = tep_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); } else { return '<strong>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</strong>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int) $identifier . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<strong>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</strong>'; } } } else { return '<strong>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</strong>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } tep_update_banner_display_count($banner['banners_id']); return $banner_string; }
function execute() { global $PHP_SELF, $oscTemplate; if (tep_not_null(MODULE_HEADER_TAGS_DIV_EQUAL_HEIGHTS_PAGES)) { $pages_array = array(); foreach (explode(';', MODULE_HEADER_TAGS_DIV_EQUAL_HEIGHTS_PAGES) as $page) { $page = trim($page); if (!empty($page)) { $pages_array[] = $page; } } $output = <<<EOD <script> <!-- \$(window).load(function() { var maxHeight = 0; \$(".equal-height").each(function() { if (\$(this).height() > maxHeight) { maxHeight = \$(this).height(); } }); \$(".equal-height").height(maxHeight); }); //--> </script> EOD; if (in_array(basename($PHP_SELF), $pages_array)) { $oscTemplate->addBlock($output, $this->group); } } }
function quote($method = '') { global $osC_Tax, $order, $cart, $shipping_weight, $shipping_num_boxes, $osC_Weight; if (MODULE_SHIPPING_TABLE_MODE == 'price') { $order_total = $cart->show_total(); } else { $order_total = $shipping_weight = $osC_Weight->convert($shipping_weight, SHIPPING_WEIGHT_UNIT, MODULE_SHIPPING_TABLE_WEIGHT_UNIT); } $table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST); $size = sizeof($table_cost); for ($i = 0, $n = $size; $i < $n; $i += 2) { if ($order_total <= $table_cost[$i]) { $shipping = $table_cost[$i + 1]; break; } } if (MODULE_SHIPPING_TABLE_MODE == 'weight') { $shipping = $shipping * $shipping_num_boxes; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)), 'tax' => 0); if ($this->tax_class > 0) { $this->quotes['tax'] = $osC_Tax->getTaxRate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; }
public function __construct($id = 0, $employees_id = 0, $period = null) { $database = $_SESSION['database']; $this->id = $id; $this->listing = array(); $this->isempty = true; if ($this->id != 0) { // Retrieve benefit by id $this->id = $database->prepare_input($this->id); $benefits_query = $database->query("select benefits_id, benefits_start_date, benefits_end_date, benefits_credit, benefits_granted, benefits_comment, employees_id, roles_id from " . TABLE_BENEFITS . " where benefits_id = '" . (int) $this->id . "'"); } else { if ($employees_id != 0 && tep_not_null($period)) { // Benefit might exist but we do not know the id // Try to retrieve the benefit for the given employee and period $this->employees_id = $database->prepare_input($employees_id); $benefits_query = $database->query("SELECT * FROM " . VIEW_BENEFITS . " WHERE benefits_start_date <= '" . tep_periodenddate($period) . "'" . " AND benefits_end_date >= '" . tep_periodstartdate($period) . "'" . " AND employees_id = " . $employees_id . " AND roles_id = " . BENEFITS_LEAVE_ROLE . ";"); } else { // We probably created an empty benefit object to retrieve the entire benefit listing $this->listing = $this->get_array($employees_id); } } if ($this->id != 0 || $employees_id != 0 && tep_not_null($period)) { $benefits_result = $database->fetch_array($benefits_query); if (tep_not_null($benefits_result)) { // Benefit exists $this->id = $benefits_result['benefits_id']; $this->fill(tep_datetouts(DATE_FORMAT_DATABASE, $benefits_result['benefits_start_date']), $benefits_result['benefits_end_date'] != '2099-12-31' ? tep_datetouts(DATE_FORMAT_DATABASE, $benefits_result['benefits_end_date']) : 0, $benefits_result['benefits_credit'], $benefits_result['benefits_granted'], $benefits_result['benefits_used'], $benefits_result['benefits_comment'], $benefits_result['employees_id'], $benefits_result['roles_id']); $this->isempty = false; } } }
function execute() { global $oscTemplate; if (isset($_GET['products_id']) && defined('MODULE_SOCIAL_BOOKMARKS_INSTALLED') && tep_not_null(MODULE_SOCIAL_BOOKMARKS_INSTALLED)) { $sbm_array = explode(';', MODULE_SOCIAL_BOOKMARKS_INSTALLED); $social_bookmarks = array(); foreach ($sbm_array as $sbm) { $class = basename($sbm, '.php'); if (!class_exists($class)) { include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/social_bookmarks/' . $sbm; include 'includes/modules/social_bookmarks/' . $class . '.php'; } $sb = new $class(); if ($sb->isEnabled()) { $social_bookmarks[] = $sb->getOutput(); } } if (!empty($social_bookmarks)) { ob_start(); include 'includes/modules/boxes/templates/product_social_bookmarks.php'; $data = ob_get_clean(); $oscTemplate->addBlock($data, $this->group); } } }
function loadProduct($product_id, $products_price, $products_tax_class_id, $qtyBlocks = 1, $price_breaks_array = NULL, $min_order_qty = 1) { // Collect required data (show for retail only) // in a preview read=only no data for the price break available if (!tep_not_null($price_breaks_array)) { $price_breaks_array = array(); $price_breaks_query = tep_db_query("select products_price, products_qty from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_id = '" . (int) $product_id . "' and customers_group_id = '0' order by products_qty"); while ($price_break = tep_db_fetch_array($price_breaks_query)) { $price_breaks_array[] = $price_break; } } //Assign members $this->thePrice = $products_price; $this->taxClass = $products_tax_class_id; $this->qtyBlocks = $qtyBlocks < 1 ? 1 : $qtyBlocks; $this->price_breaks = $price_breaks_array; $this->products_min_order_qty = $min_order_qty < 1 ? 1 : $min_order_qty; //Custom $this->hasQuantityPrice = false; $this->hiPrice = $this->thePrice; $this->lowPrice = $this->thePrice; if (count($this->price_breaks) > 0) { $this->hasQuantityPrice = true; foreach ($this->price_breaks as $price_break) { $this->hiPrice = max($this->hiPrice, $price_break['products_price']); $this->lowPrice = min($this->lowPrice, $price_break['products_price']); } } }
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 __construct($module, $user_id = null, $user_name = null) { global $PHP_SELF; $this->lang = Registry::get('Language'); $module = HTML::sanitize(str_replace(' ', '', $module)); if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { if (is_file(OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1))) { $this->lang->loadDefinitions('Shop/modules/action_recorder/' . $module); include OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1); } else { return false; } } } else { return false; } } else { return false; } $this->_module = $module; if (!empty($user_id) && is_numeric($user_id)) { $this->_user_id = $user_id; } if (!empty($user_name)) { $this->_user_name = $user_name; } $GLOBALS[$this->_module] = new $module(); $GLOBALS[$this->_module]->setIdentifier(); }
function execute() { global $currencies, $oscTemplate; if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { $random_product['products_name'] = tep_get_products_name($random_product['products_id']); $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']); if (tep_not_null($random_product['specials_new_products_price'])) { $whats_new_price = '<del>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del><br />'; $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>'; } else { $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])); } if ($this->group == 'boxes_footer') { $data = '<div class="col-sm-3 col-lg-2">' . ' <div class="footerbox best-sellers">' . ' <h2><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_WHATS_NEW_BOX_TITLE . '</a></h2>'; } else { $data = '<div class="panel panel-default">' . ' <div class="panel-heading"><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_WHATS_NEW_BOX_TITLE . '</a></div>'; } $data .= ' <div class="panel-body text-center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br />' . $whats_new_price . '</div>'; $data .= '</div>'; if ($this->group == 'boxes_footer') { $data .= '</div>'; } $oscTemplate->addBlock($data, $this->group); } }
function sbs_get_countries($countries_id = '', $with_iso_codes = false) { $countries_array = array(); if (tep_not_null($countries_id)) { if ($with_iso_codes == true) { // Ajax Country-state selector //$countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name"); $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $countries_id . "' and active = 1 order by countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']); } else { $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $countries_id . "'"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name']); } } else { // Ajax Country-state selector //$countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name"); $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " where active = 1 order by countries_name"); while ($countries_values = tep_db_fetch_array($countries)) { $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']); } } return $countries_array; }
function execute() { global $PHP_SELF, $oscTemplate, $languages_id, $currencies, $currency; if ($PHP_SELF == 'product_info.php' && isset($_GET['products_id'])) { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_image from products p, products_description pd where p.products_id = '" . (int) $_GET['products_id'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "'"); if (tep_db_num_rows($product_info_query) === 1) { $product_info = tep_db_fetch_array($product_info_query); $data = array('card' => MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TYPE, 'title' => $product_info['products_name']); if (tep_not_null(MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_SITE_ID)) { $data['site'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_SITE_ID; } if (tep_not_null(MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_USER_ID)) { $data['creator'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_USER_ID; } $product_description = substr(trim(preg_replace('/\\s\\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197); if (strlen($product_description) == 197) { $product_description .= ' ..'; } $data['description'] = $product_description; $products_image = $product_info['products_image']; $pi_query = tep_db_query("select image from products_images where products_id = '" . (int) $product_info['products_id'] . "' order by sort_order limit 1"); if (tep_db_num_rows($pi_query) === 1) { $pi = tep_db_fetch_array($pi_query); $products_image = $pi['image']; } $data['image'] = tep_href_link('images/' . $products_image, '', 'NONSSL', false, false); $result = ''; foreach ($data as $key => $value) { $result .= '<meta name="twitter:' . tep_output_string_protected($key) . '" content="' . tep_output_string_protected($value) . '" />' . "\n"; } $oscTemplate->addBlock($result, $this->group); } } }
function execute() { global $PHP_SELF, $oscTemplate; $OSCOM_Db = Registry::get('Db'); $OSCOM_Language = Registry::get('Language'); if (basename($PHP_SELF) == 'index.php') { if (isset($_GET['manufacturers_id']) && is_numeric($_GET['manufacturers_id'])) { $Qmanufacturer = $OSCOM_Db->prepare('select m.manufacturers_name, mi.manufacturers_seo_title from :table_manufacturers m, :table_manufacturers_info mi where m.manufacturers_id = mi.manufacturers_id and m.manufacturers_id = :manufacturers_id and mi.languages_id = :languages_id'); $Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']); $Qmanufacturer->bindInt(':languages_id', $OSCOM_Language->getId()); $Qmanufacturer->execute(); if ($Qmanufacturer->fetch() !== false) { if (tep_not_null($Qmanufacturer->value('manufacturers_seo_title')) && MODULE_HEADER_TAGS_MANUFACTURER_TITLE_SEO_TITLE_OVERRIDE == 'True') { $oscTemplate->setTitle($Qmanufacturer->value('manufacturers_seo_title') . OSCOM::getDef('module_header_tags_manufacturer_seo_separator') . $oscTemplate->getTitle()); } else { $oscTemplate->setTitle($Qmanufacturer->value('manufacturers_name') . OSCOM::getDef('module_header_tags_manufacturer_seo_separator') . $oscTemplate->getTitle()); } } } } }
function get_help() { extract(tep_load('defs', 'database', 'sessions')); $result = false; $zone_script = ''; if (isset($_GET['zID']) && tep_not_null($_GET['zID'])) { $zone_query = $db->query("select seo_types_class from " . TABLE_SEO_TYPES . " where seo_types_id = '" . (int) $_GET['zID'] . "'"); if ($db->num_rows($zone_query)) { $zone_array = $db->fetch_array($zone_query); $zone_script = $zone_array['seo_types_class']; } } if (!empty($zone_script)) { $file = DIR_FS_STRINGS . 'help/' . $zone_script . '.php'; } else { $file = DIR_FS_STRINGS . 'help/' . $cDefs->script; } $result = tep_read_contents($file, $contents); if (!$result) { return $result; } echo $contents; $cSessions->close(); return true; }
function cheapest() { if (is_array($this->modules)) { $rates = array(); foreach ($this->modules as $value) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $quotes = $GLOBALS[$class]->quotes; for ($i = 0, $n = sizeof($quotes['methods']); $i < $n; $i++) { if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'], 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')', 'cost' => $quotes['methods'][$i]['cost']); } } } } $cheapest = false; for ($i = 0, $n = sizeof($rates); $i < $n; $i++) { if (is_array($cheapest)) { if ($rates[$i]['cost'] < $cheapest['cost']) { $cheapest = $rates[$i]; } } else { $cheapest = $rates[$i]; } } return $cheapest; } }
function execute() { global $PHP_SELF, $oscTemplate; $OSCOM_Db = Registry::get('Db'); 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> 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) == 'checkout_success.php' && isset($_SESSION['customer_id'])) { $Qorder = $OSCOM_Db->get('orders', ['orders_id', 'billing_city', 'billing_state', 'billing_country'], ['customers_id' => $_SESSION['customer_id']], 'date_purchased desc', 1); if ($Qorder->fetch() !== false) { $totals = array(); $Qtotals = $OSCOM_Db->get('orders_total', ['value', 'class'], ['orders_id' => $Qorder->valueInt('orders_id')]); while ($Qtotals->fetch()) { $totals[$Qtotals->value('class')] = $Qtotals->value('value'); } $header .= ' _gaq.push([\'_addTrans\', \'' . $Qorder->valueInt('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 \'' . $Qorder->valueProtected('billing_city') . '\', // city \'' . $Qorder->valueProtected('billing_state') . '\', // state or province \'' . $Qorder->valueProtected('billing_country') . '\' // country ]);' . "\n"; $Qproducts = $OSCOM_Db->prepare('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 = :orders_id and op.products_id = pd.products_id and pd.language_id = l.languages_id and l.code = :code'); $Qproducts->bindInt(':orders_id', $Qorder->valueInt('orders_id')); $Qproducts->bindValue(':code', DEFAULT_LANGUAGE); $Qproducts->execute(); while ($Qproducts->fetch()) { $Qcategory = $OSCOM_Db->prepare('select cd.categories_name from :table_categories_description cd, :table_products_to_categories p2c, :table_languages l where p2c.products_id = :products_id and p2c.categories_id = cd.categories_id and cd.language_id = l.languages_id and l.code = :code'); $Qcategory->bindInt(':products_id', $Qproducts->valueInt('products_id')); $Qcategory->bindValue(':code', DEFAULT_LANGUAGE); $Qcategory->execute(); $header .= ' _gaq.push([\'_addItem\', \'' . $Qorder->valueInt('orders_id') . '\', // order ID - required \'' . $Qproducts->valueInt('products_id') . '\', // SKU/code - required \'' . $Qproducts->valueProtected('products_name') . '\', // product name \'' . $Qcategory->valueProtected('categories_name') . '\', // category \'' . $this->format_raw($Qproducts->value('final_price')) . '\', // unit price - required \'' . $Qproducts->valueInt('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 $PHP_SELF, $oscTemplate, $categories, $current_category_id; $OSCOM_Db = Registry::get('Db'); $OSCOM_Language = Registry::get('Language'); if (basename($PHP_SELF) == 'index.php' && $current_category_id > 0) { $Qmeta = $OSCOM_Db->prepare('select categories_seo_description, categories_seo_keywords from :table_categories_description where categories_id = :categories_id and language_id = :language_id'); $Qmeta->bindInt(':categories_id', $current_category_id); $Qmeta->bindInt(':language_id', $OSCOM_Language->getId()); $Qmeta->execute(); $meta = $Qmeta->fetch(); if (tep_not_null($meta['categories_seo_description'])) { $oscTemplate->addBlock('<meta name="description" content="' . HTML::output($meta['categories_seo_description']) . '" />' . PHP_EOL, $this->group); } if (tep_not_null($meta['categories_seo_keywords']) && MODULE_HEADER_TAGS_CATEGORY_SEO_KEYWORDS_STATUS == 'True') { $oscTemplate->addBlock('<meta name="keywords" content="' . HTML::output($meta['categories_seo_keywords']) . '" />' . PHP_EOL, $this->group); } } }
/** * Fetches the product and adds it as an article to the klarna class. No need to return any data. * Articles need to be set for fraud purpose, incorrect article means no_risk invoice. Hereby klarna will not take any risks. * * @param mixed $mProductId The product identified. Either int or string. Adapted according shop functionality * @param Klarna $oKlarna The Klarna class object. Used to set any articles * @return void */ protected function fetchProduct($mProductId) { global $currencies, $currency; include DIR_WS_CLASSES . 'language.php'; $lng = new language(); if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) { $lng->set_language($HTTP_GET_VARS['language']); } else { $lng->get_browser_language(); } $language = $lng->language['directory']; $languages_id = $lng->language['id']; $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $mProductId . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'"); $aProduct_info = tep_db_fetch_array($product_info_query); $sArtNo = MODULE_PAYMENT_KLARNA_ARTNO == 'id' || MODULE_PAYMENT_KLARNA_ARTNO == '' ? $aProduct_info['id'] : $aProduct_info['name']; $iTax = tep_get_tax_rate($aProduct_info['products_tax_class_id']); if (DISPLAY_PRICE_WITH_TAX == 'true') { $iPrice_with_tax = $currencies->get_value($currency) * $aProduct_info['products_price']; } else { $iPrice_with_tax = $currencies->get_value($currency) * $aProduct_info['products_price'] * ($iTax / 100 + 1); } // Add goods $this->oKlarna->addArticle(1, $sArtNo, $aProduct_info['products_name'], $iPrice_with_tax, $iTax, 0, KlarnaFlags::INC_VAT); $this->iSum += $iPrice_with_tax; }
function cm_account_sage_pay_cards() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_TITLE; $this->description = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_DESCRIPTION; if (defined('MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_STATUS')) { $this->sort_order = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_SORT_ORDER; $this->enabled = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_STATUS == 'True'; } $this->public_title = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_LINK_TITLE; $sage_pay_enabled = false; if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED) && in_array('sage_pay_direct.php', explode(';', MODULE_PAYMENT_INSTALLED))) { if (!class_exists('sage_pay_direct')) { include DIR_FS_CATALOG . 'includes/languages/' . $_SESSION['language'] . '/modules/payment/sage_pay_direct.php'; include DIR_FS_CATALOG . 'includes/modules/payment/sage_pay_direct.php'; } $sage_pay_direct = new sage_pay_direct(); if ($sage_pay_direct->enabled) { $sage_pay_enabled = true; if (MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_SERVER == 'Test') { $this->title .= ' [Test]'; $this->public_title .= ' (' . $sage_pay_direct->code . '; Test)'; } } } if ($sage_pay_enabled !== true) { $this->enabled = false; $this->description = '<div class="secWarning">' . MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_ERROR_MAIN_MODULE . '</div>' . $this->description; } }
function cm_account_braintree_cards() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_TITLE; $this->description = MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_DESCRIPTION; if (defined('MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_STATUS')) { $this->sort_order = MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_SORT_ORDER; $this->enabled = MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_STATUS == 'True'; } $this->public_title = MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_LINK_TITLE; $braintree_enabled = false; if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED) && in_array('braintree_cc.php', explode(';', MODULE_PAYMENT_INSTALLED))) { if (!class_exists('braintree_cc')) { include DIR_FS_CATALOG . 'includes/languages/' . $_SESSION['language'] . '/modules/payment/braintree_cc.php'; include DIR_FS_CATALOG . 'includes/modules/payment/braintree_cc.php'; } $braintree_cc = new braintree_cc(); if ($braintree_cc->enabled) { $braintree_enabled = true; if (MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Sandbox') { $this->title .= ' [Sandbox]'; $this->public_title .= ' (' . $braintree_cc->code . '; Sandbox)'; } } } if ($braintree_enabled !== true) { $this->enabled = false; $this->description = '<div class="secWarning">' . MODULE_CONTENT_ACCOUNT_BRAINTREE_CARDS_ERROR_MAIN_MODULE . '</div>' . $this->description; } }
public function process() { $this->get_value = ''; $this->original_get = ''; $this->cache_name = $this->setCacheString(__FILE__, 'listing', 'general'); if (false !== $this->retrieve($this->cache_name)) { KissMT::init()->setCanonical($this->checkCanonical()); return; } $query_replacements = array(':languages_id' => (int) KissMT::init()->retrieve('languages_id')); $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->reviews_query); $result = KissMT::init()->query($query); $list_array = array(); while ($reviews_products_results = tep_db_fetch_array($result)) { if (tep_not_null($reviews_products_results['products_name'])) { $list_array[] = trim($reviews_products_results['products_name']); } } $list_string = implode('[-separator-]', $this->removeArrayDuplicates($list_array)); tep_db_free_result($result); $list_string = tep_not_null($list_string) ? $list_string : false; $leading_values = implode('[-separator-]', KissMT::init()->retrieve('breadcrumb')); KissMT::init()->setCanonical($this->checkCanonical()); $this->parse(KissMT::init()->entities(sprintf(KISSMT_REVIEWS_TEXT, $leading_values), $decode = true), KissMT::init()->entities($list_string, $decode = true)); }
function actionRecorderAdmin($module, $user_id = null, $user_name = null) { global $language, $PHP_SELF; $module = tep_sanitize_string(str_replace(' ', '', $module)); if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { if (file_exists(DIR_FS_CATALOG . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1))) { include DIR_FS_CATALOG . 'includes/languages/' . $language . '/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1); include DIR_FS_CATALOG . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1); } else { return false; } } } else { return false; } } else { return false; } $this->_module = $module; if (!empty($user_id) && is_numeric($user_id)) { $this->_user_id = $user_id; } if (!empty($user_name)) { $this->_user_name = $user_name; } $GLOBALS[$this->_module] = new $module(); $GLOBALS[$this->_module]->setIdentifier(); }
function __construct() { $this->lang = Registry::get('Language'); $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = OSCOM::getDef('module_content_account_sage_pay_cards_title'); $this->description = OSCOM::getDef('module_content_account_sage_pay_cards_description'); if (defined('MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_STATUS')) { $this->sort_order = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_SORT_ORDER; $this->enabled = MODULE_CONTENT_ACCOUNT_SAGE_PAY_CARDS_STATUS == 'True'; } $this->public_title = OSCOM::getDef('module_content_account_sage_pay_cards_link_title'); $sage_pay_enabled = false; if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED) && in_array('sage_pay_direct.php', explode(';', MODULE_PAYMENT_INSTALLED))) { if (!class_exists('sage_pay_direct')) { $this->lang->loadDefinitions('modules/payment/sage_pay_direct'); include OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/payment/sage_pay_direct.php'; } $sage_pay_direct = new sage_pay_direct(); if ($sage_pay_direct->enabled) { $sage_pay_enabled = true; if (MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_SERVER == 'Test') { $this->title .= ' [Test]'; $this->public_title .= ' (' . $sage_pay_direct->code . '; Test)'; } } } if ($sage_pay_enabled !== true) { $this->enabled = false; $this->description = '<div class="secWarning">' . OSCOM::getDef('module_content_account_sage_pay_cards_error_main_module') . '</div>' . $this->description; } }
function payment($module = '') { global $payment, $language, $PHP_SELF; if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) { $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); $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 // $HTTP_POST_VARS['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 $HTTP_GET_VARS, $language, $oscTemplate; if (isset($HTTP_GET_VARS['products_id']) && defined('MODULE_SOCIAL_BOOKMARKS_INSTALLED') && tep_not_null(MODULE_SOCIAL_BOOKMARKS_INSTALLED)) { $sbm_array = explode(';', MODULE_SOCIAL_BOOKMARKS_INSTALLED); $social_bookmarks = array(); foreach ($sbm_array as $sbm) { $class = substr($sbm, 0, strrpos($sbm, '.')); if (!class_exists($class)) { include DIR_WS_LANGUAGES . $language . '/modules/social_bookmarks/' . $sbm; include DIR_WS_MODULES . 'social_bookmarks/' . $class . '.php'; } $sb = new $class(); if ($sb->isEnabled()) { $social_bookmarks[] = $sb->getOutput(); } } if (!empty($social_bookmarks)) { $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">' . MODULE_BOXES_PRODUCT_SOCIAL_BOOKMARKS_BOX_TITLE . '</div>' . ' <div class="panel-body text-center">' . implode(' ', $social_bookmarks) . '</div>' . '</div>'; if ($this->group == 'boxes_product_page') { $data .= '</div>'; } $oscTemplate->addBlock($data, $this->group); } } }
function get_current_page() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $request_type; $get_vars = array(); if (tep_not_null(REQUEST_URI)) { if (strpos(REQUEST_URI, '?')) { $current_page = PHP_SELF; // if (substr($current_page, 0, strlen(DIR_WS_CATALOG))==DIR_WS_CATALOG) $current_page = substr($current_page, strlen(DIR_WS_CATALOG)); $qstring = substr(REQUEST_URI, strpos(REQUEST_URI, '?') + 1); $qstring_array = explode('&', str_replace('&', '&', $qstring)); reset($qstring_array); while (list(, $get_var) = each($qstring_array)) { list($var_name, $var_value) = explode('=', $get_var); if (!in_array($var_name, array('x', 'y'))) { $get_vars[$var_name] = urldecode($var_value); } } } else { $current_page = REQUEST_URI; $qstring = ''; } } else { $current_page = basename(SCRIPT_FILENAME); $get_vars = $HTTP_GET_VARS; } if (!in_array(tep_session_name(), array_keys($get_vars))) { $get_vars[tep_session_name()] = tep_session_id(); } return array('page' => $current_page, 'mode' => $request_type, 'get' => $get_vars, 'post' => $HTTP_POST_VARS, 'real_page' => basename(SCRIPT_FILENAME), 'real_get' => $HTTP_GET_VARS); }
function process() { global $currencies, $order; $order_total_array = array(); if (is_array($this->modules)) { $no_zero = split(';', ORDER_TOTAL_MODULES_NO_ZERO); reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->process(); $n = sizeof($GLOBALS[$class]->output); if ($n == 0 && !in_array($class, $no_zero)) { $order_total_array[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->title . ':', 'text' => $currencies->format(0, true, $order->info['currency'], $order->info['currency_value']), 'value' => 0, 'sort_order' => $GLOBALS[$class]->sort_order); } for ($i = 0; $i < $n; $i++) { if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) { $order_total_array[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order); } } } } } $this->result_array = $order_total_array; return $order_total_array; }