Esempio n. 1
0
function smn_update_whos_online()
{
    global $customer_id;
    if (smn_session_is_registered('customer_id')) {
        $wo_customer_id = $customer_id;
        $customer_query = smn_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
        $customer = smn_db_fetch_array($customer_query);
        $wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
    } else {
        $wwo_full_name = 'Guest';
    }
    $wo_session_id = smn_session_id();
    $wo_ip_address = getenv('REMOTE_ADDR');
    $wo_last_page_url = getenv('REQUEST_URI');
    $current_time = time();
    $xx_mins_ago = $current_time - 900;
    // remove entries that have expired
    smn_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
    $stored_customer_query = smn_db_query("select count(*) as count from " . TABLE_WHOS_ONLINE . " where session_id = '" . smn_db_input($wo_session_id) . "'");
    $stored_customer = smn_db_fetch_array($stored_customer_query);
    if ($stored_customer['count'] > 0) {
        smn_db_query("update " . TABLE_WHOS_ONLINE . " set customer_id = '" . (int) $wo_customer_id . "', full_name = '" . smn_db_input($wo_full_name) . "', ip_address = '" . smn_db_input($wo_ip_address) . "', time_last_click = '" . smn_db_input($current_time) . "', last_page_url = '" . smn_db_input($wo_last_page_url) . "' where session_id = '" . smn_db_input($wo_session_id) . "'");
    } else {
        smn_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 . "', '" . smn_db_input($wo_full_name) . "', '" . smn_db_input($wo_session_id) . "', '" . smn_db_input($wo_ip_address) . "', '" . smn_db_input($current_time) . "', '" . smn_db_input($current_time) . "', '" . smn_db_input($wo_last_page_url) . "')");
    }
}
 function add_session($message, $type = 'error')
 {
     global $messageToStack;
     if (!smn_session_is_registered('messageToStack')) {
         smn_session_register('messageToStack');
         $messageToStack = array();
     }
     $messageToStack[] = array('text' => $message, 'type' => $type);
 }
 function store_modules($modulesType = 'shipping', $module = false)
 {
     global $customer_store_id, $store_id;
     if (smn_session_is_registered('store_id')) {
         $this->store_id = $store_id;
     } else {
         $this->store_id = $customer_store_id;
     }
     $this->module = array('type' => $modulesType, 'key' => 'MODULE_' . strtoupper($modulesType) . '_INSTALLED', 'headingTitle' => @constant('HEADING_TITLE_MODULES_' . strtoupper($modulesType)), 'installed' => @constant('MODULE_' . strtoupper($modulesType) . '_INSTALLED'), 'installedS' => @constant('MODULE_' . strtoupper($modulesType) . '_INSTALLED'), 'directory' => DIR_FS_CATALOG . DIR_WS_MODULES . $modulesType . '/');
     if ($module !== false) {
         if (file_exists($this->module['directory'] . $module . '.php')) {
             $this->module['installed'] = $module . '.php';
         }
     }
     $this->loadModules();
     $this->loadLanguageDefines();
 }
Esempio n. 4
0
function smn_count_customer_address_book_entries($id = '', $check_session = true)
{
    global $customer_id;
    if (is_numeric($id) == false) {
        if (smn_session_is_registered('customer_id')) {
            $id = $customer_id;
        } else {
            return 0;
        }
    }
    if ($check_session == true) {
        if (smn_session_is_registered('customer_id') == false || $id != $customer_id) {
            return 0;
        }
    }
    $addresses_query = smn_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $id . "'");
    $addresses = smn_db_fetch_array($addresses_query);
    return $addresses['total'];
}
    // verify the selected billing address
    if (is_array($billto) && empty($billto) || is_numeric($billto)) {
        $check_address_query = smn_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $billto . "'");
        $check_address = smn_db_fetch_array($check_address_query);
        if ($check_address['total'] != '1') {
            $billto = $customer_default_address_id;
            if (smn_session_is_registered('payment')) {
                smn_session_unregister('payment');
            }
        }
    }
}
require DIR_WS_CLASSES . 'order.php';
$order = new order();
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_total_modules->clear_posts();
if (!smn_session_is_registered('comments')) {
    smn_session_register('comments');
}
if (isset($HTTP_POST_VARS['comments']) && smn_not_null($HTTP_POST_VARS['comments'])) {
    $comments = smn_db_prepare_input($HTTP_POST_VARS['comments']);
}
$total_weight = $cart->show_weight();
$total_count = $cart->count_contents();
$total_count = $cart->count_contents_virtual();
// load all enabled payment modules
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment();
$breadcrumb->add(NAVBAR_TITLE_1, smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
$breadcrumb->add(NAVBAR_TITLE_2, smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
if (smn_session_is_registered('customer_id')) {
    $gv_query = smn_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
    $gv_result = smn_db_fetch_array($gv_query);
    if ($gv_result['amount'] > 0) {
        $boxContent .= smn_draw_separator();
        $boxContent .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>';
        $boxContent .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext"><a href="' . smn_href_link(FILENAME_GV_SEND, 'ID=' . $store_id) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>';
    }
}
if (smn_session_is_registered('gv_id')) {
    $gv_query = smn_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
    $coupon = smn_db_fetch_array($gv_query);
    $boxContent .= smn_draw_separator();
    $boxContent .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>';
}
if (smn_session_is_registered('cc_id') && $cc_id) {
    $coupon_query = smn_db_query("select c.*, cd.* from " . TABLE_COUPONS . "c,  " . TABLE_COUPONS_DESCRIPTION . " cd where cd.coupon_id = '" . $cc_id . "' and c.coupon_id = '" . $cc_id . "' and cd.language_id = '" . $languages_id . "'");
    $coupon = smn_db_fetch_array($coupon_query);
    $coupon_desc_query = smn_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $cc_id . "' and language_id = '" . $languages_id . "'");
    $coupon_desc = smn_db_fetch_array($coupon_desc_query);
    $text_coupon_help = sprintf("%s", $coupon_desc['coupon_name']);
    $boxContent .= smn_draw_separator();
    $boxContent .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="infoBoxContents">' . CART_COUPON . $text_coupon_help . '<br>' . '</td></tr></table>';
}
if (file_exists(DIR_WS_BOX_TEMPLATES . $box_base_name . '.php')) {
    require DIR_WS_BOX_TEMPLATES . $box_base_name . '.php';
} else {
    require DEFAULT_TEMPLATENAME_BOX;
}
$boxContent_attributes = '';
$boxLink = '';
Esempio n. 7
0
function smn_get_tax_rate($class_id, $country_id = -1, $zone_id = -1, $use_store_id = '')
{
    global $customer_zone_id, $customer_country_id, $store_id;
    if ($use_store_id == '') {
        $use_store_id = $store_id;
    }
    if ($country_id == -1 && $zone_id == -1) {
        if (!smn_session_is_registered('customer_id')) {
            $country_id = STORE_COUNTRY;
            $zone_id = STORE_ZONE;
        } else {
            $country_id = $customer_country_id;
            $zone_id = $customer_zone_id;
        }
    }
    $tax_query = smn_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za ON tr.tax_zone_id = za.geo_zone_id left join " . TABLE_GEO_ZONES . " tz ON tz.geo_zone_id = tr.tax_zone_id WHERE (za.zone_country_id IS NULL OR za.zone_country_id = '0' OR za.zone_country_id = '" . (int) $country_id . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . (int) $zone_id . "') AND tr.tax_class_id = '" . (int) $class_id . "' and tr.store_id = ' " . $store_id . "' and za.store_id = ' " . $store_id . "' GROUP BY tr.tax_priority");
    if (smn_db_num_rows($tax_query)) {
        $tax_multiplier = 0;
        while ($tax = smn_db_fetch_array($tax_query)) {
            $tax_multiplier += $tax['tax_rate'];
        }
        return $tax_multiplier;
    } else {
        return 0;
    }
}
                }
            }
        } else {
            smn_session_register('sendto');
        }
        $sendto = $_POST['address'];
        $check_address_query = smn_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $sendto . "'");
        $check_address = smn_db_fetch_array($check_address_query);
        if ($check_address['total'] == '1') {
            if ($reset_shipping == true) {
                smn_session_unregister('shipping');
            }
            smn_redirect(smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
        } else {
            smn_session_unregister('sendto');
        }
    } else {
        if (!smn_session_is_registered('sendto')) {
            smn_session_register('sendto');
        }
        $sendto = $customer_default_address_id;
        smn_redirect(smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
    }
}
// if no shipping destination address was selected, use their own address as default
if (!smn_session_is_registered('sendto')) {
    $sendto = $customer_default_address_id;
}
$breadcrumb->add(NAVBAR_TITLE_1, smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
$breadcrumb->add(NAVBAR_TITLE_2, smn_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'NONSSL'));
$addresses_count = smn_count_customer_address_book_entries();
<?php

/*
  Copyright (c) 2002 - 2006 SystemsManager.Net

  SystemsManager Technologies
  oscMall System Version 4
  http://www.systemsmanager.net
  
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
global $page_name;
if (!smn_session_is_registered('affiliate_id')) {
    $navigation->set_snapshot();
    smn_redirect(smn_href_link(FILENAME_AFFILIATE, '', 'NONSSL'));
}
$breadcrumb->add(NAVBAR_TITLE, smn_href_link(FILENAME_AFFILIATE_CLICKS, '', 'NONSSL'));
$affiliate_clickthroughs_raw = "\n    select a.*, pd.products_name from " . TABLE_AFFILIATE_CLICKTHROUGHS . " a \n    left join " . TABLE_PRODUCTS . " p on (p.products_id = a.affiliate_products_id) \n    left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "') \n    where a.affiliate_id = '" . $affiliate_id . "'  ORDER BY a.affiliate_clientdate desc\n    ";
$affiliate_clickthroughs_split = new splitPageResults($affiliate_clickthroughs_raw, MAX_DISPLAY_SEARCH_RESULTS);
$affiliate_clickthroughs_numrows_raw = "select count(*) as count from " . TABLE_AFFILIATE_CLICKTHROUGHS . " where affiliate_id = '" . $affiliate_id . "'";
$affiliate_clickthroughs_query = smn_db_query($affiliate_clickthroughs_numrows_raw);
$affiliate_clickthroughs_numrows = smn_db_fetch_array($affiliate_clickthroughs_query);
$affiliate_clickthroughs_numrows = $affiliate_clickthroughs_numrows['count'];
?>
 
Esempio n. 10
0
<?php

/*
  Copyright (c) 2002 - 2006 SystemsManager.Net

  SystemsManager Technologies
  oscMall System Version 4
  http://www.systemsmanager.net
  
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
global $page_name;
$cart->reset(TRUE);
if (!smn_session_is_registered('store_id')) {
    smn_session_register('store_id');
}
$store_id = intval($_GET['newID']);
if (!smn_session_is_registered('switch_store_id')) {
    smn_session_register('switch_store_id');
}
$switch_store_id = $store_id;
smn_redirect(smn_href_link(FILENAME_DEFAULT));
Esempio n. 11
0
     } else {
         $entry_password_error = false;
     }
 }
 if ($error == false) {
     //===============================================================================================
     $store_monthly_costs = smn_set_store_cost($new_store_type);
     $check_new_store_type = smn_set_store_type($new_store_type);
     $store_products_id = smn_set_products_id($new_store_type);
     //CREATE STORE IN THE DATABASE.....
     if ($_GET['action'] == 'update') {
         smn_session_register('customers_id');
         $customer_info = new customer($customers_id);
         $store_info = new store((int) $_GET['sID']);
     } else {
         if (!smn_session_is_registered('cart') && !is_object($cart)) {
             smn_session_register('cart');
             $cart = new shoppingCart();
         }
         $customer_info = new customer();
         $store_info = new store();
     }
     $customer_info->set_firstname($firstname);
     $customer_info->set_lastname($lastname);
     $customer_info->set_email_address($email_address);
     $customer_info->set_telephone($telephone);
     $customer_info->set_fax($fax);
     $customer_info->set_newsletter($newsletter);
     $customer_info->set_gender($gender);
     //    $customer_info->set_dob($dob);
     $customer_info->set_street_address($street_address);
            }
        } else {
            smn_session_register('billto');
        }
        $billto = $_POST['address'];
        $check_address_query = smn_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "' and address_book_id = '" . $billto . "'");
        $check_address = smn_db_fetch_array($check_address_query);
        if ($check_address['total'] == '1') {
            if ($reset_payment == true) {
                smn_session_unregister('payment');
            }
            smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
        } else {
            smn_session_unregister('billto');
        }
        // no addresses to select from - customer decided to keep the current assigned address
    } else {
        if (!smn_session_is_registered('billto')) {
            smn_session_register('billto');
        }
        $billto = $customer_default_address_id;
        smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
    }
}
// if no billing destination address was selected, use their own address as default
if (!smn_session_is_registered('billto')) {
    $billto = $customer_default_address_id;
}
$breadcrumb->add(NAVBAR_TITLE_1, smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
$breadcrumb->add(NAVBAR_TITLE_2, smn_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'NONSSL'));
$addresses_count = smn_count_customer_address_book_entries();
Esempio n. 13
0
 function collect_posts()
 {
     global $_POST, $customer_id, $currencies, $cc_id;
     if ($_POST['gv_redeem_code']) {
         // get some info from the coupon table
         $coupon_query = smn_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='" . $_POST['gv_redeem_code'] . "' and coupon_active='Y'");
         $coupon_result = smn_db_fetch_array($coupon_query);
         if ($coupon_result['coupon_type'] != 'G') {
             if (smn_db_num_rows($coupon_query) == 0) {
                 smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(ERROR_NO_INVALID_REDEEM_COUPON), 'NONSSL'));
             }
             $date_query = smn_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='" . $_POST['gv_redeem_code'] . "'");
             if (smn_db_num_rows($date_query) == 0) {
                 smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(ERROR_INVALID_STARTDATE_COUPON), 'NONSSL'));
             }
             $date_query = smn_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='" . $_POST['gv_redeem_code'] . "'");
             if (smn_db_num_rows($date_query) == 0) {
                 smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(ERROR_INVALID_FINISDATE_COUPON), 'NONSSL'));
             }
             $coupon_count = smn_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id'] . "'");
             $coupon_count_customer = smn_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id'] . "' and customer_id = '" . $customer_id . "'");
             if (smn_db_num_rows($coupon_count) >= $coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {
                 smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES), 'NONSSL'));
             }
             if (smn_db_num_rows($coupon_count_customer) >= $coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {
                 smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES), 'NONSSL'));
             }
             global $order, $ot_coupon, $currency;
             if (!smn_session_is_registered('cc_id')) {
                 smn_session_register('cc_id');
             }
             $cc_id = $coupon_result['coupon_id'];
             $coupon_amount = smn_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places']);
             // $cc_id
             $coupon_amount_out = $currencies->format($coupon_amount) . ' ';
             if ($coupon_result['coupon_minimum_order'] > 0) {
                 $coupon_amount_out .= 'on orders greater than ' . $currencies->format($coupon_result['coupon_minimum_order']);
             }
             if (!smn_session_is_registered('cc_id')) {
                 smn_session_register('cc_id');
             }
             $cc_id = $coupon_result['coupon_id'];
             if (strlen($cc_id) > 0 && $coupon_amount == 0) {
                 $err_msg = ERROR_REDEEMED_AMOUNT . ERROR_REDEEMED_AMOUNT_ZERO;
             } else {
                 $err_msg = ERROR_REDEEMED_AMOUNT . $coupon_amount_out;
             }
             smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($err_msg), 'NONSSL'));
         }
         // ENDIF valid coupon code
     }
     // ENDIF code entered
     // v5.13a If no code entered and coupon redeem button pressed, give an alarm
     if ($_POST['submit_redeem_coupon_x']) {
         smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'NONSSL'));
     }
 }
Esempio n. 14
0
 function clear_posts()
 {
     global $_POST, $_VARS;
     if (MODULE_ORDER_TOTAL_INSTALLED) {
         $this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {
                 $post_var = 'c' . $GLOBALS[$class]->code;
                 if (smn_session_is_registered($post_var)) {
                     smn_session_unregister($post_var);
                 }
             }
         }
     }
 }
Esempio n. 15
0
    // check if coupon exist
    if (smn_db_num_rows($gv_query) > 0) {
        $coupon = smn_db_fetch_array($gv_query);
        // check if coupon_id exist and coupon not redeemed
        if ($coupon['coupon_id'] > 0 && $coupon['redeemed'] == 'false') {
            smn_session_unregister('floating_gv_code');
            $gv_query = smn_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $coupon['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')");
            $gv_update = smn_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $coupon['coupon_id'] . "'");
            smn_gv_account_update($customer_id, $coupon['coupon_id']);
        }
    }
}
//**********
/*******************************************************
****  create_account.php  ***********************************
*******************************************************/
if (smn_session_is_registered('floating_gv_code')) {
    $gv_query = smn_db_query("SELECT c.coupon_id, c.coupon_amount, IF(rt.coupon_id>0, 'true', 'false') AS redeemed FROM " . TABLE_COUPONS . " c LEFT JOIN " . TABLE_COUPON_REDEEM_TRACK . " rt USING(coupon_id), " . TABLE_COUPON_EMAIL_TRACK . " et WHERE c.coupon_code = '" . $floating_gv_code . "' AND c.coupon_id = et.coupon_id");
    // check if coupon exist
    if (smn_db_num_rows($gv_query) > 0) {
        $coupon = smn_db_fetch_array($gv_query);
        // check if coupon_id exist and coupon not redeemed
        if ($coupon['coupon_id'] > 0 && $coupon['redeemed'] == 'false') {
            smn_session_unregister('floating_gv_code');
            $gv_query = smn_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $coupon['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')");
            $gv_update = smn_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $coupon['coupon_id'] . "'");
            smn_gv_account_update($customer_id, $coupon['coupon_id']);
        }
    }
}
$breadcrumb->add(NAVBAR_TITLE);
Esempio n. 16
0
                    </tr>
<?php 
}
?>
                       
                  </table>
                </td>
              </tr>
              <tr>
                <td><table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td class="smallText" valign="top"><?php 
echo TEXT_INFO_MODIFIED . $myAccount['admin_modified'];
?>
</td><td align="right"><?php 
if ($HTTP_GET_VARS['action'] == 'edit_process') {
    echo '<a href="' . smn_href_link(FILENAME_ADMIN_ACCOUNT) . '">' . smn_image_button('button_back.gif', IMAGE_BACK) . '</a> ';
    if (smn_session_is_registered('confirm_account')) {
        echo smn_image_submit('button_save.gif', IMAGE_SAVE, 'onClick="validateForm();return document.returnValue"');
    }
} elseif ($HTTP_GET_VARS['action'] == 'check_account') {
    echo '&nbsp;';
} else {
    echo smn_image_submit('button_edit.gif', IMAGE_EDIT);
}
?>
</td><tr></table></td>
              </tr>              
            </table>
   
   
            </td>
<?php 
  oscMall System Version 4
  http://www.systemsmanager.net
  
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately. 
*/
?>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php 
// systemsmanager begin - Dec 13, 2005
if (smn_session_is_registered('error_text')) {
    $messageStack->add('create_store_account_success', $error_text);
    ?>
      <tr>
        <td><?php 
    echo smn_draw_separator('pixel_trans.gif', '100%', '10');
    ?>
</td>
      </tr>
      <tr>
        <td><?php 
    echo $messageStack->output('create_store_account_success');
    ?>
</td>
      </tr>
      <tr>
Esempio n. 18
0
 function apply_credit()
 {
     global $order, $customer_id, $coupon_no, $cot_gv;
     if (smn_session_is_registered('cot_gv')) {
         $gv_query = smn_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
         $gv_result = smn_db_fetch_array($gv_query);
         $gv_payment_amount = $this->deduction;
         $gv_amount = $gv_result['amount'] - $gv_payment_amount;
         $gv_update = smn_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $gv_amount . "' where customer_id = '" . $customer_id . "'");
     }
     return $gv_payment_amount;
 }
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
    $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}
if ($order->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . smn_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . smn_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object(${$payment})) {
    $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
    $payment_class = ${$payment};
    $email_order .= $order->info['payment_method'] . "\n\n";
    if ($payment_class->email_footer) {
        $email_order .= $payment_class->email_footer . "\n\n";
    }
}
smn_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, $store->get_store_owner(), $store->get_store_owner_email_address());
// load the after_process function from the payment modules
$payment_modules->after_process();
// unregister session variables used during checkout
smn_session_unregister('sendto');
smn_session_unregister('billto');
smn_session_unregister('shipping');
smn_session_unregister('shipping_store');
smn_session_unregister('payment');
smn_session_unregister('comments');
if (smn_session_is_registered('credit_covers')) {
    smn_session_unregister('credit_covers');
}
$order_total_modules->clear_posts();
smn_redirect(smn_href_link(FILENAME_CHECKOUT_SUCCESS, 'orders_id=' . $insert_id, 'NONSSL'));
                                    }
                                }
                                $shipping_cost_store = $quotes_store[$k1][$store_list[$k]]['methods'][$k2]['cost'];
                                $shipping_store[$store_list[$k]] = array('id' => $_POST['shipping'], 'title' => $free_shipping == true ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')', 'cost' => $shipping_cost_store);
                            }
                        }
                        smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
                    }
                }
            } else {
                smn_session_unregister('shipping');
                /*Unregister the session shipping_store,By Cimi*/
                smn_session_unregister('shipping_store');
            }
        }
    } else {
        $shipping = false;
        smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
    }
}
// get all available shipping quotes
$quotes = $shipping_modules->quote();
// if no shipping method has been selected, automatically select the cheapest method.
// if the modules status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
if (!smn_session_is_registered('shipping') || smn_session_is_registered('shipping') && $shipping == false && smn_count_shipping_modules() > 1) {
    $shipping = $shipping_modules->cheapest();
}
$breadcrumb->add(NAVBAR_TITLE_1, smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
$breadcrumb->add(NAVBAR_TITLE_2, smn_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL'));
Esempio n. 21
0
    smn_redirect(smn_href_link(FILENAME_LOGIN, '', 'NONSSL'));
}
if (isset($_GET['action']) && $_GET['action'] == 'process') {
    $email_address = smn_db_prepare_input($_POST['email_address']);
    $password = smn_db_prepare_input($_POST['password']);
    // Check if email exists
    $check_admin_query = smn_db_query("select store_id, admin_id as login_id, admin_groups_id as login_groups_id, admin_firstname as login_firstname, admin_email_address as login_email_address, admin_password as login_password, admin_modified as login_modified, admin_logdate as login_logdate, admin_lognum as login_lognum from " . TABLE_ADMIN . " where admin_email_address = '" . smn_db_input($email_address) . "'");
    if (!smn_db_num_rows($check_admin_query)) {
        $login = '******';
    } else {
        $check_admin = smn_db_fetch_array($check_admin_query);
        // Check that password is good
        if (!smn_validate_password($password, $check_admin['login_password'])) {
            $login = '******';
        } else {
            if (smn_session_is_registered('password_forgotten')) {
                smn_session_unregister('password_forgotten');
            }
            $login_id = $check_admin['login_id'];
            $store_id = $check_admin['store_id'];
            $login_groups_id = $check_admin['login_groups_id'];
            $login_firstname = $check_admin['login_firstname'];
            $login_email_address = $check_admin['login_email_address'];
            $login_logdate = $check_admin['login_logdate'];
            $login_lognum = $check_admin['login_lognum'];
            $login_modified = $check_admin['login_modified'];
            smn_session_register('login_id');
            smn_session_register('store_id');
            smn_session_register('login_groups_id');
            smn_session_register('login_first_name');
            //$date_now = date('Ymd');
            break;
        case 'notify_remove':
            if ($store_registered && smn_session_is_registered('customer_id') && isset($_GET['products_id'])) {
                $check_query = smn_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $set_product_id . "' and customers_id = '" . $customer_id . "'");
                $check = smn_db_fetch_array($check_query);
                if ($check['count'] > 0) {
                    smn_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $set_product_id . "' and customers_id = '" . $customer_id . "'");
                }
                smn_redirect(smn_href_link(basename($PHP_SELF), smn_get_all_get_params(array('action'))));
            } else {
                $navigation->set_snapshot();
                smn_redirect(smn_href_link(FILENAME_LOGIN, '', 'NONSSL'));
            }
            break;
        case 'cust_order':
            if ($store_registered && (smn_session_is_registered('customer_id') && isset($_GET['pid']))) {
                if (smn_has_product_attributes($_GET['pid'])) {
                    smn_redirect(smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['pid']));
                } else {
                    $cart->add_cart($_GET['pid'], $cart->get_quantity($_GET['pid']) + 1);
                }
            }
            smn_redirect(smn_href_link($goto, smn_get_all_get_params($parameters)));
            break;
    }
}
// infobox
require DIR_WS_CLASSES . 'boxes.php';
// include the who's online functions
require DIR_WS_FUNCTIONS . 'whos_online.php';
smn_update_whos_online();
        $store_id = $check['store_id'];
        smn_session_register('store_id');
    }
    $filename = basename($PHP_SELF);
    if ($filename != FILENAME_DEFAULT && $filename != FILENAME_FORBIDEN && $filename != FILENAME_LOGOFF && $filename != FILENAME_ADMIN_ACCOUNT && $filename != FILENAME_POPUP_IMAGE && $filename != 'packingslip.php' && $filename != 'invoice.php') {
        $db_file_query = smn_db_query("select admin_files_name, admin_groups_id from " . TABLE_ADMIN_FILES . " where FIND_IN_SET( '" . $login_groups_id . "', admin_groups_id) and admin_files_name = '" . $filename . "'");
        if (!smn_db_num_rows($db_file_query)) {
            //smn_redirect(smn_href_link(FILENAME_FORBIDEN));
        } else {
            $db_file = smn_db_fetch_array($db_file_query);
        }
    }
}
// Check login and file access
if (basename($PHP_SELF) != FILENAME_LOGOFF && basename($PHP_SELF) != FILENAME_LOGIN && basename($PHP_SELF) != FILENAME_PASSWORD_FORGOTTEN) {
    if (!smn_session_is_registered('login_id')) {
        smn_session_unregister('store_id');
        smn_session_unregister('login_id');
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
            echo '{
                success: false,
                errorType: "login",
                errorMsg: "Your Login Session Has Expired, Use The Fields Below To Login."
            }';
            exit;
        }
        smn_redirect(smn_href_link(FILENAME_LOGIN, '', 'NONSSL'));
    }
}
define('AFFILIATE_NOTIFY_AFTER_BILLING', 'true');
// Nofify affiliate if he got a new invoice
*/
global $page_name;
// file uploading class
require DIR_WS_CLASSES . 'upload.php';
if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
    $messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning');
}
require DIR_WS_CLASSES . 'store.php';
require DIR_WS_CLASSES . 'store_products.php';
// if the customer is not logged on, redirect them to the login page
if (!smn_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
    smn_redirect(smn_href_link(FILENAME_LOGIN, '', 'NONSSL'));
}
// systemsmanager begin - Dec 8, 2005
if (isset($_POST['action']) && $_POST['action'] == 'process' && smn_session_is_registered('customer_store_id')) {
    $new_products = new store_products($customer_store_id);
    for ($j = 0; $j < 4; $j++) {
        if (isset($_POST["products_name_{$j}"]) && $_POST['products_name_' . $j] != '') {
            $products_array = array('products_name' => $_POST['products_name_' . $j], 'products_id' => '', 'products_model' => $_POST['products_model_' . $j], 'products_price' => $_POST['products_price_' . $j], 'products_description' => $_POST['products_description_' . $j], 'products_image' => 'products_image_' . $j, 'products_type' => $_POST['products_type_' . $j], 'category_id' => $_POST['products_category_' . $j]);
            $new_products->set_store_products($products_array);
            $error_text = $new_products->load_products();
            if ($error_text != '') {
                smn_session_register('error_text');
            }
        }
    }
    smn_redirect(smn_href_link(FILENAME_CREATE_STORE_ACCOUNT_SUCCESS, '', 'NONSSL'));
}
// systemsmanager end
$breadcrumb->add(NAVBAR_TITLE_1);
Esempio n. 25
0
}
$account_query = smn_db_query("select c.*, ab.* from " . TABLE_CUSTOMERS . " c,  " . TABLE_ADDRESS_BOOK . " ab  where ab.customers_id = '" . (int) $customer_id . "' and c.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = c.customers_default_address_id");
$account = smn_db_fetch_array($account_query);
$breadcrumb->add(NAVBAR_TITLE_1, smn_href_link(FILENAME_ACCOUNT, 'ID=' . $store_id, 'NONSSL'));
$breadcrumb->add(NAVBAR_TITLE_2, smn_href_link(FILENAME_ACCOUNT_EDIT, 'ID=' . $store_id, 'NONSSL'));
$store_categories = $spath_setup->smn_get_store_category_tree('0', '', '0');
$countries = smn_get_countries();
$Qzone = smn_db_query('select zone_name from ' . TABLE_ZONES . ' where (zone_code = "' . strtoupper($customerInfo->address_data['entry_state']) . '" || zone_name = "' . $customerInfo->address_data['entry_state'] . '")');
if (smn_db_num_rows($Qzone)) {
    $zone = smn_db_fetch_array($Qzone);
    $customerInfo->address_data['entry_state'] = $zone['zone_name'];
}
/* Common Elements For Tabs - BEGIN */
$commonCancelButton = $jQuery->getPluginClass('button', array('id' => 'cancel_button', 'text' => 'Cancel'));
$commonDeleteButton = $jQuery->getPluginClass('button', array('id' => 'delete_button', 'text' => 'Delete'));
$commonSaveButton = $jQuery->getPluginClass('button', array('id' => 'save_button', 'type' => 'submit', 'text' => 'Save'));
/* Common Elements For Tabs - END */
/* Setup Tabs - BEGIN */
$jQuery->setGlobalVars(array('languages', 'languages_id', 'store_id', 'commonSaveButton', 'commonDeleteButton', 'commonCancelButton', 'account', 'customerInfo', 'customer_store_id', 'affiliate_id', 'customersStore', 'store_categories', 'countries'));
$tabsArray = array();
$tabsArray[] = array('tabID' => 'tab-contact', 'filename' => 'tab_contact.php', 'text' => ACCOUNT_TAB_CONTACT);
$tabsArray[] = array('tabID' => 'tab-personal', 'filename' => 'tab_personal.php', 'text' => ACCOUNT_TAB_PERSONAL);
if (smn_session_is_registered('customer_store_id')) {
    $tabsArray[] = array('tabID' => 'tab-settings', 'filename' => 'tab_settings.php', 'text' => ACCOUNT_TAB_SETTINGS);
}
$submitButton = $jQuery->getPluginClass('button', array('id' => 'submitButton', 'text' => IMAGE_BUTTON_SAVE_CHANGES, 'type' => 'submit'));
$backButton = $jQuery->getPluginClass('button', array('id' => 'backButton', 'text' => IMAGE_BUTTON_BACK, 'href' => $jQuery->link(FILENAME_ACCOUNT, 'ID=' . $store_id)));
$helpButton = $jQuery->getPluginClass('button', array('id' => 'helpButton', 'text' => IMAGE_BUTTON_HELP));
$tabPanel = $jQuery->getPluginClass('tabs', array('id' => 'initialPane', 'tabDir' => DIR_FS_CATALOG . DIR_WS_MODULES . 'pages_tabs/account_edit/', 'tabs' => $tabsArray, 'footerButtons' => array($submitButton, $backButton, $helpButton), 'showFooter' => true));
$tabPanel->setHelpButton('helpButton', true);
/* Setup Tabs - END */
Esempio n. 26
0
 function remove($products_id)
 {
     global $customer_id;
     unset($this->contents[$products_id]);
     // remove from database
     if (smn_session_is_registered('customer_id')) {
         smn_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int) $customer_id . "' and products_id = '" . smn_db_input($products_id) . "'");
         smn_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int) $customer_id . "' and products_id = '" . smn_db_input($products_id) . "'");
     }
     // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
     $this->cartID = $this->generate_cart_id();
 }
Esempio n. 27
0
<?php

/*
  Copyright (c) 2002 - 2006 SystemsManager.Net

  SystemsManager Technologies
  oscMall System Version 4
  http://www.systemsmanager.net
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
if (!smn_session_is_registered('customer_id')) {
    //$navigation->set_snapshot();
    smn_redirect(smn_href_link(FILENAME_LOGIN, 'ID=' . $store_id, 'SSL'));
}
$set = isset($_GET['set']) ? $_GET['set'] : 'payment';
$action = isset($_GET['action']) ? $_GET['action'] : '';
require DIR_WS_CLASSES . 'store_modules.php';
$paymentModules = new store_modules('payment');
$shippingModules = new store_modules('shipping');
$orderTotalModules = new store_modules('order_total');
if (smn_not_null($action)) {
    $moduleType = $_GET['moduleType'];
    $moduleName = $_GET['moduleName'];
    require DIR_WS_LANGUAGES . 'install/' . $moduleType . '/' . $language . '.php';
    switch ($action) {
        case 'getInstallArray':
Esempio n. 28
0
 function cart()
 {
     /*Declared shipping_store as global,by Cimi*/
     global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $shipping_store, $payment, $store_id, $comments, $customer_default_address_id;
     $this->content_type = $cart->get_content_type();
     if ($this->content_type != 'virtual' && $sendto == false) {
         $sendto = $customer_default_address_id;
     }
     $customer_address_query = smn_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int) $customer_id . "' and ab.customers_id = '" . (int) $customer_id . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = smn_db_fetch_array($customer_address_query);
     if (is_array($sendto) && !empty($sendto)) {
         $shipping_address = array('entry_firstname' => $sendto['firstname'], 'entry_lastname' => $sendto['lastname'], 'entry_company' => $sendto['company'], 'entry_street_address' => $sendto['street_address'], 'entry_suburb' => $sendto['suburb'], 'entry_postcode' => $sendto['postcode'], 'entry_city' => $sendto['city'], 'entry_zone_id' => $sendto['zone_id'], 'zone_name' => $sendto['zone_name'], 'entry_country_id' => $sendto['country_id'], 'countries_id' => $sendto['country_id'], 'countries_name' => $sendto['country_name'], 'countries_iso_code_2' => $sendto['country_iso_code_2'], 'countries_iso_code_3' => $sendto['country_iso_code_3'], 'address_format_id' => $sendto['address_format_id'], 'entry_state' => $sendto['zone_name']);
     } elseif (is_numeric($sendto)) {
         $shipping_address_query = smn_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $sendto . "'");
         $shipping_address = smn_db_fetch_array($shipping_address_query);
     } else {
         $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     }
     if (is_array($billto) && !empty($billto)) {
         $billing_address = array('entry_firstname' => $billto['firstname'], 'entry_lastname' => $billto['lastname'], 'entry_company' => $billto['company'], 'entry_street_address' => $billto['street_address'], 'entry_suburb' => $billto['suburb'], 'entry_postcode' => $billto['postcode'], 'entry_city' => $billto['city'], 'entry_zone_id' => $billto['zone_id'], 'zone_name' => $billto['zone_name'], 'entry_country_id' => $billto['country_id'], 'countries_id' => $billto['country_id'], 'countries_name' => $billto['country_name'], 'countries_iso_code_2' => $billto['country_iso_code_2'], 'countries_iso_code_3' => $billto['country_iso_code_3'], 'address_format_id' => $billto['address_format_id'], 'entry_state' => $billto['zone_name']);
     } else {
         $billing_address_query = smn_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $billto . "'");
         $billing_address = smn_db_fetch_array($billing_address_query);
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'payment_method' => $payment, 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => smn_session_is_registered('comments') && !empty($comments) ? $comments : '');
     /*Added the code to put the shipping cost of selected the shipping method of each store,By Cimi*/
     $store_list = $cart->get_store_list();
     for ($k = 0; $k < sizeof($store_list); $k++) {
         $this->info_store[$store_list[$k]] = array('shipping_cost' => $shipping_store[$store_list[$k]]['cost']);
     }
     /*End of code*/
     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
         if (isset($GLOBALS[$payment]->public_title)) {
             $this->info['payment_method'] = $GLOBALS[$payment]->public_title;
         } else {
             $this->info['payment_method'] = $GLOBALS[$payment]->title;
         }
         if (isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && $GLOBALS[$payment]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$payment]->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => smn_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => smn_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => smn_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     /*Added the code for single checkout also,by Cimi*/
     if (ALLOW_STORE_PAYMENT == 'true') {
         $products = $cart->get_products($store_id);
     } else {
         $store_list = $cart->get_store_list();
         for ($k = 0; $k < sizeof($store_list); $k++) {
             $products = array_merge($products, $cart->get_products($store_list[$k]));
         }
     }
     /*End of code*/
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'products_store_id' => $products[$i]['store_id'], 'model' => $products[$i]['model'], 'tax' => smn_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => smn_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_query = smn_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.store_id = '" . $store_id . "' and poval.store_id = '" . $store_id . "' and popt.store_id = '" . $store_id . "' and pa.products_id = '" . (int) $products[$i]['id'] . "' and pa.options_id = '" . (int) $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $languages_id . "' and poval.language_id = '" . (int) $languages_id . "'");
                 $attributes = smn_db_fetch_array($attributes_query);
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }