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;
 }
 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;
 }
 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();
         }
     }
 }