Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Master Products - MS2


2394 replies to this topic

#1581 50/50

  • Community Member
  • 15 posts
  • Real Name:Mr. Green

Posted 11 September 2006, 15:58

Sorry, I meant to say MySQL 5 not PHP 5!

#1582 sirkyle

  • Community Member
  • 119 posts
  • Real Name:kyle bruns

Posted 15 September 2006, 16:59

** Buy Now button not working properly

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!
sirkyle

#1583 sirkyle

  • Community Member
  • 119 posts
  • Real Name:kyle bruns

Posted 15 September 2006, 17:45

Nevermind..... As usual, once I post a request I figure it out. I'll explain for those who run into this problem as well. I am using a seperate pricing per customer mod that places a variable $x in the array for $listing, so to call a products_id it is $listing[$x][products_id]. I included the variable [$x] in the links that were built, but not into the if statement. Once that was done, the buy now button works as advertised.

Happy now.
sirkyle

#1584 teleute

  • Community Member
  • 111 posts
  • Real Name:Allison Roth

Posted 16 September 2006, 00:44

Hi all;

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 trogette

  • Community Member
  • 311 posts
  • Real Name:Tracy Oldfield

Posted 16 September 2006, 07:42

View Postteleute, on Sep 16 2006, 01:44 AM, said:

Hi all;

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 trogette

  • Community Member
  • 311 posts
  • Real Name:Tracy Oldfield

Posted 16 September 2006, 08:25

Cross-posted on QTPro...

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 teleute

  • Community Member
  • 111 posts
  • Real Name:Allison Roth

Posted 18 September 2006, 01:30

View Posttrogette, on Sep 16 2006, 01:42 AM, said:

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?

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 teleute

  • Community Member
  • 111 posts
  • Real Name:Allison Roth

Posted 18 September 2006, 06:44

View Postteleute, on Sep 17 2006, 07:30 PM, 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!

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 Yumi

  • Community Member
  • 36 posts
  • Real Name:Michael

Posted 18 September 2006, 12:36

When the Slave is displayed it automatically sets Quantity to 1. So when I click "Add to Cart" both Master and Slave are added. However, my "Slaves" are Spare-Parts and not always needed. I want to set the initial Quantity to 0 so that the customer has to select the quantity.

Also it would be nice if the readme file could include the configuration options meaning and setting.

Very useful contrib! Thanks,

Michael

#1590 teleute

  • Community Member
  • 111 posts
  • Real Name:Allison Roth

Posted 18 September 2006, 20:05

View PostYumi, on Sep 18 2006, 06:36 AM, said:

When the Slave is displayed it automatically sets Quantity to 1. So when I click "Add to Cart" both Master and Slave are added. However, my "Slaves" are Spare-Parts and not always needed. I want to set the initial Quantity to 0 so that the customer has to select the quantity.

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 Yumi

  • Community Member
  • 36 posts
  • Real Name:Michael

Posted 19 September 2006, 00:38

This values are already set to "0" but still the initial value displays as "1"

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 teleute

  • Community Member
  • 111 posts
  • Real Name:Allison Roth

Posted 19 September 2006, 00:48

View PostYumi, on Sep 18 2006, 06:38 PM, said:

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

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 desidil4ever

  • Community Member
  • 97 posts
  • Real Name:Vaibhav

Posted 19 September 2006, 07:53

Just a small tip for someone who might find it useful.
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

case 'MASTER_LIST_BUY_NOW'
:

Quote

$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '1', 'size="4"');
to

Quote

$lc_text = tep_draw_checkbox_field('Qty_ProdId_' . $listing['products_id'], '1', false);

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.

Simple Add-ons Please add simple plain tips here for others.

#1594 Yumi

  • Community Member
  • 36 posts
  • Real Name:Michael

Posted 19 September 2006, 10:50

Hallo teleute! You had the right bit of code after all. The value is not in $i=0 but in the line

$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 Yumi

  • Community Member
  • 36 posts
  • Real Name:Michael

Posted 19 September 2006, 11:18

I got the drop-down boxes as well. Just went back and had a look at master_listing.php at MP 1.15. There is a difference to 1.2!

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 solucionesmipc

  • Community Member
  • 7 posts
  • Real Name:diego

Posted 19 September 2006, 14:39

hi guys.

do you know how do i change rows by columns in the master listng?
i appreciate your help.


diego.

#1597 Sense

  • Community Member
  • 38 posts
  • Real Name:Dave H

Posted 19 September 2006, 21:18

i'm having problems adding this contribution to my site. Are there any freelancers who could help me? Please PM

#1598 Yumi

  • Community Member
  • 36 posts
  • Real Name:Michael

Posted 20 September 2006, 07:59

Has somebody managed to combine Master Products with Easy populate. If yes, which version of EP and as many tips as possible.

Michael

#1599 teleute

  • Community Member
  • 111 posts
  • Real Name:Allison Roth

Posted 20 September 2006, 18:24

An update for anyone hoping to use Master Products as I described earlier (having the master and salve linked so that you can only purchase slaves if you're purchasing a master). Earlier I made the master product qty drop down start at 1, not 0, so that there was no way to add a slave without adding the master.

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 Yumi

  • Community Member
  • 36 posts
  • Real Name:Michael

Posted 25 September 2006, 08:45

Any advice on adding Master Products to Multi Stores?

Michael