Guest Posted April 16, 2006 Share Posted April 16, 2006 Thank you ATeschner - I seem to be getting somewhere now! Quote Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2006 Share Posted April 18, 2006 Hi I am adding products to my store and wanted to know if there was a better way of adding slaves. I have been creating one slave (ie small) and then doing a 'copy to' 'Duplicate Product'. However, when I do this, while it still thinks its a slave, when I go to edit the product (ie to make it a large) it has lost its attachment to the Master and in fact has the tick box checked as 'Assign as Master' Appreciate any thoughts. W Quote Link to comment Share on other sites More sharing options...
trogette Posted April 18, 2006 Share Posted April 18, 2006 Hi I am adding products to my store and wanted to know if there was a better way of adding slaves. I have been creating one slave (ie small) and then doing a 'copy to' 'Duplicate Product'. However, when I do this, while it still thinks its a slave, when I go to edit the product (ie to make it a large) it has lost its attachment to the Master and in fact has the tick box checked as 'Assign as Master' Appreciate any thoughts. W the defaults will be in the code I guess, but mine copies the master products_id field entry and the 'assign as master' checkbox is empty. :blink: It does have 'show product' as a default though so it's just as well duplicates come up with 'off' status, lol. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2006 Share Posted April 18, 2006 Hmm, interesting. I also note that if I copy a Master as a duplicate, when I look at it in the product table in admin, it has lost its master status and is neither a master or slave, just a regular product. Re mine copies the master products_id field entry, I do see a number in this field but it seems a random one (2147483647), certainly not one of the master products. the defaults will be in the code I guess, but mine copies the master products_id field entry and the 'assign as master' checkbox is empty. :blink: It does have 'show product' as a default though so it's just as well duplicates come up with 'off' status, lol. Quote Link to comment Share on other sites More sharing options...
trogette Posted April 18, 2006 Share Posted April 18, 2006 that's your barcode thingy, isn't it? Is it pulling your model/barcode field instead of the master products_id? Quote Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2006 Share Posted April 18, 2006 (edited) Hi Just looked at the code and I could only see reference to the master, as per below <tr> <td class="main"><?php echo TEXT_PRODUCTS_LISTING_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_listing_status', '1', $in_listing_status) . ' ' . TEXT_LIST_PRODUCT . ' ' . tep_draw_radio_field('products_listing_status', '0', $out_listing_status) . ' ' . TEXT_HIDE_PRODUCT; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_MASTER_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_checkbox_field('products_master_status', '1', $in_master_status); ?></td> </tr> Happy to send the full file for review if any one thinks they can help further. W that's your barcode thingy, isn't it? Is it pulling your model/barcode field instead of the master products_id? Edited April 18, 2006 by Wired PSF Quote Link to comment Share on other sites More sharing options...
Guest Posted April 19, 2006 Share Posted April 19, 2006 I don't seem to have anything listed under admin/config/slave attributes... Quote Link to comment Share on other sites More sharing options...
Guest Posted April 19, 2006 Share Posted April 19, 2006 I don't seem to have anything listed under admin/config/slave attributes... I do have a master and some slaves set up - could the problem be with my master.sql? I'm also having trouble with the master/slave options appearing on non-master products info pages. I'm using STS. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 19, 2006 Share Posted April 19, 2006 First Problem was with sql - fixed now. Second Problem was with STS - fixed now. Next Problems - 'hide' slave products won't work for me and I need there to be a pop up image link from the slave list on the master product page. I also need a simple check box instead of quantity and I need to know if its possible to make the order NOT go through unless 5 slaves have been chosen (5, 10, 15 or 20 etc) Any help would be greatly appreciated and (assuming this isn't against the rules) I'll give you a shout out in our links section when the shop is up and running. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 19, 2006 Share Posted April 19, 2006 (edited) Well, the way I got the pop up link to work was quite simple really. I just made the slaves product description a link that says 'click to see image' and that opens in a new window. It doesn't resize to the image, but beggars can't be losers all the time. Now to get that checkbox instead of quantity menu working... I would also gladly settle for 5 slaves having to be purchased before any order is processed but NOT in groups of 5 (10, 15, 20 etc) like I said previously. Edited April 19, 2006 by mpm Quote Link to comment Share on other sites More sharing options...
Guest Posted April 19, 2006 Share Posted April 19, 2006 Bit of a sloppy install in that I had forgotten to go back and have a look at the new code in index.php - my slave products are now hidden BUT is there anyway to hide the category I have them kept in? The category is purely for house keeping purposes and the customers don't need to see them. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 20, 2006 Share Posted April 20, 2006 (edited) To add checkboxes to the Slave products instead of the pull down menu do this. Resources with information to do this tasks. 1.) The catalog/includes/modules/master_listing.php page builds the Slave Products layout. 2.) The catalog/includes/functions/html_output.php contains the functions to build various form elements from form fields to hidden fields etc. In the catalog/includes/modules/master_listing.php look for the switch statement with the case " case 'MASTER_LIST_BUY_NOW': " That switch statement builds the pull down menue of the slave listings. "Comment Out" or delete it and replace it with case 'MASTER_LIST_BUY_NOW': $lc_align = 'center'; $lc_valign = 'top'; $lc_text = tep_draw_checkbox_field('Qty_ProdId_' . $listing['products_id'], $value = (int)1); break; The important variable is the $lc_text which contains the call to the function located in the catalog/includes/functions/html_output.php page to output a checkbox field. I followed this and I now have checkboxes working BUT firstly I inserted that code into the first listing of all the 'case' in the master_listing.php - it looked very similar to the code in the post but all this did was replace the table HEADING with a checkbox! The way I got this to work was use the $lc_text code further down in the file and replaced this bit of code: case 'MASTER_LIST_BUY_NOW': $lc_align = 'center'; $lc_valign = 'top'; if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { $lc_text = TEXT_STOCK; } elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); [b]$lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);[/b] } } else { $quantity = tep_get_products_stock($listing['products_id']); $qty_array = array(); for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); [b] $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);[/b] } } break; becomes this: case 'MASTER_LIST_BUY_NOW': $lc_align = 'center'; $lc_valign = 'top'; if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { $lc_text = TEXT_STOCK; } elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); [b]$lc_text = tep_draw_checkbox_field('Qty_ProdId_' . $listing['products_id'], $value = (int)1); [/b] } } else { $quantity = tep_get_products_stock($listing['products_id']); $qty_array = array(); for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); [b]$lc_text = tep_draw_checkbox_field('Qty_ProdId_' . $listing['products_id'], $value = (int)1); [/b] } } break; In other words look for the second listing of master_list_buy_now in master_listing.php Edited April 20, 2006 by mpm Quote Link to comment Share on other sites More sharing options...
trogette Posted April 20, 2006 Share Posted April 20, 2006 Well, the way I got the pop up link to work was quite simple really. I just made the slaves product description a link that says 'click to see image' and that opens in a new window. It doesn't resize to the image, but beggars can't be losers all the time. That's what I did. I could have tinkered with the stuff in master_listing.php but it would have taken more brain-ache than I can face atm :lol: Quote Link to comment Share on other sites More sharing options...
trogette Posted April 20, 2006 Share Posted April 20, 2006 cross-posted from qtpro thread: whoo!!! I've sorted out my master products vs qtpro problem... Here's the code for the 'add slave' case in application_top.php: //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; //++++ QT Pro: Begin Changed code $attributes=array(); if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) { $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']); foreach ($attrlist as $attr) { list($oid, $oval)=explode('-',$attr); if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval) $attributes[$oid]=$oval; } } if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) { foreach ($HTTP_POST_VARS['id'] as $key=>$val) { if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val) $attributes=$attributes + $HTTP_POST_VARS['id']; } } // Master Products add slave in qtpro $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id'], $attributes))+1, $attributes); //++++ QT Pro: End Changed Code } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products EOF Note this isn't tested yet with the paypal IPN and nochex APC payment modules, that's the next step. But I'm so chuffed!! Quote Link to comment Share on other sites More sharing options...
Guest Posted April 21, 2006 Share Posted April 21, 2006 Instead of hiding slave products from whats new and new products i think a nicer solution could be to actually let them show but point them into the master instead, anyone know the proper code to set this up. This way instead of hiding all slaves from these places users could see them and when they click on them it'll bring them to the master, thus adding new products to old masters will let users know that something new is there. Does anyone know if this is possible?? Quote Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2006 Share Posted April 22, 2006 Removing the slave products from the whats new and new product boxes is proving problematic. When I add products_master_status = '1' it freezes my whats new box on the master product. When I add it to products_new - everything disappears from the box entirely! Quote Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2006 Share Posted April 22, 2006 Does anyone know if this is possible?? On the product_info page, check if the product has a master and whether its listing status is 0 - if both are true redirect to the master. You should check whether the product has a master or its listing status if you wish to hide it from somewhere - not all products have a master_status of 1 There are myriad ways just checking either of those two parameters can be used. Matti Quote Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2006 Share Posted April 22, 2006 Sorry Matti - I don't understand :( How do I redirect to the master? Quote Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2006 Share Posted April 22, 2006 Never mind :) Thanks Matti! http://www.oscommerce.com/forums/index.php?s=&...ndpost&p=647072 Quote Link to comment Share on other sites More sharing options...
Guest Posted April 23, 2006 Share Posted April 23, 2006 (edited) 3 more problems :) 1. I'm trying to use the Minimum Quantity Order with Admin with Master Products. I'm trying to make the customer buy 5 slave products of the master product before they can checkout. Can I infact do that with this contribution? Or is there some way to just do this with Master products? 2. I've botched something up somewhere and I can't add any normal products to the shopping cart via 'add to cart'. 'Buy Now' works fine and so do slave products. 3. When I go to the category that my master products are in and it shows the product listing of the masters I do not want the 'buy now' button there. I want the customer to click on the master to view the slave products. I do want the 'buy now' button/column for normal product lists though. Any (more) help please? I'm so close yet so far away! :) Edited April 23, 2006 by mpm Quote Link to comment Share on other sites More sharing options...
Guest Posted April 23, 2006 Share Posted April 23, 2006 1. You can do anything you set your mind to :) 2. Sounds like it! 3. In application_top.php change the buy_now to this: 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'])); } elseif (tep_get_products_master_status($HTTP_GET_VARS['products_id']) == 1) { 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))); Matti Quote Link to comment Share on other sites More sharing options...
trogette Posted April 23, 2006 Share Posted April 23, 2006 3. When I go to the category that my master products are in and it shows the product listing of the masters I do not want the 'buy now' button there. I want the customer to click on the master to view the slave products. I do want the 'buy now' button/column for normal product lists though. Any (more) help please? I'm so close yet so far away! :) You'd need to add an if statement to the relevant case in in product_listing.php to differentiate between masters and non-masters :) Quote Link to comment Share on other sites More sharing options...
Guest Posted April 23, 2006 Share Posted April 23, 2006 You'd need to add an if statement to the relevant case in in product_listing.php to differentiate between masters and non-masters :) Why change existing logic? If you look at the default buy_now, if a product has attributes it will redirect to product_info when the buy now button is clicked - the solution above just adds to this :) Matti Quote Link to comment Share on other sites More sharing options...
trogette Posted April 23, 2006 Share Posted April 23, 2006 ah I see, I was just looking at not displaying a button. Personally most of my products either have attributes or are master/slave set-ups so I just don't show 'buy now' in the product listing. While we're on the subject, do you think it's feasible to show attribute drop-downs in the master listing?? Quote Link to comment Share on other sites More sharing options...
Guest Posted April 23, 2006 Share Posted April 23, 2006 ah I see, I was just looking at not displaying a button. Personally most of my products either have attributes or are master/slave set-ups so I just don't show 'buy now' in the product listing. While we're on the subject, do you think it's feasible to show attribute drop-downs in the master listing?? If some products have a button and others dont then customers get confused as to whether a product is available for purchase. Yes - there is an attributes add-on for Master Products on the download page :) Matti Quote 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.