Ejemplo n.º 1
0
 protected function acquire($dependency, $fullpath)
 {
     $this->products_id = (int) $dependency;
     // Bypass the query if already in the registry
     if (false !== isset(usu::$registry->{$this->dependency}[$this->products_id])) {
         usu::$performance['queries_saved']++;
         return true;
     }
     $placeholders = array(':pid', ':languages_id');
     // $values are already type cast
     $values = array($this->products_id, usu::$languages_id);
     $this->query = str_replace($placeholders, $values, $this->base_query);
     $result = usu::query($this->query);
     $this->query = null;
     $row = tep_db_fetch_array($result);
     tep_db_free_result($result);
     if (false === $row) {
         return false;
     }
     $this->link_text = $this->linkText($row['products_name']);
     if (false === isset(usu::$registry->{$this->dependency})) {
         usu::$registry->{$this->dependency} = array();
     }
     usu::$registry->attach($this->dependency, $this->products_id, $this->getProperties());
 }
Ejemplo n.º 2
0
function tep_values_name($values_id)
{
    global $languages_id;
    $values = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int) $values_id . "' and language_id = '" . (int) $languages_id . "'");
    $values_values = tep_db_fetch_array($values);
    return $values_values['products_options_values_name'];
}
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) . "')");
    }
}
Ejemplo n.º 4
0
 function execute()
 {
     global $HTTP_GET_VARS, $current_category_id, $languages_id, $oscTemplate;
     if (isset($current_category_id) && $current_category_id > 0) {
         $best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int) $current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
     } else {
         $best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
     }
     if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
         $bestsellers_list = '<ol style="margin: 0; padding-left: 25px;">';
         while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
             $bestsellers_list .= '<li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></li>';
         }
         $bestsellers_list .= '</ol>';
         if ($this->group == 'boxes_footer') {
             $data = '<div class="col-sm-3 col-lg-2">' . '  <div class="footerbox best-sellers">' . '    <h2>' . MODULE_BOXES_BEST_SELLERS_BOX_TITLE . '</h2>';
         } else {
             $data = '<div class="panel panel-default">' . '  <div class="panel-heading">' . MODULE_BOXES_BEST_SELLERS_BOX_TITLE . '</div>';
         }
         $data .= '  <div class="panel-body">' . $bestsellers_list . '</div>';
         $data .= '</div>';
         if ($this->group == 'boxes_footer') {
             $data .= '</div>';
         }
         $oscTemplate->addBlock($data, $this->group);
     }
 }
Ejemplo n.º 5
0
 function query($order_id)
 {
     global $languages_id;
     $order_query = tep_db_query("select o.*, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s where o.orders_id = '" . (int) $order_id . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int) $languages_id . "'");
     $order = tep_db_fetch_array($order_query);
     $totals_query = tep_db_query("select title, text, class from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
     while ($totals = tep_db_fetch_array($totals_query)) {
         $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class']);
     }
     $this->info = array('total' => null, 'currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'status' => $order['orders_status_name'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']);
     foreach ($this->totals as $t) {
         if ($t['class'] == 'ot_total') {
             $this->info['total'] = $t['text'];
             break;
         }
     }
     $this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']);
     $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']);
     $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']);
     $index = 0;
     $orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "'");
     while ($orders_products = tep_db_fetch_array($orders_products_query)) {
         $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']);
         $subindex = 0;
         $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
         if (tep_db_num_rows($attributes_query)) {
             while ($attributes = tep_db_fetch_array($attributes_query)) {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $index++;
     }
 }
Ejemplo n.º 6
0
 function usps()
 {
     global $order;
     $this->code = 'usps';
     $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_USPS_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_usps.gif';
     $this->tax_class = MODULE_SHIPPING_USPS_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_USPS_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_USPS_ZONE > 0) {
         $check_flag = false;
         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = tep_db_fetch_array($check_query)) {
             if ($check['zone_id'] < 1) {
                 $check_flag = true;
                 break;
             } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
                 $check_flag = true;
                 break;
             }
         }
         if ($check_flag == false) {
             $this->enabled = false;
         }
     }
     $this->types = array('Express' => 'EXPRESS', 'First Class' => 'First-Class Mail', 'Priority' => 'Priority', 'Parcel' => 'Parcel', 'BPM' => 'Bound Printed Material', 'Library' => 'Library', 'Media' => 'Media Mail');
     $this->intl_types = array('Global Express' => 'Global Express Guaranteed', 'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular', 'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular', 'Express Mail Int' => 'Express Mail International (EMS)', 'Express Mail Int Flat Rate Env' => 'Express Mail International (EMS) Flat Rate Envelope', 'Priority Mail Int' => 'Priority Mail International', 'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope', 'Priority Mail Int Flat Rate Box' => 'Priority Mail International Flat Rate Box', 'First-Class Mail Int' => 'First-Class Mail International');
     $this->countries = $this->country_list();
 }
Ejemplo n.º 7
0
 function calculate_price($products_price, $products_tax, $quantity = 1, $rate = "", $pid = "")
 {
     global $currency;
     if (is_numeric($pid)) {
         $dbres = tep_db_query("select categories_id from products_to_categories where products_id='" . $pid . "'");
         $row = tep_db_fetch_array($dbres);
         $cat_id = (int) $row['categories_id'];
         if ($cat_id == 23) {
             return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
         }
     }
     if ($rate == "") {
         $rate = get_price_rate($_SESSION['customer_id']);
     }
     if (get_price_group_name($_SESSION['customer_id']) == "Interior Designer") {
         $dbres = tep_db_query("select dn_price from products where products_id='{$pid}'");
         $row = tep_db_fetch_array($dbres);
         if ((double) $row['dn_price'] > 0) {
             $products_price = $row['dn_price'];
             $rate = "100";
         }
     }
     return ceil(tep_add_tax($products_price * $rate / 100, $products_tax)) * $quantity;
     //      return tep_round(tep_add_tax(($products_price*$rate)/100, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
 }
 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);
         }
     }
 }
Ejemplo n.º 9
0
 function updateStatus($upload_id, $status, $update_by = '')
 {
     $update_time = date('Y-m-d H:i:s');
     tep_db_query("UPDATE jng_sp_upload SET upload_status='{$status}', status_update_time='{$update_time}', status_update_by='{$update_by}' WHERE jng_sp_upload_id={$upload_id}");
     //Check if upload status update is "Success" (S)
     if ($status == 'S') {
         //Get all catalog id included in this upload for image upload and update the image_uploaded status to 1
         $catalog_query = tep_db_query("SELECT jng_sp_catalog_id FROM jng_sp_upload_image WHERE jng_sp_upload_id={$upload_id}");
         if (tep_db_num_rows($catalog_query) > 0) {
             $jcid = array();
             while ($row = tep_db_fetch_array($catalog_query)) {
                 $jcid[] = $row['jng_sp_catalog_id'];
             }
             $jcid_filter = implode(',', $jcid);
             tep_db_query("UPDATE jng_sp_catalog SET image_uploaded='1' WHERE jng_sp_catalog_id IN ({$jcid_filter})");
         }
         //Get all catalog id included in this upload and upload last_active_status accordingly and price_uploaded to 1
         $catalog_query = tep_db_query("SELECT jng_sp_catalog_id, active_status FROM jng_sp_upload_product_status WHERE jng_sp_upload_id={$upload_id}");
         if (tep_db_num_rows($catalog_query) > 0) {
             $active_status = array();
             while ($row = tep_db_fetch_array($catalog_query)) {
                 if (!isset($active_status[$row['active_status']])) {
                     $active_status[$row['active_status']] = array();
                 }
                 $active_status[$row['active_status']][] = $row['jng_sp_catalog_id'];
             }
             foreach ($active_status as $status => $jcid) {
                 $jcid_filter = implode(',', $jcid);
                 tep_db_query("UPDATE jng_sp_catalog SET last_active_status='{$status}', price_uploaded='1' WHERE jng_sp_catalog_id IN ({$jcid_filter})");
             }
         }
     } else {
         tep_db_query("DELETE FROM jng_sp_otde_removed_ean WHERE jng_sp_upload_id={$upload_id}");
     }
 }
Ejemplo n.º 10
0
 function confirmation()
 {
     global $customer_id;
     $customer_info_query = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
     $customer_info = tep_db_fetch_array($customer_info_query);
     return array('title' => sprintf(MODULE_PAYMENT_INTERKASSA_TEXT_DESCRIPTION_1, $customer_info['customers_email_address']));
 }
Ejemplo n.º 11
0
 public function process()
 {
     $this->get_value = $this->parsePath($_GET['articles_id']);
     $this->original_get = (int) $_GET['articles_id'];
     $this->cache_name = $this->setCacheString(__FILE__, 'article_info', $this->original_get);
     if (false !== $this->retrieve($this->cache_name)) {
         KissMT::init()->setCanonical($this->checkCanonical('articles_id'));
         return;
     }
     $query_replacements = array(':articles_id' => (int) $this->get_value, ':languages_id' => (int) KissMT::init()->retrieve('languages_id'));
     $query = str_replace(array_keys($query_replacements), array_values($query_replacements), $this->article_query);
     $result = KissMT::init()->query($query);
     $article_details = tep_db_fetch_array($result);
     tep_db_free_result($result);
     $name = trim($article_details['name']);
     $description = trim($article_details['description']);
     $breadcrumb = array_flip(KissMT::init()->retrieve('breadcrumb'));
     if (array_key_exists($name, $breadcrumb)) {
         unset($breadcrumb[$name]);
     }
     $breadcrumb = array_flip($breadcrumb);
     $leading_values = $name . (!empty($breadcrumb) ? '[-separator-]' . implode('[-separator-]', $breadcrumb) : '');
     KissMT::init()->setCanonical($this->checkCanonical('articles_id'));
     $this->parse(KissMT::init()->entities($leading_values, $decode = true), KissMT::init()->entities($description, $decode = true));
 }
Ejemplo n.º 12
0
 function execute()
 {
     global $languages_id, $HTTP_GET_VARS, $currencies, $oscTemplate;
     $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and r.reviews_status = 1";
     if (isset($HTTP_GET_VARS['products_id'])) {
         $random_select .= " and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'";
     }
     $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
     $random_product = tep_random_select($random_select);
     $reviews_box_contents = '';
     if ($random_product) {
         // display random review box
         $rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $random_product['reviews_id'] . "' and languages_id = '" . (int) $languages_id . "'");
         $rand_review = tep_db_fetch_array($rand_review_query);
         $rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br />');
         $reviews_box_contents .= '<div class="ui-widget-content infoBoxContents"><div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $rand_review_text . ' ..</a><br /><div align="center">' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif', sprintf(MODULE_BOXES_REVIEWS_BOX_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div></div>';
     } elseif (isset($HTTP_GET_VARS['products_id'])) {
         // display 'write a review' box
         $reviews_box_contents .= '<table border="0" cellspacing="0" cellpadding="2" class="ui-widget-content infoBoxContents"><tr><td><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></td><td><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW . '</a></td></tr></table>';
     } else {
         // display 'no reviews' box
         $reviews_box_contents .= '<div class="ui-widget-content infoBoxContents">' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '</div>';
     }
     $data = '<div class="ui-widget infoBoxContainer">' . '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_REVIEWS) . '">' . MODULE_BOXES_REVIEWS_BOX_TITLE . '</a></div>' . '  ' . $reviews_box_contents . '</div>';
     $oscTemplate->addBlock($data, $this->group);
 }
Ejemplo n.º 13
0
 /**
  * @author Michael Hammelmann <*****@*****.**>
  * @version 1
  * @param $pID products_id
 **/
 function product($pID)
 {
     global $languages_id;
     $product_info_query = tep_db_query("select p.products_distributor_id,p.products_id, pd.products_name, pd.products_description,pd.short_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,p.products_weight from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $pID . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
     $product_info = tep_db_fetch_array($product_info_query);
     $this->price = $product_info['products_price'];
     $this->tax = tep_get_tax_rate($product_info['products_tax_class_id']);
     $tax_class_query = tep_db_query("select tax_class_title from  " . TABLE_TAX_CLASS . " where tax_class_id=" . $product_info['products_tax_class_id']);
     $tax_class = tep_db_fetch_array($tax_class_query);
     $this->tax_title = $tax_class['tax_class_title'];
     $this->weight = $product_info['products_weight'];
     $this->short_description = $product_info['short_description'];
     $this->name = $product_info['products_name'];
     $this->image = $product_info['products_image'];
     /**
      * added for distributor specific data
     **/
     $distributor_path_query = tep_db_query("select * from " . TABLE_DISTRIBUTORS . " where distributor_id=" . $product_info['products_distributor_id']);
     $distributor_path = tep_db_fetch_array($distributor_path_query);
     $this->pdf_path = $distributor_path['pdf_prefix'];
     $this->image_path = $distributor_path['image_prefix'];
     if ($this->image_path == '') {
         $this->image_path = DIR_WS_IMAGES;
     }
     if ($this->image == '') {
         $this->image = 'empty.jpg';
         $this->image_path = DIR_WS_IMAGES;
     }
 }
 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 build_cds_list_menu($startid = 0, $ulstyle = '')
{
    global $languages_id;
    if ($ulstyle != '') {
        $ulstyle = ' id="' . $ulstyle . '"';
    }
    $cds_menu = '';
    //loop through category id to find all subcategories and pages
    $cds_pages_query = tep_db_query("SELECT c.categories_id as 'ID', \r\n                                                  cd.categories_name as 'Name',\r\n                                                  c.categories_parent_id as 'ParentID',\r\n                                                  c.category_append_cdpath as 'Append',\r\n                                                  c.categories_url_override as 'URL',\r\n                                                  c.categories_url_override_target as 'Target',\r\n                                                  c.pages_group_access as 'Group', 'c' as 'type',\r\n                                                  c.categories_sort_order as 'Sort'\r\n                                          FROM pages_categories c \r\n                                          LEFT JOIN pages_categories_description cd \r\n                                          ON c.categories_id = cd.categories_id \r\n                                          WHERE c.categories_parent_id = '" . $startid . "' \r\n                                          AND c.categories_status = '1'\r\n                                          AND c.categories_in_menu = '1'\r\n                                          AND cd.language_id = '" . (int) $languages_id . "'\r\n                                          UNION\r\n                                          SELECT p.pages_id as 'ID', \r\n                                                  pd.pages_menu_name as 'Name',\r\n                                                  p2c.categories_id as 'ParentID',\r\n                                                  p.pages_append_cdpath as 'Append',\r\n                                                  p.pages_url as 'URL',\r\n                                                  p.pages_url_target as 'Target',\r\n                                                  p.pages_group_access as 'Group', 'p' as 'type',\r\n                                                  p.pages_sort_order as 'Sort'\r\n                                            FROM pages p, \r\n                                                  pages_description  pd, \r\n                                                  pages_to_categories p2c \r\n                                            WHERE p.pages_id = pd.pages_id \r\n                                                AND pd.language_id ='" . (int) $languages_id . "'\r\n                                                AND p.pages_id = p2c.pages_id \r\n                                                AND p.pages_status = '1'\r\n                                                AND pd.pages_menu_name <> ''\r\n                                                AND p.pages_in_menu = '1'\r\n                                                AND p2c.categories_id ='" . $startid . "'\r\n                                            ORDER BY Sort ");
    $rows_count = tep_db_num_rows($cds_pages_query);
    if ($rows_count > 0) {
        $cds_menu .= "\n" . '     <ul' . $ulstyle . '>' . "\n";
        $ulstyle = '';
        while ($cds_pages_data = tep_db_fetch_array($cds_pages_query)) {
            $cds_menu .= '         <li>' . cds_build_menu_url($cds_pages_data['ID'], $cds_pages_data['Name'], $cds_pages_data['type'], $cds_pages_data['URL'], $cds_pages_data['Append'], $cds_pages_data['Target']);
            if ($cds_pages_data['type'] == 'c' && $cds_pages_data['URL'] == '') {
                //we found a subcategory, loop, loop, loop.......
                $cds_menu .= build_cds_list_menu($cds_pages_data['ID']);
            }
            $cds_menu .= '</li>' . "\n";
        }
        $cds_menu .= '     </ul>' . "\n";
    }
    return $cds_menu;
}
Ejemplo n.º 16
0
 function update_status()
 {
     global $order;
     if ($this->enabled == true && (int) MODULE_PAYMENT_COD_ZONE > 0) {
         $check_flag = false;
         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COD_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = tep_db_fetch_array($check_query)) {
             if ($check['zone_id'] < 1) {
                 $check_flag = true;
                 break;
             } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
                 $check_flag = true;
                 break;
             }
         }
         if ($check_flag == false) {
             $this->enabled = false;
         }
     }
     // disable the module if the order only contains virtual products
     if ($this->enabled == true) {
         if ($order->content_type == 'virtual') {
             $this->enabled = false;
         }
     }
 }
function generateDesignsId($month)
{
    //    $dateObj = DateTime::createFromFormat('!m', $month);
    //    $month_name = $dateObj->format('F');
    $month_name = date('F', mktime(0, 0, 0, $month, 10));
    echo "<h3>{$month_name}</h3>";
    $query = "SELECT designs_id, status_time FROM designs_status_history";
    $query .= " WHERE status=9 AND YEAR(FROM_UNIXTIME(status_time)) = '2014' AND MONTH(FROM_UNIXTIME(status_time)) = '{$month}'";
    $result = tep_db_query($query);
    $c = array();
    $c['no'] = 'No.';
    $c['id'] = 'Designs ID';
    $c['date'] = 'Finalized Date';
    $table_des[] = $c;
    while ($row = tep_db_fetch_array($result)) {
        $no++;
        $date = date('d-m-Y', $row['status_time']);
        $c = array();
        $c['no'] = $no;
        $c['id'] = $row['designs_id'];
        $c['date'] = $date;
        $table_des[] = $c;
    }
    $table = tep_draw_table('main_center', $table_des, true);
    echo $table;
}
Ejemplo n.º 18
0
 function getData()
 {
     global $HTTP_GET_VARS, $request_type, $oscTemplate;
     $data = '';
     $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
     if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
         if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
             // Display a list
             $manufacturers_list = '<ul class="nav nav-list">';
             while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
                 $manufacturers_name = strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name'];
                 if (isset($HTTP_GET_VARS['manufacturers_id']) && $HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id']) {
                     $manufacturers_name = '<strong>' . $manufacturers_name . '</strong>';
                 }
                 $manufacturers_list .= '<li><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a></li>';
             }
             $manufacturers_list .= '</ul>';
             $content = $manufacturers_list;
         } else {
             // Display a drop-down
             $manufacturers_array = array();
             if (MAX_MANUFACTURERS_LIST < 2) {
                 $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
             }
             while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
                 $manufacturers_name = strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name'];
                 $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers_name);
             }
             $content = tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', $request_type, false), 'get') . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : '', 'onchange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id() . '</form>';
         }
         $data = '<div class="panel panel-default">' . '  <div class="panel-heading">' . MODULE_BOXES_MANUFACTURERS_BOX_TITLE . '</div>' . '  <div class="panel-body">' . $content . '</div>' . '</div>';
     }
     return $data;
 }
Ejemplo n.º 19
0
 /**
  * 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;
 }
Ejemplo n.º 20
0
 public function retrieve()
 {
     if (SEO_URLS_ENABLED != 'false') {
         $query = str_replace(':cache_name', $this->cachename, $this->extract_query);
         $result = usu::query($query);
         $row = tep_db_fetch_array($result);
         tep_db_free_result($result);
         if (!empty($row)) {
             $cache_seconds = usu::$cachedays * 24 * 60 * 60;
             if (time() > strtotime($row['cache_date']) + $cache_seconds) {
                 $this->gc();
             } else {
                 usu::$cachefile_size = number_format(strlen($row['cache_data']) / 1024, 2) . ' kb';
                 usu::$performance['time'] = microtime(true);
                 $this->md5check = md5($row['cache_data']);
                 $rawdata = gzinflate(base64_decode($row['cache_data']));
                 usu::$registry = unserialize($rawdata);
                 usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
                 $this->retrieved = true;
                 return true;
             }
         }
     }
     usu::$registry = Usu_Registry::getInstance();
 }
Ejemplo n.º 21
0
 function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows, $link = 'db_link')
 {
     if (empty($current_page_number)) {
         $current_page_number = 1;
     }
     /*$pos_to = strlen($sql_query);
           $pos_from = strpos($sql_query, ' from', 0);
     
           $pos_group_by = strpos($sql_query, ' group by', $pos_from);
           if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by;
     
           $pos_having = strpos($sql_query, ' having', $pos_from);
           if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having;
     
           $pos_order_by = strpos($sql_query, ' order by', $pos_from);
           if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by;*/
     $count_query = preg_replace("/SELECT(.*?)FROM/si", "SELECT count(*) AS total FROM", $sql_query);
     $count_query = preg_replace("/HAVING.*\$/si", "", $count_query);
     $count_query = preg_replace("/ORDER BY.*\$/si", "", $count_query);
     $reviews_count_query = tep_db_query($count_query, $link);
     $reviews_count = tep_db_fetch_array($reviews_count_query);
     $query_num_rows = $reviews_count['total'];
     $num_pages = ceil($query_num_rows / $max_rows_per_page);
     if ($current_page_number > $num_pages) {
         $current_page_number = $num_pages;
     }
     $offset = $max_rows_per_page * ($current_page_number - 1);
     $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
 }
 function execute()
 {
     global $sessiontoken, $login_customer_id, $messageStack, $oscTemplate;
     $error = false;
     if (isset($_GET['action']) && $_GET['action'] == 'process' && isset($_POST['formid']) && $_POST['formid'] == $sessiontoken) {
         $email_address = tep_db_prepare_input($_POST['email_address']);
         $password = tep_db_prepare_input($_POST['password']);
         // Check if email exists
         $customer_query = tep_db_query("select customers_id, customers_password from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' limit 1");
         if (!tep_db_num_rows($customer_query)) {
             $error = true;
         } else {
             $customer = tep_db_fetch_array($customer_query);
             // Check that password is good
             if (!tep_validate_password($password, $customer['customers_password'])) {
                 $error = true;
             } else {
                 // set $login_customer_id globally and perform post login code in catalog/login.php
                 $login_customer_id = (int) $customer['customers_id'];
                 // migrate old hashed password to new phpass password
                 if (tep_password_type($customer['customers_password']) != 'phpass') {
                     tep_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '******' where customers_id = '" . (int) $login_customer_id . "'");
                 }
             }
         }
     }
     if ($error == true) {
         $messageStack->add('login', MODULE_CONTENT_LOGIN_TEXT_LOGIN_ERROR);
     }
     ob_start();
     include 'includes/modules/content/' . $this->group . '/templates/login_form.php';
     $template = ob_get_clean();
     $oscTemplate->addContent($template, $this->group);
 }
Ejemplo n.º 23
0
 public function output($step = 0)
 {
     global $temp_orders_id;
     $html = '';
     if (isset(Checkout::$errors[$this->type])) {
         $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$this->type]) . '</div>';
         unset(Checkout::$errors[$this->type]);
     }
     //select payment method if orders_id is known
     //also get billing country
     if (!empty($temp_orders_id)) {
         $selected_query = tep_db_query('SELECT payment_method, billing_country FROM temp_orders WHERE orders_id = "' . $temp_orders_id . '"');
         $selected = tep_db_fetch_array($selected_query);
     }
     foreach ($this->instances as $id => $data) {
         if ($data['status'] == 'true') {
             //check is active for zones and choosen shipping module
             if (parent::checkZone($data['zone'], $selected['billing_country']) && parent::checkShippingMethod($data['shipping_module'])) {
                 if (isset(Checkout::$errors[$id])) {
                     $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$id]) . '</div>';
                 }
                 $html .= '<label class="control-label" for="' . $this->type . '_' . $id . '" style="display:block;">';
                 $html .= '<div class="' . $this->type . '_item clearfix">';
                 $html .= '<input type="radio" name="' . $this->type . '" value="' . $id . '" id="' . $this->type . '_' . $id . '"' . ($selected['payment_method'] == $id ? ' checked=checked' : '') . ' />';
                 $html .= '<div class="' . $this->type . '_title">&nbsp; ' . Translate($data['title']) . '</div>';
                 if (!empty($data['description'])) {
                     $html .= '<div class="' . $this->type . '_description">&nbsp; ' . Translate($data['description']) . '</div>';
                 }
                 $html .= '</div>';
                 $html .= '</label>';
             }
         }
     }
     return $html;
 }
Ejemplo n.º 24
0
 function ups()
 {
     global $order;
     $this->code = 'ups';
     $this->title = MODULE_SHIPPING_UPS_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_UPS_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_UPS_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_ups.gif';
     $this->tax_class = MODULE_SHIPPING_UPS_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_UPS_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_UPS_ZONE > 0) {
         $check_flag = false;
         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_UPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = tep_db_fetch_array($check_query)) {
             if ($check['zone_id'] < 1) {
                 $check_flag = true;
                 break;
             } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
                 $check_flag = true;
                 break;
             }
         }
         if ($check_flag == false) {
             $this->enabled = false;
         }
     }
     $this->types = array('1DM' => 'Next Day Air Early AM', '1DML' => 'Next Day Air Early AM Letter', '1DA' => 'Next Day Air', '1DAL' => 'Next Day Air Letter', '1DAPI' => 'Next Day Air Intra (Puerto Rico)', '1DP' => 'Next Day Air Saver', '1DPL' => 'Next Day Air Saver Letter', '2DM' => '2nd Day Air AM', '2DML' => '2nd Day Air AM Letter', '2DA' => '2nd Day Air', '2DAL' => '2nd Day Air Letter', '3DS' => '3 Day Select', 'GND' => 'Ground', 'GNDCOM' => 'Ground Commercial', 'GNDRES' => 'Ground Residential', 'STD' => 'Canada Standard', 'XPR' => 'Worldwide Express', 'XPRL' => 'worldwide Express Letter', 'XDM' => 'Worldwide Express Plus', 'XDML' => 'Worldwide Express Plus Letter', 'XPD' => 'Worldwide Expedited');
 }
 function execute()
 {
     global $languages_id, $HTTP_GET_VARS, $currencies, $oscTemplate;
     $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and r.reviews_status = 1";
     if (isset($HTTP_GET_VARS['products_id'])) {
         $random_select .= " and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'";
     }
     $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
     $random_product = tep_random_select($random_select);
     $reviews_box_contents = '';
     if ($random_product) {
         // display random review box
         $rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $random_product['reviews_id'] . "' and languages_id = '" . (int) $languages_id . "'");
         $rand_review = tep_db_fetch_array($rand_review_query);
         $rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br />');
         $reviews_box_contents .= '<div class="text-center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, '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></div><div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $random_product['products_id']) . '">' . $rand_review_text . '</a>...</div><div class="text-center" title="' . sprintf(MODULE_BOXES_REVIEWS_BOX_TEXT_OF_5_STARS, $random_product['reviews_rating']) . '">' . tep_draw_stars($random_product['reviews_rating']) . '</div>';
     } elseif (isset($HTTP_GET_VARS['products_id'])) {
         // display 'write a review' box
         $reviews_box_contents .= '<span class="fa fa-thumbs-up"></span> <a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW . '</a>';
     } else {
         // display 'no reviews' box
         $reviews_box_contents .= '<p>' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '</p>';
     }
     ob_start();
     include DIR_WS_MODULES . 'boxes/templates/reviews.php';
     $data = ob_get_clean();
     $oscTemplate->addBlock($data, $this->group);
 }
Ejemplo n.º 26
0
 function form_make($engine, $id_field, $date_field, $i)
 {
     $html = '<div class="createhead">' . constant("CREATE_" . strtoupper($engine) . "_" . $i) . '</div>';
     $engine != "customers" ? $dateclause = ", MIN(UNIX_TIMESTAMP({$date_field})) as date_min, MAX(UNIX_TIMESTAMP({$date_field})) as date_max" : ($dateclause = "");
     $sql = "SELECT COUNT(*), MIN({$id_field}), MAX({$id_field})" . $dateclause . " FROM " . constant("TABLE_" . strtoupper($engine)) . $this->where;
     $result = tep_db_query($sql);
     if ($myrow = tep_db_fetch_array($result)) {
         $date_min = date('M j, Y g:i a', $myrow["date_min"]);
         $date_max = date('M j, Y g:i a', $myrow["date_max"]);
         $html .= '<span class="createlabel">' . CREATE_TOTAL . ":</span> " . $myrow["COUNT(*)"] . "<br />";
         if ($myrow["COUNT(*)"] >= 1) {
             $html .= '<span class="createlabel">' . CREATE_NUM_S . ":</span> " . $myrow["MIN({$id_field})"];
             $myrow["COUNT(*)"] > 1 ? $html .= " " . CREATE_TO . " " . $myrow["MAX({$id_field})"] . "<br />" : ($html .= "<br />");
             if ($engine != "customers") {
                 $html .= '<span class="createlabel">' . CREATE_DATE_S . ":</span> " . $date_min;
                 $myrow["COUNT(*)"] > 1 ? $html .= " " . CREATE_TO . " " . $date_max . "<br />" : ($html .= "<br />");
             }
             $html .= '<form action=' . $_SERVER[PHP_SELF] . ' method="post" name="' . $engine . $i . '">';
             $html .= '<input name="engine" type="hidden" value="' . $engine . '" />';
             $html .= '<input name="whereclause" type="hidden" value="' . $this->where . '" />';
             $html .= '<input name="qbimported" type="hidden" value="' . $i . '" />';
             $html .= '<input name="stage" type="hidden" value="process" />';
             $html .= '<input name="submit" type="submit" value="' . CREATE_BUTTON . '" />';
             $html .= '</form>';
             $html .= '<br /><br />';
         } else {
             $html .= '<br />';
         }
     }
     $this->form = $html;
 }
Ejemplo n.º 27
0
function tep_get_configuration_key_value($lookup)
{
    $configuration_query_raw = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key='" . $lookup . "'");
    $configuration_query = tep_db_fetch_array($configuration_query_raw);
    $lookup_value = $configuration_query['configuration_value'];
    return $lookup_value;
}
Ejemplo n.º 28
0
 function flat()
 {
     global $order;
     $this->code = 'flat';
     $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_FLAT_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_FLAT_ZONE > 0) {
         $check_flag = false;
         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = tep_db_fetch_array($check_query)) {
             if ($check['zone_id'] < 1) {
                 $check_flag = true;
                 break;
             } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
                 $check_flag = true;
                 break;
             }
         }
         if ($check_flag == false) {
             $this->enabled = false;
         }
     }
 }
Ejemplo n.º 29
0
 function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows)
 {
     if (empty($current_page_number)) {
         $current_page_number = 1;
     }
     $pos_to = strlen($sql_query);
     $pos_from = strpos($sql_query, ' from', 0);
     $pos_group_by = strpos($sql_query, ' group by', $pos_from);
     if ($pos_group_by < $pos_to && $pos_group_by != false) {
         $pos_to = $pos_group_by;
     }
     $pos_having = strpos($sql_query, ' having', $pos_from);
     if ($pos_having < $pos_to && $pos_having != false) {
         $pos_to = $pos_having;
     }
     $pos_order_by = strpos($sql_query, ' order by', $pos_from);
     if ($pos_order_by < $pos_to && $pos_order_by != false) {
         $pos_to = $pos_order_by;
     }
     $reviews_count_query = tep_db_query("select count(*) as total " . substr($sql_query, $pos_from, $pos_to - $pos_from));
     $reviews_count = tep_db_fetch_array($reviews_count_query);
     $query_num_rows = $reviews_count['total'];
     $num_pages = ceil($query_num_rows / $max_rows_per_page);
     if ($current_page_number > $num_pages) {
         $current_page_number = $num_pages;
     }
     $offset = $max_rows_per_page * ($current_page_number - 1);
     $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
 }
 public function output($step = 0)
 {
     global $temp_orders_id;
     $html = '';
     if ($temp_orders_id > 0) {
         $to_query = tep_db_query('SELECT * FROM temp_orders WHERE orders_id = "' . $temp_orders_id . '"');
         if (tep_db_num_rows($to_query) > 0) {
             $to = tep_db_fetch_array($to_query);
             $html .= '<div class="billing_address">';
             $html .= '<h3 class="billing_address_title">' . Translate($this->config['title']) . '</h3>';
             if (!empty($this->config['description'])) {
                 $html .= '<p class="billing_address_description">' . Translate($this->config['description']) . '</p>';
             }
             $html .= '<blockquote>';
             $html .= '<address>';
             //name
             $html .= '<strong>' . $to['billing_name'] . '</strong><br />';
             //street
             $html .= $to['billing_street_address'] . '<br />';
             //city + postcode + country
             $html .= $to['billing_postcode'] . ' ' . $to['billing_city'] . ' ' . tep_get_country_name($to['billing_country']) . '<br />';
             $html .= '</address>';
             $html .= '</blockquote>';
             $html .= '</div>';
             //end billing_address
         }
     }
     return $html;
 }