CoolCMS API

SummaryFormTrait

Step 3: recap and binding order submit.

IMPORTANT: a double click must not create two orders. The form carries a one-time token issued when the step is shown (CartManager::issueToken()); submitting burns it, so a second attempt (double click, reload, back button) creates no order and only redirects to the one that already exists. The PHP session lock also serializes concurrent requests of one session, so both cannot pass.

Api errors are translated into a clear message and a way out:

  • insufficientStock: back to the cart with the list of goods.
  • sellerRequired and paymentCallbackMisconfigured: an operational error the customer cannot fix (logged in the eshop log for the operator).
  • voucherInvalid: back to the cart, where vouchers are entered.
  • shippingInvalid and paymentInvalid: back to step 2.

Table of Contents

Methods

onSummarySuccess()  : void
summaryRows()  : array<int, array<string, mixed>>
createComponentSummaryForm()  : Form
controlString()  : string
handlePlaceFailure()  : void
redirectToDone()  : void
summaryStr()  : string

Methods

summaryRows()

public summaryRows() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>> —

recap rows for the template

controlString()

private controlString(Form $form, string $name) : string
Parameters
$form : Form
$name : string
Return values
string

handlePlaceFailure()

private handlePlaceFailure(array<string, mixed> $result) : void
Parameters
$result : array<string, mixed>

redirectToDone()

private redirectToDone(int $orderId, int|null $paymentId) : void
Parameters
$orderId : int
$paymentId : int|null

summaryStr()

private summaryStr(mixed $value) : string
Parameters
$value : mixed
Return values
string
On this page

Search results