Exemplo n.º 1
0
 function freeamount()
 {
     global $order;
     $this->code = 'freeamount';
     $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION;
     $this->icon = '';
     // change $this->icon =  DIR_WS_ICONS . 'shipping_ups.gif'; to some freeshipping icon
     $this->tax_class = MODULE_SHIPPING_FREEAMOUNT_TAX_CLASS;
     $this->sort_order = MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER;
     $this->enabled = MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_FREEAMOUNT_ZONE > 0) {
         $check_flag = false;
         $check_query = vam_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEAMOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = vam_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;
         }
     }
 }
function vam_get_download($content_id)
{
    $content_query = vam_db_query("SELECT\n\t\t\t\t\tcontent_file,\n\t\t\t\t\tcontent_read\n\t\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\t\tWHERE content_id='" . $content_id . "'");
    $content_data = vam_db_fetch_array($content_query);
    // update file counter
    vam_db_query("UPDATE \n\t\t\t" . TABLE_PRODUCTS_CONTENT . " \n\t\t\tSET content_read='" . ($content_data['content_read'] + 1) . "'\n\t\t\tWHERE content_id='" . $content_id . "'");
    // original filename
    $filename = DIR_FS_CATALOG . 'media/products/' . $content_data['content_file'];
    $backup_filename = DIR_FS_CATALOG . 'media/products/backup/' . $content_data['content_file'];
    // create md5 hash id from original file
    $orign_hash_id = md5_file($filename);
    clearstatcache();
    // create new filename with timestamp
    $timestamp = str_replace('.', '', microtime());
    $timestamp = str_replace(' ', '', $timestamp);
    $new_filename = DIR_FS_CATALOG . 'media/products/' . $timestamp . strstr($content_data['content_file'], '.');
    // rename file
    rename($filename, $new_filename);
    if (file_exists($new_filename)) {
        header("Content-type: application/force-download");
        header("Content-Disposition: attachment; filename=" . $new_filename);
        @readfile($new_filename);
        // rename file to original name
        rename($new_filename, $filename);
        $new_hash_id = md5_file($filename);
        clearstatcache();
        // check hash id of file again, if not same, get backup!
        if ($new_hash_id != $orign_hash_id) {
            copy($backup_filename, $filename);
        }
    }
}
Exemplo n.º 3
0
 function item()
 {
     global $order;
     $this->code = 'item';
     $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_ITEM_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_ITEM_ZONE > 0) {
         $check_flag = false;
         $check_query = vam_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = vam_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;
         }
     }
 }
Exemplo n.º 4
0
function ship2pay()
{
    global $order;
    $shipping = $_SESSION['shipping'];
    $shipping_module = substr($shipping['id'], 0, strpos($shipping['id'], '_')) . '.php';
    $q_ship2pay = vamDBquery("SELECT payments_allowed, zones_id FROM " . TABLE_SHIP2PAY . " where shipment = '" . $shipping_module . "' and status=1");
    $check_flag = false;
    while ($mods = vam_db_fetch_array($q_ship2pay, true)) {
        if ($mods['zones_id'] > 0) {
            $check_query = vamDBquery("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $mods['zones_id'] . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
            while ($check = vam_db_fetch_array($check_query, true)) {
                if ($check['zone_id'] < 1) {
                    $check_flag = true;
                    break 2;
                } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
                    $check_flag = true;
                    break 2;
                }
            }
        } else {
            $check_flag = true;
            break;
        }
    }
    if ($check_flag) {
        $modules = $mods['payments_allowed'];
    } else {
        $modules = MODULE_PAYMENT_INSTALLED;
    }
    $modules = explode(';', $modules);
    return $modules;
}
function vam_get_tax_description($class_id, $country_id = -1, $zone_id = -1)
{
    if ($country_id == -1 && $zone_id == -1) {
        if (!isset($_SESSION['customer_id'])) {
            $country_id = STORE_COUNTRY;
            $zone_id = STORE_ZONE;
        } else {
            $country_id = $_SESSION['customer_country_id'];
            $zone_id = $_SESSION['customer_zone_id'];
        }
    } else {
        $country_id = $country_id;
        $zone_id = $zone_id;
    }
    $tax_query = vamDBquery("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . $country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . $zone_id . "') and tr.tax_class_id = '" . $class_id . "' order by tr.tax_priority");
    if (vam_db_num_rows($tax_query, true)) {
        $tax_description = '';
        while ($tax = vam_db_fetch_array($tax_query, true)) {
            $tax_description .= $tax['tax_description'] . ' + ';
        }
        $tax_description = substr($tax_description, 0, -3);
        return $tax_description;
    } else {
        return TEXT_UNKNOWN_TAX_RATE;
    }
}
Exemplo n.º 6
0
 /**
  * class constructor
  */
 function dhl()
 {
     global $order;
     $this->code = 'dhl';
     $this->title = MODULE_SHIPPING_DHL_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_DHL_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_DHL_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_dhl.gif';
     $this->tax_class = MODULE_SHIPPING_DHL_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_DHL_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_DHL_ZONE > 0) {
         $check_flag = false;
         $check_query = vam_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_DHL_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = vam_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('ECX' => 'EU Express Service', 'DOX' => 'Document Express Service', 'SDX' => 'Start Day Express Service', 'MDX' => 'Mid Day Express Service', 'WPX' => 'Waren Express Service');
     /**
      * CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      */
     $this->num_dhl = 10;
 }
function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
    // LOCK TABLES
    @mysql_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
    if ($affiliate_parent > 0) {
        $affiliate_root_query = vam_db_query("select affiliate_root, affiliate_rgt, affiliate_lft from  " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' ");
        // Check if we have a parent affiliate
        if ($affiliate_root_array = vam_db_fetch_array($affiliate_root_query)) {
            vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root  =  '" . $affiliate_root_array['affiliate_root'] . "' and  affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . "  AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
            vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root  =  '" . $affiliate_root_array['affiliate_root'] . "' and  affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . "  ");
            $sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root'];
            $sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt'];
            $sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1;
            vam_db_perform(TABLE_AFFILIATE, $sql_data_array);
            $affiliate_id = vam_db_insert_id();
        }
        // no parent -> new root
    } else {
        $sql_data_array['affiliate_lft'] = '1';
        $sql_data_array['affiliate_rgt'] = '2';
        vam_db_perform(TABLE_AFFILIATE, $sql_data_array);
        $affiliate_id = vam_db_insert_id();
        vam_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
    }
    // UNLOCK TABLES
    @mysql_query("UNLOCK TABLES");
    return $affiliate_id;
}
Exemplo n.º 8
0
function updateBill($login, $password, $txn, $status)
{
    //обработка возможных ошибок авторизации
    if ($login != MODULE_PAYMENT_QIWI_ID) {
        return 150;
    }
    if (!empty($password) && $password != strtoupper(md5($txn . strtoupper(md5(MODULE_PAYMENT_QIWI_SECRET_KEY))))) {
        return 150;
    }
    // получаем номер заказа
    $transaction = intval($txn);
    // проверяем, есть ли такой заказ в базе
    $order_query = vam_db_query("select count(*) as total from " . TABLE_ORDERS . " where orders_id = '" . (int) $transaction . "'");
    $order_exists = vam_db_fetch_array($order_query);
    if ($order_exists['total'] <= 0) {
        return 210;
    }
    // меняем статус заказа при условии оплаты счёта
    if ($status == 60) {
        $sql_data_array = array('orders_status' => MODULE_PAYMENT_QIWI_ORDER_STATUS_ID);
        vam_db_perform('orders', $sql_data_array, 'update', "orders_id='" . $transaction . "'");
        $sql_data_arrax = array('orders_id' => $transaction, 'orders_status_id' => MODULE_PAYMENT_QIWI_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'QIWI accepted this order payment');
        vam_db_perform('orders_status_history', $sql_data_arrax);
        // Отправляем письмо клиенту и админу о смене статуса заказа
        require_once DIR_WS_CLASSES . 'order.php';
        $order = new order($transaction);
        $vamTemplate = new vamTemplate();
        // assign language to template for caching
        $vamTemplate->assign('language', $_SESSION['language']);
        $vamTemplate->caching = false;
        $vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
        $vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
        $vamTemplate->assign('NAME', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
        $vamTemplate->assign('ORDER_NR', $transaction);
        $vamTemplate->assign('ORDER_LINK', vam_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $transaction, 'SSL'));
        $vamTemplate->assign('ORDER_DATE', vam_date_long($order->info['date_purchased']));
        $lang_query = vam_db_query("select languages_id from " . TABLE_LANGUAGES . " where directory = '" . $_SESSION['language'] . "'");
        $lang = vam_db_fetch_array($lang_query);
        $lang = $lang['languages_id'];
        if (!isset($lang)) {
            $lang = $_SESSION['languages_id'];
        }
        $orders_status_array = array();
        $orders_status_query = vam_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . $lang . "'");
        while ($orders_status = vam_db_fetch_array($orders_status_query)) {
            $orders_statuses[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']);
            $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
        }
        $vamTemplate->assign('ORDER_STATUS', $orders_status_array[MODULE_PAYMENT_QIWI_ORDER_STATUS_ID]);
        $html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/change_order_mail.html');
        $txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/change_order_mail.txt');
        include_once DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/qiwi.php';
        // create subject
        $order_subject = str_replace('{$nr}', $transaction, MODULE_PAYMENT_QIWI_EMAIL_SUBJECT);
        // send mail to admin
        vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, EMAIL_BILLING_ADDRESS, STORE_NAME, EMAIL_BILLING_FORWARDING_STRING, $order->customer['email_address'], $order->customer['firstname'], '', '', $order_subject, $html_mail, $txt_mail);
        // send mail to customer
        vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $order_subject, $html_mail, $txt_mail);
    }
}
 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 = vam_db_query("select count(*) as total " . substr($sql_query, $pos_from, $pos_to - $pos_from));
     $reviews_count = vam_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);
     if ($offset < 0) {
         $offset = 0;
     }
     $sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
 }
Exemplo n.º 10
0
function get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false, $cPath = '')
{
    if ($parent_id == 0) {
        $cPath = '';
    } else {
        $cPath .= $parent_id . '_';
    }
    if (!is_array($category_tree_array)) {
        $category_tree_array = array();
    }
    if (sizeof($category_tree_array) < 1 && $exclude != '0') {
        $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);
    }
    if ($include_itself) {
        $category_query = "select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $_SESSION['languages_id'] . "' and c.categories_status = '1' and cd.categories_id = '" . $parent_id . "'";
        $category_query = vamDBquery($category_query);
        $category = vam_db_fetch_array($category_query, true);
        $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
    }
    $categories_query = "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $_SESSION['languages_id'] . "' and c.parent_id = '" . $parent_id . "' and c.categories_status = '1' order by c.sort_order, cd.categories_name";
    $categories_query = vamDBquery($categories_query);
    while ($categories = vam_db_fetch_array($categories_query, true)) {
        $SEF_link = vam_href_link(FILENAME_DEFAULT, vam_category_link($categories['categories_id'], $categories['categories_name']));
        if ($exclude != $categories['categories_id']) {
            $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'link' => $SEF_link);
        }
        $category_tree_array = get_category_tree($categories['categories_id'], $spacing . '&nbsp;&nbsp;&nbsp;', $exclude, $category_tree_array, false, $cPath);
    }
    return $category_tree_array;
}
Exemplo n.º 11
0
 function fedexeu()
 {
     global $order;
     $this->code = 'fedexeu';
     $this->title = MODULE_SHIPPING_FEDEXEU_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FEDEXEU_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_FEDEXEU_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_fedexeu.gif';
     $this->tax_class = MODULE_SHIPPING_FEDEXEU_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_FEDEXEU_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_FEDEXEU_ZONE > 0) {
         $check_flag = false;
         $check_query = vam_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FEDEXEU_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = vam_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('ENV' => 'FedEx Envelope', 'PAK' => 'FedEx Pak', 'BOX' => 'FedEx Box');
     /**
      * CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      */
     $this->num_fedexeu = 8;
 }
function vam_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n")
{
    $address_query = vam_db_query("select entry_firstname as firstname, entry_secondname as secondname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customers_id . "' and address_book_id = '" . $address_id . "'");
    $address = vam_db_fetch_array($address_query);
    $format_id = vam_get_address_format_id($address['country_id']);
    return vam_address_format($format_id, $address, $html, $boln, $eoln);
}
function vam_get_products_image($products_id = '')
{
    $product_query = "select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'";
    $product_query = vamDBquery($product_query);
    $products_image = vam_db_fetch_array($product_query, true);
    return $products_image['products_image'];
}
function vam_display_banner($action, $identifier)
{
    if ($action == 'dynamic') {
        $banners_query = vam_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
        $banners = vam_db_fetch_array($banners_query);
        if ($banners['count'] > 0) {
            $banner = vam_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
        } else {
            return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $banner_query = vam_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . $identifier . "'");
            if (vam_db_num_rows($banner_query)) {
                $banner = vam_db_fetch_array($banner_query);
            } else {
                return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>';
            }
        }
    } else {
        return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>';
    }
    if (vam_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = '<a href="' . vam_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" onclick="window.open(this.href); return false;">' . vam_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . '</a>';
    }
    vam_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}
function vam_get_products_stock($products_id)
{
    $products_id = vam_get_prid($products_id);
    $stock_query = vam_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
    $stock_values = vam_db_fetch_array($stock_query);
    return $stock_values['products_quantity'];
}
function vam_get_vpe_name($vpeID)
{
    $vpe_query = "SELECT products_vpe_name FROM " . TABLE_PRODUCTS_VPE . " WHERE language_id='" . (int) $_SESSION['languages_id'] . "' and products_vpe_id='" . $vpeID . "'";
    $vpe_query = vamDBquery($vpe_query);
    $vpe = vam_db_fetch_array($vpe_query, true);
    return $vpe['products_vpe_name'];
}
function vam_oe_customer_infos($customers_id)
{
    $customer_query = vam_db_query("select a.entry_country_id, a.entry_zone_id from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " a where c.customers_id  = '" . $customers_id . "' and c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id");
    $customer = vam_db_fetch_array($customer_query);
    $customer_info_array = array('country_id' => $customer['entry_country_id'], 'zone_id' => $customer['entry_zone_id']);
    return $customer_info_array;
}
Exemplo n.º 18
0
function vam_get_path($current_category_id = '')
{
    global $cPath_array;
    if (vam_not_null($current_category_id)) {
        $cp_size = sizeof($cPath_array);
        if ($cp_size == 0) {
            $cPath_new = $current_category_id;
        } else {
            $cPath_new = '';
            $last_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $cPath_array[$cp_size - 1] . "'";
            $last_category_query = vamDBquery($last_category_query);
            $last_category = vam_db_fetch_array($last_category_query, true);
            $current_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $current_category_id . "'";
            $current_category_query = vamDBquery($current_category_query);
            $current_category = vam_db_fetch_array($current_category_query, true);
            if ($last_category['parent_id'] == $current_category['parent_id']) {
                for ($i = 0; $i < $cp_size - 1; $i++) {
                    $cPath_new .= '_' . $cPath_array[$i];
                }
            } else {
                for ($i = 0; $i < $cp_size; $i++) {
                    $cPath_new .= '_' . $cPath_array[$i];
                }
            }
            $cPath_new .= '_' . $current_category_id;
            if (substr($cPath_new, 0, 1) == '_') {
                $cPath_new = substr($cPath_new, 1);
            }
        }
    } else {
        $cPath_new = vam_not_null($cPath_array) ? implode('_', $cPath_array) : '';
    }
    return 'cPath=' . $cPath_new;
}
Exemplo n.º 19
0
 function update_status()
 {
     global $order;
     $check_order_query = vam_db_query("select count(*) as count from " . TABLE_ORDERS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
     $order_check = vam_db_fetch_array($check_order_query);
     if ($order_check['count'] < MODULE_PAYMENT_INVOICE_MIN_ORDER) {
         $check_flag = false;
         $this->enabled = false;
     } else {
         $check_flag = true;
         if ($this->enabled == true && (int) MODULE_PAYMENT_INVOICE_ZONE > 0) {
             $check_flag = false;
             $check_query = vam_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_INVOICE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
             while ($check = vam_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;
         }
     }
 }
Exemplo n.º 20
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->free = MODULE_SHIPPING_UPS_TEXT_FREE;
     $this->enabled = MODULE_SHIPPING_UPS_STATUS == 'True' ? true : false;
     if ($this->enabled == true && (int) MODULE_SHIPPING_UPS_ZONE > 0) {
         $check_flag = false;
         $check_query = vam_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 = vam_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;
         }
     }
     /**
      * CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      */
     $this->num_ups = 7;
 }
function vam_get_tax_rate($class_id, $country_id = -1, $zone_id = -1)
{
    if ($country_id == -1 && $zone_id == -1) {
        if (!isset($_SESSION['customer_id'])) {
            $country_id = STORE_COUNTRY;
            $zone_id = STORE_ZONE;
        } else {
            $country_id = $_SESSION['customer_country_id'];
            $zone_id = $_SESSION['customer_zone_id'];
        }
    } else {
        $country_id = $country_id;
        $zone_id = $zone_id;
    }
    $tax_query = vamDBquery("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . $country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . $zone_id . "') and tr.tax_class_id = '" . $class_id . "' group by tr.tax_priority");
    if (vam_db_num_rows($tax_query, true)) {
        $tax_multiplier = 1.0;
        while ($tax = vam_db_fetch_array($tax_query, true)) {
            $tax_multiplier *= 1.0 + $tax['tax_rate'] / 100;
        }
        return ($tax_multiplier - 1.0) * 100;
    } else {
        return 0;
    }
}
 function vam_get_tax_title_class_id($tax_class_title)
 {
     $classes_query = vam_db_query("select tax_class_id from " . TABLE_TAX_CLASS . " WHERE tax_class_title = '" . $tax_class_title . "'");
     $tax_class_array = vam_db_fetch_array($classes_query);
     $tax_class_id = $tax_class_array['tax_class_id'];
     return $tax_class_id;
 }
Exemplo n.º 23
0
 /**
  * class constructor
  */
 function chronopost()
 {
     $this->code = 'chronopost';
     $this->title = MODULE_SHIPPING_CHRONOPOST_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_CHRONOPOST_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_CHRONOPOST_SORT_ORDER;
     $this->icon = DIR_WS_ICONS . 'shipping_chronopost.gif';
     $this->tax_class = MODULE_SHIPPING_CHRONOPOST_TAX_CLASS;
     $this->enabled = MODULE_SHIPPING_CHRONOPOST_STATUS == 'True' ? true : false;
     /**
      * CUSTOMIZE THIS SETTING FOR THE NUMBER OF chronopost NEEDED
      */
     $this->num_chronopost = 10;
     //NBen je remplace 1 par 10
     if ($this->enabled == true && (int) MODULE_SHIPPING_CHRONOPOST_ZONE > 0) {
         $check_flag = false;
         $check_query = vam_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_CHRONOPOST_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
         while ($check = vam_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;
         }
     }
 }
function file_changers($file_path)
{
    $result = vam_db_query("\n            SELECT content_md5, modification_date, contrib\n            FROM " . TABLE_CIP_FILE_INTEGRITY . "\n            WHERE path_md5='" . md5($file_path) . "'\n            ORDER BY modification_date");
    while ($file_changer = vam_db_fetch_array($result)) {
        $array[] = array('path_md5' => $file_changer['path_md5'], 'content_md5' => $file_changer['content_md5'], 'modification_date' => $file_changer['modification_date'], 'contrib' => $file_changer['contrib']);
    }
    return $array;
}
Exemplo n.º 25
0
 function currencies()
 {
     $this->currencies = array();
     $currencies_query = vam_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
     while ($currencies = vam_db_fetch_array($currencies_query)) {
         $this->currencies[$currencies['code']] = array('title' => $currencies['title'], 'symbol_left' => $currencies['symbol_left'], 'symbol_right' => $currencies['symbol_right'], 'decimal_point' => $currencies['decimal_point'], 'thousands_point' => $currencies['thousands_point'], 'decimal_places' => $currencies['decimal_places'], 'value' => $currencies['value']);
     }
 }
function get_price_range($current_category)
{
    $sql = "SELECT MAX(p.products_price) max_price, MIN(p.products_price) min_price\n            FROM " . TABLE_PRODUCTS . " p \n            INNER JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ON p2c.products_id = p.products_id AND p2c.categories_id = " . $current_category . "\n            WHERE p.products_status = '1'";
    $res = vam_db_query($sql);
    $price_limit = vam_db_fetch_array($res);
    $result = "<script type='text/javascript'>\n\t\tvar min_price = " . $price_limit['min_price'] . ";\n\t\tvar max_price = " . $price_limit['max_price'] . ";\n     </script>";
    return $result;
}
Exemplo n.º 27
0
 function selection()
 {
     global $order;
     $payment_query = vam_db_query("select * from " . TABLE_COMPANIES . " where customers_id = '" . (int) $order->customer['id'] . "'");
     $payment_data = vam_db_fetch_array($payment_query);
     $selection = array('id' => $this->code, 'module' => $this->title, 'description' => $this->info, 'fields' => array(array('title' => '<div id="schet">' . MODULE_PAYMENT_SCHET_J_NAME_TITLE, 'field' => MODULE_PAYMENT_SCHET_J_NAME_DESC), array('title' => MODULE_PAYMENT_SCHET_J_NAME, 'field' => vam_draw_input_field('s_name', $payment_data['name']) . MODULE_PAYMENT_SCHET_J_NAME_IP), array('title' => MODULE_PAYMENT_SCHET_J_INN, 'field' => vam_draw_input_field('s_inn')), array('title' => MODULE_PAYMENT_SCHET_J_TELEPHONE, 'field' => vam_draw_input_field('s_telephone', $order->customer['telephone']) . '</div>')));
     return $selection;
 }
function vam_get_customers_country($customers_id)
{
    $customers_query = vam_db_query("select customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customers_id . "'");
    $customers = vam_db_fetch_array($customers_query);
    $address_book_query = vam_db_query("select entry_country_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . $customers['customers_default_address_id'] . "'");
    $address_book = vam_db_fetch_array($address_book_query);
    return $address_book['entry_country_id'];
}
function vam_oe_get_options_values_name($products_options_values_id, $language = '')
{
    if (empty($language)) {
        $language = $_SESSION['languages_id'];
    }
    $product_query = vam_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $products_options_values_id . "' and language_id = '" . $language . "'");
    $product = vam_db_fetch_array($product_query);
    return $product['products_options_values_name'];
}
function vam_expire_specials()
{
    $specials_query = vam_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (vam_db_num_rows($specials_query)) {
        while ($specials = vam_db_fetch_array($specials_query)) {
            vam_set_specials_status($specials['specials_id'], '0');
        }
    }
}