Example #1
0
 function shipping($module = '')
 {
     global $language, $PHP_SELF, $customer_id;
     $customer_group = new customer_group($customer_id);
     if (ereg('all', $customer_group->getshipment())) {
         $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
     } else {
         $this->modules = explode(';', $customer_group->getshipment());
     }
     if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
         $include_modules = array();
         if (tep_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1));
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
     }
 }
Example #2
0
 function payment($module = '')
 {
     global $payment, $language, $PHP_SELF, $customer_id;
     $customer_group = new customer_group($customer_id);
     if (ereg('all', $customer_group->getpayment())) {
         //      if (defined('MODULE_ORDER_TOTAL_INSTALLED') && tep_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {
         $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
     } else {
         $this->modules = explode(';', $customer_group->getpayment());
     }
     if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
         //        $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         $include_modules = array();
         if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . '.php');
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
         if (tep_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
             $payment = $include_modules[0]['class'];
         }
         if (tep_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
Example #3
0
 public function register()
 {
     $customer = new customer_entity();
     $customer->customer_email = $this->customer_email;
     $customer->customer_active = 1;
     $customer->customer_default_group_ID = 1;
     $customer->customer_first_name = $this->customer_firstname;
     $customer->customer_last_name = $this->customer_lastname;
     $customer->customer_gender = $this->customer_gender;
     $customer->customer_password = $this->customer_pwd;
     if ($customer->save()) {
         customer_group::addment($customer->customer_ID, null, 1);
         return true;
     }
     return false;
 }
Example #4
0
 public function actionUpdate()
 {
     $this->htmlOption = array('class' => 'icon-head head-products', 'header' => "编辑客户", 'button' => array(array('class' => 'scalable save', 'id' => 'form-save', 'header' => '保存')));
     $model = $this->loadModel();
     if ($_POST['customer']) {
         if ($_POST['password']) {
             $model->setPassword($_POST['password']);
         }
         $model->attributes = $_POST['customer'];
         if ($model->save()) {
             customer_group::updateItem($model->customer_ID, $_POST['customer_group'], $model->customer_default_group_ID);
             $this->redirect(array('index'));
         }
     }
     $this->constructScript('create');
     if ($_POST['customer_group']) {
         $groups = $_POST['customer_group'];
     } else {
         $groups = customer_group::customerGroups($model->customer_ID);
     }
     $this->render('update', array('model' => $model, 'groups' => $groups));
 }
Example #5
0
function b_specials()
{
    global $currency, $currencies, $languages_id, $xoopsDB, $xoopsConfig, $customer_group, $customer_id, $_GET;
    /* if(!defined("XOSC_BLOCK") && !defined("XOSC_CONFIG")) {
      define("XOSC_BLOCK",1);
      require_once(XOOPS_ROOT_PATH."/modules/osC/includes/application_top.php");
     }
    */
    // Config Part
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/configure.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/database_tables.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/filenames.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/database.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/general.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/html_output.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/boxes.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/currencies.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/product.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/customer_group.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/languages/" . $xoopsConfig['language'] . ".php";
    //$currencies = new currencies();
    if (!isset($customer_group)) {
        if (!isset($_SESSION['customer_id'])) {
            $customer_group = new customer_group(0);
        } else {
            $customer_group = new customer_group($_SESSION['customer_id']);
        }
    }
    if (!defined('XBLOCK_CONFIG')) {
        $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
        while ($configuration = tep_db_fetch_array($configuration_query)) {
            define($configuration['cfgKey'], $configuration['cfgValue']);
        }
        define('XBLOCK_CONFIG', "1");
    }
    if (!isset($_SESSION['languages_id'])) {
        $lang_query = "select languages_id from " . TABLE_LANGUAGES . " where directory ='" . $xoopsConfig['language'] . "'";
        $lang = tep_db_query($lang_query);
        $lang_id = tep_db_fetch_array($lang);
        $languages_id = $lang_id['languages_id'];
    } else {
        $languages_id = $_SESSION['languages_id'];
    }
    // currency
    if (isset($_GET['currency'])) {
        $currency = $_GET['currency'];
    }
    if (!session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
        if (!session_is_registered('currency')) {
            session_register('currency');
        }
        if (isset($HTTP_GET_VARS['currency'])) {
            if (!($currency = tep_currency_exists($HTTP_GET_VARS['currency']))) {
                $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
            }
        } else {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    }
    if ($currency == '') {
        if (!($currency = tep_currency_exists($HTTP_GET_VARS['currency']))) {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    }
    //$currencies = new currencies();
    if (!isset($currencies) || !is_object($currencies)) {
        $currencies = new currencies();
    }
    //echo "CUR:".$currencies.":".$currency;
    //print_r($currencies);
    // Box Part
    if ($random_product = tep_random_select("select p.products_distributor_id,p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
        $sproduct = new product($random_product["products_id"]);
        $add_text = '';
        if ($customer_group->getdisplaytax() == '1') {
            $add_text = '<br>' . TEXT_VAT_INFO . ' ' . $sproduct->get_tax() . ' % ' . $sproduct->get_tax_title();
        }
        if ($customer_group->getdisplayshipment() == '1') {
            $add_text .= '<br>' . TEXT_SHIPPING_HANDLING_INFO;
        }
        $image_path = DIR_WS_IMAGES;
        switch ($random_product['products_distributor_id']) {
            case 1:
                $image_path = 'http://ec.ingrammicro.de/jpg/';
                break;
            case 2:
                $image_path = '';
                break;
        }
        $info_box_contents = array();
        $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image($image_path . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>' . $add_text);
        $block = new infoBox($info_box_contents);
    }
    return $block->content;
}