VbzCart/v1/class/vcPageContent ckout/CapturePage
< VbzCart | v1/class | vcPageContent ckout
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Call Chains
- vcPageContent_ckout::OnRunCalculations() [protected; events system] calls...
- vcPageContent_ckout::ProcessPage() [protected], which calls...
- vcPageContent_ckout::CapturePage() [protected], which calls...
- vcPageContent_ckout::CaptureBilling(), which is essentially a shortcut to...
- vcPageContent_ckout::CaptureCart() [protected]
- vcPageContent_ckout::CaptureShipping() [protected], which calls...
- vcCartDataManager::CaptureShippingPage() [public]
- vcPageContent_ckout::CapturePage() [protected], which calls...
- vcPageContent_ckout::ProcessPage() [protected], which calls...
Code
/*----
ACTION: receives form input and determines where to save it
enforces form rules -- mainly, don't allow advance until all required fields are filled in
OUTPUT:
* logs Cart event recording which page's form was received
* sets $this->PageKey_forShow()
* sets $this->DidRequestAdvance()
REQUIRES: Input needs to have been parsed so we know what page's data we're capturing
*/
protected function CapturePage() {
$sPKeyData = $this->GetPageKey_forData();
// log as system event
/*
$arEv = array(
fcrEvent::KF_CODE => 'CK-PG-REQ', // checkout page request
fcrEvent::KF_DESCR_START => 'saving data from page '.$sPKeyData,
fcrEvent::KF_WHERE => 'ckout.CapturePage',
fcrEvent::KF_PARAMS => array(
'pgData' => $sPKeyData,
'pgShow' => $this->GetPageKey_forShow()
)
);
*/
// log cart progress
$arEv = array(
'pgData' => $sPKeyData,
'pgShow' => $this->GetPageKey_forShow()
);
$rcCart = $this->GetCartRecord();
$rcSysEv = $rcCart->CreateEvent(
'CK-PG-REQ', // CODE: checkout page request
'saving data from page '.$sPKeyData, // TEXT
$arEv // DATA
);
// DEBUGGING
//echo "PAGE KEY FOR DATA = [$sPKeyData]<br>";
//$arStat = $this->GetFormObject()->Receive($_POST);
$out = NULL; // no processing needed
switch ($sPKeyData) {
case KSQ_PAGE_CART: // shopping cart
$out = $this->CaptureCart();
$this->formSeqData = KI_SEQ_CART; // 0
break;
case KSQ_PAGE_SHIP: // shipping information
$out = $this->CaptureShipping();
$this->formSeqData = KI_SEQ_SHIP; // 1
break;
case KSQ_PAGE_PAY: // billing information
$out = $this->CaptureBilling();
$this->formSeqData = KI_SEQ_PAY; // 2
break;
case KSQ_PAGE_CONF: // confirmation
$out = NULL; // no processing needed
$this->formSeqData = KI_SEQ_CONF; // 3
break;
default:
$this->formSeqData = NULL;
// more likely to be a hacking attempt than an internal error:
$out = "Cannot save data from unknown page [$sPKeyData]";
$arEv = array(
fcrEvent::KF_DESCR_FINISH => 'page not recognized',
fcrEvent::KF_IS_ERROR => TRUE,
);
$rcSysEv->Finish($arEv);
}
$rcCart->UpdateBlob();
$this->GetFormObject()->Save();
return $out;
}