00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Checkout_Model_Type_Multishipping_State extends Varien_Object
00035 {
00036 const STEP_SELECT_ADDRESSES = 'multishipping_addresses';
00037 const STEP_SHIPPING = 'multishipping_shipping';
00038 const STEP_BILLING = 'multishipping_billing';
00039 const STEP_OVERVIEW = 'multishipping_overview';
00040 const STEP_SUCCESS = 'multishipping_success';
00041
00042
00043
00044
00045
00046
00047 protected $_steps;
00048
00049
00050
00051
00052
00053
00054 protected $_checkout;
00055
00056
00057
00058
00059
00060 public function __construct()
00061 {
00062 parent::__construct();
00063 $this->_steps = array(
00064 self::STEP_SELECT_ADDRESSES => new Varien_Object(array(
00065 'label' => Mage::helper('checkout')->__('Select Addresses')
00066 )),
00067 self::STEP_SHIPPING => new Varien_Object(array(
00068 'label' => Mage::helper('checkout')->__('Shipping Information')
00069 )),
00070 self::STEP_BILLING => new Varien_Object(array(
00071 'label' => Mage::helper('checkout')->__('Billing Information')
00072 )),
00073 self::STEP_OVERVIEW => new Varien_Object(array(
00074 'label' => Mage::helper('checkout')->__('Place Order')
00075 )),
00076 self::STEP_SUCCESS => new Varien_Object(array(
00077 'label' => Mage::helper('checkout')->__('Order Success')
00078 )),
00079 );
00080
00081 foreach ($this->_steps as $step) {
00082 $step->setIsComplete(false);
00083 }
00084
00085 $this->_checkout = Mage::getSingleton('checkout/type_multishipping');
00086 $this->_steps[$this->getActiveStep()]->setIsActive(true);
00087 }
00088
00089
00090
00091
00092
00093
00094 public function getCheckout()
00095 {
00096 return $this->_checkout;
00097 }
00098
00099
00100
00101
00102
00103
00104 public function getSteps()
00105 {
00106 return $this->_steps;
00107 }
00108
00109
00110
00111
00112
00113
00114 public function getActiveStep()
00115 {
00116 $step = $this->getCheckoutSession()->getCheckoutState();
00117 if (isset($this->_steps[$step])) {
00118 return $step;
00119 }
00120 return self::STEP_SELECT_ADDRESSES;
00121 }
00122
00123 public function setActiveStep($step)
00124 {
00125 if (isset($this->_steps[$step])) {
00126 $this->getCheckoutSession()->setCheckoutState($step);
00127 }
00128 else {
00129 $this->getCheckoutSession()->setCheckoutState(self::STEP_SELECT_ADDRESSES);
00130 }
00131
00132
00133 if(!$this->_steps[$step]->getIsActive()) {
00134 foreach($this->getSteps() as $stepObject) {
00135 $stepObject->unsIsActive();
00136 }
00137 $this->_steps[$step]->setIsActive(true);
00138 }
00139 return $this;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148 public function setCompleteStep($step)
00149 {
00150 if (isset($this->_steps[$step])) {
00151 $this->getCheckoutSession()->setStepData($step, 'is_complete', true);
00152 }
00153 return $this;
00154 }
00155
00156
00157
00158
00159
00160
00161
00162 public function getCompleteStep($step)
00163 {
00164 if (isset($this->_steps[$step])) {
00165 return $this->getCheckoutSession()->getStepData($step, 'is_complete');
00166 }
00167 return false;
00168 }
00169
00170
00171
00172
00173
00174
00175
00176 public function unsCompleteStep($step)
00177 {
00178 if (isset($this->_steps[$step])) {
00179 $this->getCheckoutSession()->setStepData($step, 'is_complete', false);
00180 }
00181 return $this;
00182 }
00183
00184 public function canSelectAddresses()
00185 {
00186
00187 }
00188
00189 public function canInputShipping()
00190 {
00191
00192 }
00193
00194 public function canSeeOverview()
00195 {
00196
00197 }
00198
00199 public function canSuccess()
00200 {
00201
00202 }
00203
00204
00205
00206
00207
00208
00209 public function getCheckoutSession()
00210 {
00211 return Mage::getSingleton('checkout/session');
00212 }
00213 }