Skip to content

Instantly share code, notes, and snippets.

@ismailmechbal
Forked from likewhoa/1. distro.make
Created April 23, 2014 22:02
Show Gist options
  • Save ismailmechbal/11234000 to your computer and use it in GitHub Desktop.
Save ismailmechbal/11234000 to your computer and use it in GitHub Desktop.
api = 2
core = 7.x
projects[drupal][type] = core
projects[drupal][download][type] = git
projects[drupal][download][branch] = 7.x
projects[drupal][download][url] = http://git.drupal.org/project/drupal.git
# Fetch Drupal 7 core
> drush -y make distro.make
# Install Drupal
> drush -y site-install minimal --db-url=mysql://username:password@localhost/dbname # Save the admin password for later.
# Install Contrib Modules
> drush -y dl addressfield-7.x-1.x-dev ctools-7.x-1.x-dev entity-7.x-1.x-dev rules-7.x-2.x-dev views-7.x-3.x-dev features-7.x-2.x-dev commerce-7.x-1.x-dev commerce_features-7.x-1.x-dev date-7.x-2.x-dev field_permissions-7.x-1.x-dev field_group-7.x-2.x-dev interval-7.x-1.x-dev admin_menu-7.x-3.x-dev devel-7.x-1.x-dev strongarm-7.x-2.x-dev message-7.x-1.x-dev entityreference-7.x-1.x-dev commerce_paypal-7.x-2.x-dev commerce_sp-7.x-2.x-dev commerce_sp_paypal-7.x-1.x-dev
# Enable Contrib Modules
> drush en -y commerce commerce_ui commerce_customer commerce_customer_ui commerce_price commerce_line_item commerce_line_item_ui commerce_order commerce_order_ui commerce_checkout commerce_payment commerce_product commerce_cart commerce_product_pricing commerce_product_ui commerce_tax_ui admin_menu devel commerce_sp commerce_sp_paypal
You now only need to do the following steps.
1. Create a few subscription based products
admin/commerce/products/add/commerce-sp-subscription
2. Create a Subscription content type with a Product reference field then reference the subscriptions added in step 1
3. Create the product display node
node/add/subscription
4. Add items from step 3 into cart and checkout.
5. Verify order was made
admin/commerce/orders
Ok, now that we have our first order, what should we do next? What can we do with these subscriptions?
Sell user roles steps.
1. First lets create a customer role
> drush rcrt 'customer' 'Customer'
2. Add a rule on subscription start
admin/config/workflow/rules/reaction/manage/rules_commerce_sp_subscription_started_insert
3. Add an action
admin/config/workflow/rules/reaction/manage/rules_commerce_sp_subscription_started_insert/add/1/action
4. Select "User -> Add user role"
5. Select "customer" role created in step 1 then click Save
6. Repeat steps 3 through 5 for
admin/config/workflow/rules/reaction/manage/rules_commerce_sp_subscription_started_update
Remove user role at end of subscription
1. Add an action
admin/config/workflow/rules/reaction/manage/rules_commerce_sp_subscription_validity_is_unset
2. Select "User -> Remove user role"
3. Select "customer" role and save
Now proceed to make another order and then view the users profile to see the newly added "customer" role
Notes:
1. Cron jobs handle the rules subscription validations for expired subscriptions
3. ???
4. PROFIT!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment