Product Category-Dependent Custom Fields in admin

Discussion in 'Customization & add-ons' started by bfritton, Jan 24, 2013.

  1. bfritton

    bfritton Certified aMember Developer

    Joined:
    Oct 26, 2009
    Messages:
    54
    Hello all,
    I'm using aMember as my company's central billing system for a number of platforms, all have their own aMember product categories that are filled with different subscription products specific to the platform our customer is subscribing to (ie a Magento-based product offering versus a wordpress one).

    I have non-technical Administators that will need to, on occasion, adjust custom product field values that I've made available in the admin by using, for example:

    PHP:
    Am_Di::getInstance()
                ->
    productTable
                
    ->customFields()
                ->
    add(new Am_CustomFieldText(
                    
    'magento_sub_product_id',
                    
    "Magento Subscription Product ID",
                    
    'When a user subscribes to this product, they will receive a subscription to this product in Magento',
                    
    ''
                
    )
            );
    Now its working fine but my issue is that Administrators are getting confused when they see magento-related custom product fields on another platform's subscription product edit form.

    Is there any way I can show these fields for certain product categories only in the admin? The solution to this in the frontend would be helpful as well but I'm really looking for the admin end of it as post of the fields are not shown nor editable by customers.

    Thanks for any help you can offer!
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    This couldn't be done as plugin but you can modify function which adds these fields to form.
    Check /amember/application/AdminUsersController.php :
    function insertAdditionalFields()

Share This Page