Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

I got master products installed without too many problems, but I've just realised that the 'What's New' page doesn't work. Not sure how to explain this: you know the infobox which displays a random new product? Well the header of that infobox has a small icon which when clicked should list all new products right? Well, it doesn't :( All I get is a parse error. This is my products_new.php code:

 

<?php

/*

  $Id: products_new.php,v 1.27 2003/06/09 22:35:33 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

*/

 

  require('includes/application_top.php');

 

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW);

 

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table width="100%" border="0" align="center" cellpadding="3" cellspacing="3">

  <tr>

    <td width="<?php echo BOX_WIDTH; ?>" class="columnposition" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

    </table></td>

<!-- body_text //-->

    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

      <tr>

        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

          <tr>

            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

            <td class="pageHeading" align="right"><?php //echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

          </tr>

        </table></td>

      </tr>

      <tr>

        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

      </tr>

<?php

  $products_new_array = array();

//Products_master

  $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

//Products_master EOF

  $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

  if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

      <tr>

        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

          <tr>

            <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>

            <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

          </tr>

        </table></td>

      </tr>

      <tr>

        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

      </tr>

<?php

  }

?>

      <tr>

        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

  if ($products_new_split->number_of_rows > 0) {

    $products_new_query = tep_db_query($products_new_split->sql_query);

    while ($products_new = tep_db_fetch_array($products_new_query)) {

      if ($new_price = tep_get_products_special_price($products_new['products_id'])) {

        $products_price = '<s>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';

      } else {

        $products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));

      }

?>

          <tr>

            <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>

            <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>

<!--Master Products //-->         

<?php if ($products_new['products_master_status'] != '1' && $products_new['products_master'] =='0') {

?>           

            <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

<?php

} elseif ($products_new['products_master'] != '0') {

?>

            <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_master']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

<?php

} else {

?>           

            <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

<?php

}

?>

<!--Master Products EOF //-->

          <tr>

            <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>

          </tr>

          <tr>

            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

          </tr>

<?php

  }

?>

        </table></td>

      </tr>

<?php

  if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

      <tr>

        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

          <tr>

            <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>

            <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

          </tr>

        </table></td>

      </tr>

<?php

  }

?>

    </table></td>

<!-- body_text_eof //-->

    <td width="<?php echo BOX_WIDTH; ?>" class="columnposition" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

    </table></td>

  </tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Any ideas?

 

Thanks in advance.

boo :)

Link to comment
Share on other sites

Hi there,

 

Matti thanks for this contrib, it's just what the doctor ordered.

 

I went through the files looking for 'Master Products' (as opposed to file comparison) and found a couple of things:

 

[1] In admin/categories.php when previewing the product as read only the prices show as zero value since 'p.products_price, p.products_weight,' where omitted in the revised sql statement.

 

[2] In admin/categories.php where the category/products are listed (default) the addition made to identify whether the product is a master was not identified.

 

I think in admin/categories.php where the MP stuff was inserted into the 'new products' section the initial seperating td did not span 2 columns.

 

If anyone knows of any other unidentified changes in the 1.1.5 version would be good to know.

 

Having manually installed the contribution I'm not sure if I've missed something, when a MP is created the 'products_listing_status' does not get set, the products db tables says the default value is '1' but when you create the MP via the 'add master product' button it uses the 'insert_product' action so here the value ends up being '0' because from the submitted form there is no 'products_listing_status'.

Yet in when testing the above in an overwrite and run version this problem didn't occur?

 

I've read this forum starting from Apr 3 (the release date of version 1.1.5) and noted Matt's and Chris's posts regarding searches and product listing respectively.

 

I wonder if there if there is anything else that might be considered mentioned possibly from earlier posts?

For example I noticed a post about product listings and the 'Buy Now' buttons, but in the manual install just performed clicking on the column heading 'Buy Now' button results in an empty shopping cart, each of the products listed have their own buy now buttons which is not what was suggested in the links from those posts i.e. drop down menus. And in the overwrite and run installation version there is no column heading buy now button?

 

Today was my first study, so apols if seems naive.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

G'day Greg,

 

I think I did state somewhere here to expect omissions - I shall run the next update through BC :P

 

I have not had near enough time as I would like to update the contribution. I do have a new and much simpler admin/categories.php that I shall try and find time to upload tomorrow - this should greatly simplify adding the contrib to already modified stores - I structured the original categories.php in anticipation additions for master products, but have now decided that these should be included in a separate file - what was simple for me (the way I did it) has proved difficult with already modified stores.

 

The product_listing_status will default if there is not a variable set in the query :)

 

There should not be any column buy now buttons in the slave listing display - only a single button (this is in product_info). Slave buy now buttons in product_listing should direct to the master product product_info page.

 

There is definitely useful info in earlier posts - some which will definitely be implemented in updates. A little work on master_listing.php and application_top.php will see attributes as functional - this is important.

 

The neatest way I have seen the contrib used is combined with Flash to give 'click and build' functionality :D

 

Matti

Link to comment
Share on other sites

Being fairly new to this stuff..... :blink:

 

When you update the contribution, does it have instructions included for an upgrade install, or do you need to uninstall the previous vversion and start over?

 

Thank You,

 

Betty

Link to comment
Share on other sites

Hi Matti,

 

resolved the problem with the buy now button occuring in standard 'product_listing' column heading, I put the edit in the wrong place.

 

However that then lead me to discover that in index.php all of the '$listing' sql statements need to be revised since for example if viewing by manufacturer then the link has a blank product_id.

Is this ok?

 

Also I noticed that if you create a MP but don't assign a quantity and that this MP has no SP's then when viewing that MP in product_info the add to cart button appears but the qty field doesn't so if you click it you get told your shopping cart is empty since there is not 'Qty..' field.

Could you advise what might/should occur...

 

I haven't looked yet but what is the intended difference between 'new_master' and 'new_product' in the admin, is just the javascript document form field names used in the javascript functions?

 

Also I changed the form actions in 'master_preview' to 'update_master' and 'insert_master' respectively and things seem ok now for me (otherwise they would never be used?).

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Also I changed the form actions in 'master_preview' to 'update_master' and 'insert_master' respectively and things seem ok now for me (otherwise they would never be used?).

Was an error on my part.....

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Hi,

 

first of all I would like to thank Matti for this great mod. This has solved so many problems for me (i.e it works great with eBay Auction Sales Manager because I don`t have to assign attributes anymore. My attributes are now slaves and I can synchronize these with my attribute-heavy eBay auction sales flawlessly ;-)

 

However, I do have one small problem:

 

When merging Matti`s code into my admin/categories.php the following shows in my admin-panel:

 

doublelist_mp.gif

 

I`m no coder just a paster, so if someone could perhaps tell me what I did wrong, that would be great!

 

Thanks

Alex

Link to comment
Share on other sites

Alex,

 

Can't say for sure but the problem is around 834 of a fresh admin/categories.php.

This is what my line looks like, i.e. when merging I had to remove the product name and the closing table.td tag:

<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 you post the code you have for that section of the file might be able to tell more easily.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Alex,

 

Can't say for sure but the problem is around 834 of a fresh admin/categories.php.

This is what my line looks like, i.e. when merging I had to remove the product name and the closing table.td tag:

<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 you post the code you have for that section of the file might be able to tell more easily.

Hi Greg,

 

this is the code in my categories.php at the line you are referring to:

 

<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> ' . $products['products_name']; ?></td>

 

 

I replaced it with your code but unfortunately received an error. Do you also have the latest ultraimages installed?

 

My categories.php is modified quite a lot because I couldn`t get ultraimages running.

Chris had the same problem but fixed this and sent me his categories.php which I merged into my file (thanks alot Chris ;-).

 

Here is some more code around that area. Perhaps you can see what the problem is. THANKS

 

<?php

}

//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, 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, 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");

}

while ($products = tep_db_fetch_array($products_query)) {

$products_count++;

$rows++;

//Master Products EOF

// Get categories_id for product if search

if (isset($HTTP_GET_VARS['search'])) $cPath = $products['categories_id'];

 

if ( (!isset($HTTP_GET_VARS['pID']) && !isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['pID']) && ($HTTP_GET_VARS['pID'] == $products['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {

// find out the rating average from customer reviews

$reviews_query = tep_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$products['products_id'] . "'");

$reviews = tep_db_fetch_array($reviews_query);

$pInfo_array = array_merge($products, $reviews);

$pInfo = new objectInfo($pInfo_array);

}

 

if (isset($pInfo) && is_object($pInfo) && ($products['products_id'] == $pInfo->products_id) ) {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '\'">' . "\n";

} else {

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '\'">' . "\n";

}

?>

<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> ' . $products['products_name']; ?></td>

<?php

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

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

} elseif ($products['products_master'] != 0) {

echo '<span style="color: #0080C0">' . $products['products_name'] . ' (Slave)</span></td>';

} else {

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

} ?>

<td class="dataTableContent" align="center">

<?php

if ($products['products_status'] == '1') {

echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';

} else {

echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);

}

?></td>

<td class="dataTableContent" align="right"><?php if (isset($pInfo) && is_object($pInfo) && ($products['products_id'] == $pInfo->products_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>

</tr>

<?php

}

 

$cPath_back = '';

if (sizeof($cPath_array) > 0) {

for ($i=0, $n=sizeof($cPath_array)-1; $i<$n; $i++) {

if (empty($cPath_back)) {

$cPath_back .= $cPath_array[$i];

} else {

$cPath_back .= '_' . $cPath_array[$i];

}

}

}

 

$cPath_back = (tep_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';

?>

<tr>

<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo TEXT_CATEGORIES . ' ' . $categories_count . '<br>' . TEXT_PRODUCTS . ' ' . $products_count; ?></td>

<!-- Master Products //-->

<td align="right" class="smallText"><?php if (sizeof($cPath_array) > 0) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, $cPath_back . 'cID=' . $current_category_id) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> '; if (!isset($HTTP_GET_VARS['search'])) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_category') . '">' . tep_image_button('button_new_category.gif', IMAGE_NEW_CATEGORY) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_master') . '">' . tep_image_button('button_new_master.gif', IMAGE_NEW_MASTER) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_product') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?> </td>

<!-- Master Products EOF //-->

Link to comment
Share on other sites

Ok, I managed to get attributes to go into the slaves and it works when there is only one slave but when there are more than one, only the last slave will work and I believe I know why but just don't know the correct way to fix it. The problem is stemming from the tep_draw's for the attribute selections. This is what the master products quantity selector is:

$lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);

And this is the way my other three look: (one's a text box)

$lc_text = tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute);
           
$lc_text = tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute);
           
$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];
$lc_text = $tmp_html;

 

How do I change the last three so that they get added to the database correctly.

 

Heres a screen shot if you interested it what I did:

master.gif

 

Thanks for the help.

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

I don't think that I made any other changes except adding an index on products_master to the database.

 

Hth,

Matt

Hi Matt,

 

First, thanks for your post. I've made the changes to advanced_search_results.php per your post and it works great for text searches. However it still ignores slaves for price range searches. I haven't added the index, but I can't see that making a difference.

 

My product is a model of kite, which comes in a number of sizes. It is quite reasonable to expect the customer to want up to three different sizes, hence the use of master/slave so they can add them all at once. The master is a virtual container that holds the product description and manufacturer details with the price set to zero to prevent its purchase. The slaves are the available sizes:

 

Master: Naish Boxer (price $0)

Slave: 6 Metre $600

Slave: 9 Metre $650

Slave: 12 Metre $700

Slave: 16 Metre $750

Slave: 19 Meter $800

 

The problem is using the master as a virtual container. For my specific case the ideal would be to ignore the price criteria on the master record when the price is 0 and return it only when a slave matched the criteria.

 

Using your code changes, a search on '12 Metre' returns the master product for Boxer as expected. A search using the advanced search and a 'Price from' value greater than 0 produces no results. A 'Price to' value of greater than 0 always returns the master product. i.e The search criteria appear to be applied only to the master.

 

At this point, given my primitive grasp of SQL, I'm resigned to living with this problem, unless you or anyone else already has a solution.

 

I don't think I can be the only one in this situation though so I hereby put this forward for consideration for a future release of Master Products, 2.1 perhaps? :)

Link to comment
Share on other sites

Your Shopping Cart is empty!

Fresh install.I cannot add individual products, masters or slaves to the cart.

 

Ok. I did try something someone mentioned and added a new product with quantity of 1. That item now goes into and shows up in cart.

However none of the items already in the database will show up in the cart whether qty is >0 or not.

I had been operating with no qty requirement which is my preference.

Please suggest where I should start looking for the "problem."

 

 

thanks

 

joe

Link to comment
Share on other sites

It works fine for me :blink: - check your settings under configuration->stock:

 

Check stock level - false

Subtract stock - false

Allow Checkout - true

 

 

Matti

Link to comment
Share on other sites

Thanks for the quick response.

 

I had to change subtract stock to false.

 

I still have strange behavior.

Some products will work others will not. Both mine and those from original data. I assume it is related to whether original quantity was >0. Hard to be more specific. But on the item I was able to add to cart I can continue to do so even though onhand is -3. Others when I change qty>0 they still will not add to cart. Very confused.

 

This is a non production cart at this time, just exploring osc for possible changeover so it's no big deal if I need to redo some items. Still I'm worried I may have a problem with my installation. As all worked well before the Master.

 

What do I need to look at and/or what is it I am missing about the normal behavior of the cart?

 

Thanks

Link to comment
Share on other sites

Ok.

 

Here's what is weird:

 

The items that will go into the cart go directly from the buy now button.. from index.php to shopping_cart.php..

Items that won't go in go from index.php to product_info.php. And then add to cart... the cart appears but the item is not shown.

 

Here is snip of product_info.php where I edited.

 

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<!-- Master Products //-->

<td width="100%" valign="top"><?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') . '">'; ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php

// Master Products EOF

if ($product_check['total'] < 1) {

?>

 

Here is where I took out:

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php

if ($product_check['total'] < 1) {

?>

 

Methinks I may have botched the edit.

 

This is the only change I made in this file BTW. I'm at work and can't check if I omitted something.

 

Thanks

Link to comment
Share on other sites

I am hoping to get Master Products and Bundles working together. I posted my thoughts in the bundle thread. I hope it won't be too difficult to achieve. What I shall try and do is integrate the stock update from bundles into the Master Products framework. Maybe I am being too ambitious but it seems worth a try. :rolleyes:

Link to comment
Share on other sites

I am hoping to get Master Products and Bundles working together. I posted my thoughts in the bundle thread. I hope it won't be too difficult to achieve. What I shall try and do is integrate the stock update from bundles into the Master Products framework. Maybe I am being too ambitious but it seems worth a try. :rolleyes:

Sounds great David - pm me if you get stuck.

 

I have not had a chance to look yet - does bundles have attributes working?

 

Matti

Link to comment
Share on other sites

To tell the truth Matti I'm not sure if they have attributes working, but I haven't noticed any coding to update the stock for attributes. I don't really need attirbutes any longer on my site.

 

When I look through the bundle contribution there are whole sections of it - eg most of the admin section and the database changes - that would not be needed with Master Products if we assume that all the slave products are automatically part of the same bundle.

 

Hopefully all that is required for admin then is a switch to turn on the ability to buy the master product which would also be the bundle. I think that has already been contributed in this thread somewhere. Probably another switch to make it a bundle would be a good idea.

 

My plan is initially just to use the stock update section of the product bundle. For stage 2 show the saving the customer would make. To do that, I reckon that the slave products could be accessed in the same way as the product bundle is at present.

 

What are the limitations of this simplified approach?

- For shops which just want to offer a discount for buying a complete set

- No nested bundles

- Slave products can only be part of one bundle

Link to comment
Share on other sites

Hello everybody

 

I would like to know how Is it possible to have a master product in slave and a slave product in master in the same time for an OSC2.2MS2FR

 

For example:

I have a master product digital camera with slave an USB cable and a Stands.

It work well

 

But now

when I go to the Stand I would like to have the digital camera in slave.

 

I want to know what,where and wich files can I modify in order order to have a link to my product in the Slave Box Product

 

Best Regards

Poor english

Link to comment
Share on other sites

Got my problems fixed by doing an over the top type install.

My prior clumsy hacks had caused the qty selector to be hidden resulting in the default zero qty not adding to the cart and hence the empty cart message.

 

I do have design disaggreement with the customer choosing a qty prior to entering the cart. Since many customers only buy one I think it makes it faster and a better shopping experience to only make qty changes in the cart. To each his own and of course if I had the coding talent I could change it. Maybe someone could offer up a howto.

 

ALSO...

I'm with ryanf above. Absolutely must have attributes in the slaves table for my shop. My usage is for coffee and I'm looking at different weights e.g Master one lb of a variety. Slaves 1/2 lb and slave 5lbs. So far so good but then the customer must indicate if it is to be ground or not and how. So these attributes must be selectable for each item whether master or slave.

 

Mattii, thanks for your excellent contribution.

Link to comment
Share on other sites

Hey, I have found the cause of my troubles of adding attributes in with slave products. In the code to add the slave products it calls the array of attributes 'id' so if there are 7 slave products all with the same attributes when you add a product to the cart, it will just look at the last one caled 'id'.

 

The problem is I don't know how to fix it. I think it would be easiest to give the attribute arrays the name of the product_id then they would all be different. Then in application_top instead of adding 'id' you would add product_id. I tried changing the code in master_listings from

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

to

$products_options_array[] = array($listing[products_id] => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

 

but then it wouldn't put anything for a value. I am stuck. I made a page

http://www.abdulky.com/help.html

that has all the necessary code, since it's too big to post here. Please take a look and see if you have any ideas, I have been at this for ever and my coding abilities aren't high enough to get this one.

 

Thanks,

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

I have a question.

 

I installed Master Product, although, when putting slaves against masters with 0 in QTY for the master, the product shows the Out of Stock red message bellow the descriptions, but the slaves have stock.

 

Basicaly, I have a Black T-Shirt (master) with a price and QTY of 0.

Then I have 3 slaves of this for Medium, Large and Xlarge. They all have

theyr specific QTY set, and the drop down menu of the slaves indicate the QTY left.

 

But I still get the red marking of Out of Stock. Hwy is that?

 

Thanks for your Help.

Link to comment
Share on other sites

Because your Master Product has a stock level of 0 - set it to 1.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

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