Index: subproducts.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/subproducts/subproducts.install,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 subproducts.install
--- subproducts.install	20 Jun 2006 12:05:17 -0000	1.2.2.1
+++ subproducts.install	15 Nov 2006 05:32:24 -0000
@@ -78,3 +78,8 @@
   }
 }
 
+function subproducts_update_1() {
+  db_query("ALTER TABLE {ec_attribute} ADD `image` varchar(255)");
+  db_query("ALTER TABLE {ec_variation} ADD `type` int(3) DEFAULT 0 NOT NULL");
+  //db_query("ALTER TABLE {ec_variation} ADD `description` LONGTEXT DEFAULT ''");
+}
\ No newline at end of file


Index: subproducts.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/subproducts/subproducts.module,v
retrieving revision 1.21.2.10
diff -u -r1.21.2.10 subproducts.module
--- subproducts.module	2 Oct 2006 00:33:21 -0000	1.21.2.10
+++ subproducts.module	15 Nov 2006 05:33:06 -0000
@@ -62,6 +62,7 @@
         if (count($node->children)) {
           $items = cart_get_items();
           $child_variations = subproducts_get_child_attributes($node);
+	  	  $listtypes = array('select' , 'radios');
           $form['#method'] = 'post';
           $form['#action'] = url("cart/add/$node->nid", "destination=node/$node->nid");
           $form['#tree'] = TRUE;
@@ -70,10 +71,13 @@
             foreach($variation->attributes as $attribute) {
               if (in_array($attribute->aid, $child_variations)) {
                 $options[$attribute->aid] = subproducts_surcharge_extra($attribute);
+                if ($variation->type==1 && !empty($attribute->image)) { //if list typeradio and image is not empty, then display image.
+					$options[$attribute->aid] .= ' <img src="' . $attribute->image . '"/>' ; 
+				}
               }
             }
             $form['variations'][$variation->vid] = array(
-              '#type' => 'select',
+              '#type' => $listtypes[$variation->type], //ability to select between select and radio
               '#title' => $variation->name,
               '#default_value' => $node->variations[$variation->vid],
               '#options' => $options,
@@ -1482,6 +1486,13 @@
     '#attributes' => NULL,
     '#required' => TRUE,
   );
+  $form['type'] = array(
+    '#type' => 'select',
+    '#title' => t('List type'),
+    '#default_value' => $edit['type'],
+    '#options' => array( t('Normal'), t('Radio') ),
+    '#description' => t('The attributes list will be shown as a select or Radio '),
+  );
   $form['weight'] = array(
     '#type' => 'weight',
     '#title' => t('Weight'),
@@ -1577,6 +1588,14 @@
     '#delta' => 10,
     '#description' => t('In listings, the heavier (with a higher weight value) attributes will sink and the lighter attributes will be positioned nearer the top.'),
   );
+  $form['image'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Image'),
+    '#default_value' => $edit['image'],
+    '#size' => 50,
+    '#maxlength' => 64,
+    '#description' => t('If you want to show the attribute photo/image, put here the URL.'),
+  );
   $form['surcharge'] = array(
     '#type' => 'textfield',
     '#title' => t('Surcharge'),
@@ -1619,7 +1638,7 @@
  */
 function subproducts_save_variation($edit) {
   if ($edit['vid'] && $edit['name']) {
-    db_query("UPDATE {ec_variation} SET name = '%s', weight = %d WHERE vid = %d", $edit['name'], $edit['weight'], $edit['vid']);
+    db_query("UPDATE {ec_variation} SET name = '%s', weight = %d, type=%d WHERE vid = %d", $edit['name'], $edit['weight'], $edit['type'], $edit['vid']);
     $message = t('The variation %variation has been updated.', array('%variation' => theme('placeholder', $edit['name'])));
   }
   else if ($edit['vid']) {
@@ -1635,7 +1654,7 @@
   }
   else {
     $edit['vid'] = db_next_id('{ec_variation}_vid');
-    db_query("INSERT INTO {ec_variation} (vid, name, weight, ptype) VALUES (%d, '%s', %d, '%s')", $edit['vid'], $edit['name'], $edit['weight'], $edit['ptype']);
+    db_query("INSERT INTO {ec_variation} (vid, name, weight, ptype, type) VALUES (%d, '%s', %d, '%s', %d)", $edit['vid'], $edit['name'], $edit['weight'], $edit['ptype'], $edit['type']);
     $message = t('Created new variation %variation.', array('%variation' => theme('placeholder', $edit['name'])));
   }
 
@@ -1690,7 +1709,7 @@
  */
 function subproducts_save_attribute($edit) {
   if ($edit['aid'] && $edit['name']) {
-    db_query("UPDATE {ec_attribute} SET vid = %d, name = '%s', weight = %d, surcharge = '%s' WHERE aid = %d", $edit['vid'], $edit['name'], $edit['weight'], $edit['surcharge'], $edit['aid']);
+    db_query("UPDATE {ec_attribute} SET vid = %d, name = '%s', weight = %d, surcharge = '%s', image = '%s' WHERE aid = %d", $edit['vid'], $edit['name'], $edit['weight'], $edit['surcharge'], $edit['image'], $edit['aid']);
     $message = t('The attribute %attribute has been updated.', array('%attribute' => theme('placeholder', $edit['name'])));
   }
   else if ($edit['aid']) {
@@ -1708,7 +1727,7 @@
   }
   else {
     $edit['aid'] = db_next_id('{ec_attribute}_aid');
-    db_query("INSERT INTO {ec_attribute} (aid, vid, name, weight, surcharge) VALUES (%d, %d, '%s', %d, %d)", $edit['aid'], $edit['vid'], $edit['name'], $edit['weight'], $edit['surcharge']);
+    db_query("INSERT INTO {ec_attribute} (aid, vid, name, weight, surcharge, image) VALUES (%d, %d, '%s', %d, %d, %s)", $edit['aid'], $edit['vid'], $edit['name'], $edit['weight'], $edit['surcharge'], $edit['image']);
     $message = t('Created new attribute %attribute.', array('%attribute' => theme('placeholder', $edit['name'])));
   }
 
