Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

case 'MASTER_LIST_BUY_NOW'
:

 

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

to

$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
Simple Add-ons Please add simple plain tips here for others.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

It is also possible, as an example, in product info.php, to change both instances of:

 

if ($product_master['product_master_status']!= 1)

 

to:

 

if ($product_master['products_price']!= '0')

 

This would make an add to cart button appear for the Master if a price for it is added in admin - I believe I left the product price field intact with this thought in mind........ while the Slaves can be purchased in their respective quantities also. This would make it possible to have the Nurses' Outfit as the Master Product - purchasable, and the separate parts of the outfit also purchasable in whatever quantity is selected - the customer may choose either option.... or, imagine a carburettor, and all its separate parts.... B)

 

This contribution will undergo continued development based to a large degree on feedback from these forums. I released version 1 as I saw it as usable as it stands - there is much still in the pipeline, and that list grows daily :D

 

Matti

 

Ok I would like to have it where on some master products if the price is not set(set to $0), then the master product cannot be added to the cart, but the slaves can.

 

is there a fix for that, I have tried searching, and I get nothing.

 

-Brian

Link to comment
Share on other sites

HELPPPPPP!! Master Products And Easy Populate. I have setup the EP 2.76c module that has Master Products support.

 

My question is, do I need to setup the master products through my admin first and only use EP to setup the slaves?

 

I ask because in the v_products_master column for slaves you must specify the master products id. And the only way to get this is to setup the master in the admin and use a test slave product to view the drop down selection menu of available master products so it spits out that master products id in the box next to it. Then you take this number and copy it into EP v_products_maste field to make the slave match up with the master.

 

Is that the only way to do it? Isn't there a way I can just put in Master and Slaves in easy populate and have it work?

 

**help**

Link to comment
Share on other sites

Ok I would like to have it where on some master products if the price is not set(set to $0), then the master product cannot be added to the cart, but the slaves can.

 

is there a fix for that, I have tried searching, and I get nothing.

 

-Brian

 

I'm sure mine works like that as default.

Link to comment
Share on other sites

Hello,

 

How can I get the same idea to my site that musica360.com has? After you have selected an album, you can just choose either to select single songs or the whole album? Just pressing the select crossboxes, very handy!

 

Is there an easy way to do it?

Link to comment
Share on other sites

I'm having a problem with No Image uploading or previewing when I create or edit a Master product.

 

Can anyone give me a clue as to where (in categories.php I suppose) I might find what I missed or what is conflicting?

 

I installed the Master_products-v1.2 on a heavily modified shop.

 

When I upload the Master_products-v1.2 included admin/categories.php it works fine (of course my other modifations don't work then).

I would appericate any help as I'm at the end of my wits!

 

I gotta get it to work...

 

Thanks in advance

 

ps I love this mod -- I know its me that doesn't work!

Kendall

Brooklyn, New York USA

Link to comment
Share on other sites

I'm having a problem with No Image uploading or previewing when I create or edit a Master product.

 

Can anyone give me a clue as to where (in categories.php I suppose) I might find what I missed or what is conflicting?

 

I installed the Master_products-v1.2 on a heavily modified shop.

 

When I upload the Master_products-v1.2 included admin/categories.php it works fine (of course my other modifations don't work then).

I would appericate any help as I'm at the end of my wits!

 

I gotta get it to work...

 

Thanks in advance

 

ps I love this mod -- I know its me that doesn't work!

 

I found out that it does add the product image name to the database so I can manually upload the image to the server and then it works. This is fine as a temporary workaround but I would like to have the image actually get uploaded to the server when the master product is edited (image changed) or created.

 

I could send a copy of my modified categories.php to someone -- But I'm reluctant to post that huge file here!

Kendall

Brooklyn, New York USA

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...