Warning: You are browsing the documentation for PrestaShop 8, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 9. Read the updated version of this page

Learn how to update to the latest version.

AmountCurrencyType

Amount with currency: combination of a NumberType input and a ChoiceType input (for currency selection).

Type options

Option Type Default value Description
label boolean false
amount_constraints string []
inherit_data boolean true
currencies array []

Code example

$builder
   ->add('amount_currency', AmountCurrencyType::class, [
        'amount_constraints' => [
            new NotNull(),
            new GreaterThan([
                'value' => 0,
                'message' => $this->translator->trans(
                    'Invalid value: the payment must be a positive amount.', [], 'Admin.Notifications.Error'
                ),
            ]),
        ],
        'currencies' => $this->currencySymbolByIdChoiceProvider->getChoices([
            'id_shop' => $this->contextShopId,
        ]),
    ])

Preview example

AmountCurrencyType rendered in form example