CartThrob Credits Version 1.17
CartThrob Credits addon enables your CartThrob powered site to sell Credits to customers that can be redeemed as 1 to 1 credits, or as micropayments. Purchase and redemption of credits requires membership. Purchased credits can not be automatically gifted to another user, and are tied to the member account.
CartThrob Credits is an addon for CartThrob. Like other CartThrob addons, it must be uploaded and installed on your website, and CartThrob must be active for it to run. To use this addon, you will need to add additional template tags for selling, redeeming, and viewing information about credit balances. You can place the tags in any of your EE templates to suit your specific workflow. Sample template code can be found here in the documentation.
When active in a customer account, credits are deducted from each purchase until the credits are exhausted, at which point a backup payment option will be required to complete the transaction, or more credits will need to be purchased.
Features
Credits are tied to the member account. No redemption codes are needed to use credits. They're automatically deducted from the purchase price in each transaction
Credits are stored in the database and can be used across multiple transactions
An optional credit payment gateway is included, which will make it possible for you to force customers into only using credits to complete a transaction and disallow any other payment method.
Requirements
- ExpressionEngine 2.5+
- CartThrob 2.2+
- PHP 5.3+
Installation
- Upload the
/system/expressionengine/third_party/cartthrob_credits/
folder to/system/expressionengine/third_party/
- Make sure Extensions are enabled on your system
- Install the CartThrob Credits module and extension (through EE's add-ons/modules panel)
- Upload the individual files stored in the
/system/expressionengine/third_party/cartthrob/
folder to their respective folders in your CartThrob installation.
Upgrading
- Upload the
/system/expressionengine/third_party/cartthrob_credits/
folder to/system/expressionengine/third_party/
Overwriting existing files. - Go to EE settings » addons » and click "Run Module Updates"
Settings
The settings are self-explanatory for the most part, however please pay note the default conversion rate. By default all credits will be applied at a one to one ratio. You can change this however, by adjusting the "default conversion rate". If you would like to apply 3 credits to every dollar, you would set this setting to "3". Any time Credits converts a monetary value, it will be multiplied by this conversion rate. This is useful when you will be selling small items for less than $1 (for instance when used with a gaming system where members purchase experience points, or virtual game items), or when the purchase power of $1 becomes less over time (for instance when used with micropayments).
Tags
cart_total_minus_credits
outputs the total with credits deducted
{exp:cartthrob_credits:cart_total_minus_credits}
credits
outputs the credits for the logged in user
{exp:cartthrob_credits:credits}
credits_data
This is a tag pair that outputs information about credits available to a specific member.
member_id
If the member id parameter is not set, all credit information for all members will be listed.
Example
{exp:cartthrob_credits:credits_data member_id="{logged_in_member_id}"}
there are {credits} credits for member
{member_id}
<br />
{if no_results}
No credits
{/if}
{/exp:cartthrob_credits:credits_data}
redemptions
Outputs information about redemptions made by this member, or connected to a specific order_id
This is tag is a variable pair. If no order_id is supplied, it automatically applies to the logged in member.
// Member Specific
{exp:cartthrob_credits:redemptions}
order_id {order_id}
credits_used {credits_used}
amount {amount}
member_id {member_id}
id {id}
{/exp:cartthrob_credits:redemptions}
// Order Specific
{exp:cartthrob_credits:redemptions order_id="{order_id}"}
order_id {order_id}
credits_used {credits_used}
amount {amount}
member_id {member_id}
id {id}
{/exp:cartthrob_credits:redemptions}
add_to_cart_form
This tag pair extends CartThrob's default add to cart form tag, making it possible to add credits to the cart, which can be purchased for later redemption. The amount of an item added to the cart is used as the basis for the credit purchase. If credits are not manually set when adding an item to the cart, the default conversion rate will be applied to the items price, and that amount of credits will be added to the customer's account when the customer successfully completes checkout.
credits
The credits parameter, is a parameter of the add_to_cart_form
tag. It is optional, and only used to override the default conversion rate that would otherwise be automatically applied when adding credits to the cart. If the default conversion rate is 1 to 1, but you'd like to give 10 credits for a $1 item, you can use this parameter to specify the desired credit amount. If this value is specified the conversion rate is completely ignored for this item
credits="10"
for all other prarmaters, see add_to_cart_form for more details.
Example
{exp:channel:entries channel="products"}
{exp:cartthrob_credits:add_to_cart_form return="cart/index" entry_id="{entry_id}" credits="10"}
<input type="submit" name="Add this item which will apply 10 credits to your account" />
{/exp:cartthrob_credits:add_to_cart_form}
{/exp:channel:entries}