VbzCart/docs/v1/class/vcPageContent ckout/DoPage: Difference between revisions
< VbzCart | docs | v1/class | vcPageContent ckout
Jump to navigation
Jump to search
imported>Woozle No edit summary |
m (Woozle moved page VbzCart/VbzCart/v1/class/vcPageContent ckout/DoPage to VbzCart/docs/v1/class/vcPageContent ckout/DoPage without leaving a redirect: part 5/5) |
||
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{page/code/class/method}} | {{page/code/class/method}} | ||
==Notes== | ==Notes== | ||
'''2019- | '''2019-05-05''' Revised order of events: | ||
* '''detect submitted page''' - $this->GetPageKey_forData(); | * PHASE I: receive | ||
* ''' | ** '''detect submitted page''' - $this->GetPageKey_forData(); | ||
* '''determine page to show''' - $this->HandlePageRequest(); | ** '''load controls to receive that''' | ||
** calculate if requested page should be displayed | ** '''receive form data''' | ||
* '''load | ** '''save form data''' | ||
** ''' | *** save back to blob -- the Cart should save the blob field on return | ||
* PHASE II: display | |||
** '''determine page to show''' - $this->HandlePageRequest(); | |||
*** calculate if requested page should be displayed (if any required fields are missing, can't advance) | |||
** '''load controls to display that''' | |||
** '''load any saved values from blob''' | |||
** DON'T '''display the page''' because that is handled by the {{l/version/method|vcPageContent_ckout|Render}}() event. | |||
Old notes: | |||
* | ==History== | ||
* | * '''2019-05-22''' This has been renamed to DoPage() and substantially rewritten; other related objects gutted | ||
* '''2019-05-05''' Order of events revised | |||
* '''{{l/sub|2019-04-27}}''' old notes archived | |||
==Calls== | ==Calls== | ||
* {{l/version/method|vcPageContent_ckout|OnRunCalculations}}() [protected; events system] calls... | * {{l/version/method|vcPageContent_ckout|OnRunCalculations}}() [protected; events system] calls... | ||
** {{hilite|{{l/version/method|vcPageContent_ckout|ProcessPage}}()}} calls | ** {{hilite|{{l/version/method|vcPageContent_ckout|ProcessPage}}()}} calls | ||
*** {{l/version/method|vcPageContent_ckout|DetectPageRequest}}() | *** {{l/version/method|vcPageContent_ckout|DetectPageRequest}}() | ||
*** {{l/version/method|vcPageContent_ckout|HandlePageRequest}}() | *** {{l/version/method|vcPageContent_ckout|HandlePageRequest}}() | ||
*** {{l/version/method|vcPageContent_ckout|CapturePage}}($oRes); | |||
* Internal states: | * Internal states: | ||
** {Set/Get}PageKey_Request() - the page requested by the user | ** {Set/Get}PageKey_Request() - the page requested by the user | ||
Line 45: | Line 51: | ||
$gotPgDest = FALSE; | $gotPgDest = FALSE; | ||
$gotPgSrce = FALSE; | $gotPgSrce = FALSE; | ||
// 2019-04-28 Should this bit be moved into HandlePageRequest()? | |||
$sKey = fcHTTP::Request()->GetString(KSQ_ARG_PAGE_DEST); | $sKey = fcHTTP::Request()->GetString(KSQ_ARG_PAGE_DEST); | ||
if (is_null($sKey)) { | if (is_null($sKey)) { | ||
Line 52: | Line 60: | ||
$this->SetPageKey_forShow($sKey); | $this->SetPageKey_forShow($sKey); | ||
} | } | ||
// [end of "this bit"] | |||
// get actual page to display | // get actual page to display | ||
Line 82: | Line 91: | ||
$this->doRefrBtn = FALSE; | $this->doRefrBtn = FALSE; | ||
// | $this->DetectPageRequest(); | ||
$this->HandlePageRequest(); | |||
// controls need to get added by this point | |||
echo 'RECEIVING FORM IN ['.$this->GetName().']<br>'; | |||
$oRes = $this->GetFormObject()->Receive($_POST); // returns fcFormResult | $oRes = $this->GetFormObject()->Receive($_POST); // returns fcFormResult | ||
$this->CapturePage($oRes); | $this->CapturePage($oRes); | ||
//$this->GetSkinObject()->Content('main',$this->RenderPage()); | //$this->GetSkinObject()->Content('main',$this->RenderPage()); | ||
} | } | ||
</source> | </source> |
Latest revision as of 01:58, 25 February 2024
Template:Page/code/class/method
Notes
2019-05-05 Revised order of events:
- PHASE I: receive
- detect submitted page - $this->GetPageKey_forData();
- load controls to receive that
- receive form data
- save form data
- save back to blob -- the Cart should save the blob field on return
- PHASE II: display
- determine page to show - $this->HandlePageRequest();
- calculate if requested page should be displayed (if any required fields are missing, can't advance)
- load controls to display that
- load any saved values from blob
- DON'T display the page because that is handled by the Template:L/version/method() event.
- determine page to show - $this->HandlePageRequest();
Old notes:
History
- 2019-05-22 This has been renamed to DoPage() and substantially rewritten; other related objects gutted
- 2019-05-05 Order of events revised
- 2019-04-27 old notes archived
Calls
- Template:L/version/method() [protected; events system] calls...
- Internal states:
- {Set/Get}PageKey_Request() - the page requested by the user
- {Set/Get}PageKey_forShow() - the page to display
- Template:L/version/method()
Code
/*----
PURPOSE: core form processing & page rendering
ACTIONS:
* dispatches to ParseInput_Login() & HandleInput_Login() to render/handle login controls
* logs a Cart event to record which page was displayed
* sets PageKey_forShow()
* dispatches to RenderPage() to render the page
HISTORY:
2018-07-21
* ParseInput_Login() and HandleInput_Login() were defined in files which have now
been removed from VbzCart. This *should* now be handled automatically by Ferreteria
if the right page component class is used.
* Also, PageKey_forShow_default() no longer exists; I'm going to assume
that we can just use PageKey_forShow().
TODO: Consider whether maybe this functionality should be moved into $oContent.
*/
protected function ProcessPage() {
$gotPgDest = FALSE;
$gotPgSrce = FALSE;
// 2019-04-28 Should this bit be moved into HandlePageRequest()?
$sKey = fcHTTP::Request()->GetString(KSQ_ARG_PAGE_DEST);
if (is_null($sKey)) {
$this->SetPageKey_forShow(KSQ_PAGE_SHIP);
} else {
$gotPgDest = TRUE;
$this->SetPageKey_forShow($sKey);
}
// [end of "this bit"]
// get actual page to display
$sShow = $this->GetPageKey_forShow();
/*
$arEv = array(
fcrEvent::KF_CODE => 'PG-IN',
fcrEvent::KF_DESCR_FINISH => 'showing page "'.$sShow.'"',
fcrEvent::KF_WHERE => 'HandleInput()',
); */
$rcCart = $this->GetCartRecord_ifWriteable();
if (is_null($rcCart)) {
$sMsg = fcApp::Me()->MessagesString();
$wpCart = vcGlobals::Me()->GetWebPath_forCartPage();
if (is_null($sMsg)) {
// 2016-04-24 This can happen when browser fingerprint changes.
//throw new exception('In checkout with no current cart set, but there are no error messages.');
$sMsg = "You don't seem to have a shopping cart yet, so you can't check out. If you had one before, your IP address or browser version may have changed.";
fcHTTP::DisplayOnReturn($sMsg);
fcHTTP::Redirect($wpCart);
} else {
fcHTTP::DisplayOnReturn($sMsg);
fcHTTP::Redirect($wpCart);
}
}
//$rcEv = $rcCart->CreateEvent($arEv);
$rcEv = $rcCart->CreateEvent('PG-IN',"showing page '$sShow'"); // 2018-07-22 can add array (3rd arg) with additional info if needed
$this->doBackBtn = TRUE;
$this->doRefrBtn = FALSE;
$this->DetectPageRequest();
$this->HandlePageRequest();
// controls need to get added by this point
echo 'RECEIVING FORM IN ['.$this->GetName().']<br>';
$oRes = $this->GetFormObject()->Receive($_POST); // returns fcFormResult
$this->CapturePage($oRes);
//$this->GetSkinObject()->Content('main',$this->RenderPage());
}