SUBS-Data loops over the subscriptions of the logged-in customer, and within this loop all other tags return the details for the respective subscription.
- Guide: Subscription module
- Reference: SUBS- (taking out a subscription)
The loop over the subscriptions
SUBS-Data can do three things: output the number of subscriptions as a single tag, check as a bracketing whether there are any at all, and loop over them.
SUBS-Data is not limited to the management page. The loop works on all templates as long as a buyer is logged in. On an overview page, for example, you can use it to display the number of running subscriptions.The subscribed product
SUBS-Data_Index is the identifier the shop system uses to address this one subscription. It is contained in all field names within the loop and ensures that a form page with several subscriptions remains unambiguous.SUBS-Data_SubShop() optionally takes subshop identifiers as parameters and then applies as a bracketing only for these. Without a parameter, it outputs the identifier in which the product was subscribed.The delivery interval
Letting the customer change the interval
If the customer is to change the interval, build the same selection within the loop as on the product page. There,SUBS-CycleSelection_input automatically returns the field name related to this subscription, and SUBS-CycleSelection_data_selected compares against the stored interval instead of against a form input.
Points in time and counters
All four time values come as Unix timestamps and are converted into a readable form via the date tags.For
SUBS-Data_nextorder_unixtimestamp, only the date part is reliable. The time it contains says nothing about when on that day the order is actually placed.All five tags apply as a bracketing when a value is present. For a newly created subscription, the time of the last order and the counter are still empty. Therefore, bracket the output instead of displaying a 0 or 1 January 1970.
The state of the subscription
SUBS-Data_state_code outputs the technical code; four bracketings query it.
States 1 and 2 concern the transition from taking out the subscription to the first delivery. A subscription is initially new, and as soon as the first order has been triggered, it is considered triggered. After that, it switches to active.
SUBS-Data_state_code is exclusively a single tag. For case distinctions, use the four bracketings.Pausing, resuming and deleting
Each action runs via its own button.SUBS-Data_Buttonname returns the name, the three Buttonvalue tags the value.
Pausing and resuming are only available in the appropriate state.
SUBS-Data_Buttonvalue_pause returns nothing for an already paused subscription and does not apply as a bracketing there either; conversely, SUBS-Data_Buttonvalue_resume only applies for a paused subscription. Therefore, bracket the two buttons with their own tag so that only the sensible one appears in each case.Deleting is always available. The bracketing of
SUBS-Data_Buttonvalue_delete applies in every state and serves the consistency of the template rather than a case distinction.The feedback after an action
After submission, five tags per subscription tell you what happened to it.Code 0 means “not affected”. It is never output, because in this case
SUBS-Data_affected already does not apply. The four codes are therefore: 0 not affected, 1 changed, 2 paused, 3 resumed.The feedback applies to the call immediately after submission. If the customer reloads the page, it is gone.
Payment method, bank details and delivery address per subscription
These three details are stored on the individual subscription. All three tags output the value as a single tag and apply as a bracketing if it is set. With a parameter, they check for equality instead.For index 0, the bracketing does not apply. Here this is not a missing value but a statement: for
SUBS-Data_DelivAddress(), 0 means that no different delivery address is stored, and for SUBS-Data_BankIndex(), that no bank details are attached to the subscription. Catch this case with the negative bracketing.The bank index is only relevant for direct debit. For other payment methods, it is usually 0.
Building the selection for changes
If the customer is to change these three details, use the same_input and _selected tags as on the product page. Within the loop, the _input tags append the subscription identifier to the field name, so that a page with several subscriptions also remains unambiguous.
Triggering new subscriptions
When the customer has just taken out a subscription, it initially appears as new in the list without any order having been placed yet. A separate button triggers the first order.Both tags belong outside the
SUBS-Data loop, because they refer to all new subscriptions at once and not to a single one. They are therefore also the only tags on this page that are available outside the loop.The bracketing applies as long as at least one subscription is in the “new and active” state, that is, code 1. An already triggered subscription with code 2 no longer counts.
Tags at a glance
The table reflects the tag mask of the shop system. Several tags are permitted as single tags in it but output nothing there. This concerns all pure bracketings, that is, the units, the states and the tags of the
SUBS-Data_affected family. The previous documentation lists these tags only as bracketings, which corresponds to their sensible use.SUBS-Buttonname and SUBS-Buttonvalue_triggernewsubscriptions belong in the SUBS-Data loop. Outside it, they are invalid tags.
Related topics
- Guide: Subscription module
- Reference: SUBS- (taking out a subscription)
- Reference: E-SUBS- (subscription module)
- Reference: DC- (date and time)
- Reference:
Subscriptionsection in the shop configuration
