Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

1064 - You have an error in your SQL syntax near ' p.products_master from products p, products_description pd where p.products_id' at line 1

I guess you made an error when changing the sql statements:

p.manufacturers_id from, p.products_master from products p,

should be:

p.manufacturers_id, p.products_master from products p,

No clue about the rest. Sorry.

Link to comment
Share on other sites

Excellent - got the second thing fixed - thanks to Richard for his help :)

 

That just leaves the osPlayer to sort out now - it needs to be able to recognise Master Products, and doesn't as yet....

Edited by clayts
Link to comment
Share on other sites

about price in product_listing

 

If i have a master, and dont want the costumer to beabel to buy the master product, i change the price to 0.

 

But that look strange in the product_listing because i have products both with master and products not using masters or slaves. So some products have price in product listing and some doesnot have a price. How can i show a price for the master in product listing, but not be abel to buy the product?

 

The best thing should be if the cheapest slave_products prive wil show in product_listing. Any ideas?

Link to comment
Share on other sites

Sorry - meant to add what I did - got waylaid there...

 

In your catalog/products_info.php page after this line (around about line 180 on an unmodified version, approx line 169 with the master products amendments in it) - don't forget to keep back ups of any original PHP files you are changing, so you can reinstate them if things go wonky ! :

 

  
           <tr>
      <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
    </tr>
    <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
    </tr>
<?php
  }
?>
     <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
    </tr>

 

remove this next bit of code :

 

<?php
   if ($product_info['products_price']>0) {

   $qty_array = array();

   for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {

   $qty_array[] = array('id' => $i, 'text' => $i);
}
?>
     <tr>
       <td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) {
     echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
     } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
       $qty_array = array();
           for ($i=0; $ns = 20, $i <= $ns; $i++) {
           $qty_array[] = array('id' => $i, 'text' => $i);
       }
     echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
     } else {
     echo TEXT_STOCK;
}
 echo tep_draw_separator('pixel_trans.gif', '30', '10');
?>
       </td>
     </tr>
<?php
}
?>

 

and replace it with

 

<?php
$master_query2 = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master =  '" . (int)$HTTP_GET_VARS['products_id'] . " '");
$results2 = tep_db_fetch_array($master_query2);
if ($results2['products_id'] == null) {
?>
  <tr>
     <td align="right" class="main">
<?php

echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">';

   }
?>
     </td>
   </tr>

 

This has a dual affect of allowing you to put a price on a master without it being added to the basket (the checkout takes its total from adding up the quantities of slaves the customer selects) and removing the quantity boxes that appear on non-master standalone products - see it in action here.

 

If you get stuck, post up your full product_info.php page, and I'll have a dig around for you, although don't profess to be an expert at all...hence the reason my osPlayer is still missing in action :(

Link to comment
Share on other sites

Thank ya Clatys!

 

I got it working for just a coupel a minutes ago!

This support tree is sooooo loooong, hard to find the thing ya seraching for! =)

 

:D

Link to comment
Share on other sites

The Master Products Contrib is great. How hard would it be to enable the slave products to link to a number of masters?

 

For examle if I'm selling computers I have a number of CPU Boxes as Masters and would like to slave hard drives and memory and monitors so it is easy to select a package.

 

All these products are available individually however I would like to see them on all the master pages as well.

 

Also how can I make the master product have a default purchase value of 1 not 0.

Link to comment
Share on other sites

I believe multi-master slaves will be on a future release, if and when Matti gets time...

 

With regards to setting the master quantity to 1 by default, pretty sure this is mentioned somewhere on the 30 pages (read it through about 3 times now !)...sorry cannot remember where exactly....

Edited by clayts
Link to comment
Share on other sites

Here you go - post 1083

 

one more small tip.

currently the default no. of the item in drop down is 0. so if customer click add to cart, nothing adds up. in my case i want to display slave products too so wanted them not to drop down and choose 1 or more quantities. default was set to one so if they click add to cart, one master product get added.

 

if they want only slave, they go to slave.

 

on line 191.

<?php
   if ($product_info['products_price']>0) {
  
   $qty_array = array();
  
   for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
   
   $qty_array[] = array('id' => $i, 'text' => $i); 
}
?>

 

replace with

<?php
   if ($product_info['products_price']>0) {
  
   $qty_array = array();
  
   for ($i=1; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
   
   $qty_array[] = array('id' => $i, 'text' => $i); 
}
?>

Link to comment
Share on other sites

Hey, I've successfully installed master products on my osCommerce system, and I'm about to add the mods from the Multiple Products contribution into it as well. The problem is that I want to be able to have nothing list on the Master product (so you can't buy it) in the product listing, and then I want to have the slaves indented on the product listing page. I'm not clear on how I can do this.

 

I want to have the fields for choosing multiple items only show up on slaves, and everything else would have a buy now, except for masters, which would show no option to buy.

 

Any suggestions?

Link to comment
Share on other sites

To make the search results return the master rather than the slave product, I made the following changes to advanced_search_results.php.  Add before line 223: 
 ?$from_str .= " left join " . TABLE_PRODUCTS . " pm on pm.products_master = p.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pdm on pm.products_id = pdm.products_id";

Change line 223 from

 ?$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_listing_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and pdm.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

and around lines 258-9, change

 ? ? ? ? ?$where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
? ? ? ? ?if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";

to

 ? ? ? ? ?$where_str .= "(pdm.products_name like '%" . tep_db_input($keyword) . "%' or pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
? ? ? ? ?if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pdm.products_description like '%" . tep_db_input($keyword) . "%' or pd.products_description like '%" . tep_db_input($keyword) . "%'";

For efficiency, I also added a new index on the products_master column of the products table.

 

Hth,

Matt

 

Hi Matt,

 

i just tried your codes...

 

Now only products with slaves are displayed! Products without slaves are not shown anymore...

 

What is wrong with the code....

what should i do.

 

Thanx

Gr.

kasper

Link to comment
Share on other sites

This should be a simple one. I have Master Products installed with Option Type Feature. When I add items to the cart, I want to make sure that for slave items, the text attribute is not brought with it. All I need is a p.products_master_status check where it looks at the attribute type. Just need to get the syntax right. Here's the section from shopping_cart.php:

 

//CLR 020606 check if input was from text box.  If so, store additional attribute information
           //CLR 020708 check if text input is blank, if so do not add to attribute lists
           //CLR 030228 add htmlspecialchars processing.  This handles quotes and other special chars in the user input.
           $attr_value = NULL;
           $blank_value = FALSE;
           if (strstr($option, TEXT_PREFIX)) {
             if (trim($value) == NULL)
             {
               $blank_value = TRUE;
             } else {
               $option = substr($option, strlen(TEXT_PREFIX));
               $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
               $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
               $this->contents[$products_id]['attributes_values'][$option] = $attr_value;
             }
           }
           if (!$blank_value)
           {
           $this->contents[$products_id]['attributes'][$option] = $value;

Link to comment
Share on other sites

Please excususe my post, I am sure these questions are anwered in 60 pages of this forum. I either could not find the answer or did not understand what I was reading. If you could just point me to the post that answers these questions, I would be grateful.

 

My site I sell fishing items, such as line and have the master as ABC fishing line then slaves as 10 lb, 20 lb etc.

 

I want to remove the description from the slave, as the name is adequate and instead of the drop down quatity box I would like to have the add to cart button on each line.

 

Thank You

Link to comment
Share on other sites

My site I sell fishing items, such as line and have the master as ABC fishing line then slaves as 10 lb, 20 lb etc.

 

I want to remove the description from the slave, as the name is adequate and instead of  the drop down quatity box I would like to have the add to cart button on each line.

 

Thank You

Removing the description is quite straightforward, go to Admin,Configuration and then in Slave Products you can choose what you want to show for the slaves. As for your other question, I am afraid I can't help.

 

I have seen a way of adding checkboxes rather than the drop down boxes as an alternative approach, do a search for that

 

Steve

Link to comment
Share on other sites

This should be a simple one.  I have Master Products installed with Option Type Feature.  When I add items to the cart, I want to make sure that for slave items, the text attribute is not brought with it.  All I need is a p.products_master_status check where it looks at the attribute type.  Just need to get the syntax right.  Here's the section from shopping_cart.php:

 

//CLR 020606 check if input was from text box. ?If so, store additional attribute information
? ? ? ? ? ?//CLR 020708 check if text input is blank, if so do not add to attribute lists
? ? ? ? ? ?//CLR 030228 add htmlspecialchars processing. ?This handles quotes and other special chars in the user input.
? ? ? ? ? ?$attr_value = NULL;
? ? ? ? ? ?$blank_value = FALSE;
? ? ? ? ? ?if (strstr($option, TEXT_PREFIX)) {
? ? ? ? ? ? ?if (trim($value) == NULL)
? ? ? ? ? ? ?{
? ? ? ? ? ? ? ?$blank_value = TRUE;
? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ?$option = substr($option, strlen(TEXT_PREFIX));
? ? ? ? ? ? ? ?$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
? ? ? ? ? ? ? ?$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
? ? ? ? ? ? ? ?$this->contents[$products_id]['attributes_values'][$option] = $attr_value;    
? ? ? ? ? ? ?}
? ? ? ? ? ?}
? ? ? ? ? ?if (!$blank_value)
? ? ? ? ? ?{
? ? ? ? ? ?$this->contents[$products_id]['attributes'][$option] = $value;

 

 

 

 

Try this:

 

in shopping_cart.php find:

 

$master_prod = tep_db_query("select products_master, products_master_status

 

change to

 

$master_prod = tep_db_query("select products_master, products_master_status, products_listing_status

 

 

next find:

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

 

change to:

 

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes']) && ($master_prod_values['products_listing_status'] == 1)) {

 

 

 

This worked for me.

Link to comment
Share on other sites

Hi,

 

I have installed this and it works great.

 

I'm hoping that someone can help me a little bit here.

 

I uses the Seperate Pricing Per Customer contribution http://www.oscommerce.com/community/contri...ng+Per+Customer

 

And this also works great, but the only problem i have with this two is that the prices in the slave_listing.php doesn't show other than the retail price and not the price for the customer group.

 

I have tried to include the database and the group to make the price differient, but then i only get an longer list with the same products over and over again (4 times)

 

I hope that someone out there can help we with this one.

 

Regards

Thomas

Link to comment
Share on other sites

i am also interested in having slaves show up under multiple masters - this would make the contrib. perfect.

 

Does anyone find solutions to do this?

For example...

I sell notebooks (30 models) and carry bags for this notebooks (only one model - for all notebooks this same bag). So... I must add this same bag 20x in my catalog (one for one notebook !) because I can't add multiple masters for one slave!

I think, it has no sens.. :/

 

Maby someone know how to do this...

Thanks for help ;-)

Edited by maxiooo
Link to comment
Share on other sites

Hello guys,

first of all I wanna thank you Matti for the great contrib and his support. Also the other guys who helped the users to make it better and working.

 

For me - who has some problems in understanding the english language sometimes - the contrib is not working as it should be. Maybe it?s discussed in the last pages, but I haven?t foudn a conclusion yet. I read lots of threads and comments and tried lots of updates. But nothing worked for me.

 

I guess, it?s some kind of simple problem, but I can?t solve it for myself.

 

I have a master with some slaves in my shop. And also some products without slaves and it?s also no master. There is always the information (quantity or out of stock) under the picture. I want this information only on the "normal" products", which haven?t a slave. The master shouldn?t have that, because you can?t buy them! You can only buy the slaves.

 

I hope you understand that and can help me. This would be awesome!

 

I can show you the examples for the master and "normal" product:

master

and normal product

 

 

Thanx for your help and my best regards!

Schroedy_1

Link to comment
Share on other sites

Have you given the Master attributes? If yes that might be causing you the problem.

 

The Master doesn't need any.

 

Steve

 

 

Hi Steve!

I?m sorry. I guess I don?t understand what you mean with the master attributes. Can you describe me, what this is?

 

 

Regards,

Schroedy_1

Link to comment
Share on other sites

My site I sell fishing items, such as line and have the master as ABC fishing line then slaves as 10 lb, 20 lb etc.

 

I want to remove the description from the slave, as the name is adequate and instead of the drop down quatity box I would like to have the add to cart button on each line.

 

I would also like to edit the "what's new here" page and take out the buy it now button because only the masters are shown on this page.

 

I dont know what files I need to edit

 

Thank You

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...