Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

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