Master Products - MS2
#1581
Posted 11 September 2006, 15:58
#1582
Posted 15 September 2006, 16:59
I have added Master Products to my already customized store and the buy now button is not working as it should (and as it has on past builds).
The only buy now link that works properly is the buy now on slave products. The master products and the regular products do not work. The link they provide is:
http://mystore/product_info.php?cPath=10_2...p;products_id=0
I think I have isolated the issue to this piece of code in included/modules/product_listing.php
//Master Products
if ($listing['products_master_status'] != '1' && $listing['products_master'] == '0') {
$lc_text = ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
} elseif ($listing['products_master'] != '0') {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
}
//Master Products EOF
If i change the if statement to show
if ($listing['products_master_status'] != '1' && $listing['products_master'] == "" ){
then the buy now is available on all products including the slave and master.I have also stepped through the rest of my code and I can't see where I'm missing anything.
I have seperate price and bts installed and am working with MP 1.15
I have verified the data in my database shows that products_master_status = 0 and the products_master = 0, neither have a null value, but the products appear to step past the first result in the if statement and proceede to the second result.
If anyone has run across this problem, please let me know.
Thank You!
#1583
Posted 15 September 2006, 17:45
Happy now.
#1584
Posted 16 September 2006, 00:44
My apologies if this has been covered, but I ran searches and couldn't find anything...
I've installed Master Products, and set up two products - a master and a slave. They appear properly in the listings, the product info, everything, so that's good.
However, if I leave the quantity of the master product 0, and set a quantity of 1 or greater to the slave product, it allows me to continue (with only the slave product in my cart). Is this the normal/desired behaviour? If so, anyone have any suggestions as to how to keep it from happening? And if not, any ideas as to where I went wrong would be greatly appreciated.
Thank you!
#1585
Posted 16 September 2006, 07:42
teleute, on Sep 16 2006, 01:44 AM, said:
My apologies if this has been covered, but I ran searches and couldn't find anything...
I've installed Master Products, and set up two products - a master and a slave. They appear properly in the listings, the product info, everything, so that's good.
However, if I leave the quantity of the master product 0, and set a quantity of 1 or greater to the slave product, it allows me to continue (with only the slave product in my cart). Is this the normal/desired behaviour? If so, anyone have any suggestions as to how to keep it from happening? And if not, any ideas as to where I went wrong would be greatly appreciated.
Thank you!
Yes that's normal behaviour. If you're using it as a 'modifications for a base product' thing as oppose to a 'group-for-front-end-display-purposes' thing maybe one of the computer-builder contributions would work better?
#1586
Posted 16 September 2006, 08:25
I'm looking again at the issue of options in Master Products when using the QTPro contribution. Options on MP listings don't add to my cart at all, v frustrating! I'd like to see the pad_base file (particularly the tep_draw_pull_down_menu lines) of anyone who has got this working.
Thanks
#1587
Posted 18 September 2006, 01:30
trogette, on Sep 16 2006, 01:42 AM, said:
I don't know if the PC builders are really what I'm going for, though - really, MS *almost* works perfectly for what I'm trying to do. Basically, there are 2 products. Product A is the main product, and B is a supplementary product that can only be purchased if they're also getting the main product. I thought about doing it as an attribute, except that someone should be able to buy 1 of A and 3 of B. Really, MS would be exactly right if it just restricted purchase of a slave product based on the master.
Does anyone have an idea where I'd begin to look to make that modification? Thanks!
#1588
Posted 18 September 2006, 06:44
teleute, on Sep 17 2006, 07:30 PM, said:
Does anyone have an idea where I'd begin to look to make that modification? Thanks!
Just as an update - I set it so that the master product quantity drop down starts with 1 (so there's no way to add a slave without the master). However, that's only a very partial solution, as they could always remove the master from the cart and the slave will stick around. Still looking for how to change this, but again if anyone's got any pointers, I'd love to hear. Thanks!
#1589
Posted 18 September 2006, 12:36
Also it would be nice if the readme file could include the configuration options meaning and setting.
Very useful contrib! Thanks,
Michael
#1590
Posted 18 September 2006, 20:05
Yumi, on Sep 18 2006, 06:36 AM, said:
The drop down for the slaves is generated in the master_listing.php file (in /includes/modules/). You should see a couple of for loops in the BUY_NOW case that go from $i to $ns - $i is the first value and $ns the final value. You can set these to whatever you like.
#1591
Posted 19 September 2006, 00:38
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);
$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '1', 'size="4"');
}
} 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);
Your mail reminds me that I do not have drop-down boxes on my slaves, only on the master. I am using MP 1.2 as of the 14th Sept. 1006
Thanks for the quick reply.
Michael, Beijing
#1592
Posted 19 September 2006, 00:48
Yumi, on Sep 18 2006, 06:38 PM, said:
Hmmm...well, the code you pasted (which was indeed the code I was thinking of) is for generating the parameters for the drop down function. If you don't have drop downs, you're not using that chunk of code. What you *are* using, though, I couldn't say. Did you modify the contribution at all?
#1593
Posted 19 September 2006, 07:53
A very smiple trick to change textbox input field to a checkbox...which m sure many of you would find useful.
Do it manually by changing in include/modules/master_listing (2 occurences) in
Quote
Quote
Quote
The 1 is the value of products you want to add....recommend that you keep it to 1 only. The false is to leave the checkbox unchecked.
Hope it makes someones life easy:)
Edited by desidil4ever, 19 September 2006, 07:54.
#1594
Posted 19 September 2006, 10:50
$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '0', 'size="4"');
The syntax is tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) X-Ref
I changed the Value from '1' to '0' and now the initial quantity displays as 0.
However, I still have to find the bit for the drop-down boxes. If I sound clever - I am not. Did it by trial and error.
Thanks a lot.
Michael
#1595
Posted 19 September 2006, 11:18
Version MP1.2 has $lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '1', 'size="4"');
Version MP1.15 has $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array) ;
I just pasted the old version into the new file and it works.
Thanks again.
Michael, Beijing
#1596
Posted 19 September 2006, 14:39
do you know how do i change rows by columns in the master listng?
i appreciate your help.
diego.
#1597
Posted 19 September 2006, 21:18
#1598
Posted 20 September 2006, 07:59
Michael
#1599
Posted 20 September 2006, 18:24
However, this did not stop people from removing the master from the cart and keeping the slave. To fix this for now, I've done a bit of a hack (since I only have 3 products - one regular, one master and one slave). If anyone wants to develop this into a real mod, I may work on it with you (or do it myself later - too busy now!).... Anyway, I went into application_top.php, and found the "action" switch. In the "update_product" case, I changed it to the following;
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]);
if ($HTTP_POST_VARS['products_id'][$i] == '2') {
for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
if ($HTTP_POST_VARS['products_id'][$i] == 3) {
$slave = $i;
}
}
$cart->remove($HTTP_POST_VARS['products_id'][$slave]);
}
} else {
And then the PHP3 code, etc...So what I've done is that if the id of the product being deleted is 2 (my master product), then it should also delete any products with the id of 3 (the slave product). I know this is pretty hack-y, but I was in a hurry. I'd like to improve it later, but I thought I'd post it here as a start for anyone looking along the same lines.
#1600
Posted 25 September 2006, 08:45
Michael














