Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Оформление заказа


Recommended Posts

Как при нажатии на кнопку Continue сделать чтобы заказ оформился

checkout.tpl

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
 <div class="checkout">
   <div id="payment-address">
  <div class="checkout-content"></div>
   </div>
   <div id="confirm">
  <div class="checkout-content"></div>
   </div>
 </div>
 </div>
<script type="text/javascript"><!--
$(document).ready(function() {
$.ajax({
 url: 'index.php?route=checkout/payment_address',
 dataType: 'html',
 success: function(html) {
  $('#payment-address .checkout-content').html(html);

  $('#payment-address .checkout-content').slideDown('slow');
 },
 error: function(xhr, ajaxOptions, thrownError) {
  alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
 }
});
});
// Payment Address
$('#button-payment-address').live('click', function() {
$.ajax({
 url: 'index.php?route=checkout/payment_address/validate',
 type: 'post',
 data: $('#payment-address input[type=\'text\'], #payment-address input[type=\'password\'], #payment-address input[type=\'checkbox\']:checked, #payment-address input[type=\'radio\']:checked, #payment-address input[type=\'hidden\'], #payment-address select'),
 dataType: 'json',
 beforeSend: function() {
  $('#button-payment-address').attr('disabled', true);
  $('#button-payment-address').after('<span class="wait"> <img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
 },
 complete: function() {
  $('#button-payment-address').attr('disabled', false);
  $('.wait').remove();
 },  
 success: function(json) {
  $('.warning, .error').remove();

  if (json['redirect']) {
   location = json['redirect'];
  } else if (json['error']) {
   if (json['error']['warning']) {
 $('#payment-address .checkout-content').prepend('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');

 $('.warning').fadeIn('slow');
   }

   if (json['error']['firstname']) {
 $('#payment-address input[name=\'firstname\']').after('<span class="error">' + json['error']['firstname'] + '</span>');
   }

   if (json['error']['lastname']) {
 $('#payment-address input[name=\'lastname\']').after('<span class="error">' + json['error']['lastname'] + '</span>');
   }

   if (json['error']['telephone']) {
 $('#payment-address input[name=\'telephone\']').after('<span class="error">' + json['error']['telephone'] + '</span>');
   } 

   if (json['error']['company_id']) {
 $('#payment-address input[name=\'company_id\']').after('<span class="error">' + json['error']['company_id'] + '</span>');
   }

   if (json['error']['tax_id']) {
 $('#payment-address input[name=\'tax_id\']').after('<span class="error">' + json['error']['tax_id'] + '</span>');
   }

   if (json['error']['address_1']) {
 $('#payment-address input[name=\'address_1\']').after('<span class="error">' + json['error']['address_1'] + '</span>');
   }

   if (json['error']['city']) {
 $('#payment-address input[name=\'city\']').after('<span class="error">' + json['error']['city'] + '</span>');
   }

   if (json['error']['postcode']) {
 $('#payment-address input[name=\'postcode\']').after('<span class="error">' + json['error']['postcode'] + '</span>');
   }

   if (json['error']['country']) {
 $('#payment-address select[name=\'country_id\']').after('<span class="error">' + json['error']['country'] + '</span>');
   }

   if (json['error']['zone']) {
 $('#payment-address select[name=\'zone_id\']').after('<span class="error">' + json['error']['zone'] + '</span>');
   }
  } else {


   $.ajax({
 url: 'index.php?route=checkout/payment_address',
 dataType: 'html',
 success: function(html) {
  $('#payment-address .checkout-content').html(html);
 },
 error: function(xhr, ajaxOptions, thrownError) {
  alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
 }
   });   
  }  
 },
 error: function(xhr, ajaxOptions, thrownError) {
  alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
 }
});
});
//--></script>
<?php echo $footer; ?>

ckeckout.php

<?php 
class ControllerCheckoutCheckout extends Controller {
public function index() {
 // Validate cart has products and has stock.
 if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
 $this->redirect($this->url->link('checkout/cart'));
 }

 // Validate minimum quantity requirments.  
 $products = $this->cart->getProducts();

 foreach ($products as $product) {
  $product_total = 0;

  foreach ($products as $product_2) {
   if ($product_2['product_id'] == $product['product_id']) {
 $product_total += $product_2['quantity'];
   }
  } 

  if ($product['minimum'] > $product_total) {
   $this->redirect($this->url->link('checkout/cart'));
  }   
 }

 $this->language->load('checkout/checkout');

 $this->document->setTitle($this->language->get('heading_title'));
 //$this->document->addScript('catalog/view/javascript/jquery/colorbox/jquery.colorbox-min.js');
 //$this->document->addStyle('catalog/view/javascript/jquery/colorbox/colorbox.css');

 $this->data['logged'] = $this->customer->isLogged();
 $this->data['shipping_required'] = $this->cart->hasShipping();

 if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/checkout.tpl')) {
  $this->template = $this->config->get('config_template') . '/template/checkout/checkout.tpl';
 } else {
  $this->template = 'default/template/checkout/checkout.tpl';
 }

 $this->children = array(
  'common/column_left',
  'common/column_right',
  'common/content_top',
  'common/content_bottom',
  'common/footer',
  'common/header'
 );

 $this->response->setOutput($this->render());
  }

public function country() {
 $json = array();

 $this->load->model('localisation/country');
 $country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);

 if ($country_info) {
  $this->load->model('localisation/zone');
  $json = array(
   'country_id'	    => $country_info['country_id'],
   'name'			  => $country_info['name'],
   'iso_code_2'	    => $country_info['iso_code_2'],
   'iso_code_3'	    => $country_info['iso_code_3'],
   'address_format'    => $country_info['address_format'],
   'postcode_required' => $country_info['postcode_required'],
   'zone'			  => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']),
   'status'		    => $country_info['status'] 
  );
 }

 $this->response->setOutput(json_encode($json));
}
}
?>

post-29298-0-21699400-1361853356_thumb.jpeg

Надіслати
Поділитися на інших сайтах


Гість
Ця тема закрита для публікації повідомлень.
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.