Jump to content



Latest News: (loading..)

- - - - -

Master Products - MS2


  • Please log in to reply
2401 replies to this topic

#2361   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 14 October 2011 - 06:01 PM

Let me rephrase the 1st problem I am having.

When I go to product_info.php?products_id=xx, I have the text_quantity drop down box and limited to 20.  Can I change this drop down box to a input box?

Also when I am on the individual product page and enter a number in the drop down box, it will not update the shopping cart.  Please help, I really like this contribution.

#2362   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 16 October 2011 - 05:16 AM

Anyone, please!!!

#2363   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 16 October 2011 - 08:32 AM

View Postdspeak, on 16 October 2011 - 05:16 AM, said:

Anyone, please!!!


Hi,

maybe reverse this:

To use a checkbox in includes/modules/master_listing.php

change

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

to

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



but this will not enough. At this moment v2.3.1 version use drop down. Look at Master Products pervious version for osCommerce 2.2 core.
I will do admin switch for it in future.

Edited by Gergely, 16 October 2011 - 08:35 AM.

Header Footer Content Modules
SCM
v3

and some rewrites :-)

#2364   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 16 October 2011 - 07:29 PM

thank you.  I don't have a problem if the product is a master or slave.  The problem arises when a product that is not assigned as a slave is chosen.  The drop down menu limits the customer to only 20.  I sell parts for farmers.  A few of my products, the customer may order 20, 40 or sometimes as many as 500.

#2365   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 17 October 2011 - 05:44 PM

I am sure with all the great programmers out there, that someone can step up to the plate and figure out how to change the drop down box to a input box.

Please someone.  This is a wonderful contribution, and this is all that is needed to make it perfect.

#2366   kplace

kplace
  • Members
  • 27 posts
  • Real Name:Sonya Ellis

Posted 23 October 2011 - 04:54 AM

I was wondering if anyone else is having the same problem that I am.   I have installed Master Products for V2.3 and I can assign a product as a master, but if I need to edit the product, I am not able to save it.  I get redirected to the categories page and the changes are not saved.  Attached is my categories.php page.

Attached Files



#2367   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 23 October 2011 - 04:01 PM

View Postkplace, on 23 October 2011 - 04:54 AM, said:

I was wondering if anyone else is having the same problem that I am.   I have installed Master Products for V2.3 and I can assign a product as a master, but if I need to edit the product, I am not able to save it.  I get redirected to the categories page and the changes are not saved.  Attached is my categories.php page.


Hi try to close elseif branch:
// BOF: Availability + Warranty
		  if (isset($HTTP_POST_VARS['availability_id_out_of_stock_image']) && tep_not_null($HTTP_POST_VARS['availability_id_out_of_stock_image']) && ($HTTP_POST_VARS['availability_id_out_of_stock_image'] != 'none')) {
			$sql_data_array['availability_id_out_of_stock_image'] = tep_db_prepare_input($HTTP_POST_VARS['availability_id_out_of_stock_image']);
		  } elseif (isset($HTTP_POST_VARS['availability_id_in_stock_image']) && tep_not_null($HTTP_POST_VARS['availability_id_in_stock_image']) && ($HTTP_POST_VARS['availability_id_in_stock_image'] != 'none')) {
			$sql_data_array['availability_id_in_stock_image'] = tep_db_prepare_input($HTTP_POST_VARS['availability_id_in_stock_image']);
		  } elseif (isset($HTTP_POST_VARS['availability_id_in_stock2_image']) && tep_not_null($HTTP_POST_VARS['availability_id_in_stock2_image']) && ($HTTP_POST_VARS['availability_id_in_stock2_image'] != 'none')) {
			$sql_data_array['availability_id_in_stock2_image'] = tep_db_prepare_input($HTTP_POST_VARS['availability_id_in_stock2_image']);
		  } elseif (isset($HTTP_POST_VARS['availability_id_in_stock3_image']) && tep_not_null($HTTP_POST_VARS['availability_id_in_stock3_image']) && ($HTTP_POST_VARS['availability_id_in_stock3_image'] != 'none')) {
			$sql_data_array['availability_id_in_stock3_image'] = tep_db_prepare_input($HTTP_POST_VARS['availability_id_in_stock3_image']);
		  } elseif (isset($HTTP_POST_VARS['availability_id_in_stock_special_image']) && tep_not_null($HTTP_POST_VARS['availability_id_in_stock_special_image']) && ($HTTP_POST_VARS['availability_id_in_stock_special_image'] != 'none')) {
			$sql_data_array['availability_id_in_stock_special_image'] = tep_db_prepare_input($HTTP_POST_VARS['availability_id_in_stock_special_image']);
// EOF: Availability

add after

{
Header Footer Content Modules
SCM
v3

and some rewrites :-)

#2368   kplace

kplace
  • Members
  • 27 posts
  • Real Name:Sonya Ellis

Posted 24 October 2011 - 07:02 AM

Thank you for the reply.  I uninstalled Master Products and Reinstalled it and now it works perfect.

#2369   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 26 October 2011 - 08:56 PM

Does anyone know where the code is that controls the qty drop down box for the master product and for product_info.  I am going to try and change this so it is a text input box.

#2370   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 27 October 2011 - 08:38 PM

try a simple html php mixed code.

	 <input name="Qty_ProdId_<?php echo $product_info['products_id']; ?>" type="text" size="30" maxlength="30">

its all.
Header Footer Content Modules
SCM
v3

and some rewrites :-)

#2371   jrvs

jrvs
  • Members
  • 22 posts
  • Real Name:Jarvis
  • Location:Maryland

Posted 28 October 2011 - 11:08 AM

Posted 17 February 2004, 17:38

In catalog/advanced_search_result.php change:

  $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

to:

  $where_str = " where p.products_status = '1' and p.products_master = '0' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

This only works if the Master has the search term - a better solution is to have the result return the Master if the search term is found within the Slave - something I shall get around to I am sure.

Matti Ressler
-----


I need to modify the $where_str code so that so that it searches all the slaves products_id and displays the master.  Currently is either all slaves or only the masters (p.products_master = 0).  Perhaps:

   $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

  if (isset($HTTP_GET_VARS['products_master_status'] == 0) && (isset($HTTP_GET_VARS ['products_master'] != 0))) {
$where_str .= " or p.products_master = '" . (int)$HTTP_GET_VARS['products_id'] . "'";
  }

Parse error: syntax error, unexpected T_IS_EQUAL, expecting ',' or ')'

I would greatly appreciate your assistance – struggling for a couple of years with this issue.

#2372   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 28 October 2011 - 07:17 PM

View Postjrvs, on 28 October 2011 - 11:08 AM, said:

I would greatly appreciate your assistance – struggling for a couple of years with this issue.

Hi,

Could you put here the full query string? (try to use database logging and select the main query string)
Header Footer Content Modules
SCM
v3

and some rewrites :-)

#2373   jrvs

jrvs
  • Members
  • 22 posts
  • Real Name:Jarvis
  • Location:Maryland

Posted 29 October 2011 - 06:51 AM

Thank you so much for your reply.

$Id: advanced_search_result.php,v 1.72 2003/06/23

Advanced_search_results.php is such an odd document.  The $select, $from and $where_str statements are separated in portions.  I know that the issue lies solely in:

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

The above displays all slaves – which sometimes are over 20 slaves per master.  See Scientiis.com

$where_str = " where p.products_status = '1' and p.products_master = '0' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

The above displays the master, but does not search the slaves.  Searching for a slave model gives " There is no product that matches the search criteria."

Maybe if I could adapt somehow the following:

// Master Products
$master_prod = tep_db_query("select products_master, products_master_status
from " . TABLE_PRODUCTS . "
where products_id = '" . $products_master['products_id'] . "'");
$master_prod_values = tep_db_fetch_array($master_prod);

if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) {
$str_selected_values = $master_prod_values['products_master'];
} else {
$str_selected_values = $products_master['products_id'];
}

Tried adapting the following, but received errors

if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }

There is also this function in /includes/functions/general.php

// Master Products
  function tep_get_products_master_status($product_id) {

$product_query = tep_db_query("select products_master_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
$product = tep_db_fetch_array($product_query);

return $product['products_master_status'];
  }
// Master Products EOF

By the way, I'm not a programmer.

Thank you again.

#2374   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 30 October 2011 - 04:04 PM

Hi,

if I understand the question is that search all master products which has slave product with search key. The results contain master products or single products only. The slaves are not listing.


This process need subqueries.

Here is a simple sql code where searching for price in osCommerce v2.3.1 core:

SELECT * FROM `products` WHERE products_master_status = '1' and products_id in(SELECT replace(replace(replace(products_master, "_ ", ""), " ", ", "), "_", "") FROM `products` WHERE products_price = '824' and products_master_status = '0')

The results give only masters.


At this model searching for single master products. The master products only single (_ xxxx _) and not multiply (like _ xxxx yyyy fff _)


The problem is that how can search masters but there are a lot of events.
Header Footer Content Modules
SCM
v3

and some rewrites :-)

#2375   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 31 October 2011 - 08:15 PM

View PostGergely, on 27 October 2011 - 08:38 PM, said:

try a simple html php mixed code.

	 <input name="Qty_ProdId_<?php echo $product_info['products_id']; ?>" type="text" size="30" maxlength="30">

its all.
I assume this would be in the product_info.php file.  Would you suggest I add this in addition to code that is there or replace the dropdown code with this.  Sorry to be such a bother.

#2376   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 31 October 2011 - 09:21 PM

Hi,

change:
echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array, MASTER_PRODUCT_DEFAULT_QUANTITY);

to:
echo tep_draw_input_field('Qty_ProdId_' . $product_info['products_id'], '0', 'size="4"');

look at master_listing.php
		  case 'MASTER_LIST_BUY_NOW':
			$list_box_contents .= '<td' . (($slave_id == $listing['products_id']) ? ' class="slave" align="center">' : ' align="center">');
			if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {
//			$list_box_contents .= TEXT_STOCK;
			  $list_box_contents .= '<small> use here go-ahead sales enhance</small>';
			} 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);
			  }
//		   $list_box_contents .= tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '0', 'size="4"');			 
		   $list_box_contents .= tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);
			} 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);
			  }
//		   $list_box_contents .= tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '0', 'size="4"');			 
	 $list_box_contents .= tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);
		 }
			$list_box_contents .= '</td>';
		   break;

where you can switch on simple input field

Edited by Gergely, 31 October 2011 - 09:24 PM.

Header Footer Content Modules
SCM
v3

and some rewrites :-)

#2377   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 31 October 2011 - 09:42 PM

Thank, I must run home now, but I will give it a try this evening.  I really appreciate your help.  Some day I would like to buy you a beer, of coffee whichever you prefer.

#2378   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 01 November 2011 - 06:47 PM

Thanks Gergely,

I looked at the code last night, I am using RC2.  I see some similarity in the code, but just can't quite get it all figured out.  I will play with it some, hopefully I can get this working soon.

#2379   dspeak

dspeak
  • Members
  • 86 posts
  • Real Name:Danny

Posted 01 November 2011 - 08:14 PM

I messed up, was looking at the wrong master_listing file.

#2380   Millie

Millie
  • Members
  • 63 posts
  • Real Name:Millie
  • Location:Ohio

Posted 15 November 2011 - 04:17 PM

Is there a contribution for adding extra fields known to work with Master Products on version 2.3x?  I started installing Extra Product Fields for 2.31 v1.1 and upon reaching install steps for admin/ categories.php I think it may be beyond my skill level to merge. If anyone has had success with that contribution and would share the code they ended up with I might be able to sort it out or, I'd appreciate hearing of success with any other contributions.