How to get the expiration day for a specific product/category?

Discussion in 'Customization & add-ons' started by gennaro_montone, Jan 16, 2016.

  1. gennaro_montone

    gennaro_montone aMember Pro Customer

    Joined:
    Jul 8, 2012
    Messages:
    17
    Hello,

    I know that I can use this code to get the expiration day:
    PHP:
    echo "Your subscirpiton will be expired at "am4PluginsManager::getAPI()->getExpire();
    In my case we offer different packages so it could happen that a user has different expirations, becasue of different products. If I use the code above, the result will refer to the last expiration date possible for that user.

    How to get the expiration day for a specific product/category?

    Thanks!
    Jen
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Here is signature of this method
    PHP:
    public function getExpire($search self::ANY)
    $search can be either product_id or array of product_id or one of the following constants:
    • Am_Lite::ANY - subscription to any product
    • Am_Lite:: PAID - any not-free subscription
    • Am_Lite::FREE - any free subscription
    So to get expire date for product with id 10 you can use code:
    PHP:
    am4PluginsManager::getAPI()->getExpire(10);

Share This Page