Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Master Products - MS2


2394 replies to this topic

#41 Jeremy

  • Community Member
  • 22 posts
  • Real Name:Jeremy

Posted 04 December 2003, 01:16

Matt, holy cow man! You are a lifesaver! Wow, that is just so awesome, thank you. It works flawlessly.

#42 iiinetworks

  • Community Member
  • 3,734 posts
  • Real Name:Matt

Posted 04 December 2003, 01:24

If you want to add the master product at the same time as you add the slaves, you can do so by adding a tep_draw_hidden_field('Qty_ProdId_' . $product_info['products_id'], 1) prior to the </form> in includes/modules/master_listing.php, around line 213:
        <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_hidden_field('Qty_ProdId_' . $product_info['products_id'], 1) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td>
Note: this change will affect all master products and will add the master every time the Add to Cart button is pressed.

Hth,
Matt

#43 flynst4r

  • Community Member
  • 13 posts
  • Real Name:A AA

Posted 04 December 2003, 15:39

Hello,

I'm desperatly trying to combine Master Products with UltraPics/HTMLArea but got into serious problems while trying to join the changes in categories.php.

This is a part of my categories.php with UltraPics installed:
      case 'update_product':
        if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {
          $action = 'new_product';
        } else {
        
// BOF MaxiDVD: Modified For Ultimate Images Pack!
            if ($HTTP_POST_VARS['delete_image'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image']);
            }
            if ($HTTP_POST_VARS['delete_image_med'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_med']);
            }
            if ($HTTP_POST_VARS['delete_image_lrg'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_lrg']);
            }
            if ($HTTP_POST_VARS['delete_image_sm_1'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_1']);
            }
            if ($HTTP_POST_VARS['delete_image_xl_1'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_1']);
            }
            if ($HTTP_POST_VARS['delete_image_sm_2'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_2']);
            }
            if ($HTTP_POST_VARS['delete_image_xl_2'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_2']);
            }
            if ($HTTP_POST_VARS['delete_image_sm_3'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_3']);
            }
            if ($HTTP_POST_VARS['delete_image_xl_3'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_3']);
            }
            if ($HTTP_POST_VARS['delete_image_sm_4'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_4']);
            }
            if ($HTTP_POST_VARS['delete_image_xl_4'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_4']);
            }
            if ($HTTP_POST_VARS['delete_image_sm_5'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_5']);
            }
            if ($HTTP_POST_VARS['delete_image_xl_5'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_5']);
            }
            if ($HTTP_POST_VARS['delete_image_sm_6'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_sm_6']);
            }
            if ($HTTP_POST_VARS['delete_image_xl_6'] == 'yes') {
                unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_previous_image_xl_6']);
            }
// EOF MaxiDVD: Modified For Ultimate Images Pack!
          if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);
          $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

          $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

          $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
                                  'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
                                  'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),
                                  'products_date_available' => $products_date_available,
                                  'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),
                                  'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),
                                  'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),
                                  'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

// BOF MaxiDVD: Modified For Ultimate Images Pack!
       if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {
            $sql_data_array['products_image'] = '';
           } else {
         if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {
            $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_med'] == 'yes') or ($HTTP_POST_VARS['delete_image_med'] == 'yes')) {
            $sql_data_array['products_image_med'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_med']) && tep_not_null($HTTP_POST_VARS['products_image_med']) && ($HTTP_POST_VARS['products_image_med'] != 'none')) {
            $sql_data_array['products_image_med'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_med']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_lrg'] == 'yes') or ($HTTP_POST_VARS['delete_image_lrg'] == 'yes')) {
            $sql_data_array['products_image_lrg'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_lrg']) && tep_not_null($HTTP_POST_VARS['products_image_lrg']) && ($HTTP_POST_VARS['products_image_lrg'] != 'none')) {
            $sql_data_array['products_image_lrg'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_lrg']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_sm_1'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_1'] == 'yes')) {
            $sql_data_array['products_image_sm_1'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_sm_1']) && tep_not_null($HTTP_POST_VARS['products_image_sm_1']) && ($HTTP_POST_VARS['products_image_sm_1'] != 'none')) {
            $sql_data_array['products_image_sm_1'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_1']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_xl_1'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_1'] == 'yes')) {
            $sql_data_array['products_image_xl_1'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_xl_1']) && tep_not_null($HTTP_POST_VARS['products_image_xl_1']) && ($HTTP_POST_VARS['products_image_xl_1'] != 'none')) {
            $sql_data_array['products_image_xl_1'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_1']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_sm_2'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_2'] == 'yes')) {
            $sql_data_array['products_image_sm_2'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_sm_2']) && tep_not_null($HTTP_POST_VARS['products_image_sm_2']) && ($HTTP_POST_VARS['products_image_sm_2'] != 'none')) {
            $sql_data_array['products_image_sm_2'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_2']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_xl_2'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_2'] == 'yes')) {
            $sql_data_array['products_image_xl_2'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_xl_2']) && tep_not_null($HTTP_POST_VARS['products_image_xl_2']) && ($HTTP_POST_VARS['products_image_xl_2'] != 'none')) {
            $sql_data_array['products_image_xl_2'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_2']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_sm_3'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_3'] == 'yes')) {
            $sql_data_array['products_image_sm_3'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_sm_3']) && tep_not_null($HTTP_POST_VARS['products_image_sm_3']) && ($HTTP_POST_VARS['products_image_sm_3'] != 'none')) {
            $sql_data_array['products_image_sm_3'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_3']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_xl_3'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_3'] == 'yes')) {
            $sql_data_array['products_image_xl_3'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_xl_3']) && tep_not_null($HTTP_POST_VARS['products_image_xl_3']) && ($HTTP_POST_VARS['products_image_xl_3'] != 'none')) {
            $sql_data_array['products_image_xl_3'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_3']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_sm_4'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_4'] == 'yes')) {
            $sql_data_array['products_image_sm_4'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_sm_4']) && tep_not_null($HTTP_POST_VARS['products_image_sm_4']) && ($HTTP_POST_VARS['products_image_sm_4'] != 'none')) {
            $sql_data_array['products_image_sm_4'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_4']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_xl_4'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_4'] == 'yes')) {
            $sql_data_array['products_image_xl_4'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_xl_4']) && tep_not_null($HTTP_POST_VARS['products_image_xl_4']) && ($HTTP_POST_VARS['products_image_xl_4'] != 'none')) {
            $sql_data_array['products_image_xl_4'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_4']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_sm_5'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_5'] == 'yes')) {
            $sql_data_array['products_image_sm_5'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_sm_5']) && tep_not_null($HTTP_POST_VARS['products_image_sm_5']) && ($HTTP_POST_VARS['products_image_sm_5'] != 'none')) {
            $sql_data_array['products_image_sm_5'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_5']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_xl_5'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_5'] == 'yes')) {
            $sql_data_array['products_image_xl_5'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_xl_5']) && tep_not_null($HTTP_POST_VARS['products_image_xl_5']) && ($HTTP_POST_VARS['products_image_xl_5'] != 'none')) {
            $sql_data_array['products_image_xl_5'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_5']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_sm_6'] == 'yes') or ($HTTP_POST_VARS['delete_image_sm_6'] == 'yes')) {
            $sql_data_array['products_image_sm_6'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_sm_6']) && tep_not_null($HTTP_POST_VARS['products_image_sm_6']) && ($HTTP_POST_VARS['products_image_sm_6'] != 'none')) {
            $sql_data_array['products_image_sm_6'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_6']);
          }
          }
       if (($HTTP_POST_VARS['unlink_image_xl_6'] == 'yes') or ($HTTP_POST_VARS['delete_image_xl_6'] == 'yes')) {
            $sql_data_array['products_image_xl_6'] = '';
           } else {
          if (isset($HTTP_POST_VARS['products_image_xl_6']) && tep_not_null($HTTP_POST_VARS['products_image_xl_6']) && ($HTTP_POST_VARS['products_image_xl_6'] != 'none')) {
            $sql_data_array['products_image_xl_6'] = tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_6']);
          }
          }
// EOF MaxiDVD: Modified For Ultimate Images Pack!

          if ($action == 'insert_product') {
            $insert_sql_data = array('products_date_added' => 'now()');

            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array);
            $products_id = tep_db_insert_id();

            tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
          } elseif ($action == 'update_product') {
            $update_sql_data = array('products_last_modified' => 'now()');

            $sql_data_array = array_merge($sql_data_array, $update_sql_data);

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
          }

          $languages = tep_get_languages();
          for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
            $language_id = $languages[$i]['id'];

            $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),
                                    'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),
                                    'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

            if ($action == 'insert_product') {
              $insert_sql_data = array('products_id' => $products_id,
                                       'language_id' => $language_id);

              $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
            } elseif ($action == 'update_product') {
              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
            }
          }

          if (USE_CACHE == 'true') {
            tep_reset_cache_block('categories');
            tep_reset_cache_block('also_purchased');
          }

          tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
        }
        break;

###################
###################

and I'm unable to join it with Master Products version, which goes like that:

      case 'update_product':
        if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {
          $action = 'new_product';
        } else {
          if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);
          $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

          $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

          $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
                                  'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
                                  'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),
                                  'products_date_available' => $products_date_available,
                                  'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),
                                  'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),
// Master Products
                                  'products_listing_status' => tep_db_prepare_input($HTTP_POST_VARS['products_listing_status']),
                                  'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),
                                  'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']),
                                  'products_master' => tep_db_prepare_input($HTTP_POST_VARS['products_master']));
// Master Products EOF



          if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {
            $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);
          }

          if ($action == 'insert_product') {
            $insert_sql_data = array('products_date_added' => 'now()');

            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array);
            $products_id = tep_db_insert_id();

            tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
          } elseif ($action == 'update_product') {
            $update_sql_data = array('products_last_modified' => 'now()');

            $sql_data_array = array_merge($sql_data_array, $update_sql_data);

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
          }

          $languages = tep_get_languages();
          for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
            $language_id = $languages[$i]['id'];

            $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),
                                    'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),
                                    'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

            if ($action == 'insert_product') {
              $insert_sql_data = array('products_id' => $products_id,
                                       'language_id' => $language_id);

              $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
            } elseif ($action == 'update_product') {
              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
            }
          }

          if (USE_CACHE == 'true') {
            tep_reset_cache_block('categories');
            tep_reset_cache_block('also_purchased');
          }

          tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
        }
        break;
//Master Products        

I seriously need a solution because I need to be able to set different product weights and ids ! :((

Please give me a hand..

Greetz from Germany
René Reineke

Edited by flynst4r, 04 December 2003, 15:41.


#44 marcus76

  • Community Member
  • 160 posts
  • Real Name:Marc

Posted 04 December 2003, 15:51

iiinetworks, on Dec 3 2003, 04:22 AM, said:

It should get its color from the same place as the product listings, unless it's changed since the version that I installed. The CSS classes would be TD.productListing-data and the TR.productListing-odd and TR.productListing-even.

Hth,
Matt
Matt, Many thanks - i've slogged over 3 days trying to find this setting - your spot on - i didnt have any background reference set under this header. Your next answer to my question relating to the type the quantity Vs drop down i'll try this evening.

I do have one outstanding display issue with the box however. It doesn't appear to line up so well. The drop down column doesn't line up with the title and the far side of the box has a vacant column - no title above this, as if the box has over drawn horizontally? - i'm currently not hosted so can't show you? any ideas based on what i've said?

Thanks again for your help, really appreciate the time you've saved me.

Marc

#45 marcus76

  • Community Member
  • 160 posts
  • Real Name:Marc

Posted 04 December 2003, 16:02

....similarly , i started with a base of OSC 2.2, installed

Master Products - MS2.

then

MS2 HTML WYSIWYG Editor, Product Desc, Email

Works ok, but i'm struggling getting the admin/categories.php working. Currently settled for designing my HTML page in frontpage and pasting the text into the box within OSC\admin - i havent updated the categories file to include the HTML contrib as i'd prefer the Master Products working completely.. It seems by leaving the updates of the HTML contrib i dont have the ability to edit the page within the OSc admin, but rather paste HTML into the box, which is then displayed correctly in the catalog.

So what i'd ideally like to do is get the Java applet working in categories.php so i can edit the pages within Osc admin without breaking the Master Products...anyone done this?

thanks

Marc

#46 flynst4r

  • Community Member
  • 13 posts
  • Real Name:A AA

Posted 06 December 2003, 10:00

Greetz,

I could finally merge the files more or less but now I'm stuck again.

http://www.hair-xperts.de/product_info.php/products_id/32
I am able to chose the amount of products but clicking on buy means -> 'empty cart' :(

Can't solve that.

Anybody able to help?


Thanks
René

Edited by flynst4r, 06 December 2003, 10:00.


#47 flynst4r

  • Community Member
  • 13 posts
  • Real Name:A AA

Posted 06 December 2003, 12:49

I have to add something to my last post.

I believe that something in application_top.php might go wrong concerning "case: add_slave"

That's what I have got:
      //Master Products                         
      // customer adds multiple products from the master_listing page
      case 'add_slave' :    
                              while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) { 
                                 if (substr($key,0,11) == "Qty_ProdId_") { 
                                 $prodId = substr($key,11); 
                                 $qty = $val; 
                                 if ($qty <= 0 ) continue; 

                                 $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id']))+($qty), $HTTP_POST_VARS['id']);
    	echo("$prodId<br>" . $HTTP_POST_VARS['id'] . "<br>" . $HTTP_POST_VARS['id'] . "<br><p>");
                                } 
                              } 
                              die;
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break; 
      //Master Products EOF

Trying to locate the source of the error I added a die() function, which gets executed (result: add_slave is called!) but nothing is returned by my echo function (maybe while(...) not workin')

a part of the form source follows (product_info.php/master_listing.php)
<!-- Master Products //-->      
 
                <td width="10"><img src="images/pixel_trans.gif" border="0" alt="" width="10" height="1"></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      
      <tr>
        <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"></td>
      </tr>



   <tr>
    <td align="left" class="main">&nbsp;*Bitte w&auml;hlen Sie unten die gew&uuml;nschte Anzahl aus.</td>
   </tr>
      <tr>
        <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"></td>
      </tr>   
   <tr>
    <td><form name="buy_now_" method="post" action="http://www.hair-xperts.de/product_info.php/cPath/21/products_id/32/sort/3a/[b]action/add_slave[/b]"><form name="buy_now_" method="post" action="http://www.hair-xperts.de/product_info.php/cPath/21/products_id/32/sort/3a/action/add_slave"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListing">
  <tr>
    <td class="productListing-heading">&nbsp;<a href="http://www.hair-xperts.de/product_info.php/cPath/21/products_id/32/page/1/sort/1a" title="Sortierung der Artikel ist aufsteigend nach Modell" class="productListing-heading">Modell</a>&nbsp;</td>
    <td align="center" class="productListing-heading">&nbsp;Beschreibung&nbsp;</td>
    <td class="productListing-heading">&nbsp;<a href="http://www.hair-xperts.de/product_info.php/cPath/21/products_id/32/page/1/sort/3d" title="Sortierung der Artikel ist absteigend nach Name" class="productListing-heading">Name+</a>&nbsp;</td>
    <td align="right" class="productListing-heading">&nbsp;<a href="http://www.hair-xperts.de/product_info.php/cPath/21/products_id/32/page/1/sort/4a" title="Sortierung der Artikel ist aufsteigend nach Preis" class="productListing-heading">Preis</a>&nbsp;</td>
    <td align="center" class="productListing-heading">&nbsp;Jetzt kaufen!&nbsp;</td>
  </tr>
  <tr class="productListing-odd">
    <td class="productListing-data">&nbsp;18-CS-1000&nbsp;</td>
    <td class="productListing-data">&nbsp;Dies ist die 1000ml version des prodkt&nbsp;</td>
    <td class="productListing-data">&nbsp;1.8 Color Saver Shampoo 1000 ml</a>&nbsp;</td>
    <td align="right" class="productListing-data">&nbsp;127,60€&nbsp;</td>
    <td align="center" class="productListing-data"><select name="Qty_ProdId_33" value="0" class="main" style="width: 40px">
                                                     <option value="0">0</option>
                          <option value="1">1</option>
           <option value="2">2</option>
                         <option value="3">3</option>
                                               <option value="4">4</option>
                                                     <option value="5">5</option>
           <option value="6">6</option>        	
           <option value="7">7</option>
           <option value="8">8</option>        	
           <option value="9">9</option>
           <option value="10">10</option>        	
           <option value="11">11</option>
           <option value="12">12</option>        	
           <option value="13">13</option>
           <option value="14">14</option>          
           <option value="15">15</option>  
           <option value="16">16</option>        	
           <option value="17">17</option>
           <option value="18">18</option>        	
           <option value="19">19</option>
                  <option value="20">20</option>        	
           </select></td>
  </tr>
  <tr class="productListing-even">
    <td class="productListing-data">&nbsp;18-CS-500&nbsp;</td>
    <td class="productListing-data">&nbsp;5500&nbsp;</td>
    <td class="productListing-data">&nbsp;500 ml</a>&nbsp;</td>
    <td align="right" class="productListing-data">&nbsp;63,80€&nbsp;</td>
    <td align="center" class="productListing-data"><select name="Qty_ProdId_34" value="0" class="main" style="width: 40px">
                                                     <option value="0">0</option>
                          <option value="1">1</option>
           <option value="2">2</option>
                         <option value="3">3</option>
                                               <option value="4">4</option>
                                                     <option value="5">5</option>
           <option value="6">6</option>        	
           <option value="7">7</option>
           <option value="8">8</option>        	
           <option value="9">9</option>
           <option value="10">10</option>        	
           <option value="11">11</option>
           <option value="12">12</option>        	
           <option value="13">13</option>
           <option value="14">14</option>          
           <option value="15">15</option>  
           <option value="16">16</option>        	
           <option value="17">17</option>
           <option value="18">18</option>        	
           <option value="19">19</option>
                  <option value="20">20</option>        	
           </select></td>
  </tr>
</table>
     <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"></td>
      </tr>
      <tr> 
        <td class="main" align="right"><input type="hidden" name="products_id" value="32"><input type="image" src="includes/languages/german/images/buttons/button_in_cart.gif" border="0" alt="In den Warenkorb" title=" In den Warenkorb "></form></td> 
     </tr> 
      <tr>
        <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"></td>
      </tr> 
     </table>
     
     <table border="0" width="100%" cellspacing="0" cellpadding="2">          
     <tr>
        <td class="smallText">angezeigte Produkte: <b>1</b> bis <b>2</b> (von <b>2</b> insgesamt)</td>
        <td class="smallText" align="right">Seiten: &nbsp;<b>1</b>&nbsp;</td>
     </tr>
    </table>
      <tr>
        <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"></td>
      </tr>

</td>
   </tr>
   
<!-- Master Products EOF //-->

Edited by flynst4r, 06 December 2003, 12:53.


#48 burt

  • Community Member
  • 6,765 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEVon/NULL -> get it, hardeharhar.

Posted 06 December 2003, 13:00

Johnson, on Nov 27 2003, 10:21 AM, said:

Ok - here's the fix - was just one of those things I didn't get back to and tidy up :blink:
Now works very well, thank you Matti.

Idea for next version:

The dropdown quantity selector goes from 0 -> 20 on every product. This would be more beneficial to go from 0 -> quantity in stock.

I will have a go at doing this when I finish my next project (if no-one does it in the meantime).

A very useful addition to Oscommerce - finally removing one of the big barriers to being able to deploy this to the business sector (rather than the "amateur business" sector) -> attributes stock levels. Good work.
Me page.

#49 flynst4r

  • Community Member
  • 13 posts
  • Real Name:A AA

Posted 06 December 2003, 15:32

Got it already running.

add_slave was infact broken but don't know why.
Used a foreach loop und worked after some tries like a charm :)
Sorry for bothering!

#50 Johnson

  • Banned
  • 5,205 posts
  • Real Name:Matti Ressler
  • Location:Sydney, Australia

Posted 07 December 2003, 06:47

burt, on Dec 6 2003, 09:00 AM, said:

Now works very well, thank you Matti.

Idea for next version:

The dropdown quantity selector goes from 0 -> 20 on every product.  This would be more beneficial to go from 0 -> quantity in stock.

I will have a go at doing this when I finish my next project (if no-one does it in the meantime).

A very useful addition to Oscommerce - finally removing one of the big barriers to being able to deploy this to the business sector (rather than the "amateur business" sector) -> attributes stock levels.  Good work.
Thankyou Burt

I've been toying in my mind with what to do with the quantity select - basing it on stock becomes a problem if there is a great deal of stock - I definitely intend to add admin control of the select range - perhaps a stock option if it is not too difficult. Some people prefer a simple text field, so this needs to be an option also. Global settings are simple, but some also prefer control per product.... this also is a consideration.....

Attributes are the no.1 priority at the moment - this will multiply the usefulness of Master Products immensly... almost there, busy, busy....

Also in the works: - (Admin) easy identification of Master and Slave products - the abilty to select a Master and have Slaves listed with it . More control for Master products so they are purchasable - this will include a quantity select on product_info.php for the Master, maintaining a single Buy Now button. An option on the admin product edit page whether a slave will have its own product_info page or not.... I think perhaps a series of check boxes as to which pages a Slave will show on... products_new, specials etc.

Feedback/ideas are greatly appreciated.

Matti
Matti Ressler

We were all once expert at...... nothing
_____

#51 ruta

  • Community Member
  • 31 posts
  • Real Name:ruta

Posted 07 December 2003, 09:51

When I try add slaves to the cart I have
Your Shopping Cart is empty! (every time) :angry:

Why?
I use
Apache 1.3.29
PHP 4.3.4
MySQL 4.0.16

at php.ini
register_globals=on

Can somebody help?

#52 flynst4r

  • Community Member
  • 13 posts
  • Real Name:A AA

Posted 07 December 2003, 14:19

ruta, on Dec 7 2003, 09:51 AM, said:

When I try add slaves to the cart I have
Your Shopping Cart is empty! (every time) :angry:

Why?
I use
Apache 1.3.29
PHP 4.3.4 
MySQL 4.0.16

at php.ini
register_globals=on

Can somebody help?
Try to replace function add_slave in catalog/includes/application_top.php
with the following:
      //Master Products  ENDLICH ÜBERHOLT!! René Reineke 06.12.03                       
      // customer adds multiple products from the master_listing page
      case 'add_slave' :    
                              foreach ($HTTP_POST_VARS as $keyA => $valueA) {
                                 if (substr($keyA,0,11) == "Qty_ProdId_") { 
                                 $prodId = substr($keyA,11); 
                                 if ($valueA <= 0 ) continue; 
                                 $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id']))+($valueA), $HTTP_POST_VARS['id']);
                                } 
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break; 
      //Master Products EOF      
Worked for me!

Edited by flynst4r, 07 December 2003, 14:22.


#53 Branden

  • Community Member
  • 71 posts
  • Real Name:Branden

Posted 08 December 2003, 01:57

Hello, I have a shop with attributes sorter and Mo Pics installed which leaves my admin/catagories.php hacked to hell. My php knowlege is not enough to copy and paste all the Master Products changes into the hacked up file...I was wondering if anyone could help?

#54 madyson3

  • Community Member
  • 74 posts
  • Real Name:Kristy
  • Location:Atlanta, GA

Posted 08 December 2003, 04:00

Hello, I'm new to php; I have been learning very quickly though! I have a problem that I am hoping someone can fix. I added the master slave contribution, and finally got it to play nice with my other contributions; however here is the problem that remains:
I have a master product with 2 slaves (color and sizes). When I select how many of a slave I want, the program only adds the master product and not the slave.
The only way I can add a slave is to click on the slave image, thus opening it's own product page, and then adding to the cart from there.

Also, my slave products are showing up in the "New products" box even though they are set no to show in the listing.

Thank you folks for all of the contributions and support you have provided. You are helping me reach my dream. I can't express enough how awesome you all are.

--Kristy
See you on the dark side,
Kristy

I'm just a girl living in captivity
Your rules of thumb makes me worrisome

#55 iiinetworks

  • Community Member
  • 3,734 posts
  • Real Name:Matt

Posted 08 December 2003, 05:28

burt, on Dec 6 2003, 08:00 AM, said:

The dropdown quantity selector goes from 0 -> 20 on every product.  This would be more beneficial to go from 0 -> quantity in stock.
I think that it is enough to replace the $lc_text line in the buy_now case in includes/modules/master_listing.php (around lines 163-85) with
            $quantity_select_list = array();
            for ($i = 0, $n2 = (($listing['products_quantity'] < 20) ? $listing['products_quantity'] : 20); $i <= $n2; $i++) {
              $quantity_select_list[] = array('id' => $i, 'text' => $i);
            }
            $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $quantity_select_list, '0', 'class="main" style="width: 40px"');
Note that the 20 and the '0' could be replaced by admin settings and that the whole thing could be enclosed in an if statement that selects between the pull_down (code here) and an input field.

Hth,
Matt

#56 Johnson

  • Banned
  • 5,205 posts
  • Real Name:Matti Ressler
  • Location:Sydney, Australia

Posted 08 December 2003, 10:57

iiinetworks, on Dec 8 2003, 01:28 AM, said:

I think that it is enough to replace the $lc_text line in the buy_now case in includes/modules/master_listing.php
This works nicely if you add p.products_quantity to the $master_sql query in master_products.php:

      $master_sql = "select  " . $select_column_list . " p.products_id,  p.manufacturers_id, p.products_tax_class_id, s.specials_new_products_price, s.status, p.products_quantity, p.products_price from ". TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = pd.products_id and p.products_master = '" . $thisquery['products_master'] . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "'";

For those who didn't quite get that, the '20' in Matt's code is the upper limit the drop menu will display - change to the desired setting. Good one :D

Edited by Johnson, 08 December 2003, 10:57.

Matti Ressler

We were all once expert at...... nothing
_____

#57 flynst4r

  • Community Member
  • 13 posts
  • Real Name:A AA

Posted 08 December 2003, 13:14

Add this in shopping_cart.php to link back to the master product instead of a slave!
## after
      $info_box_contents[$cur_row][] = array('align' => 'center',
                                             'params' => 'class="productListing-data" valign="top"',
                                             'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

##add this
// René Reineke -- link back to master product on shopping cart      
      $master_prod = tep_db_query("select products_master, products_master_status
                                      from " . TABLE_PRODUCTS . "
                                      where products_id = '" . $products[$i]['id'] . "'");
      $master_prod_values = tep_db_fetch_array($master_prod);
      
      if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) {
     	 $products[$i]['id'] = $master_prod_values['products_master'];
      }
 // René Reineke MaSTER Mod end

creates an extra query. I'm sure it can be optimized but no time now.

#58 burt

  • Community Member
  • 6,765 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEVon/NULL -> get it, hardeharhar.

Posted 08 December 2003, 16:44

iiinetworks, on Dec 8 2003, 05:28 AM, said:

burt, on Dec 6 2003, 08:00 AM, said:

The dropdown quantity selector goes from 0 -> 20 on every product.  This would be more beneficial to go from 0 -> quantity in stock.
I think that it is enough to replace the $lc_text line in the buy_now case in includes/modules/master_listing.php (around lines 163-85) with
            $quantity_select_list = array();
            for ($i = 0, $n2 = (($listing['products_quantity'] < 20) ? $listing['products_quantity'] : 20); $i <= $n2; $i++) {
              $quantity_select_list[] = array('id' => $i, 'text' => $i);
            }
            $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $quantity_select_list, '0', 'class="main" style="width: 40px"');
Note that the 20 and the '0' could be replaced by admin settings and that the whole thing could be enclosed in an if statement that selects between the pull_down (code here) and an input field.

Hth,
Matt
Ah, good one - I'll try that a little later.
Me page.

#59 iiinetworks

  • Community Member
  • 3,734 posts
  • Real Name:Matt

Posted 09 December 2003, 03:50

Johnson, on Dec 8 2003, 05:57 AM, said:

This works nicely if you add p.products_quantity to the $master_sql query in master_products.php:
The other change to includes/modules/master_products.php that I forgot to mention was that I commented out (around line 58):
//          $select_column_list .= 'p.products_quantity, ';
Hth,
Matt

#60 ringman57

  • Community Member
  • 10 posts
  • Real Name:Anthony DeSalvatore

Posted 10 December 2003, 17:34

Any plans to allow a slave to belong to multiple masters? Like if you have a series of gift baskets that use differnt products mostly, but may have some products in common...