Guest Posted June 10, 2011 Share Posted June 10, 2011 I am sure I read somewhere that when you have your master set at no price/no quantity that it should not show 'products out of stock'. If that is true, how come it still shows up? Doesn't look very good to have the master say that products are out of stock, while the slaves still have products. What do I need to fix? Thanks, Marianne I also seem to have a problem with the master product adding when a slave is added to the cart, I only want the slaves to be added to the cart, not the master, it is only the description of the item, not the actual product. I do have the 'Allow checkout' set to false in the config, so since the master has 0 quantity, it should not add to the cart. Marianne Quote Link to comment Share on other sites More sharing options...
Guest Posted June 10, 2011 Share Posted June 10, 2011 I also seem to have a problem with the master product adding when a slave is added to the cart, I only want the slaves to be added to the cart, not the master, it is only the description of the item, not the actual product. I do have the 'Allow checkout' set to false in the config, so since the master has 0 quantity, it should not add to the cart. Marianne Ok, I have figured out how to stop the 'out of stock' appearing on the master listing. BUT....I still have the problem that when adding a slave to the shopping cart, it automatically adds the master as well. This is not what I want. I want only the slave added, since the master only has the description, no price or quantity. Sure it can be deleted later, but that is a nuisance. I don't want it added in the first place!! How can I stop this from happening?? Thanks, Marianne Quote Link to comment Share on other sites More sharing options...
Peper Posted June 10, 2011 Share Posted June 10, 2011 Ok, I have figured out how to stop the 'out of stock' appearing on the master listing. BUT....I still have the problem that when adding a slave to the shopping cart, it automatically adds the master as well. This is not what I want. I want only the slave added, since the master only has the description, no price or quantity. Sure it can be deleted later, but that is a nuisance. I don't want it added in the first place!! How can I stop this from happening?? Thanks, Marianne I struggled also with this issue, sorted now Just delete the addons you not using in the code - only last piece in product_info.php when adding master products !!!!!Please backup first!!!!! //Master Products if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if ($product_info['products_price']>0) { $qty_array = array(); for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } ?> <tr> <td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) { echo QUANTITY_WISH . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ; } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } echo QUANTITY_WISH . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ; } else { echo TEXT_STOCK; } echo tep_draw_separator('pixel_trans.gif', '30', '10'); ?> </td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td> </tr> <?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); if ($reviews['count'] > 0) { ?> <tr> <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master = " . $HTTP_GET_VARS['products_id']); $results = tep_db_fetch_array($master_query); if (($results['products_id'] != NULL) && ($product_info['products_master_status'] == 1)) { ?> <tr> <td align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></td> </tr> <?php } } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <!-- Back button --> <td class="main"> <?php $referer = $_SERVER['HTTP_REFERER']; if (!$referer == '') { echo '<a href="' . $referer . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_path($current_category_id = '')) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; } ?></td> <!-- end back button --> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']); if ($product_info['sold_in_bundle_only'] == "yes") { echo TEXT_BUNDLE_ONLY; } elseif ((STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') && ($qty < 1)) { echo tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK); } else { echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); } ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php if ($product_info['products_pdfupload'] == '') { // echo '<a href="' . tep_href_link(DIR_WS_MANUALS. $product_info['products_pdfupload']) . '"target="_blank">' . TEXT_CLICK_TO_PDFUPLOAD2 . '</a>'; } else { echo '<a href="' . tep_href_link(DIR_WS_MANUALS . $product_info['products_pdfupload']) . '"target="_blank">' . TEXT_CLICK_TO_PDFUPLOAD . '</a>'; } echo '<br>'; if ($product_info['products_fileupload'] == '') { // echo '<a href="' . tep_href_link(DIR_WS_MANUALS . $product_info['products_fileupload']) . '"target="_blank">' . TEXT_CLICK_TO_FILEUPLOAD2 . '</a>'; } else { echo '<a href="' . tep_href_link(DIR_WS_MANUALS . $product_info['products_fileupload']) . '"target="_blank">' . TEXT_CLICK_TO_FILEUPLOAD . '</a>'; } ?> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <!--- BEGIN Header Tags SEO Social Bookmarks --> <?php if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php'); ?> <!--- END Header Tags SEO Social Bookmarks --> <tr> <td> <?php //added for cross -sell if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_xsell_products(3600); //added for Xsell echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } ?> </td> </tr> <?php /*** Begin Header Tags SEO ***/ ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="smallText" align="center"><?php echo TEXT_VIEWING; ?> <?php echo '<a title="' . $header_tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '"/# ' . $header_tags_array['title'] . '">' . $header_tags_array['title']; ?></a></td> </tr> <?php /*** End Header Tags SEO ***/ ?> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Hope this helps Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Guest Posted June 10, 2011 Share Posted June 10, 2011 Thanks for the help, but I can't see what you changed to get it to not add the master to the shopping cart when adding a slave. And you have so many more addons than I have that I get lost. Can you just show me what you changed? thanks, Marianne Quote Link to comment Share on other sites More sharing options...
Peper Posted June 11, 2011 Share Posted June 11, 2011 Thanks for the help, but I can't see what you changed to get it to not add the master to the shopping cart when adding a slave. And you have so many more addons than I have that I get lost. Can you just show me what you changed? thanks, Marianne mmm, quite right I will try and find the some other change I made Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted June 12, 2011 Share Posted June 12, 2011 I edited the index.php file to get slave products showing up by removing and p.products_master = '0' How to get link from slave product in index.php not to point to it's master product, slave to be product on it's own Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted June 13, 2011 Share Posted June 13, 2011 I edited the index.php file to get slave products showing up by removing and p.products_master = '0' How to get link from slave product in index.php not to point to it's master product, slave to be product on it's own Replying to my own threads. Still need some little help to finally complete this great addon. Got everything sorted except the quantity drop down box. When displaying product with master the quantity works fine on adding master and slave product. When displaying a normal product the quantity selected from drop down is always 1 even if 20 is selected Anyone had this problem please help Geotex 1 Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted June 13, 2011 Share Posted June 13, 2011 Once again I see something else happening. A slave product, is it only restricted to its own category or across multiple categories? e.g. I assigned like 10 master products in different categories, then in another category I made a product slave and assigned it to master products in admin, catalog - the slave however does not display with the master products created. Only products within that category gets a slave attached to its master In the database field for product_master the slave product shows 194 175 518 501 502 527 Any suggestions please? Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted June 13, 2011 Share Posted June 13, 2011 (edited) double post Edited June 13, 2011 by Peper Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Geotex Posted June 13, 2011 Share Posted June 13, 2011 Replying to my own threads. Still need some little help to finally complete this great addon. Got everything sorted except the quantity drop down box. When displaying product with master the quantity works fine on adding master and slave product. When displaying a normal product the quantity selected from drop down is always 1 even if 20 is selected Anyone had this problem please help Try this code in product_info.ph where the quantity to purchase displays. Works fine on mine. ?> <tr> <td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) { echo TEXT_QUANTITY . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ; } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) { $qty_array = array(); for ($i=1; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } echo TEXT_QUANTITY . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ; } else { echo TEXT_STOCK; } echo tep_draw_separator('pixel_trans.gif', '30', '10'); ?> </td> </tr> Quote GEOTEX from Houston, TX (George) Link to comment Share on other sites More sharing options...
Geotex Posted June 13, 2011 Share Posted June 13, 2011 Once again I see something else happening. A slave product, is it only restricted to its own category or across multiple categories? e.g. I assigned like 10 master products in different categories, then in another category I made a product slave and assigned it to master products in admin, catalog - the slave however does not display with the master products created. Only products within that category gets a slave attached to its master In the database field for product_master the slave product shows 194 175 518 501 502 527 Any suggestions please? Unless I totally misunderstand what you are showing in your database, you cannot display a slave with multiple masters. Diplay a slave prodct that has only a single master. There is no way for the slave product to know which master to choose. Check you database call in catalog/includes/modules/Master_products.php to be certain there are no category calls. Rounding up products from different categories is not a problem. Quote GEOTEX from Houston, TX (George) Link to comment Share on other sites More sharing options...
Peper Posted June 13, 2011 Share Posted June 13, 2011 (edited) Unless I totally misunderstand what you are showing in your database, you cannot display a slave with multiple masters. Diplay a slave prodct that has only a single master. There is no way for the slave product to know which master to choose. Check you database call in catalog/includes/modules/Master_products.php to be certain there are no category calls. Rounding up products from different categories is not a problem. Thanks Geotex You quite right to the products slaves to all categories - would be some mess. What I however did find is that some slaves does not appear for the master which is in the same category - isolated to 2 masters from same category, the slave product in that same cat does not show up. This is somewhat mysterious as the master and slaves for that product is assigned in the database but nada. For the rest of the products is showing however fine using the same/similar configuration to other master and slaves created. I assume adding another field to slave product to get it listed for every master shouldn't be too difficult, only my programming skills lacking >_< Ps. the quantity display not yet resolved Edited June 13, 2011 by Peper Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Geotex Posted June 13, 2011 Share Posted June 13, 2011 Thanks Geotex You quite right to the products slaves to all categories - would be some mess. What I however did find is that some slaves does not appear for the master which is in the same category - isolated to 2 masters from same category, the slave product in that same cat does not show up. This is somewhat mysterious as the master and slaves for that product is assigned in the database but nada. For the rest of the products is showing however fine using the same/similar configuration to other master and slaves created. I assume adding another field to slave product to get it listed for every master shouldn't be too difficult, only my programming skills lacking >_< Ps. the quantity display not yet resolved This would be an exercise in futility. Think about it. How would you determine which Master to display? If you keep stock levels on your cart, give the master a stock level so that it will show in a category and by manipulating the date field occasionally, keeping some of them in New Products. Then, the Master becomes your premier selling piece to promote the associated products. If you would like to carry the concept one step further, look at http://addons.oscommerce.com/info/2343This allows full descriptions similar to products for your categories. Quote GEOTEX from Houston, TX (George) Link to comment Share on other sites More sharing options...
Peper Posted June 14, 2011 Share Posted June 14, 2011 Thanks for reply To solve cart quantity showing normal products, I think it's coming from application_top.php Any help on code below? // Shopping cart actions if (isset($HTTP_GET_VARS['action'])) { // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled if ($session_started == false) { tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE)); } if ($HTTP_GET_VARS['products_set_only']) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO . '?products_id=' . $HTTP_GET_VARS['products_master'])); } if (DISPLAY_CART == 'true') { $goto = FILENAME_SHOPPING_CART; $parameters = array('action', 'cPath', 'products_id', 'pid'); } else { $goto = basename($PHP_SELF); if ($HTTP_GET_VARS['action'] == 'buy_now') { // BOE: XSell if (isset($HTTP_GET_VARS['product_to_buy_id'])) { $parameters = array('action', 'pid', 'products_to_but_id'); } else { $parameters = array('action', 'pid', 'products_id'); } // EOE: XSell } else { $parameters = array('action', 'pid'); } } switch ($HTTP_GET_VARS['action']) { // customer wants to update the product quantity in their shopping cart case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); } else { if (PHP_VERSION < 4) { // if PHP3, make correction for lack of multidimensional array. reset($HTTP_POST_VARS); while (list($key, $value) = each($HTTP_POST_VARS)) { if (is_array($value)) { while (list($key2, $value2) = each($value)) { if (preg_match ("/(.*)\]\[(.*)/", $key2, $var)) { $id2[$var[1]][$var[2]] = $value2; } } } } $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : ''; } else { $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; } $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products // customer adds multiple products from the master_listing page case 'add_slave' : reset($HTTP_POST_VARS); while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) { if (substr($key,0,11) == "Qty_ProdId_") { $prodId = substr($key,11); $qty = $val; if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) { // We have attributes $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]); } else { // No attributes $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty); } } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products EOF // customer adds a product from the products page case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // custom product builder add to cart from builder_info page case 'add_build' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { if ($_POST['uncloaked_build'] == '0') { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1' where products_id = '" . $_POST['products_id'] . "' and products_quantity > '" . $cart->get_quantity(tep_get_uprid($_POST['products_id'],$_POST['id'])) . "'"); } $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); if ($_POST['disable_build'] == '1' or $_POST['uncloaked_build'] =='0') { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . $_POST['products_id'] . "'"); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // BOF: XSell case 'buy_now' : if (isset($HTTP_GET_VARS['product_to_buy_id'])) { if (tep_has_product_attributes($HTTP_GET_VARS['product_to_buy_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['product_to_buy_id'])); } else { $cart->add_cart($HTTP_GET_VARS['product_to_buy_id'], $cart->get_quantity($HTTP_GET_VARS['product_to_buy_id'])+1); } } elseif (isset($HTTP_GET_VARS['products_id'])) { // EOF: XSell if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } elseif (isset($HTTP_POST_VARS['cart_quantity'])) { $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$HTTP_POST_VARS['cart_quantity']); } else { //modification to add quantity instead of 1 if($HTTP_POST_VARS['buyqty']=="") { $quantity = 1; }else{ $quantity = $HTTP_POST_VARS['buyqty']; } //end of modification to add quantity instead of 1 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$quantity); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; case 'notify' : if (tep_session_is_registered('customer_id')) { if (isset($HTTP_GET_VARS['products_id'])) { $notify = $HTTP_GET_VARS['products_id']; } elseif (isset($HTTP_GET_VARS['notify'])) { $notify = $HTTP_GET_VARS['notify']; } elseif (isset($HTTP_POST_VARS['notify'])) { $notify = $HTTP_POST_VARS['notify']; } else { tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify')))); } if (!is_array($notify)) $notify = array($notify); for ($i=0, $n=sizeof($notify); $i<$n; $i++) { $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['count'] < 1) { tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())"); } } tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify')))); } else { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } break; case 'notify_remove' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) { $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['count'] > 0) { tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'"); } tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')))); } else { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } break; case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) { if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid'])); } else { $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; } } // include the who's online functions Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
dspeak Posted June 15, 2011 Share Posted June 15, 2011 I am really wanting to try this contribution. It is exaclty what I am looking for. I am using oscommerce v2.2 RC2. I have downloaded Master Products V2.3 x V2.0 and the sql file in V2.3 x V2.0a. Following the instructions has already got me confused. The instructions says to upload the following files in catalog/ includes: •includes ◦boxes ■bm_suggested_accessories.php ■bm_reviews.php ■bm_shopping_cart.php ■bm_specials.php ■bm_whats_new.php ■bm_best_sellers.php That is 6 files. When I go to the downloaded upload file, includes, these files are not there only folders for classes, languages and modules. Where do I find the files that are supposed to be uploaded? Thanks for the help. Quote Link to comment Share on other sites More sharing options...
dspeak Posted June 15, 2011 Share Posted June 15, 2011 Let me clarify my previous post. The instructions say to upload the following files. •includes ◦boxes ■bm_suggested_accessories.php ■bm_reviews.php ■bm_shopping_cart.php ■bm_specials.php ■bm_whats_new.php ■bm_best_sellers.php but when I check the download application the only file I see under includes/boxes is suggest_accesories. What am I missing? Quote Link to comment Share on other sites More sharing options...
Geotex Posted June 15, 2011 Share Posted June 15, 2011 I believe the code for the version you have downloaded are for osCommerce 2.3.x. Please check the opening lines in the included in Master_Products_guide_V23x.html Think you will need to uninstall that version completely by restoring the backup you did before starting to install that contribution and preview an earlier version more suited to one of the RC2 releases. If Gergely is stil getting reply notifications for this topic, he needs to jump in on this one. Quote GEOTEX from Houston, TX (George) Link to comment Share on other sites More sharing options...
dspeak Posted June 16, 2011 Share Posted June 16, 2011 thank you, luckily I have not installed this contribution yet, was just beginning to and saw that files didn't match up. Do you know which version would be more suited to oscommerce v2.2 RC2 ? thanks Quote Link to comment Share on other sites More sharing options...
Peper Posted June 20, 2011 Share Posted June 20, 2011 Still stuck with drop-down quantity box for when showing just a normal product. is there maybe a code change we can do in product_info.php to say if no master product is displaying, remove its quantity box and insert the following box <tr> <?php for ($i=0; $i<15; $i++) { $qty_array[] = array('id' => $i+1, 'text' => $i+1); } ?> <td align="right" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td> </tr> application_top.php, I changed the following for the above: $HTTP_POST_VARS['id']))+1 and replaced with this: $HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity'] Anyone please? Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
tgely Posted June 20, 2011 Share Posted June 20, 2011 (edited) Still stuck with drop-down quantity box for when showing just a normal product. is there maybe a code change we can do in product_info.php to say if no master product is displaying, remove its quantity box and insert the following box <tr> <?php for ($i=0; $i<15; $i++) { $qty_array[] = array('id' => $i+1, 'text' => $i+1); } ?> <td align="right" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td> </tr> application_top.php, I changed the following for the above: $HTTP_POST_VARS['id']))+1 and replaced with this: $HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity'] Anyone please? Hi, switch ($HTTP_GET_VARS['action']) { // customer wants to update the product quantity in their shopping cart case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array(isset($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : $node_note) ? $HTTP_POST_VARS['cart_delete'] : array()))) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); } else { $attributes = (isset($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]])) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds a product from the products page case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : ''; $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer removes a product from their shopping cart case 'remove_product' : if (isset($HTTP_GET_VARS['products_id'])) { $cart->remove($HTTP_GET_VARS['products_id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products // customer adds multiple products from the master_listing page case 'add_slave' : // Master Products modification if attributes needed while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) { if (substr($key,0,11) == "Qty_ProdId_" && ($val !== 0)) { $prodId = substr($key,11); $qty = (is_numeric($val) ? $val : 0); // prevent injection if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) { // We have attributes $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]); } else { if (isset($HTTP_POST_VARS["products_id"]) && isset($HTTP_POST_VARS['id'])) { // We have attributes with normal product only if ($prodId == $HTTP_POST_VARS['products_id']) { $attributes = $HTTP_POST_VARS['id']; } else { $attributes = $HTTP_POST_VARS["id_$prodId"]; } $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $attributes))+$qty, $attributes); } else { // No attributes and normal products $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty); } } } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products EOF // performed by the 'buy now' button in product listings and review page case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) { if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } else { $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; and product_info.php in oscommerce v2.3.1 (can be a little diffenecies) <?php $qty_array = array(); if ($product_info['products_price']>0) { for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } } ?> <div class="buttonSet"> <p align="left" class="main"> <?php if ($product_info['products_quantity'] > 0) { if ($product_info['products_price'] > 0 ) { echo TEXT_QUANTITY . ' ' . ( ($product_info['products_buy_status'] == 1) ? tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) : '' ) ; } else { //echo 'Master'; } } elseif ((STOCK_CHECK == 'false') && ($product_info['products_quantity'] < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } echo TEXT_QUANTITY . ' ' . ( ($product_info['products_buy_status'] == 1) ? tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) : '' ) ; } elseif ((STOCK_CHECK == 'true') && ($product_info['products_quantity'] < 1)){ } else { echo '<p class="stockWarning">' . TEXT_ORDER . '</p>'; echo '<p align="center"><small><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'] . '&action=notify') . '">' . TEXT_STOCK_NOTIFY . '</a><br /><a href="' . tep_href_link(FILENAME_CONTACT_US, 'products_id=' . $product_info['products_id']) . '">' . TEXT_STOCK_CONTACT . '</a><br /><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $product_info['products_name'] . '&search_in_description=1&stock=in') . '">' . TEXT_STOCK_OFFERS . '</a></small></p>'; } ?> </p> </div> Edited June 20, 2011 by Gergely Quote osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
Peper Posted June 20, 2011 Share Posted June 20, 2011 Thanks Gergely Tried as you suggested My cart is ver. 2.2 Piece of code that I think is giving the main problem is <?php if ($product_info['products_price']>0) { $qty_array = array(); for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } ?> <tr> <td class="main" align="right"><?php if ($product_info['products_quantity'] > 0) { echo QUANTITY_WISH . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ; } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } echo QUANTITY_WISH . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ; } else { echo TEXT_STOCK; } echo tep_draw_separator('pixel_trans.gif', '30', '10'); echo tep_draw_hidden_field('products_id', $product_info['products_id']); if ($master_check['check'] == "1") { echo TEXT_BUNDLE_ONLY; } elseif ((STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') && ($qty < 1)) { echo tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK); } else { echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); } ?> The code works correctly when a master product is displaying but for a normal product the amount added to cart will always be 1 When I add <!-- ############ easy way add Qty box in your product_info.php BOF ################# --> <tr> <?php for ($i=0; $i<15; $i++) { $qty_array[] = array('id' => $i+1, 'text' => $i+1); } ?> <td align="center" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td> </tr> <!-- ############## easy way add Qty box in your product_info.php EOF ############# --> ------------------------------------------------------------------------------------------------------------------------------- 2. Like Sean's contribution, search application_top.php for the following code: --------------------------------------------- $HTTP_POST_VARS['id']))+1 -------------------------------------------- and replace with this: $HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity'] Then normal products is adding correctly except for master products My code in application_top.php // customer wants to update the product quantity in their shopping cart case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); } else { if (PHP_VERSION < 4) { // if PHP3, make correction for lack of multidimensional array. reset($HTTP_POST_VARS); while (list($key, $value) = each($HTTP_POST_VARS)) { if (is_array($value)) { while (list($key2, $value2) = each($value)) { if (preg_match ("/(.*)\]\[(.*)/", $key2, $var)) { $id2[$var[1]][$var[2]] = $value2; } } } } $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : ''; } else { $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; } $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products // customer adds multiple products from the master_listing page case 'add_slave' : reset($HTTP_POST_VARS); while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) { if (substr($key,0,11) == "Qty_ProdId_") { $prodId = substr($key,11); $qty = $val; if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) { // We have attributes $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]); } else { // No attributes $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty); } } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products EOF // customer adds a product from the products page case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity'], $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // custom product builder add to cart from builder_info page case 'add_build' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { if ($_POST['uncloaked_build'] == '0') { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1' where products_id = '" . $_POST['products_id'] . "' and products_quantity > '" . $cart->get_quantity(tep_get_uprid($_POST['products_id'],$_POST['id'])) . "'"); } $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); if ($_POST['disable_build'] == '1' or $_POST['uncloaked_build'] =='0') { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . $_POST['products_id'] . "'"); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // BOF: XSell case 'buy_now' : if (isset($HTTP_GET_VARS['product_to_buy_id'])) { if (tep_has_product_attributes($HTTP_GET_VARS['product_to_buy_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['product_to_buy_id'])); } else { $cart->add_cart($HTTP_GET_VARS['product_to_buy_id'], $cart->get_quantity($HTTP_GET_VARS['product_to_buy_id'])+1); } } elseif (isset($HTTP_GET_VARS['products_id'])) { // EOF: XSell if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } elseif (isset($HTTP_POST_VARS['cart_quantity'])) { $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$HTTP_POST_VARS['cart_quantity']); } else { //modification to add quantity instead of 1 if($HTTP_POST_VARS['buyqty']=="") { $quantity = 1; }else{ $quantity = $HTTP_POST_VARS['buyqty']; } //end of modification to add quantity instead of 1 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$quantity); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; case 'notify' : :'( Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
tgely Posted June 20, 2011 Share Posted June 20, 2011 Thanks Gergely Tried as you suggested My cart is ver. 2.2 Piece of code that I think is giving the main problem is Hi, I think the form action is wrong. If I have truth you have to change fom header in the product_info.php. (2 in one) if ($master_check['products_master_status'] > 0 || $master_check['products_master'] == 0) { // this modify!! echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; } else { echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); } // Master Products EOF I had to separate this functions some month before. There are two different form action we use. The original and the master (buy_now_) product actions. Sorry but I didnt examine your codes. Peper 1 Quote osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
Peper Posted June 20, 2011 Share Posted June 20, 2011 Hi, I think the form action is wrong. If I have truth you have to change fom header in the product_info.php. (2 in one) if ($master_check['products_master_status'] > 0 || $master_check['products_master'] == 0) { // this modify!! echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; } else { echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); } // Master Products EOF I had to separate this functions some month before. There are two different form action we use. The original and the master (buy_now_) product actions. Sorry but I didnt examine your codes. WoW, thanks alot Yeah worked :lol: if ($master_check['products_master_status'] > 0 || $master_check['products_master'] == 0) { // this modify!! Almost there after reading the tread for the 3rd time(busy) looking to make either description or product name clickable from slaves to take customer to slave's product_info.php page Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted June 21, 2011 Share Posted June 21, 2011 Me again >_< I see that when showing product on the index.php page and product has got options, if we click on add to cart, it will first redirect us to it's master product. Options on the product is however selectable when having master product on top of page, but this would be sort of wrong way - misleading product to wrong page? So, in index.php showing products, product got options then it need to direct customer to actual product and not it's master Any help please Geotex 1 Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Geotex Posted June 21, 2011 Share Posted June 21, 2011 (edited) Me again >_< I see that when showing product on the index.php page and product has got options, if we click on add to cart, it will first redirect us to it's master product. Options on the product is however selectable when having master product on top of page, but this would be sort of wrong way - misleading product to wrong page? So, in index.php showing products, product got options then it need to direct customer to actual product and not it's master Any help please Basically what you are saying is that "if a product has no options, go to Master" and "if product has options, go to prodct"? This voids the purpose of setting a Master-Slave relationship. The choice here is to not have a master for items with options, or add options to product listing when pulling a category, thereby changing the basic action of a buy now in catalog/includes/modules/product_listing[_col].php. You would also need to alter the shopping cart options in catalog/includes/application_top.php and possible also classes and functions. The second option is possible, but not very desirable for obvious reasons. Edited June 21, 2011 by Geotex Quote GEOTEX from Houston, TX (George) Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.