Ejemplo n.º 1
0
 public function output($step = 0)
 {
     global $temp_orders_id;
     $html = '';
     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]);
     }
     //select payment method if orders_id is known
     //also get billing country
     if (!empty($temp_orders_id)) {
         $selected_query = tep_db_query('SELECT payment_method, billing_country FROM temp_orders WHERE orders_id = "' . $temp_orders_id . '"');
         $selected = tep_db_fetch_array($selected_query);
     }
     foreach ($this->instances as $id => $data) {
         if ($data['status'] == 'true') {
             //check is active for zones and choosen shipping module
             if (parent::checkZone($data['zone'], $selected['billing_country']) && parent::checkShippingMethod($data['shipping_module'])) {
                 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 . '_' . $id . '" style="display:block;">';
                 $html .= '<div class="' . $this->type . '_item clearfix">';
                 $html .= '<input type="radio" name="' . $this->type . '" value="' . $id . '" id="' . $this->type . '_' . $id . '"' . ($selected['payment_method'] == $id ? ' checked=checked' : '') . ' />';
                 $html .= '<div class="' . $this->type . '_title">&nbsp; ' . Translate($data['title']) . '</div>';
                 if (!empty($data['description'])) {
                     $html .= '<div class="' . $this->type . '_description">&nbsp; ' . Translate($data['description']) . '</div>';
                 }
                 $html .= '</div>';
                 $html .= '</label>';
             }
         }
     }
     return $html;
 }
Ejemplo n.º 2
0
 public function output($step = 0)
 {
     global $temp_orders_id;
     $html = '';
     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]);
     }
     foreach ($this->instances as $id => $data) {
         if ($data['status'] == 'true') {
             //check is active for zones and choosen shipping module
             if (parent::checkZone($data['zone'], $this->temp_data[$temp_orders_id]['orders']['billing_country']) && parent::checkShippingMethod($data['shipping_module'])) {
                 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 . '_' . $id . '" style="display:block;">';
                 $html .= '<div class="' . $this->type . '_item clearfix">';
                 $html .= '<input type="radio" name="' . $this->type . '" value="' . $id . '" id="' . $this->type . '_' . $id . '"' . ($this->temp_data[$temp_orders_id]['orders']['payment_method'] == $id ? ' checked=checked' : '') . ' />';
                 $paymentMethods = array();
                 foreach ($this->paymentmethods as $name => $value) {
                     $payment = new $value();
                     //Store the issuers for this paymentmethod into an array
                     $issuers = $payment->getSupportedIssuers();
                     foreach ($issuers as $issuer => $issuerData) {
                         if (isset($issuerData['name'])) {
                             $paymentMethods[] = array('value' => $value . '__' . $issuer, 'name' => $issuerData['name']);
                         } else {
                             $paymentMethods[] = array('value' => $value . '__' . $issuer, 'name' => $name);
                         }
                     }
                 }
                 if (count($paymentMethods) > 1) {
                     $html .= '<select name="' . $this->type . '_paymentmethod">';
                     foreach ($paymentMethods as $key => $value) {
                         $html .= '<option value="' . $value['value'] . '">' . $value['name'] . '</option>';
                     }
                     $html .= '</select>';
                 } else {
                     $html .= '<input type="hidden" name="' . $this->type . '_paymentmethod" value="' . $paymentMethods[0]['value'] . '" />';
                 }
                 $html .= '<div class="' . $this->type . '_title">&nbsp; ' . $data['title'] . '</div>';
                 if (!empty($data['description'])) {
                     $html .= '<div class="' . $this->type . '_description">&nbsp; ' . $data['description'] . '</div>';
                 }
                 $html .= '</div>';
                 $html .= '</label>';
             }
         }
     }
     return $html;
 }
Ejemplo n.º 3
0
 public function output($step = 0)
 {
     global $temp_orders_id;
     $html = '';
     if (isset(Checkout::$errors[$this->type])) {
         $html .= '<div class="alert alert-error"><strong>' . Translate('Opgelet!') . '</strong> ' . Translate(Checkout::$errors[$this->type]) . '</div>';
         tep_db_query('DELETE FROM temp_orders_total WHERE orders_id = "' . $temp_orders_id . '" AND class= "' . $this->type . '"');
         unset(Checkout::$errors[$this->type]);
     } else {
         //Only show success alert if there are NO error alerts (Normaly it isn't possible to have both...)
         if (isset($this->success[$this->type])) {
             $html .= '<div class="alert alert-success">' . Translate($this->success[$this->type]) . '</div>';
             unset($this->success[$this->type]);
         } else {
             $this->recalculate();
         }
     }
     //select payment method if orders_id is known
     //also get billing country
     if (!empty($temp_orders_id)) {
         $selected_query = tep_db_query('SELECT payment_method, billing_country FROM temp_orders WHERE orders_id = "' . $temp_orders_id . '"');
         $selected = tep_db_fetch_array($selected_query);
     }
     if ($this->config['status'] == 'true') {
         //check is active for zones and choosen shipping module
         if (parent::checkZone($this->config['zone'], $selected['billing_country']) && parent::checkShippingMethod($this->config['shipping_module'])) {
             $html .= '<div class="' . $this->type . '">';
             $html .= '<label class="control-label ' . $this->type . '_title" for="' . $this->type . '_input">' . Translate($this->config['title']) . '</label>';
             $html .= '<div class="control-group">';
             if (!empty($this->config['description'])) {
                 $html .= '<div class="' . $this->type . '_description">' . Translate($this->config['description']) . '</div>';
             }
             $html .= '<div class="controls">';
             $html .= '<input type="text" name="' . $this->type . '" value="' . $_POST[$this->type] . '" placeholder="' . Translate('Vul hier uw kortingscode in.') . '" id="' . $this->type . '_input" />&nbsp;';
             $html .= '<button type="submit" name="submit_' . $this->type . '" value="process" class="btn">' . Translate('Inwisselen') . '</button>';
             $html .= '</div>';
             $html .= '</div>';
             $html .= '</div>';
         }
     }
     return $html;
 }