How to add fields to a product

From aMember Pro Documentation
Jump to: navigation, search

Add this code to site.php file:

Am_Di::getInstance()->productTable->customFields()->add(new Am_CustomFieldText('field_name', 'Field Title'));

List of available additional field types:

  • Am_CustomFieldHidden
  • Am_CustomFieldText
  • Am_CustomFieldSelect
  • Am_CustomFieldRadio
  • Am_CustomFieldCheckbox

To retrieve value of such field for specific product from product record you can use the following code:

$product = Am_Di::getInstance()->productTable->load(1); //retrieve product record with id = 1