Community Documentation

ARCHIVE: E-Commerce Installation Profile

Last updated March 13, 2011. Created by bdragon on June 9, 2006.
Edited by linclark, ax, add1sun, Amazon. Log in to edit this page.

E-Commerce is a collection of several dozen modules for creating an online store. However, it requires some advanced configuration. As an example we have produced a simple install profile for e-commerce. In this profile we provide first a list of modules that should be enabled, then a profile description. In each of the .install files we have copied important pieces of settings forms to be added to the installation system forms.

<?php
/**
* The modules that are enabled when this profile is installed.
*
* @return
*  An array of modules to be enabled.
*/
function ecommerce_profile_modules() {
  return array(
'system', 'apparel', 'audio', 'block', 'cart', 'civicrm', 'cod', 'comment', 'content', 'coupon', 'custom', 'donate', 'ecivicrm', 'file', 'filter', 'help', 'image', 'image_attach', 'menu', 'node', 'page', 'path', 'payment', 'product', 'recommend', 'role_discount', 'shipcalc', 'shipping', 'store', 'stores', 'story', 'subproducts', 'tangible', 'taxonomy', 'text', 'user', 'userreview', 'views', 'votingapi', 'watchdog');
}

/**
*
*/
function ecommerce_profile_details() {
  return array(
          
'name' => 'Ecommerce',
          
'description' => 'Select this profile to enable the ecommerce distribution.');
}

function
ecommerece_install_configure(&$form) {
 
drupal_set_title('ecommerce configuration');
}

function
ecommerece_get_styles() {
  return array(
'profiles/civicspace/civicspace-installer.css');
}

function
civicspace_get_scripts() {
  return array(
'profiles/civicspace/toggle.js');
}
?>

Here is an example of how we can add configuration forms for E-Commerce to the installation profile.

<?php

function store_install_configure(&$form) {
 
$options = array(
     
t('Customers do not have to create accounts in order to purchase items from this site.'),
     
t('Customers must create accounts before purchasing an item from this site.'));
 
$form['store'] = array(
   
'#type' => 'fieldset',
   
'#title' => t('Store settings'),
  );
 
$form['store']['store_auth_cust'] = array(
   
'#type' => 'radios',
   
'#title' => t('Authenticated customers'),
   
'#default_value' => variable_get('store_auth_cust', 1),
   
'#options' => $options,
   
'#description' => t('There are several advantages in having customers create accounts. When they shop, the items in their cart will be remembered from visit to visit, and they can store their shipping and billing addresses in an address book at this site.')
  );
  return
$form;
}
function
store_install_configure_submit($form_id, $edit) {
 
variable_set('store_auth_cust', $edit['store_auth_cust']);
}
?>

Page status

About this page

Drupal version
Drupal 4.7.x

Archive

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.