-->

Displaying value from the “ps_product” table in a

2020-05-09 09:10发布

问题:

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 ...;
}