Displaying value from the “ps_product” table in a twig file in prestashop 1.7.5

﹥>﹥吖頭↗ 提交于 2020-03-16 11:19:11

问题


I'm currently migrating an old shop in which the fields isDirect and isMotor already exist in the ps_product table.

I added these two fields in the ps_product table of the new shop.

These two fields are tinyint type, and their value is 0 or 1.

Here is my Product class :

public $isMotor;
public $isDirect;

with following data-structure:

'isMotor' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'isDirect' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),

Then when I try to add it in the twig file, nothing appears on the page:

{{ isMotor }}

Do you know how to make it display on the page? The goal would be to do an if else statement on twig (

if (isMotor) {
  echo ...;
}
else {
  echo ...;
}

来源:https://stackoverflow.com/questions/57523020/displaying-value-from-the-ps-product-table-in-a-twig-file-in-prestashop-1-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!