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) . "')");
    }
}
예제 #2
0
 function query($order_id)
 {
     // PWA BOF
     // added customers_dummy_account
     $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_dummy_account, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, delivery_date, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     // PWA EOF
     $order = tep_db_fetch_array($order_query);
     $totals_query = tep_db_query("select title, text 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']);
     }
     $this->info = array('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'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified'], 'delivery_date' => $order['delivery_date']);
     $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'], 'is_dummy_account' => $order['customers_dummy_account']);
     // PWA EOF
     $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_code, 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'], 'code' => $orders_products['products_code'], '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++;
     }
 }
예제 #3
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;
 }
 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);
 }
예제 #5
0
 function _draw_stocked_attributes()
 {
     global $languages_id;
     $out = '';
     $attributes = $this->_build_attributes_array(true, false);
     if (sizeof($attributes) <= 1) {
         return parent::_draw_stocked_attributes();
     }
     // Check stock
     $s = sizeof($attributes[0]['ovals']);
     for ($a = 0; $a < $s; $a++) {
         $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int) $this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int) $attributes[0]['oid'] . "-" . (int) $attributes[0]['ovals'][$a]['id'] . "(,|\$)' AND products_stock_quantity > 0");
         $out_of_stock = tep_db_num_rows($attribute_stock_query) == 0;
         if ($out_of_stock) {
             unset($attributes[0]['ovals'][$a]);
         }
     }
     // Draw first option dropdown with all values
     $out .= '<tr><td align="right" class=main><b>' . $attributes[0]['oname'] . ":</b></td><td class=main>" . tep_draw_pull_down_menu('id[' . $attributes[0]['oid'] . ']', array_merge(array(array('id' => 0, 'text' => 'First select ' . $attributes[0]['oname'])), $attributes[0]['ovals']), $attributes[0]['default'], "onchange=\"i" . $attributes[0]['oid'] . "(this.form);\"") . "</td></tr>\n";
     // Draw second to next to last option dropdowns - no values, with onchange
     for ($o = 1; $o < sizeof($attributes) - 1; $o++) {
         $out .= '<tr><td align="right" class=main><b>' . $attributes[$o]['oname'] . ":</b></td><td class=main>" . tep_draw_pull_down_menu('id[' . $attributes[$o]['oid'] . ']', array(array('id' => 0, 'text' => 'Next select ' . $attributes[$o]['oname'])), '', "onchange=\"i" . $attributes[$o]['oid'] . "(this.form);\"") . "</td></tr>\n";
     }
     // Draw last option dropdown - no values, no onchange
     $out .= '<tr><td align="right" class=main><b>' . $attributes[$o]['oname'] . ":</b></td><td class=main>" . tep_draw_pull_down_menu('id[' . $attributes[$o]['oid'] . ']', array(array('id' => 0, 'text' => 'Next select ' . $attributes[$o]['oname'])), '') . "</td></tr>\n";
     $out .= $this->_draw_dropdown_sequence_js($attributes);
     return $out;
 }
예제 #6
0
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;
}
예제 #7
0
 function execute()
 {
     global $customer_id, $languages_id, $PHP_SELF, $oscTemplate;
     if (tep_session_is_registered('customer_id')) {
         // retreive the last x products purchased
         $orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int) $customer_id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
         if (tep_db_num_rows($orders_query)) {
             $product_ids = '';
             while ($orders = tep_db_fetch_array($orders_query)) {
                 $product_ids .= (int) $orders['products_id'] . ',';
             }
             $product_ids = substr($product_ids, 0, -1);
             $customer_orders_string = '<ul class="list-unstyled">';
             $products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int) $languages_id . "' order by products_name");
             while ($products = tep_db_fetch_array($products_query)) {
                 $customer_orders_string .= '<li><span class="pull-right"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id']) . '"><span class="glyphicon glyphicon-shopping-cart"></span></a></span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a></li>';
             }
             $customer_orders_string .= '</ul>';
             if ($this->group == 'boxes_footer') {
                 $data = '<div class="col-sm-3 col-lg-2">' . '  <div class="footerbox order-history">' . '    <h2>' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</h2>';
             } else {
                 $data = '<div class="panel panel-default">' . '  <div class="panel-heading">' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</div>';
             }
             $data .= '  <div class="panel-body">' . $customer_orders_string . '</div>';
             $data .= '</div>';
             if ($this->group == 'boxes_footer') {
                 $data .= '</div>';
             }
             $oscTemplate->addBlock($data, $this->group);
         }
     }
 }
예제 #8
0
 function _draw_stocked_attributes()
 {
     global $languages_id;
     $out = '';
     $attributes = $this->_build_attributes_array(true, false);
     if (sizeof($attributes) > 0) {
         for ($o = 0; $o < sizeof($attributes); $o++) {
             $s = sizeof($attributes[$o]['ovals']);
             for ($a = 0; $a < $s; $a++) {
                 $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int) $this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int) $attributes[$o]['oid'] . "-" . (int) $attributes[$o]['ovals'][$a]['id'] . "(,|\$)' AND products_stock_quantity > 0");
                 $out_of_stock = tep_db_num_rows($attribute_stock_query) == 0;
                 if ($out_of_stock && $this->show_out_of_stock == 'True') {
                     switch ($this->mark_out_of_stock) {
                         case 'Left':
                             $attributes[$o]['ovals'][$a]['text'] = TEXT_OUT_OF_STOCK . ' - ' . $attributes[$o]['ovals'][$a]['text'];
                             break;
                         case 'Right':
                             $attributes[$o]['ovals'][$a]['text'] .= ' - ' . TEXT_OUT_OF_STOCK;
                             break;
                     }
                 } elseif ($out_of_stock && $this->show_out_of_stock != 'True') {
                     unset($attributes[$o]['ovals'][$a]);
                 }
             }
             $out .= '<tr><td align="right" class="main"><b>' . $attributes[$o]['oname'] . ':</b></td><td class="main" align="left">' . tep_draw_pull_down_menu('id[' . $attributes[$o]['oid'] . ']', array_values($attributes[$o]['ovals']), $attributes[$o]['default'], 'onchange="stkmsg(this.form);"') . '</td></tr>';
         }
         $out .= $this->_draw_out_of_stock_message_js($attributes);
         return $out;
     }
 }
예제 #9
0
 function __construct(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows)
 {
     if (empty($current_page_number)) {
         $current_page_number = 1;
     }
     // # scrub any white space found in incoming queries!
     if ($sql_query) {
         $sql_query = preg_replace("/\\s+/", " ", $sql_query);
     }
     //error_log(print_r($sql_query,1));
     $pos_to = strlen($sql_query);
     $pos_from = strripos($sql_query, ' from', 0);
     $pos_order_by = strripos($sql_query, ' order by', $pos_from);
     if ($pos_order_by < $pos_to && $pos_order_by != false) {
         $pos_to = $pos_order_by;
     }
     $pos_limit = strripos($sql_query, ' limit', $pos_from);
     if ($pos_limit < $pos_to && $pos_limit != false) {
         $pos_to = $pos_limit;
     }
     $pos_procedure = strripos($sql_query, ' procedure', $pos_from);
     if ($pos_procedure < $pos_to && $pos_procedure != false) {
         $pos_to = $pos_procedure;
     }
     $offset = $max_rows_per_page * ($current_page_number - 1);
     $sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
     $reviews_count_query = tep_db_query("select 0 " . substr($sql_query, $pos_from, $pos_to - $pos_from));
     //$reviews_count = tep_db_fetch_array($reviews_count_query);
     $query_num_rows = (int) tep_db_num_rows($reviews_count_query);
     $this->current_page_number = $current_page_number;
     $this->max_rows_per_page = $max_rows_per_page;
     $this->query_num_rows = $query_num_rows;
 }
function processXMLFile($xml_file)
{
    global $timestamp, $logger;
    $xmlt = new xml_tools();
    $xml = $xmlt->loadFile($xml_file);
    $order_date = $timestamp;
    $segments_id = (int) $xml->LOCAL_INFO->SEGMENT_ID;
    $group_name = (string) $xml->LOCAL_INFO->GROUP_NAME;
    $refill_orders = $xml->REFILL_ORDERS->ORDER;
    $counter = 0;
    foreach ($refill_orders as $ro) {
        $products_id = (int) $ro->PRODUCTS_ID;
        $articles_id = (int) $ro->ARTICLES_ID;
        $products_ean = $ro->PRODUCTS_EAN;
        $quantity = (int) $ro->QUANTITY;
        $trans_type = (string) (strtoupper($ro->TRANS_TYPE) == 'NULL' ? '' : $ro->TRANS_TYPE);
        $trans_id = (int) $ro->TRANS_ID;
        //CREATE DEPOT ORDERS
        $q_check = "SELECT depot_orders_id FROM depot_orders " . " WHERE segments_id = {$segments_id}" . " AND trans_type = '' AND trans_id = {$trans_id}";
        $r_check = tep_db_query($q_check);
        //ONLY CREATE ORDER WHICH NOT IMPORTED
        if (tep_db_num_rows($r_check) == 0) {
            $class_do = new depot_orders();
            $class_do->newOrder($segments_id, $products_id, $articles_id, $products_ean, $quantity, $order_date, $trans_type, $trans_id, $group_name);
            $counter++;
        }
    }
    $logger->write("{$counter} orders imported");
    unlink($xml_file);
    $logger->write("xml deleted");
    return $counter;
}
예제 #11
0
function amazonGetBoxAvailable($jng_sp_id, $order_id, $destination_id)
{
    /* Rule:
     * maximum PO per box = 5
     */
    $time_stamp = time();
    $date_today = date('Y-m-d', $time_stamp);
    $scanned_time = date('Y-m-d H:i:s', $time_stamp);
    $total_po_per_package = 5;
    $q_check = "SELECT packaging_box FROM orders_use_packaging_box" . " WHERE date_allocation = '{$date_today}' AND order_id = '{$order_id}'" . " AND shipping_id = '{$destination_id}' AND jng_sp_id = {$jng_sp_id}";
    $res_check = tep_db_query($q_check);
    if (tep_db_num_rows($res_check) > 0) {
        $dt = tep_db_fetch_array($res_check);
        $packaging_box = $dt['packaging_box'];
    } else {
        //Allocate it
        $q = "SELECT order_id FROM orders_use_packaging_box" . " WHERE date_allocation = '{$date_today}' AND shipping_id = '{$destination_id}'" . " AND jng_sp_id = {$jng_sp_id}";
        $res = tep_db_query($q);
        $po_allocated_total = tep_db_num_rows($res);
        $po_allocated_next = $po_allocated_total + 1;
        $packaging_box = ceil($po_allocated_next / $total_po_per_package);
        $data = array();
        $data['date_allocation'] = $date_today;
        $data['jng_sp_id'] = $jng_sp_id;
        $data['order_id'] = $order_id;
        $data['shipping_id'] = $destination_id;
        $data['packaging_box'] = $packaging_box;
        $data['scanned_time'] = $scanned_time;
        tep_db_perform('orders_use_packaging_box', $data);
    }
    return $packaging_box;
}
 function execute()
 {
     global $PHP_SELF, $oscTemplate, $product_check, $languages_id, $currency;
     if ($product_check['total'] > 0) {
         $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_quantity, p.products_tax_class_id, p.products_date_available 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('og:type' => 'product', 'og:title' => $product_info['products_name'], 'og:site_name' => STORE_NAME);
             $product_description = substr(trim(preg_replace('/\\s\\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197) . '...';
             $data['og: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['og:image'] = tep_href_link('images/' . $products_image, '', 'NONSSL', false, false);
             if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
                 $products_price = $this->format_raw($new_price);
             } else {
                 $products_price = $this->format_raw($product_info['products_price']);
             }
             $data['product:price:amount'] = $products_price;
             $data['product:price:currency'] = $currency;
             $data['og:url'] = tep_href_link('product_info.php', 'products_id=' . $product_info['products_id'], 'NONSSL', false);
             $data['product:availability'] = $product_info['products_quantity'] > 0 ? MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_IN_STOCK : MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_OUT_OF_STOCK;
             $result = '';
             foreach ($data as $key => $value) {
                 $result .= '<meta property="' . tep_output_string_protected($key) . '" content="' . tep_output_string_protected($value) . '" />' . PHP_EOL;
             }
             $oscTemplate->addBlock($result, $this->group);
         }
     }
 }
예제 #13
0
 function execute()
 {
     global $HTTP_GET_VARS, $languages_id, $oscTemplate;
     if (isset($HTTP_GET_VARS['products_id'])) {
         $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int) $languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
         if (tep_db_num_rows($manufacturer_query)) {
             $manufacturer = tep_db_fetch_array($manufacturer_query);
             $manufacturer_info_string = NULL;
             if (tep_not_null($manufacturer['manufacturers_image'])) {
                 $manufacturer_info_string .= '<div>' . tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturer['manufacturers_name']) . '</div>';
             }
             if (tep_not_null($manufacturer['manufacturers_url'])) {
                 $manufacturer_info_string .= '<div class="text-center"><a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $manufacturer['manufacturers_id']) . '" target="_blank">' . sprintf(MODULE_BOXES_MANUFACTURER_INFO_BOX_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></div>';
             }
             $data = NULL;
             if ($this->group == 'boxes_product_page') {
                 $data .= '<div class="col-sm-4 product_box hidden-xs">';
             }
             $data .= '<div class="panel panel-default">' . '  <div class="panel-heading">' . MODULE_BOXES_MANUFACTURER_INFO_BOX_TITLE . '</div>' . '  <div class="panel-body">' . $manufacturer_info_string . '</div>';
             $data .= '  <div class="panel-footer clearfix"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id']) . '">' . MODULE_BOXES_MANUFACTURER_INFO_BOX_OTHER_PRODUCTS . '</a></div>';
             $data .= '</div>';
             if ($this->group == 'boxes_product_page') {
                 $data .= '</div>';
             }
             $oscTemplate->addBlock($data, $this->group);
         }
     }
 }
예제 #14
0
 function query($returns_id)
 {
     $returns_query = tep_db_query("SELECT * FROM " . TABLE_RETURNS . " WHERE returns_id = '" . tep_db_input($returns_id) . "'");
     $returns = tep_db_fetch_array($returns_query);
     $refund_payment_query = tep_db_query("SELECT * FROM " . TABLE_RETURN_PAYMENTS . " where returns_id = '" . tep_db_input($returns_id) . "'");
     $refund_payment = tep_db_fetch_array($refund_payment_query);
     $this->returnid = $returns['returns_id'];
     $this->orderid = $returns['order_id'];
     $this->info = array('currency' => $returns['currency'], 'currency_value' => $returns['currency_value'], 'payment_method' => $returns['payment_method'], 'rma_value' => $returns['rma_value'], 'order_id' => $returns['order_id'], 'cc_type' => $returns['cc_type'], 'cc_owner' => $returns['cc_owner'], 'cc_number' => $returns['cc_number'], 'cvvnumber' => $returns['cvvnumber'], 'cc_expires' => $returns['cc_expires'], 'comments' => $returns['comments'], 'date_purchased' => $returns['date_purchased'], 'orders_status' => $returns['returns_status'], 'date_finished' => $returns['date_finished'], 'customer_method' => $refund_payment['customer_method'], 'refund_method' => $refund_payment['refund_payment_name'], 'payment_reference' => $refund_payment['refund_payment_reference'], 'refund_amount' => 0, 'refund_date' => $refund_payment['refund_payment_date'], 'refund_gv_id' => $returns['refund_gv_id'], 'last_modified' => $returns['last_modified'], 'return_reason' => $returns['returns_reason']);
     $this->customer = array('name' => $returns['customers_name'], 'company' => $returns['customers_company'], 'street_address' => $returns['customers_street_address'], 'suburb' => $returns['customers_suburb'], 'city' => $returns['customers_city'], 'postcode' => $returns['customers_postcode'], 'state' => $returns['customers_state'], 'country' => $returns['customers_country'], 'format_id' => $returns['customers_address_format_id'], 'telephone' => $returns['customers_telephone'], 'fax' => $returns['customers_fax'], 'email_address' => $returns['customers_email_address']);
     $this->delivery = array('name' => $returns['delivery_name'], 'company' => $returns['delivery_company'], 'street_address' => $returns['delivery_street_address'], 'suburb' => $returns['delivery_suburb'], 'city' => $returns['delivery_city'], 'postcode' => $returns['delivery_postcode'], 'state' => $returns['delivery_state'], 'country' => $returns['delivery_country'], 'format_id' => $returns['delivery_address_format_id']);
     $this->billing = array('name' => $returns['billing_name'], 'company' => $returns['billing_company'], 'street_address' => $returns['billing_street_address'], 'suburb' => $returns['billing_suburb'], 'city' => $returns['billing_city'], 'postcode' => $returns['billing_postcode'], 'state' => $returns['billing_state'], 'country' => $returns['billing_country'], 'format_id' => $returns['billing_address_format_id']);
     $returns_products_query = tep_db_query("SELECT * FROM " . TABLE_RETURNS_PRODUCTS_DATA . " WHERE returns_id ='" . tep_db_input($returns_id) . "'");
     while ($returned_products = tep_db_fetch_array($returns_products_query)) {
         $this->products = array('qty' => $returned_products['products_quantity'], 'name' => $returned_products['products_name'], 'model' => $returned_products['products_model'], 'tax' => $returned_products['products_tax'], 'price' => $returned_products['products_price'], 'id' => $returned_products['products_id'], 'refund_shipping' => $returned_products['refund_shipping'], 'restock_quantity' => $returned_products['restock_quantity'], 'refund_amount' => $returned_products['refund_amount'], 'exchange_amount' => $returned_products['exchange_amount'], 'refund_shipping_amount' => $returned_products['refund_shipping_amount'], 'final_price' => $returned_products['products_price']);
         $this->info['refund_amount'] += $returned_products['refund_amount'];
     }
     // # END while
     $this->exchange = array();
     $returns_products_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS . " \r\n\t\t\t\t\t\t\t\t\t\t\t\t WHERE exchange_returns_id ='" . tep_db_input($returns_id) . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t");
     while ($returned_products = tep_db_fetch_array($returns_products_query)) {
         $this->exchange[] = array('orders_products_id' => $returned_products['orders_products_id'], 'qty' => $returned_products['products_quantity'], 'name' => $returned_products['products_name'], 'model' => $returned_products['products_model'], 'tax' => $returned_products['products_tax'], 'price' => $returned_products['products_price'], 'final_price' => $returned_products['products_price'], 'id' => $returned_products['products_id'], 'free_shipping' => $returned_products['free_shipping'], 'separate_shipping' => $returned_products['separate_shipping'], 'weight' => $returned_products['products_weight']);
         $attributes_query = tep_db_query("SELECT * FROM  " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " \r\n\t\t\t\t\t\t\t\t\t\t\t  WHERE orders_id = '" . $this->orderid . "' \r\n\t\t\t\t\t\t\t\t\t\t\t  AND orders_products_id = '" . (int) $returned_products['orders_products_id'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t");
         if (tep_db_num_rows($attributes_query)) {
             while ($attributes = tep_db_fetch_array($attributes_query)) {
                 $this->exchange[sizeof($this->exchange) - 1]['attributes'][] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
             }
             // # END while $attributes
         }
         // # END if tep_db_num_rows
     }
     // # END $returned_products
 }
예제 #15
0
파일: order.php 프로젝트: eosc/EosC-2.3
 function query($order_id)
 {
     $order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     $order = tep_db_fetch_array($order_query);
     $totals_query = tep_db_query("select * 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'], 'value' => $totals['value'], 'sort_order' => $totals['sort_order'], 'orders_total_id' => $totals['orders_total_id']);
     }
     $this->info = array('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'], 'shipping_tax' => $order['shipping_tax'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']);
     $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']);
     $countryid = tep_get_country_id($this->delivery["country"]);
     $zoneid = tep_get_zone_id($countryid, $this->delivery["state"]);
     $index = 0;
     $orders_products_query = tep_db_query("\n     SELECT \n\t op.orders_products_id, \n\t op.products_name, \n\t op.products_model, \n\t op.products_price,\n\t op.products_tax, \n\t op.products_quantity, \n\t op.final_price, \n\t p.products_tax_class_id,\n\t p.products_weight\n  FROM " . TABLE_ORDERS_PRODUCTS . " op\n  LEFT JOIN " . TABLE_PRODUCTS . " p\n    ON op.products_id = p.products_id\n 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'], 'tax_description' => tep_get_tax_description($orders_products['products_tax_class_id'], $countryid, $zoneid), 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price'], 'weight' => $orders_products['products_weight'], 'orders_products_id' => $orders_products['orders_products_id']);
         $subindex = 0;
         $attributes_query = tep_db_query("select * 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'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
                 $subindex++;
             }
         }
         $index++;
     }
 }
예제 #16
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}");
     }
 }
function setProductDescription2($products_id, $focus = null)
{
    use_class('element');
    $q = tep_db_query("SELECT * FROM products_description2 WHERE products_id={$products_id}");
    $pd2 = tep_db_fetch_array($q);
    $elements_used = $this->retrieveElementsUsed($products_id);
    if (!is_null($focus) && !is_array($focus)) {
        $focus = explode(',', $focus);
    }
    $need_tobe_filled_c = is_null($focus) || in_array('c', $focus) && ($pd2['clasp_type'] == '' || $pd2['clasp_type'] == 0) ? true : false;
    $need_tobe_filled_s = is_null($focus) || in_array('s', $focus) && ($pd2['setting_type'] == '' || $pd2['setting_type'] == 0) ? true : false;
    if ($need_tobe_filled_c || $need_tobe_filled_s) {
        $sda = array();
        foreach ($elements_used as $eid) {
            $el = new element($eid);
            if ($need_tobe_filled_c && !isset($sda['clasp_type']) && $sda['clasp_type'] == '') {
                $sda['clasp_type'] = $el->attributes['clasp']['id'];
            }
            if ($need_tobe_filled_s && !isset($sda['setting_type']) && $sda['setting_type'] == '') {
                $sda['setting_type'] = $el->attributes['setting']['id'];
            }
        }
        if (count($sda) > 0) {
            if (tep_db_num_rows($q) > 0) {
                tep_db_perform('products_description2', $sda, 'update', "products_id={$products_id}");
            } else {
                $sda['products_id'] = $products_id;
                tep_db_perform('products_description2', $sda);
            }
        }
    }
}
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;
}
    function getSetField()
    {
        global $languages_id;
        $statuses_array = array();
        $flags_query = tep_db_query("describe orders_status public_flag");
        if (tep_db_num_rows($flags_query) == 1) {
            $statuses_query = tep_db_query("select orders_status_id, orders_status_name from orders_status where language_id = '" . (int) $languages_id . "' and public_flag = '0' order by orders_status_name");
        } else {
            $statuses_query = tep_db_query("select orders_status_id, orders_status_name from orders_status where language_id = '" . (int) $languages_id . "' order by orders_status_name");
        }
        while ($statuses = tep_db_fetch_array($statuses_query)) {
            $statuses_array[] = array('id' => $statuses['orders_status_id'], 'text' => $statuses['orders_status_name']);
        }
        $input = tep_draw_pull_down_menu('transactions_order_status_id', $statuses_array, OSCOM_APP_PAYPAL_TRANSACTIONS_ORDER_STATUS_ID, 'id="inputTransactionsOrderStatusId"');
        $result = <<<EOT
<div>
  <p>
    <label for="inputTransactionsOrderStatusId">{$this->title}</label>

    {$this->description}
  </p>

  <div>
    {$input}
  </div>
</div>
EOT;
        return $result;
    }
예제 #20
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);
     }
 }
예제 #21
0
 public function __construct()
 {
     global $temp_orders_id, $currency, $languages_code, $api;
     require_once 'api/icepay_api_basic.php';
     //load config => title, text, sort_order, status, zone, order_status_id, works_with_shipping_module
     if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE 'checkout_" . get_class($this) . "'")) < 1) {
         $this->install();
     }
     $query = tep_db_query('SELECT * FROM checkout_' . get_class($this));
     while ($array = tep_db_fetch_array($query)) {
         $this->instances[get_class($this) . '_' . $array['id']] = $array;
     }
     if ($temp_orders_id > 0) {
         $this->temp_data = Checkout::get_all_data_from_temp_db($temp_orders_id);
         //get all orders data
         foreach ($this->temp_data[$temp_orders_id]['orders_total'] as $key => $data) {
             if ($data['class'] == 'order_total') {
                 $this->order_total = $data['value'];
             }
         }
         $country = tep_get_countries_with_iso_codes($this->temp_data[$temp_orders_id]['orders']['billing_country']);
         // Read paymentmethods from folder, load the classes and filter the data
         $api = Icepay_Api_Basic::getInstance()->readFolder(realpath('api/paymentmethods'))->prepareFiltering()->filterByStatus()->filterByAmount($this->order_total);
         // Store the filtered data in an array;
         $this->paymentmethods = $api->getArray();
     }
 }
 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);
         }
     }
 }
예제 #23
0
 function getDetail($products_id, $elements_id = null)
 {
     if (is_null($this->id) && !is_null($products_id)) {
         $q = tep_db_query("SELECT drafts_id FROM designs_products WHERE products_id={$products_id}");
         if (tep_db_num_rows($q) > 0) {
             $r = tep_db_fetch_array($q);
             $this->id = $r['drafts_id'];
         }
     } elseif (is_null($this->id) && !is_null($elements_id)) {
         $q = tep_db_query("SELECT drafts_id FROM designs_elements WHERE elements_id={$elements_id}");
         if (tep_db_num_rows($q) > 0) {
             $r = tep_db_fetch_array($q);
             $this->id = $r['drafts_id'];
         }
     }
     $id = $this->id;
     $q = "SELECT dd.* FROM designs_drafts dd WHERE dd.drafts_id='{$id}'";
     $r = tep_db_query($q);
     if (tep_db_num_rows($r) > 0) {
         $row = tep_db_fetch_array($r);
         $this->setDetail($row['designs_id'], $row['drafts_name'], $row['image_1'], $row['approve_status'], $row['approve_date'], $row['approve_by'], $row['comments'], $row['comments_last_update_time'], $row['comments_last_update_by'], $row['colors_request'], $row['products_image_by'], $row['products_image_start'], $row['followers'], $row['wax_history_info']);
     } else {
         $this->id = null;
         $this->setDetail();
     }
 }
예제 #24
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++;
     }
 }
예제 #25
0
 function restore_wishlist()
 {
     global $customer_id;
     if (!tep_session_is_registered('customer_id')) {
         return false;
     }
     // merge current wishlist items in database
     if (isset($this->wishID) && is_array($this->wishID)) {
         reset($this->wishID);
         while (list($wishlist_id, ) = each($this->wishID)) {
             $wishlist_query = tep_db_query("select products_id from " . TABLE_WISHLIST . " where customers_id = '" . $customer_id . "' and products_id = '" . $wishlist_id . "'");
             if (!tep_db_num_rows($wishlist_query)) {
                 tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id) values ('" . $customer_id . "', '" . $wishlist_id . "')");
                 if (isset($this->wishID[$wishlist_id]['attributes'])) {
                     reset($this->wishID[$wishlist_id]['attributes']);
                     while (list($option, $value) = each($this->wishID[$wishlist_id]['attributes'])) {
                         tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $wishlist_id . "', '" . $option . "', '" . $value . "' )");
                     }
                 }
             }
         }
     }
     // reset session contents
     unset($this->wishID);
     $wishlist_session = tep_db_query("select products_id from " . TABLE_WISHLIST . " where customers_id = '" . $customer_id . "'");
     while ($wishlist = tep_db_fetch_array($wishlist_session)) {
         $this->wishID[$wishlist['products_id']] = array($wishlist['products_id']);
         // attributes
         $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_WISHLIST_ATTRIBUTES . " where customers_id = '" . $customer_id . "' and products_id = '" . $wishlist['products_id'] . "'");
         while ($attributes = tep_db_fetch_array($attributes_query)) {
             $this->wishID[$wishlist['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
         }
     }
 }
 function OSCOM_PayPal_HS_Cfg_prepare_order_status_id()
 {
     global $OSCOM_PayPal;
     $this->title = $OSCOM_PayPal->getDef('cfg_hs_prepare_order_status_id_title');
     $this->description = $OSCOM_PayPal->getDef('cfg_hs_prepare_order_status_id_desc');
     if (!defined('OSCOM_APP_PAYPAL_HS_PREPARE_ORDER_STATUS_ID')) {
         $check_query = tep_db_query("select orders_status_id from orders_status where orders_status_name = 'Preparing [PayPal Pro HS]' limit 1");
         if (tep_db_num_rows($check_query) < 1) {
             $status_query = tep_db_query("select max(orders_status_id) as status_id from orders_status");
             $status = tep_db_fetch_array($status_query);
             $status_id = $status['status_id'] + 1;
             $languages = tep_get_languages();
             foreach ($languages as $lang) {
                 tep_db_query("insert into orders_status (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal Pro HS]')");
             }
             $flags_query = tep_db_query("describe orders_status public_flag");
             if (tep_db_num_rows($flags_query) == 1) {
                 tep_db_query("update orders_status set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");
             }
         } else {
             $check = tep_db_fetch_array($check_query);
             $status_id = $check['orders_status_id'];
         }
     } else {
         $status_id = OSCOM_APP_PAYPAL_HS_PREPARE_ORDER_STATUS_ID;
     }
     $this->default = $status_id;
 }
 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);
         }
     }
 }
예제 #28
0
 function createNew($package_code = '', $package_type = null)
 {
     $counter = 0;
     if ($package_code == '') {
         $counter++;
         $prefix = !is_null($package_type) ? 'JG' : 'RET';
         $dateprefix = date('ymd');
         $package_code = $prefix . '-' . $dateprefix . '-' . $counter;
     }
     $check_code_exist = tep_db_query("SELECT packages_id FROM minierp_packages WHERE packages_code='{$package_code}'");
     while (tep_db_num_rows($check_code_exist) > 0) {
         if ($counter > 0) {
             $old_counter = $dateprefix . '-' . $counter;
             $counter++;
             $new_counter = $dateprefix . '-' . $counter;
             $package_code = str_replace($old_counter, $new_counter, $package_code);
         } else {
             $package_code .= '-New';
         }
         $check_code_exist = tep_db_query("SELECT packages_id FROM minierp_packages WHERE packages_code='{$package_code}'");
     }
     $psda = array();
     //$psda['logistic_partners'] = 'SPN';
     $psda['packages_code'] = $package_code;
     if (!is_null($package_type)) {
         $psda['package_type'] = $package_type;
     }
     tep_db_perform('minierp_packages', $psda);
     $new_id = tep_db_insert_id();
     return $new_id;
 }
예제 #29
0
 function retrieveDetail($jng_warehouses_id)
 {
     $wh = null;
     $wh_query = tep_db_query("SELECT * FROM jng_warehouses WHERE jng_warehouses_id={$jng_warehouses_id}");
     $wh = tep_db_num_rows($wh_query) > 0 ? tep_db_fetch_array($wh_query) : null;
     return $wh;
 }
 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;
 }