为什么prestashop不将我的修改保存到数据库中?使用prestashop 1.7
/override/classes/Product.php
class Product extends ProductCore {
public $por_gan; public function __construct ($idProduct = null, $idLang = null, $idShop = null) {
$definition = self::$definition;
$definition['fields']['por_gan'] = array('type' => self::TYPE_INT, 'required' => false);
parent::__construct($idProduct, $idLang, $idShop); } }
Run Code Online (Sandbox Code Playgroud)
在ProductInformation.php中
->add('por_gan', 'Symfony\Component\Form\Extension\Core\Type\NumberType', array(
'required' => false,
'label' => $this->translator->trans('Beneficio', [], 'Admin.Catalog.Feature'),
'constraints' => array(
new Assert\NotBlank(),
new Assert\Type(array('type' => 'numeric'))
),
))
Run Code Online (Sandbox Code Playgroud)
在form.html.twing中
<div class="col-md-6">
<label class="form-control-label">% de beneficio</label
{{ form_widget(form.step1.por_gan) }}
</div>
Run Code Online (Sandbox Code Playgroud)
谢谢