|
| 1 | +<?php |
| 2 | +/** |
| 3 | +* 2010-2018 Webkul. |
| 4 | +* |
| 5 | +* NOTICE OF LICENSE |
| 6 | +* |
| 7 | +* All right is reserved, |
| 8 | +* Please go through this link for complete license : https://store.webkul.com/license.html |
| 9 | +* |
| 10 | +* DISCLAIMER |
| 11 | +* |
| 12 | +* Do not edit or add to this file if you wish to upgrade this module to newer |
| 13 | +* versions in the future. If you wish to customize this module for your |
| 14 | +* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. |
| 15 | +* |
| 16 | +* @author Webkul IN <support@webkul.com> |
| 17 | +* @copyright 2010-2018 Webkul IN |
| 18 | +* @license https://store.webkul.com/license.html |
| 19 | +*/ |
| 20 | + |
| 21 | +class CheckoutCustomerDetailsStep extends AbstractCheckoutStep |
| 22 | +{ |
| 23 | + public function __construct() { |
| 24 | + parent::__construct(); |
| 25 | + $this->step_key = 'checkout_customer'; |
| 26 | + } |
| 27 | + |
| 28 | + public function handleRequest() |
| 29 | + { |
| 30 | + $idAddressDelivery = $this->context->cart->id_address_delivery; |
| 31 | + $objAddress = new Address($idAddressDelivery); |
| 32 | + if (Tools::getValue('proceed_to_customer_dtl')) { |
| 33 | + $this->step_is_reachable = 1; |
| 34 | + $this->step_is_current = 1; |
| 35 | + if ($idAddressDelivery) { |
| 36 | + if (!Validate::isLoadedObject($objAddress)) { |
| 37 | + if ($this->context->cookie->__get('customer_details_proceeded')) { |
| 38 | + $this->step_is_current = 0; |
| 39 | + $this->step_is_complete = 1; |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + } elseif (Tools::getValue('proceed_to_payment')) { |
| 44 | + $this->step_is_reachable = 1; |
| 45 | + $this->step_is_current = 1; |
| 46 | + if ($idAddressDelivery) { |
| 47 | + if (Validate::isLoadedObject($objAddress)) { |
| 48 | + $this->step_is_current = 0; |
| 49 | + $this->step_is_complete = 1; |
| 50 | + $this->context->cookie->__set('customer_details_proceeded', 1); |
| 51 | + } |
| 52 | + } |
| 53 | + } elseif ($this->context->cookie->__get('customer_details_proceeded') |
| 54 | + || $this->context->cookie->__get('cart_summary_proceeded') |
| 55 | + ) { |
| 56 | + if ($idAddressDelivery) { |
| 57 | + if (!Validate::isLoadedObject($objAddress)) { |
| 58 | + $this->context->cookie->__set('customer_details_proceeded', 0); |
| 59 | + $this->step_is_reachable = 1; |
| 60 | + $this->step_is_current = 1; |
| 61 | + } |
| 62 | + } else { |
| 63 | + $this->step_is_reachable = 1; |
| 64 | + $this->step_is_current = 1; |
| 65 | + $this->context->cookie->__set('customer_details_proceeded', 0); |
| 66 | + } |
| 67 | + } elseif ($this->context->customer->logged) { |
| 68 | + $this->step_is_reachable = 1; |
| 69 | + if ($idAddressDelivery) { |
| 70 | + $this->step_is_complete = 1; |
| 71 | + } else { |
| 72 | + $this->step_is_complete = 0; |
| 73 | + $this->step_is_current = 1; |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | +} |
0 commit comments