Skip to content

Configuration for checkout forms

You can use generic configuration for checkout forms to override the forms and form logic for your project.

Siso\Bundle\CheckoutBundle\Model\FormConfig is the class managing the configuration.

The checkout forms are configured in vendor/silversolutions/silver.e-shop/src/Siso/Bundle/CheckoutBundle/Resources/config/checkout.yml.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
parameters:
    checkoutForms:
        invoice:
            modelClass: Siso\Bundle\CheckoutBundle\Form\CheckoutInvoiceAddress
            typeService: siso_checkout.form_entity.checkout_invoice_address_type
            #typeClass:
            template: SilversolutionsEshopBundle:Checkout:checkout_invoice_address.html.twig
            templateSidebar: SilversolutionsEshopBundle:Checkout:sidebar_invoice_address.html.twig
            invalidMessage: error_message_checkout_invoice_address
            validMessage: success_message_checkout_invoice_address
            service: siso_checkout.checkout_form.invoice_address
        delivery:
            modelClass: Siso\Bundle\CheckoutBundle\Form\CheckoutDeliveryAddress
            typeService: siso_checkout.form_entity.checkout_delivery_address_type
            #typeClass:
            template: SilversolutionsEshopBundle:Checkout:checkout_delivery_address.html.twig
            templateSidebar: SilversolutionsEshopBundle:Checkout:sidebar_delivery_address.html.twig
            invalidMessage: error_message_checkout_delivery_address
            validMessage: success_message_checkout_delivery_address
            service: siso_checkout.checkout_form.delivery_address
        shippingPayment:
            modelClass: Siso\Bundle\CheckoutBundle\Form\CheckoutShippingPayment
            typeService: siso_checkout.form_entity.checkout_shipping_payment_type
            #typeClass:
            template: SilversolutionsEshopBundle:Checkout:checkout_shipping_payment.html.twig
            invalidMessage: error_message_checkout_shipping_payment
            validMessage: success_message_checkout_shipping_payment
            service: siso_checkout.checkout_form.shipping_payment
        summary:
            modelClass: Siso\Bundle\CheckoutBundle\Form\CheckoutSummary
            typeService: siso_checkout.form_entity.checkout_summary_type
            #typeClass:
            template: SilversolutionsEshopBundle:Checkout:checkout_summary.html.twig
            templateSidebar: SilversolutionsEshopBundle:Checkout:sidebar_summary.html.twig
            invalidMessage: error_message_checkout_summary
            validMessage: success_message_checkout_summary
            service: siso_checkout.checkout_form.summary

You can modify this configuration to override e.g. the form type, form service or templates.

Note

If you change the form model class, you should also override the form type, templates and form service, because the logic may have changed.

Other configuration values

vendor/silversolutions/silver.e-shop/src/Siso/Bundle/CheckoutBundle/Resources/config/checkout.yml contains settings for forms and preferred choices. The choices for the delivery address depend on the user status.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
parameters:
    ses_forms.checkout_values:
        deliveryAddressStatusCustomerNr:
            sameAsInvoice: use_invoice_as_delivery
            new: new_delivery
            existing: existing_delivery
        deliveryAddressStatusAnonymous:
            sameAsInvoice: use_invoice_as_delivery
            new: new_delivery
        deliveryAddressStatusNoCustomerNr:
            sameAsInvoice: use_invoice_as_delivery
            new: new_delivery
        shippingMethods:
            standardMail: standard_mail
            mail: mail
            expressDelivery: express_delivery
        paymentMethods:
            paypal: paypal
            invoice: invoice
            creditCard: credit_card

    ses_forms.checkout_preferred_choices:
        preferred_delivery_address_status_no_customer_nr: new
        preferred_delivery_address_status_anonymous: new
        preferred_delivery_address_status_customer_nr: sameAsInvoice
        preferred_shipping_method: standardMail
        preferred_payment_method: creditCard

Tip

You can also override the shipping and payment method configuration by implementing a Pre-form-checkout event that stores the values in the dataMap.

Caution

The value of the preferred choice and the index of the choice must match.

For example:

1
2
3
4
5
6
7
8
ses_forms.checkout_values:
    deliveryAddressStatusCustomerNr:
        sameAsInvoice: use_invoice_as_delivery
        new: new_delivery existing:
        existing_delivery

ses_forms.checkout_preferred_choices:
    preferred_delivery_address_status_customer_nr: sameAsInvoice
Read the Docs