We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37438
    • 20 Posts
    Hi guys,

    I'm trying to add more fields into a table that represented by a xPDO object

    I added the corresponding <field> statement in the schema file.

    For example

    <field key="packs_per_carton" dbtype="tinyint" attributes="unsigned" precision="5" phptype="integer"  null="false" default="0" />
    


    However I couldn't get the new fields in the toArray() method

    
    $product = $modx->getObject('vcProduct', $productId);
    
    $productArray = $product->toArray();


    In firebug I couldn't see the new fields in the Response.

    I can't save or retrieve data from the new fields at all.

    Could anyone shed me some light please?
    [ed. note: wizardofoz last edited this post 14 years, 11 months ago.]
      • 37438
      • 20 Posts
      $product->get('packs_per_carton')


      return NULL

      It seems not picked up in the object property.

      I'm using revolution 2.1.3
        • 37438
        • 20 Posts
        found it! I had to update the map file as well