Add a field in a product with AM 4

Discussion in 'aMember Pro v.4' started by nganhtuan63, Aug 23, 2012.

  1. nganhtuan63

    nganhtuan63 New Member

    Joined:
    Jul 3, 2012
    Messages:
    3
    Hi Alex,
    I'm looking for 'How to add a field in a new product'.
    I found some solution in forum. But not run.
    I try to add a new file named site.inc.php in amember root folder with include code like:
    Code:
    <?php
    add_product_field('field_name', 'Field Name', 'text', "Field Description to appear on product page");
    ?>
    
    But not run, new product form not having new field.

    Can you help me a new solution ?
  2. nganhtuan63

    nganhtuan63 New Member

    Joined:
    Jul 3, 2012
    Messages:
    3
    ok. I just found:
    add some code in amember/application/site.php (if not having site.php, just creating)
    Code:
    Am_Di::getInstance()->productTable->customFields()->add('site_url','Provide URL of your store','text');
    
    if you want add a new field in your billing table ?
    Code:
    Am_Di::getInstance()->billingPlanTable->customFields()->add('install_theme','Installation theme','text');
    
  3. bsg1

    bsg1 New Member

    Joined:
    Apr 29, 2009
    Messages:
    8
    Created the site.php and just added the line of code you provided above and didn't see it get added. Is there another step?
  4. nganhtuan63

    nganhtuan63 New Member

    Joined:
    Jul 3, 2012
    Messages:
    3
    sorry. The correct path of site.php is:
    amember/application/configs/site.php​
  5. bsg1

    bsg1 New Member

    Joined:
    Apr 29, 2009
    Messages:
    8

Share This Page