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_idUnique ID for the subscription in Subscribe Pro
statusSubscription status ('Active', 'Failed', 'Paused', etc)
next_order_dateOrder date for the next subscription order which is due
platform_product_idSubscribe Pro product ID subscribed
product_skuProduct SKU subscribed
product_idMagento product ID subscribed
qtyQuantity subscribed
platform_customer_idSubscribe Pro customer ID
customer_idMagento customer ID
intervalSubscription interval (period). I.E. 'Monthly', '1 Month', etc
shipping_methodMagento shipping carrier and method code, for example: flatrate_flatrate or ups_03
coupon_codeMagento 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 StatusAllowed Status Transitions
ActiveRetry, Failed, Expired, Paused, Cancelled
RetryActive, Failed, Expired, Cancelled
FailedActive, Expired, Paused, Cancelled
PausedActive, Expired
CancelledActive
ExpiredActive

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