The Subscription Model Class
NOTE: This information only applies to versions 1.3.x and earlier of the Magento 1 extension for Subscribe Pro. Versions 1.4.0.0 and later make use of the Subscribe Pro PHP SDK.
The SFC_Autoship_Model_Subscription
Class
The class SFC_Autoship_Model_Subscription
is used through the extension to represent a single subscription.
Data fields on the subscription model may be accessed like this:
$subscription->getData('subscription_id');
The class provides the following data fields which may be used to get and set information about a subscription:
Field | |
---|---|
subscription_id | Unique ID for the subscription in Subscribe Pro |
status | Subscription status ('Active', 'Failed', 'Paused', etc) |
next_order_date | Order date for the next subscription order which is due |
platform_product_id | Subscribe Pro product ID subscribed |
product_sku | Product SKU subscribed |
product_id | Magento product ID subscribed |
qty | Quantity subscribed |
platform_customer_id | Subscribe Pro customer ID |
customer_id | Magento customer ID |
interval | Subscription interval (period). I.E. 'Monthly', '1 Month', etc |
shipping_method | Magento shipping carrier and method code, for example: flatrate_flatrate or ups_03 |
coupon_code | Magento coupon code which is applied to the subscription. Or null if no coupon. |
Subscription Status Changes A subscription can have a status of active, retry, failed, expired, paused, and cancelled. However, the ability to change a subscription to a given status depends on the current status. The following chart explains the allowed status transitions:
Original Status | Allowed Status Transitions |
---|---|
Active | Retry, Failed, Expired, Paused, Cancelled |
Retry | Active, Failed, Expired, Cancelled |
Failed | Active, Expired, Paused, Cancelled |
Paused | Active, Expired |
Cancelled | Active |
Expired | Active |
Specific Examples of Customization (Code Samples)
Overriding the Next Order Date when new subscriptions are created
Click to download: modify_new_subscription_dates.php
Changing the product SKU on an existing subscription
Click to download: change_subscription_sku.php