当前位置: 首页>>代码示例>>PHP>>正文


PHP calculationHelper::_instance方法代码示例

本文整理汇总了PHP中calculationHelper::_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP calculationHelper::_instance方法的具体用法?PHP calculationHelper::_instance怎么用?PHP calculationHelper::_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在calculationHelper的用法示例。


在下文中一共展示了calculationHelper::_instance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setShopperGroupsController


//.........这里部分代码省略.........
             $shoppergroupmodel = new VirtueMartModelShopperGroup();
             if (method_exists($shoppergroupmodel, 'removeSessionSgrps')) {
                 if (method_exists($shoppergroupmodel, 'appendShopperGroups')) {
                     if (!empty($is_business)) {
                         // we will differenciate between default and anonymous shopper group
                         // default is used for non-logged users
                         // anononymous is used for logged in users as guests
                         OPCShopperGroups::setShopperGroups($business_shopper_group);
                         $remove[] = $visitor_shopper_group;
                         // function appendShopperGroups(&$shopperGroups,$user,$onlyPublished = FALSE,$vendorId=1){
                         // remove previous:
                         /*
                         $session = JFactory::getSession();
                         $shoppergroup_ids = $session->get('vm_shoppergroups_add',array(),'vm');
                         $shoppergroupmodel->removeSessionSgrps($shoppergroup_ids); 
                         $new_shoppergroups = array(); 
                         $new_shoppergroups[] = $business_shopper_group;  
                         $shoppergroup_ids = $session->set('vm_shoppergroups_add',$new_shoppergroups,'vm');
                         $shoppergroupmodel->appendShopperGroups($new_shoppergroups, null); 
                         
                         JRequest::setVar('virtuemart_shoppergroup_id', $new_shoppergroups, 'post');
                         */
                         //appendShopperGroups
                     } else {
                         OPCShopperGroups::setShopperGroups($visitor_shopper_group);
                         $remove[] = $business_shopper_group;
                         /*
                         	 $shoppergroupmodel = new VirtueMartModelShopperGroup(); 
                         	 // function appendShopperGroups(&$shopperGroups,$user,$onlyPublished = FALSE,$vendorId=1){
                         	 // remove previous: 
                         	 $session = JFactory::getSession();
                         	 $shoppergroup_ids = $session->get('vm_shoppergroups_add',array(),'vm');
                         	 $shoppergroupmodel->removeSessionSgrps($shoppergroup_ids); 
                         	 $new_shoppergroups = array(); 
                         	 $new_shoppergroups[] = $visitor_shopper_group; 
                         	 $shoppergroup_ids = $session->set('vm_shoppergroups_add',$new_shoppergroups,'vm');
                         	 $shoppergroupmodel->appendShopperGroups($new_shoppergroups, null); 
                         	 JRequest::setVar('virtuemart_shoppergroup_id', $new_shoppergroups, 'post');
                         */
                     }
                 }
             }
         }
     }
     // EU VAT shopper group:
     if (!empty($euvat_shopper_group)) {
         $removeu = true;
         $session = JFactory::getSession();
         $vatids = $session->get('opc_vat', array());
         if (!is_array($vatids)) {
             $vatids = @unserialize($vatids);
         }
         //BIT vat checker:
         if (!empty($vatids['field'])) {
             $euvat = JRequest::getVar($vatids['field'], '');
             $euvat = preg_replace("/[^a-zA-Z0-9]/", "", $euvat);
             $euvat = strtoupper($euvat);
             if (!empty($cart)) {
                 $address = $cart->ST == 0 ? $cart->BT : $cart->ST;
                 $country = $address['virtuemart_country_id'];
             } else {
                 $country = JRequest::getVar('virtuemart_country_id');
             }
             $vathash = $country . '_' . $euvat;
             $home = 'NL';
             if (!class_exists('ShopFunctions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
             }
             $country_2_code = shopFunctions::getCountryByID($country, 'country_2_code');
             $home = explode(',', $home_vat_countries);
             $list = array();
             if (is_array($home)) {
                 foreach ($home as $k => $v) {
                     $list[] = strtoupper(trim($v));
                 }
             } else {
                 $list[] = $v;
             }
             if (!in_array($country_2_code, $list)) {
                 if (!empty($euvat)) {
                     $euvat = strtoupper($euvat);
                     if (!empty($vatids[$vathash])) {
                         //change OPC VAT shopper group:
                         OPCShopperGroups::setShopperGroups($euvat_shopper_group);
                         $removeu = false;
                     }
                 }
             }
         }
         if ($removeu) {
             $remove[] = $euvat_shopper_group;
         }
     }
     OPCShopperGroups::setShopperGroups(-1, $remove);
     if (class_exists('calculationHelper')) {
         calculationHelper::$_instance = null;
     }
     $session = JFactory::getSession();
     $shoppergroup_ids = $session->get('vm_shoppergroups_add', array(), 'vm');
 }
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:101,代码来源:shoppergroups.php

示例2: getInstance

 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new calculationHelper();
     } else {
         //We store in UTC and use here of course also UTC
         $jnow = JFactory::getDate();
         self::$_instance->_now = $jnow->toMySQL();
     }
     return self::$_instance;
 }
开发者ID:Roma48,项目名称:abazherka_old,代码行数:11,代码来源:calculationh.php


注:本文中的calculationHelper::_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。