Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

I'm running Master Products MS2 with these modules: 3 Image, Option Type and Master Products (1.2). Integrating Master Products was a bit scary, but it works beautifully now. Thank you, Matt, for the great contribution.

 

I'd like to (humbly) add my voice to the requests for attribute support (which I know you're working on; more so if people like me didn't keep posting).

 

Ideas:

 

1) Include the Option Type attribute enhancement module, or at least support for it. I can't see how options are too useful without it.

 

2) UI: Look to see if all the slave product options are identical. If so, then present the attribute fields for all of them in the master product box (above them). (The allows much of the existing product_info machinery to be used).

 

3) UI: If the slave product options are not identical, have text that says: "These products can be customized" (or something). Each product will then have an "OPTIONS" link that will take you to the Product Info page. There, you can use the standard product_info machinery to handle the attributes.

 

Thanks,

 

Bill Evans

Edited by not_steve
Link to comment
Share on other sites

(Correction in above post; MP 1.1.2. Why doesn't editing work in this forum software?)

 

Possible bug in MP 1.1.2?

 

In the MP code (below) the price and weight fields are excluded.

 

995: $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id, p.products_master from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");

 

This would apply to this code, as well (of course).

 

1131: $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_listing_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");

 

Bill Evans

Link to comment
Share on other sites

Hi

 

I asked elsewhere but this might be the right topic. I have Master Products and Price Break installed together.

 

However, Price Break see's each slave product as a different product - so it doesn't count someone buying say 3 slave products as having purchased 3 of the same product.

 

E.g. Master product is Trainer Pant - slave products for each pattern option - I want to offer a discount if someone buys 3... and probably they will want 3 different patterns.

 

Is there a way of modifying Price Break to count 3 purchases of a particular Master Product...? My PHP still isn't up to figuring this one myself...

 

 

Christine

Link to comment
Share on other sites

I have a heavily modified osc 2.2MS2 and have been trying to get the master products contribution up and running.

 

The admin side works fine, the problem at the moment is in the catalog side I have a blank page showing nothing at all.

 

Due to the modifications allready installed I have manually made the changes for this contribution.

 

What parts of this contribution could cause this blank page.

 

It is installed on a local machine so I cannot provide a url

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Ignore my post issue resolved had duplicate product description code in functions/general.php

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

I have opted to replace the includes/modules/product_listing.php with the one from the contribution and now have two buy now buttons and and table headers.

 

Any ideas as to what is causing this

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Is there a way of modifying Price Break to count 3 purchases of a particular Master Product...?

For Price Break, the PriceFormatter class contains the routines for computing the prices. But (I think) it uses one instance of a purchase to determine the discount.

 

You want to look across all of them, probably by (nested) looping through the shopping cart items. Look to see to see if any items share the same master. You'll need to do this every time a price is diplayed, so the PriceFormatter routines might be the perfect place.

 

Of also possible interest is the file, "product_info.php" ( directly in "Catalog"), containing the code where the user makes the purchase. Look for this code (added from PriceBreak):

 

<?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>

 

Hope that's helpful.

 

Bill

Edited by not_steve
Link to comment
Share on other sites

I have opted to replace the includes/modules/product_listing.php with the one from the contribution and now have two buy now buttons and and table headers.

 

It seems to me there was a problem with double buttons in admin dicussed farther back in the thread. This is not in admin but the source of that problem may help you with locating the source of this one. I'm not sure but I think it had to do with identical code from two different mods which both got cut and pasted into the same file. However, in the case of a total file replacement it may be a loopback problem caused by another mod which doesn't recognise slaves as being individual products with their own product numbers.

 

Hope that helps,

Charles

We stand in ignorance only for questions not asked. Plug up the leaks in your knowledge base and open up a flood of understanding.
Link to comment
Share on other sites

I made a minor modification of the script to allow me to view which products in the categories.php (/catalog/admin/categories.php) page were designated as "Master" and which were "Slave." Because I entered all my slave products with the same name(s) as the masters, it was impossible to tell with a simple glance at the list.

 

Here are my mods, if anyone's interested:

 

In the master products queries (around line 1420 in my copy) I simply added 'p.products_master_status' to each query:

//Master Products

? ? $products_count = 0;

? ? if (isset($HTTP_GET_VARS['search'])) {

? ? ? $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_master_status, p.products_listing_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");

? ? } else {

? ? ? $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_master_status, p.products_listing_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");

? ? }

 

And then changed the table display based on $products['products_master_status'] down around lines 1455 (in my copy - your mileage may vary):

 

? ? ? ? ? ? ? ? <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ';

? ?

? if ($products['products_master_status'] == "1") {

?  echo '<span style="color: #00f;">' . $products['products_name'] . ' (Master)</span></td>';

? } else {

?  echo $products['products_name'] . '</td>';

? } ?>

 

Now, my products list displays as:

 

Black Leather Studded Belt - Master

Black Leather Studded Belt

Black Leather Studded Belt

 

(Mind you - if I had just entered all my content with a slightly different name for the slave items, I wouldn't have needed to go to this trouble. But I didn't, so I did. So there. :) )

 

 

HOWEVER...

 

Something odd has happened that I don't believe is related to the code I changed. Now, when I click on a product for a quick overview in the box to the right of the list, I get two sets of "Edit/Delete/Move/Copy To" buttons. The top set of buttons appears to relate to the master item - the "Edit" button, for example - while the bottom buttons appear to relate to a standard (slave) item. (See image below:)

 

oscommerce1.gif

 

I really have no idea what's going on. I removed my edits above from the script and the extra buttons were still there. Any ideas?

I have found this post on a similar issue to my own however this is in the admin and I can find no resolve to this issue in the posts.

 

This was my original post

I have opted to replace the includes/modules/product_listing.php with the one from the contribution and now have two buy now buttons and and table headers.

 

Any ideas as to what is causing this

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

For Price Break, the PriceFormatter class contains the routines for computing the prices. But (I think) it uses one instance of a purchase to determine the discount.

 

You want to look across all of them, probably by (nested) looping through the shopping cart items. Look to see to see if any items share the same master. You'll need to do this every time a price is diplayed, so the PriceFormatter routines might be the perfect place.

 

Of also possible interest is the file, "product_info.php" ( directly in "Catalog"), containing the code where the user makes the purchase. Look for this code (added from PriceBreak):

 

<?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>

 

Hope that's helpful.

 

Bill

 

Thanks Bill

 

It sort of helps... I think I understand what Priceformatter does - it seems to fill an array with the price break level and amount and then the ComputePrice function will loops through 4 times to work out which price break applies and adjusts the price accordingly.

 

That's where I get stuck - its one thing being able to guess what the code does... even then I might be wrong - but its quite another to actually write some from scratch!

 

If someone could point me in the direction of some code that loops through the cart for other purposes then that might help?

 

 

Christine

Link to comment
Share on other sites

If someone could point me in the direction of some code that loops through the cart for other purposes then that might help?

When I finish this contribution, I may have some more info for you. I am working with the shopping class and file right now, so perhaps I'll learn something.

 

Bill

Link to comment
Share on other sites

Matti,

 

I am really hoping you can help me with my problem. I have almost sucessfully installed Master Products along with Price Break, Cross sell and Option Type feature. I am not getting any errors but in my catalog, all of my category headers and box headers are messed up. They are displaying the default code instead of the actual titles. Here is the site so you can see what I mean:

 

http://www.pcswebstudios.com/catalog

 

I've checked and checked but cannot seem to figure out which file would cause this problem. Do you have any ideas?

 

Thanks so much for your awesome work!!

 

Pam

Link to comment
Share on other sites

catalog/includes/languages/english.php - check that the file is not empty, if its ok then check that index.php has:

 

 ?require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

 

Matti

Edited by Johnson
Link to comment
Share on other sites

If someone could point me in the direction of some code that loops through the cart for other purposes then that might help?

I'm not sure what you mean by "other purposes," but it's easy to cycle through the cart. Look in "catalog/shopping_cart.php" around line 76:

 

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

 

The get_products function returns an array. You can access the product id in the $i loop with $products[$i]['id'].

 

You will find the get_products function in the Shopping Cart class. There's lots of other useful functions there. (As long as you haven't hacked your class to pieces as I have.) I don't know where $cart is defined, but perhaps it is a global variable...you can check with a search, I guess.

 

Bill

Link to comment
Share on other sites

Good Morning/Afternoon/Evening All!

 

First off, as everyone says, excellent contribution! Why not change it to "Matti's Excellent Master Products Contribution" instead?

 

Anyway... enough of the kissing up. I have a problem with my MP site... well, more like a suggestion rather than a problem. We have some items that are "regular items" and have no masters and some that have a master/slave relationship. At the present time, all master/slave items have duplicate Add to Cart buttons. (see below)

 

Dup-Add-Cart.jpg

 

What I want to see happen is have the top Add to Cart remain in the products which are just plain items and have the top ATC button disappear when it's a Master/Slave item. I'd found a fix for it somewhere, but apparently it was not in the MP Support Forum... and I don't recall the search string I used to find it.

 

My suggestion is to have OSC/MP automatically recognize that there is a slave product & remove the Add To Cart button on its own. Or, if the button cannot disappear, become a destination link to the first slave item... does that make sense to you?

 

Can someone help me??? Please???

 

Thanks... Tim Doyle

 

:angry: Before Master Products

:D After Master Products

"Success has nothing to do with what you gain in life or accomplish for yourself. It's what you do for others."

 

- Danny Thomas, founder of St Jude Children's Research Hospital

Link to comment
Share on other sites

on mine round about line 269 after the review bit replace the standard add to cart code with

<!-- Master Products Moded by John//-->      
<?php if ($product_master['products_price']!= '0'){ ?> 
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']);//. tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><?php echo (($product_info['products_price'] > 0) ? tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : ''); ?>

 

that will hide the top button if the price is 0

hope that helps!

 

Regards John

Link to comment
Share on other sites

edit------------------------

i have just noticed that the above code dont work if you also got normal products it wont display a button only in master. since i only have master products with slaves i dont really care but still here is the fix for all of you ;-)

 

<!-- Master Products Moded by John//-->      
<?php if ($product_master['products_price']!= '0'){ ?> 
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']);//. tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><?php echo (($product_info['products_price'] > 0) ? tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : ''); ?>
<?php
   } else {
?>
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']);//. tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><?php echo (($product_info['products_price'] > 0) ? tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : ''); ?>
<?php
}
?>

 

Regards John

Link to comment
Share on other sites

You are awesome - that worked exactly how I wanted it to. :D I am once again happy with OSC.

 

Thanks... Tim D.

"Success has nothing to do with what you gain in life or accomplish for yourself. It's what you do for others."

 

- Danny Thomas, founder of St Jude Children's Research Hospital

Link to comment
Share on other sites

Well... I thought it was working until I added a couple items to my cart. Instead of adding the slave products I choose to buy to my cart, it instead adds just the master. :( Any idea what's amiss with that? I can tell this does exactly what I want it to do, just doesn't handle things totally right.

 

For the mean time, I'm reverting to my backup copy... though once we have this all debugged, I'm definately using this code you've suyggested!

 

Thanks... Tim

"Success has nothing to do with what you gain in life or accomplish for yourself. It's what you do for others."

 

- Danny Thomas, founder of St Jude Children's Research Hospital

Link to comment
Share on other sites

Hi again

 

Which code displays the listing of slave products? Is it possible to change it so that instead of quantity it shows availability and instead of allowing up to 20 things to be bought it is limited to the 'in stock' number?

 

 

Christine

Link to comment
Share on other sites

This has already been dealt with on page 5 with code fixes on page 6

 

Limit product quantities

 

The 'in stock' number is the default in version 1.

 

You also might look at the code fixes on pages 3 and 4. They display 'Sorry, temporarily out of stock."

 

Good luck,

Charles

We stand in ignorance only for questions not asked. Plug up the leaks in your knowledge base and open up a flood of understanding.
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...