Jump to content
Johnson

Master Products - MS2

Recommended Posts

Hi,

 

I need to add another condition to ther following lines of code in product_info.php

 

<?php if ($product_info['products_quantity'] > 0) { ?>

      <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_buy_album.gif', IMAGE_BUTTON_IN_CART); ?>  </td>

 

I do not want the button to appear if the item is a Master Product, so I need the correct code for something along the lines of"and if product_master_status = 0" added to that statement, so that if the product was a Master there would be no button.

 

Help

 

Steve

 

Still no offers on the above so I tried

<?php if ($product_info['products_quantity'] > 0)

'And if (product_master_status = 0) '

{ ?>

 

The browser returned

Parse error: parse error, unexpected '{' in /usr/users/sierrab2/public_html/catalog/product_info.php on line 189. So that means I think that my line is almost right. Any php/MYSQL wizz spot the problem?

 

Steve

Share this post


Link to post
Share on other sites
Perhaps

will do?

Tec,,,,genius,Almost!!! So Close. It now returns "Out of Stock" whereas in my wildest dreams i want to have nothing there, as I am not actually out of stock. PayPal just won't "see" a Master Product' slaves and so the slaves are in stock!! Maybe when the condition product_master_status= 0, I could use a background.gif called back.gif

,Here the code again.

//CODE

<?php if ($product_info['products_quantity'] > 0 && $product_info['products_master_status'] == 0)

{ ?>

*

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_buy_album.gif', IMAGE_BUTTON_IN_CART); ?>  </td>

<?php

} elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {

?>

 

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

<?php

} else {

?>

//CODE

 

Mant Many thanks for your input

 

Steve

Share this post


Link to post
Share on other sites
It now returns "Out of Stock" whereas in my wildest dreams i want to have nothing there, as I am not actually out of stock.
So wouldn't it make more sense to fix that error than make a hack? I can't follow you about PayPal, but I haven't been following this thread for a long time so I probably missed something.

Share this post


Link to post
Share on other sites
So wouldn't it make more sense to fix that error than make a hack? I can't follow you about PayPal, but I haven't been following this thread for a long time so I probably missed something.

Jan,

 

As a purist you are going to hate even more what I have done now!

 

I deleted the text definition for "TEXT STOCK" in the lanuages file.

 

It now displays the desired Nothing!!

 

I have been soldiering away for 3 months...it was the only thing that was holding me up.

 

This is my first store

 

Next I am going to get some a good beginners guide to PHP, which will make my life a lot easier for the next one!!

 

OSC can become addictive

 

Steve

Share this post


Link to post
Share on other sites

any way to sort the fields in an options drop down? sizes for clothes seem to come up all over the place, eg: 6,10,16,12

Share this post


Link to post
Share on other sites
I goofed in the last post linking to my site.  I apologize for this.

 

I have uploaded 

 

01/20/2004 - Easypopulate v2.73-MS2/MASTER PRODUCT SUPPORT

 

as a contribution.

 

Get it here: http://www.oscommerce.com/community/contributions,500

Matti, thanks for the heads up,  and thanks for all your hard work on Master Products.  I am looking forward to the new release.

 

anyone wanting to see it in use click on my web button. B)

 

 

Does this mod work with the latest version of easypopulate (I believe 7.61b)?

Share this post


Link to post
Share on other sites

Hello All, how do I move my attributes on each slave product to the main page.

 

Right now the master page shows the master descritpion, pic, etc at the top and down the bottom is the list of slaves.

 

Pic slave 1 Model # Name Options Qty Price

 

 

Right now the options just repeats what is under name. I would like a drop down for a person to pick their size. Right now they have to click on the slave to go to a seperate page to pick a size (which right now is doubling on me not sure why). I want everything on one page as you already have the description on the master product.

 

Please help this newbie!!

Share this post


Link to post
Share on other sites
Hello All, how do I move my attributes on each slave product to the main page.

 

Right now the master page shows the master descritpion, pic, etc at the top and down the bottom is the list of slaves.

 

Pic slave 1    Model #  Name    Options      Qty      Price

Right now the options just repeats what is under name.  I would like a drop down for a person to pick their size.  Right now they have to click on the slave to go to a seperate page to pick a size (which right now is doubling on me not sure why).  I want everything on one page as you already have the description on the master product.

 

Please help this newbie!!

Go to the products attributes page. In Product Options Add Size. In Option Values give Size the values you wish one line at a time

Then in Product Attributes award all those values to each slave....

Then you slaves will have adrop down box with the sizes

Probabaly best to do one shoe with all its sizes and then use EZ pop to populate by first downloading the one shoe and then using that as a formulae to add the rest

 

Steve

Share this post


Link to post
Share on other sites

I did not explain myself clearly. On this page see where it says "options" down in the red shoe section? I want a drop down box of the attributes I assigned. Right now the only way a person can pick a size which I need them to do is if they click on the shoe to go to a new page. I need a customer to pick not only the shoe color they want and the qty but what size.

 

My Webpage

 

Ideally my customers do not need to pick quanity as they tend to only order one pair of a particular color/style so I would love to get rid of the quantiy and have the buy now on the same line as the item but for now will settle for the size attribute dropdown being included.

 

I've given up on quanity control by attributes :'(

Share this post


Link to post
Share on other sites

anyone know how i would sort the fields in an options drop down?

 

sizes for clothes seem to come up all over the place, eg: 6,10,16,12

Share this post


Link to post
Share on other sites

Hey ho! I?m tried the last times a lot, but I couldn?t solve the problem I described in Post #1209. Does some have an idea or can help me? That would be awesome :-)

 

Take care and thanx,

Schroedy_1

Share this post


Link to post
Share on other sites

Hi,

 

for some reason I can't get the admin/categories.php to get it work... :( I've looked at this forum and have spent for more then a week to work.. but I really can't see what's the problem.. I know I did something wrong... but can't figure out what.. :'( Could you please help me... and see what I've done wrong...

 

I see the buttons and everything.. but everytime I click on it.. It isn't doing anything, but reloading the page... :unsure:

 

I think one of the other contribs is getting in the way, but not knowing which one and how I can fix it... Could you please help me... :'(

 

Here is a part of the page...

 

<?php

 // BOF Wolfen featured sets
     case 'setflag_featured':
       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
         if (isset($HTTP_GET_VARS['pID'])) {
           tep_set_product_featured($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
         }

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

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));
       break;
 
 case 'setflag_categories_featured':
       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
         if (isset($HTTP_GET_VARS['cID'])) {
           tep_set_categories_featured($HTTP_GET_VARS['cID'], $HTTP_GET_VARS['flag']);
         }

         if (USE_CACHE == 'true') {
           tep_reset_cache_block('categories');
         }
       }
  if ($categories['parent_id'] == '0') {
       tep_redirect(tep_href_link(FILENAME_CATEGORIES));
 } else {
 tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
 }
    //   tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath']));
       break;
 // EOF Wolfen featured sets

     case 'insert_category':
     case 'update_category':
       if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
       $distributors_id = tep_db_prepare_input($HTTP_POST_VARS['distributors_id']); //rmh M-S_multi-stores
       $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

       $sql_data_array = array('distributors_id' => $distributors_id, //rmh M-S_multi-stores
                               'sort_order' => $sort_order);

       if ($action == 'insert_category') {
         $insert_sql_data = array('parent_id' => $current_category_id,
 // BOF Wolfen featured sets
                                  'date_added' => 'now()',
      'categories_featured' => tep_db_prepare_input($HTTP_POST_VARS['categories_featured']),
      'categories_featured_until' => tep_db_prepare_input($HTTP_POST_VARS['categories_featured_until']));
 // EOF Wolfen featured sets

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

         tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

         $categories_id = tep_db_insert_id();
       } elseif ($action == 'update_category') {
 // BOF Wolfen featured sets
         $update_sql_data = array('last_modified' => 'now()',
      'categories_featured' => tep_db_prepare_input($HTTP_POST_VARS['categories_featured']),
      'categories_featured_until' => tep_db_prepare_input($HTTP_POST_VARS['categories_featured_until']));
 // EOF Wolfen featured sets

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

         tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");
       }

       $languages = tep_get_languages();
       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
         $categories_name_array = $HTTP_POST_VARS['categories_name'];

         $language_id = $languages[$i]['id'];

         $sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));

         if ($action == 'insert_category') {
           $insert_sql_data = array('categories_id' => $categories_id,
                                    'language_id' => $languages[$i]['id']);

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

           tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);
         } elseif ($action == 'update_category') {
           tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
         }
       }

       if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_CATS)) {
         tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
       }
//rmh M-S_multi-stores begin
       if (isset($HTTP_POST_VARS['stores_id'])) {
         $stores_id = tep_db_prepare_input($HTTP_POST_VARS['stores_id']);
         tep_db_query("delete from " . TABLE_CATEGORIES_TO_STORES . " where categories_id = '" . (int)$categories_id . "'");
         for ($i=0, $n=sizeof($stores_id); $i<$n; $i++) {
           if (isset($HTTP_POST_VARS['stores_id'])) tep_db_query("insert into " . TABLE_CATEGORIES_TO_STORES . " (categories_id, stores_id) values ('" . (int)$categories_id . "', '" . (int)$stores_id[$i] . "')");
         }
       }
//rmh M-S_multi-stores end
       if (USE_CACHE == 'true') {
         tep_reset_cache_block('categories');
         tep_reset_cache_block('also_purchased');
       }

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
       break;
     case 'delete_category_confirm':
       if (isset($HTTP_POST_VARS['categories_id'])) {
         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

         $categories = tep_get_category_tree($categories_id, '', array(0), '', true); //rmh M-S_multi-stores
         $products = array();
         $products_delete = array();

         for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
           $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'] . "'");

           while ($product_ids = tep_db_fetch_array($product_ids_query)) {
             $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];
           }
         }

         reset($products);
         while (list($key, $value) = each($products)) {
           $category_ids = '';

           for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {
             $category_ids .= "'" . (int)$value['categories'][$i] . "', ";
           }
           $category_ids = substr($category_ids, 0, -2);

           $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");
           $check = tep_db_fetch_array($check_query);
           if ($check['total'] < '1') {
             $products_delete[$key] = $key;
           }
         }

// removing categories can be a lengthy process
         tep_set_time_limit(0);
         for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
           tep_remove_category($categories[$i]['id']);
         }

         reset($products_delete);
         while (list($key) = each($products_delete)) {
           tep_remove_product($key);
         }
       }

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

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
       break;
     case 'delete_product_confirm':
       if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['product_categories']) && is_array($HTTP_POST_VARS['product_categories'])) {
         $product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
         $product_categories = $HTTP_POST_VARS['product_categories'];

         for ($i=0, $n=sizeof($product_categories); $i<$n; $i++) {
           tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "' and categories_id = '" . (int)$product_categories[$i] . "'");
         }

         $product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");
         $product_categories = tep_db_fetch_array($product_categories_query);

         if ($product_categories['total'] == '0') {
           tep_remove_product($product_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));
       break;
     case 'move_category_confirm':
       if (isset($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id'])) {
         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
         $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

         $path = explode('_', tep_get_generated_category_path_ids($new_parent_id));

         if (in_array($categories_id, $path)) {
           $messageStack->add_session(ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');

           tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
         } else {
           tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where categories_id = '" . (int)$categories_id . "'");

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

           tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));
         }
       }

       break;
     case 'move_product_confirm':
       $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
       $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

       $duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$new_parent_id . "'");
       $duplicate_check = tep_db_fetch_array($duplicate_check_query);
       if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . (int)$new_parent_id . "' where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$current_category_id . "'");

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

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));
       break;
//Master Products
     
      case 'insert_master':
      case 'update_master':

       if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {
         $action = 'new_master';
       } 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';
         $products_master_status = '1';

         $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
           'products_bundle' => tep_db_prepare_input($HTTP_POST_VARS['products_bundle']),
                                 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
                                 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),
         'products_cost' => tep_db_prepare_input($HTTP_POST_VARS['products_cost']),
         'products_qty_blocks' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_qty_blocks'])) < 1) ? 1 : $i, //rmh M-S_pricing
                                 'products_date_available' => $products_date_available,
                                 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),
                                 'products_master_status' => tep_db_prepare_input($HTTP_POST_VARS['products_master_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']));
                                 

         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 (isset($HTTP_POST_VARS['products_subimage1']) && tep_not_null($HTTP_POST_VARS['products_subimage1']) && ($HTTP_POST_VARS['products_subimage1'] != 'none')) {
           $sql_data_array['products_subimage1'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage1']);
         }

 

         if ($action == 'insert_master') {
           $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();
//rmh M-S_multi-stores inserted next line
           tep_db_query("insert into " . TABLE_PRODUCTS_TO_STORES . " (products_id, stores_id) values ('" . (int)$products_id . "', '" . (int)$selected_store_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_master') {
           $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]),
 // BOF Wolfen featured sets
                                   'products_short' => tep_db_prepare_input($HTTP_POST_VARS['products_short'][$language_id]),
 // EOF Wolfen featured sets
                                   '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_master') {
             $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_master') {
             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 EOF   	 
 
     case 'insert_product':
     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_bundle' => tep_db_prepare_input($HTTP_POST_VARS['products_bundle']),
                                 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
                                 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 
         'products_cost' => tep_db_prepare_input($HTTP_POST_VARS['products_cost']),
                                 'products_qty_blocks' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_qty_blocks'])) < 1) ? 1 : $i, //rmh M-S_pricing
                                 'products_date_available' => $products_date_available,
                                 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),
// BOF Wolfen featured sets
                                 'products_featured' => tep_db_prepare_input($HTTP_POST_VARS['products_featured']),
                      'products_featured_until' => tep_db_prepare_input($HTTP_POST_VARS['products_featured_until']),
// EOF Wolfen featured sets
                                 '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_master_status' => tep_db_prepare_input($HTTP_POST_VARS['products_master_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 (isset($HTTP_POST_VARS['products_subimage1']) && tep_not_null($HTTP_POST_VARS['products_subimage1']) && ($HTTP_POST_VARS['products_subimage1'] != 'none')) {
           $sql_data_array['products_subimage1'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage1']);
         }

         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();
//rmh M-S_multi-stores inserted next line
           tep_db_query("insert into " . TABLE_PRODUCTS_TO_STORES . " (products_id, stores_id) values ('" . (int)$products_id . "', '" . (int)$selected_store_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 . "'");
         }

         // update bundle contents
         if ($HTTP_POST_VARS['products_bundle'] == "yes") {
           tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'");
           for ($i=0, $n=6; $i<$n; $i++) {
             if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) {
               tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')");
             }
           }
         }

         $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_short' => tep_db_prepare_input($HTTP_POST_VARS['products_short'][$language_id]), 	 //  Wolfen featured sets
                                   '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;

     case 'copy_to_confirm':
       if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {
         $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

         if ($HTTP_POST_VARS['copy_as'] == 'link') {
           if ($categories_id != $current_category_id) {
             $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");
             $check = tep_db_fetch_array($check_query);
             if ($check['total'] < '1') {
               tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
             }
           } else {
             $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
           }
         } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
// BOF Wolfen featured sets
           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_qty_blocks, products_date_available, products_weight, products_tax_class_id, products_featured, products_featured_until, distributors_id, manufacturers_id, products_master, products_master_status  from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");


           $product = tep_db_fetch_array($product_query);
//rmh M-S_multi-stores edited next line
           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_featured, products_featured_until, products_tax_class_id, manufacturers_id, products_master, products_master_status) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_subimage1']) . "', '" . tep_db_input($product['products_subimage2']) . "', '" . tep_db_input($product['products_subimage3']) . "', '" . tep_db_input($product['products_subimage4']) . "', '" .  tep_db_input($product['products_subimage5']) . "', '" . tep_db_input($product['products_subimage6']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_cost']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_featured'] . "', '" .	(int)$product['products_featured_until'] . "', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')" . $product['products_master'] . "', '" . (int)$product['products_master_status'] . "')");
	 $dup_products_id = tep_db_insert_id();
// Master Products EOF 
           $description_query = tep_db_query("select language_id, products_name, products_description, products_short, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
           while ($description = tep_db_fetch_array($description_query)) {
            tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_short, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_short']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
           }
// EOF Wolfen featured sets

           tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
           $products_id = $dup_products_id;
         }

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

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
       break;
     case 'new_product_preview':

    $products_image = new upload('products_image');
       $products_image->set_destination(DIR_FS_CATALOG_IMAGES);
       if ($products_image->parse() && $products_image->save()) {
         $products_image_name = $products_image->filename;
       } else {
         $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');
       }
       break;
     case 'new_master_preview':

//rmh M-S_multi-stores begin
     case 'category_to_stores_confirm':
       if (isset($HTTP_POST_VARS['categories_id'])) {
         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
         $stores_id = tep_db_prepare_input($HTTP_POST_VARS['stores_id']);
         tep_db_query("delete from " . TABLE_CATEGORIES_TO_STORES . " where categories_id = '" . (int)$categories_id . "'");
         for ($i=0, $n=sizeof($stores_id); $i<$n; $i++) {
           if (isset($HTTP_POST_VARS['stores_id'])) tep_db_query("insert into " . TABLE_CATEGORIES_TO_STORES . " (categories_id, stores_id) values ('" . (int)$categories_id . "', '" . (int)$stores_id[$i] . "')");
         }

         if (isset($HTTP_POST_VARS['rolldown_store']) && ($HTTP_POST_VARS['rolldown_store'] == 'on')) {
           $categories = tep_get_category_tree($categories_id, '', array(0), '', true);
           $products = array();
           $products_add = array();

           for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
             $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'] . "'");

             while ($product_ids = tep_db_fetch_array($product_ids_query)) {
               $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];
             }
           }

           reset($products);
           while (list($key, $value) = each($products)) {
             $category_ids = '';

             for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {
               $category_ids .= "'" . (int)$value['categories'][$i] . "', ";
             }
             $category_ids = substr($category_ids, 0, -2);

             $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");
             $check = tep_db_fetch_array($check_query);
             if ($check['total'] < '1') {
               $products_add[$key] = $key;
      tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
       break;
             }
           }
?>

Share this post


Link to post
Share on other sites

Hi all

 

I?m new here in this forum but have been doing some osCommerce in Sweden for a year.

I have used MP for a time and now i have added the latest contrib that makes it possible to have one slave to several masters.

But... It doesn?t work properly :(

 

I can connect several masters in admin and the product id is stored in the db but the slave only shows in one of the defined master products in the shop.

 

Anyone here that have had the same problem and a sollution?

 

Thanks in advance

 

Borje

Edited by collage

Share this post


Link to post
Share on other sites

Hi Matti,

 

I have a problem that may be caused by my ammended Master Products. I can download MP3 files but not the FLAC options.

 

I have looked at the files that you sent me but can see nothing obvious

 

After a succesful purchase both show up in the checkout success page as hyperlinks, but only the MP3 downloads, the FLAC returns an Error 500

 

I thought it might have been caused by the size of the FLAC files but have ammended the download.php to download in 32Kb chunks, so I don't think that's an issue.

 

Both files are in the same folder so it' nota problem caused by permissions

 

I can succesfully download an 11mb MP3 file

 

I renamed a flac file as an MP3 in attributes and renamed the actual file via ftp, but that also returned a 500. (I left the attributes as MP3)

 

Anu suggestions as to where the solution might lie

 

Steve

Share this post


Link to post
Share on other sites

Not sure if this would be th right place to post this, but....

 

I have installed Master products and the Easypopulate for MP. Everything seems to be fine with MP, but not with this modeified version of EP (for MP). When I login to my admin area and proceed to the EP section I get this error showing at the top:

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/..../store/admin/easypopulate.php:1) in /home/.../store/admin/includes/functions/sessions.php on line 67

 

I have no problems uploading using this version of EP, but I do get the same above error as well as the foloowing errors if I tried to download.

 

Warning: Cannot modify header information - headers already sent by (output started at /home/.../store/admin/easypopulate.php:1) in /home/.../store/admin/easypopulate.php on line 579

 

Warning: Cannot modify header information - headers already sent by (output started at /home/.../store/admin/easypopulate.php:1) in /home/.../store/admin/easypopulate.php on line 580

 

Warning: Cannot modify header information - headers already sent by (output started at /home/zoie05/.../store/admin/easypopulate.php:1) in /home/zoie05/.../store/admin/easypopulate.php on line 586

 

Warning: Cannot modify header information - headers already sent by (output started at /home/.../store/admin/easypopulate.php:1) in /home/...l/store/admin/easypopulate.php on line 588

 

Any clues? I have made sure there are not any extra white spaces in any of the files mentioned. Any help would be GREATLY appreciated - I am so close to going live.

Share this post


Link to post
Share on other sites

Could someone please help me with my problem from this post. Right now a customer finds the style they like (master product) then chooses which color or detail they like (slave product) but does not know where to pick their size as the size attribute on the slave is on the slaves product page which no one goes to as all the info they need is on the master page. The spot to pick a size (which is mandatory) should be on the master page with each slave choice so they pick their quantiy and size and add to cart.

 

Any help with moving this would be most appreciated.

 

Wanda

Share this post


Link to post
Share on other sites
Hi Matti,

 

I have a problem that may be caused by my ammended Master Products. I can download MP3 files but not the FLAC options.

 

Steve

 

Update on the last post (full text 3 above this one) I encoded a small sample to FLAC and find that I can purchase and download, so my previous thoughts that it might be something to do with the attributes settings is wrong.

 

The 500 error would appear to be caused purely by the size of the file.

 

Steve

Share this post


Link to post
Share on other sites

Hi there, how is everyone?

I am using the MP mod, i have it on an mp3 site, so the master is the album and the slaves are the individual songs on the album. So tehy can either purchase the whole album (Master) or the singles (slaves)

 

now what i was wondering, is, is there a way to set it up so that if someone does a search, and gets a slave as a result, can i link the slave to the master product?

 

SO if click on the slave from a search result, it will take them to the master product.

 

Hope you get what i mean :blush:

Share this post


Link to post
Share on other sites

I have an ammended checkout process as part pf Master Products

 

Around line 18 I have

include('includes/application_top.php');

$povid = 17;

 

I think this relates to one of the digital dowbload options, in this case flac files.

 

Now Flac files are causing me a big problem and won't downlaod through OSCommerce but will through a test download.php file that is stripped of all session infi and just offers up a fixed file for download

 

So something in the session info is causing a problem with large files.

 

Anyone able to help me out wiyh info re these lines of code?

 

And if they might jave any impact on my problem

 

Steve

Share this post


Link to post
Share on other sites

I am using Master Products and am having a small problem. I don't want the slave products to appear anywhere but as slaves to their master in product_info. For example, sometimes the slave will display in the What's New InfoBox. Can I have only the masters appear there (and anywhere else this might occur)? I did check the box to hide the product in Admin, but that didn't seem to do it.

 

Thanks all,

Mark

Share this post


Link to post
Share on other sites
I am using Master Products and am having a small problem. I don't want the slave products to appear anywhere but as slaves to their master in product_info. For example, sometimes the slave will display in the What's New InfoBox. Can I have only the masters appear there (and anywhere else this might occur)? I did check the box to hide the product in Admin, but that didn't seem to do it.

 

Thanks all,

Mark

Did you change the settings for Slave Products as well in Configuration?

 

Steve

Share this post


Link to post
Share on other sites
I am using Master Products and am having a small problem. I don't want the slave products to appear anywhere but as slaves to their master in product_info. For example, sometimes the slave will display in the What's New InfoBox. Can I have only the masters appear there (and anywhere else this might occur)? I did check the box to hide the product in Admin, but that didn't seem to do it.

 

Thanks all,

Mark

 

 

In /includes/boxes/whats_new.php change the query:

 

  if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {

 

to:

 

  if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price, products_master_status from " . TABLE_PRODUCTS . " where products_status = '1' and products_master_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {

 

Matti


Matti Ressler

 

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

_____

Share this post


Link to post
Share on other sites
In /includes/boxes/whats_new.php change the query:

 

  if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {

 

to:

 

  if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price, products_master_status from " . TABLE_PRODUCTS . " where products_status = '1' and products_master_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {

 

Matti

Thanks so much, That did it for the What's New InfoBox.

 

Can it also be done for products_new.php, search results, and.....(are there other places this might happen)?

 

Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×