Jump to content

Edit History

bk_developer

bk_developer

Hi

I am trying to add a custom field by the name "minimumprice" in product form right after the wholesale_price. I have used the following code to achieve it. But it is not working. Custom field is not displayed in the product form.

 

public function hookActionProductFormBuilderModifier(array $params) {

/** @var $formBuilder \Symfony\Component\Form */

$formBuilder = $params['form_builder']; 

$allFields = $formBuilder->all(); foreach ($allFields as $inputField => $input) {

$formBuilder->remove($inputField); }

foreach ($allFields as $inputField => $input) {

$formBuilder->add($input);

if ($inputField == 'wholesale_price') {

/** @var MoneyType::class \Symfony\Component\Form\Extension\Core\Type\MoneyType */

$formBuilder->add( 'minimumprice', MoneyType::class, ['label' => 'Minimum Price'] );

} } } 

bk_developer

bk_developer

Hi

I am trying to add a custom field by the name "minimumprice" in product form right after the wholesale_price. I have used the following code to achieve it. But it is not working. Custom field is not added in the product form.

 

public function hookActionProductFormBuilderModifier(array $params) {

/** @var $formBuilder \Symfony\Component\Form */

$formBuilder = $params['form_builder']; 

$allFields = $formBuilder->all(); foreach ($allFields as $inputField => $input) {

$formBuilder->remove($inputField); }

foreach ($allFields as $inputField => $input) {

$formBuilder->add($input);

if ($inputField == 'wholesale_price') {

/** @var MoneyType::class \Symfony\Component\Form\Extension\Core\Type\MoneyType */

$formBuilder->add( 'minimumprice', MoneyType::class, ['label' => 'Minimum Price'] );

} } } 

bk_developer

bk_developer

Hi

I am trying to add a custom field by the name "minimumprice" in product form right after the wholesale_price. I have used the following code to achieve it. But it is not working.

 

public function hookActionProductFormBuilderModifier(array $params) {

/** @var $formBuilder \Symfony\Component\Form */

$formBuilder = $params['form_builder']; 

$allFields = $formBuilder->all(); foreach ($allFields as $inputField => $input) {

$formBuilder->remove($inputField); }

foreach ($allFields as $inputField => $input) {

$formBuilder->add($input);

if ($inputField == 'wholesale_price') {

/** @var MoneyType::class \Symfony\Component\Form\Extension\Core\Type\MoneyType */

$formBuilder->add( 'minimumprice', MoneyType::class, ['label' => 'Minimum Price'] );

} } } 

×
×
  • Create New...