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


PHP ShopFunctions::convertWeightUnit方法代码示例

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


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

示例1: checkConditions

 /** TODO
  * Here can add check if user has filled in valid phone number or mail so he is reachable by zasilkovna
  */
 protected function checkConditions($cart, $method, $cart_prices)
 {
     $address = $cart->ST == 0 ? $cart->BT : $cart->ST;
     $is_cz = $this->isCz($address['virtuemart_country_id']);
     $is_sk = $this->isSk($address['virtuemart_country_id']);
     if (!$is_sk && !$is_cz) {
         return false;
     }
     $wstart = (double) $method->weight_start;
     $ws = (double) $method->weight_stop;
     $orderWeight = $this->getOrderWeight($cart, $method->weight_unit);
     if (!empty($wstart)) {
         if ($orderWeight < $wstart) {
             return false;
         }
     }
     // do not allow oversize packages
     if (!empty($ws)) {
         if (empty($method->strategy)) {
             if ($orderWeight > $ws) {
                 return false;
             }
         }
     }
     if (!empty($ws)) {
         if (!empty($method->strategy)) {
             if (count($cart->products) > 0) {
                 foreach ($cart->products as $product) {
                     $weight = ShopFunctions::convertWeightUnit($product->product_weight, $product->product_weight_uom, $method->weight_unit);
                     // single product weight is larger then x:
                     if ($weight > $ws) {
                         return false;
                     }
                 }
             }
         }
     }
     $total = (int) $cart->pricesUnformatted['billTotal'];
     if (!empty($method->orderamount_start)) {
         $st = (double) $method->orderamount_start;
         if ($total < $st) {
             return false;
         }
     }
     if (!empty($method->orderamount_stop)) {
         $st = (double) $method->orderamount_stop;
         if ($total < $st) {
             return false;
         }
     }
     return true;
 }
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:55,代码来源:ulozenka.php

示例2: getBasket

    public static function getBasket(&$ref, $OPCloader, $withwrapper = true, &$op_coupon = '', $shipping = '', $payment = '', $isexpress = false)
    {
        include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
        $has_k2 = OPCloader::tableExists('k2mart');
        if (!class_exists('ShopFunctions')) {
            require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
        }
        if (!method_exists('ShopFunctions', 'convertWeightUnit')) {
            $opc_show_weight = false;
        }
        /*
           if (!class_exists('VirtueMartModelProduct'))
         require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
        */
        require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
        $productClass = OPCmini::getModel('product');
        //new VirtueMartModelProduct();
        if (!class_exists('CurrencyDisplay')) {
            require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
        }
        $currencyDisplay = CurrencyDisplay::getInstance($ref->cart->pricesCurrency);
        $google_html = '';
        $VM_LANG = new op_languageHelper();
        $product_rows = array();
        $p2 = $ref->cart->products;
        if (empty($ref->cart)) {
            $ref->cart = VirtueMartCart::getCart();
        }
        $vm2015 = false;
        $ref->cart->prices = $ref->cart->pricesUnformatted = OPCloader::getCheckoutPrices($ref->cart, false, $vm2015, 'opc');
        $useSSL = VmConfig::get('useSSL', 0);
        $action_url = $OPCloader->getActionUrl($OPCloader, true);
        $xi = 0;
        if (isset($currencyDisplay->_priceConfig)) {
            $savedConfig = $currencyDisplay->_priceConfig;
        }
        if (empty($product_price_display)) {
            $product_price_display = 'salesPrice';
        }
        //$test_product_price_display = array($product_price_display, 'salesPrice', 'basePrice', 'priceWithoutTax', 'basePriceWithTax', 'priceBeforeTax', 'costPrice');
        $test_product_price_display = array($product_price_display, 'salesPrice', 'basePrice', 'priceWithoutTax', 'basePriceWithTax', 'priceBeforeTax');
        // check price config
        $testf = false;
        foreach ($test_product_price_display as $product_price_display_test) {
            $test = $currencyDisplay->createPriceDiv($product_price_display, '', '10', false, false, 1);
            if (empty($test)) {
                if (isset($currencyDisplay->_priceConfig)) {
                    if (isset($currencyDisplay->_priceConfig[$product_price_display_test])) {
                        if (empty($currencyDisplay->_priceConfig[$product_price_display_test][0])) {
                            $currencyDisplay->_priceConfig[$product_price_display_test] = array(1, -1, 1);
                        }
                    }
                }
                $testf = true;
            } else {
                if (!isset($product_price_display_test2)) {
                    $product_price_display_test2 = $product_price_display_test;
                }
            }
        }
        if (empty($testf)) {
            $product_price_display = $product_price_display_test2;
        }
        $totalw = 0;
        $to_weight_unit = VmConfig::get('weight_unit_default', 'KG');
        foreach ($ref->cart->products as $pkey => $prow) {
            if ($opc_show_weight) {
                $totalw += ShopFunctions::convertWeightUnit((double) $prow->product_weight, $prow->product_weight_uom, $to_weight_unit) * (double) $prow->quantity;
            }
            $product = array();
            $id = $prow->virtuemart_media_id;
            if (empty($id)) {
                $imgf = '';
            } else {
                if (is_array($id)) {
                    $id = reset($id);
                }
                $imgf = $OPCloader->getImageFile($id);
            }
            $product['product_full_image'] = $imgf;
            if (!empty($opc_only_parent_links)) {
                if (!empty($prow->product_parent_id)) {
                    $parent = $prow->product_parent_id;
                    $prow->url = JRoute::_('index.php?option=com_virtuemart&virtuemart_product_id=' . $parent . '&view=productdetails', true);
                }
            }
            // check if k2 exists:
            if (!isset($prow->url)) {
                if (isset($prow->link)) {
                    $prow->url = $prow->link;
                    if (strpos($prow->url, '&amp;') === false) {
                        $prow->url = str_replace('&', '&amp;', $prow->url);
                    }
                } else {
                    $prow->url = JRoute::_('index.php?option=com_virtuemart&virtuemart_product_id=' . $prow->virtuemart_product_id . '&view=productdetails', true);
                }
            }
            if ($has_k2) {
                $db = JFactory::getDBO();
                $q = 'select baseID from #__k2mart where referenceID = ' . (int) $prow->virtuemart_product_id . ' limit 0,1';
//.........这里部分代码省略.........
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:101,代码来源:basket.php

示例3: getOrderWeight

 /**
  * Get the total weight for the order, based on which the proper shipping rate
  * can be selected.
  *
  * @param object $cart Cart object
  * @return float Total weight for the order
  */
 protected function getOrderWeight(VirtueMartCart $cart, $to_weight_unit)
 {
     static $weight = array();
     if (!isset($weight[$to_weight_unit])) {
         $weight[$to_weight_unit] = 0.0;
     }
     if (count($cart->products) > 0 and empty($weight[$to_weight_unit])) {
         foreach ($cart->products as $product) {
             $weight[$to_weight_unit] += ShopFunctions::convertWeightUnit($product->product_weight, $product->product_weight_uom, $to_weight_unit) * $product->quantity;
         }
     }
     return $weight[$to_weight_unit];
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:20,代码来源:vmpsplugin.php

示例4: getOrderWeight

 /**
  * Get the total weight for the order, based on which the proper shipping rate
  * can be selected.
  *
  * @param object $cart Cart object
  * @return float Total weight for the order
  * @author Oscar van Eijk
  */
 protected function getOrderWeight(VirtueMartCart $cart, $to_weight_unit)
 {
     static $weight = 0.0;
     if (count($cart->products) > 0 and empty($weight)) {
         foreach ($cart->products as $product) {
             vmdebug('getOrderWeight', $product->product_weight);
             $weight += ShopFunctions::convertWeightUnit($product->product_weight, $product->product_weight_uom, $to_weight_unit) * $product->quantity;
         }
     }
     return $weight;
 }
开发者ID:Arturogcalleja,项目名称:herbolario,代码行数:19,代码来源:vmpsplugin.php


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