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


PHP Checkout::calculate_weight方法代码示例

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


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

示例1: output

 public function output($step = 0)
 {
     global $currencies, $temp_orders_id;
     if ($temp_orders_id > 0) {
         $this->temp_data = Checkout::get_all_data_from_temp_db($temp_orders_id);
         foreach ($this->temp_data[$temp_orders_id]['orders_total'] as $key => $data) {
             if ($data['class'] == 'order_subtotal') {
                 $this->order_subtotal = $data['value'];
             }
         }
     }
     $html = '';
     //check for errors
     if (isset(Checkout::$errors[$this->type])) {
         $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$this->type]) . '</div>';
         unset(Checkout::$errors[$this->type]);
     }
     if ($this->config['status'] == 'true' && $this->order_subtotal >= $this->config['min_amount'] && ($this->config['max_weight'] >= Checkout::calculate_weight($temp_orders_id, 'temp_') || $this->config['max_weight'] == 0)) {
         if ($this->checkCountry($this->temp_data[$temp_orders_id]['orders']['delivery_country'], $this->temp_data[$temp_orders_id]['orders']['delivery_postcode'])) {
             //Search kialo points with postcode
             if (isset($_POST[get_class($this) . '_submit']) && $_POST[get_class($this) . '_submit'] == 'search_postcode' && !empty($_POST[get_class($this) . '_postcode'])) {
                 $iso2_query = tep_db_query('SELECT countries_iso_code_2 FROM countries WHERE countries_id = "' . $this->temp_data[$temp_orders_id]['orders']['delivery_country'] . '"');
                 $iso2 = tep_db_fetch_array($iso2_query);
                 $sort_extra = '';
                 if ($this->temp_data[$temp_orders_id]['orders']['shipping_method'] == get_class($this) && !empty($this->temp_data[$temp_orders_id]['orders']['shipping_method_extra'])) {
                     $sort_extra = '+' . $this->temp_data[$temp_orders_id]['orders']['shipping_method_extra'];
                 }
                 $this->xml = $this->convertXMLtoArray(simplexml_load_file('http://locateandselect.kiala.com/kplist?dspid=' . $this->config['dspid'] . '&country=' . $iso2['countries_iso_code_2'] . '&zip=' . $_POST[get_class($this) . '_postcode'] . '&language=' . $languages_code . '&max-result=5&sort-method=ACTIVE_FIRST' . $sort_extra));
             }
             if (isset(Checkout::$errors[$id])) {
                 $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$id]) . '</div>';
             }
             $html .= '<label class="control-label" for="' . $this->type . '_' . get_class($this) . '" style="display:block;">';
             $html .= '<div class="' . $this->type . '_item clearfix">';
             $html .= '<input type="radio" name="' . $this->type . '" value="' . get_class($this) . '" id="' . $this->type . '_' . get_class($this) . '"' . ($this->temp_data[$temp_orders_id]['orders']['shipping_method'] == get_class($this) ? ' checked=checked' : '') . ' />';
             $html .= '<div class="' . $this->type . '_title">&nbsp; ' . Translate($this->config['title']) . '</div>';
             $html .= '<div class="' . $this->type . '_quote">' . ($this->getQuote() > 0 ? $currencies->display_price($this->getQuote(), 0) : Translate('Gratis')) . '</div>';
             if (!empty($data['description'])) {
                 $html .= '<div class="' . $this->type . '_description">&nbsp; ' . Translate($this->config['description']) . '</div>';
             }
             $html .= '</div>';
             $html .= '</label>';
             $html .= '<div class="well" style="margin-left:25px;" id="Kiala_points_list">';
             //search box
             $html .= '<input type="text" name="' . get_class($this) . '_postcode" value="' . $_POST[get_class($this) . '_postcode'] . '" placeholder="' . Translate('Vul hier uw postcode in') . '" />';
             $html .= '&nbsp;<button type="submit" class="btn" name="' . get_class($this) . '_submit" value="search_postcode">' . Translate('Zoeken') . '</button>';
             //kiala punt lijst
             $html .= $this->getKpList($this->temp_data[$temp_orders_id]['orders']['delivery_country']);
             $html .= '</div>';
         }
     }
     return $html;
 }
开发者ID:CristianCCIT,项目名称:shop4office,代码行数:53,代码来源:Kiala_module.php

示例2: output

 public function output($step = 0)
 {
     global $currencies, $temp_orders_id;
     if ($temp_orders_id > 0) {
         $this->temp_data = Checkout::get_all_data_from_temp_db($temp_orders_id);
         foreach ($this->temp_data[$temp_orders_id]['orders_total'] as $key => $data) {
             if ($data['class'] == 'order_subtotal') {
                 $this->order_subtotal = $data['value'];
             }
         }
     }
     $html = '';
     //check for errors
     if (isset(Checkout::$errors[$this->type])) {
         $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$this->type]) . '</div>';
         unset(Checkout::$errors[$this->type]);
     }
     if ($this->config['status'] == 'true' && $this->order_subtotal >= $this->config['min_amount'] && ($this->config['max_weight'] >= Checkout::calculate_weight($temp_orders_id, 'temp_') || $this->config['max_weight'] == 0)) {
         if ($this->checkCountry($this->temp_data[$temp_orders_id]['orders']['delivery_street_address'], $this->temp_data[$temp_orders_id]['orders']['delivery_postcode'])) {
             //Search bpost service points with customer address
             if (isset($_POST[get_class($this) . '_submit']) && $_POST[get_class($this) . '_submit'] == 'search_postcode' && !empty($_POST[get_class($this) . '_postcode'])) {
                 $this->xml = $this->convertXMLtoArray(simplexml_load_file('http://taxipost.geo6.be/Locator?Partner=' . $this->config['account_id'] . '&AppId=' . STORE_NAME . '&Function=search&Format=xml&Zone=' . $_POST[get_class($this) . '_postcode'] . '&Language=' . $languages_code . '&Type=' . $this->config['bpost_types'] . '&Limit=' . $this->config['max_sp']));
             }
             if (isset(Checkout::$errors[$id])) {
                 $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$id]) . '</div>';
             }
             $html .= '<label class="control-label" for="' . $this->type . '_' . get_class($this) . '" style="display:block;">';
             $html .= '<div class="' . $this->type . '_item clearfix">';
             $html .= '<input type="radio" name="' . $this->type . '" value="' . get_class($this) . '" id="' . $this->type . '_' . get_class($this) . '"' . ($this->temp_data[$temp_orders_id]['orders']['shipping_method'] == get_class($this) ? ' checked=checked' : '') . ' />';
             $html .= '<div class="' . $this->type . '_title">&nbsp; ' . Translate($this->config['title']) . '</div>';
             $html .= '<div class="' . $this->type . '_quote">' . ($this->getQuote() > 0 ? $currencies->display_price($this->getQuote(), 0) : Translate('Gratis')) . '</div>';
             if (!empty($data['description'])) {
                 $html .= '<div class="' . $this->type . '_description">&nbsp; ' . Translate($this->config['description']) . '</div>';
             }
             $html .= '</div>';
             $html .= '</label>';
             $html .= '<div class="well" style="margin-left:25px;" id="Bpost_points_list">';
             //search box
             $html .= '<input type="text" name="' . get_class($this) . '_postcode" value="' . $_POST[get_class($this) . '_postcode'] . '" placeholder="' . Translate('Vul hier uw postcode in') . '" />';
             $html .= '&nbsp;<button type="submit" class="btn" name="' . get_class($this) . '_submit" value="search_postcode">' . Translate('Zoeken') . '</button>';
             //Bpost punt lijst
             $html .= $this->getServicePointList($this->temp_data[$temp_orders_id]['orders']['delivery_street_address'], $this->temp_data[$temp_orders_id]['orders']['delivery_postcode']);
             $html .= '</div>';
         }
     }
     return $html;
 }
开发者ID:CristianCCIT,项目名称:shop4office,代码行数:47,代码来源:Bpost_module.php

示例3: calculate_instance_max

 private function calculate_instance_max($instance)
 {
     global $cart, $temp_orders_id;
     $temp_order_data = Checkout::get_all_data_from_temp_db($temp_orders_id);
     //check mode
     if ($this->instances[$instance]['mode'] == 'weight') {
         $this->instance_max[$instance] = Checkout::calculate_weight($temp_orders_id, 'temp_');
     } else {
         //mode == price
         $subtotal = 0;
         if (is_array($temp_order_data[$temp_orders_id]['orders_total'])) {
             foreach ($temp_order_data[$temp_orders_id]['orders_total'] as $total_data) {
                 if ($total_data['class'] == 'order_subtotal') {
                     $subtotal = $total_data['value'];
                 }
             }
         }
         if ($subtotal > 0) {
             $this->instance_max[$instance] = $subtotal;
         } else {
             $this->instance_max[$instance] = $cart->show_total();
         }
     }
 }
开发者ID:CristianCCIT,项目名称:shop4office,代码行数:24,代码来源:Table_module.php


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