Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

Donovan Long,

 

"the new files will be ready when they're ready" is understood and theres no need to restate the obvious. I was just asking a simple question with no tension or malice intended or implied in the message at all. I'm not sure what you read in the post but it was a simple question about the development of the contribution.

 

Nevertheless, everyone has stated their appreciation to Matti for this contribution and the other work he has done for OSC.

 

(don't reply to this message on the thread....lets keep the thread on topic. PM me if you have any more issues.)

Link to comment
Share on other sites

kat2nz,

 

You could edit your product_info.php where it displays that message or I think you should be able to just change the "define('TEXT_STOCK',..." to a blank message so it won't display that message anymore.

Link to comment
Share on other sites

Once again

I was wondering if anyone happens to know the code to make the Categories / Products list in the admin Categorized?

EXAMPLE :

 

Product info (Master)

Product1 (slave)

Product2 (slave)

Product3 (slave)

Product info (Master)

Product1 (slave)

Product2 (slave)

Product3 (slave)

 

As oppose to how it displays now which is a mess especially considering the huge number or products.

 

I cant seem to find the exact query in categories.php to make the mods to and even so im not sure how i might create the 2 queries to get this result properly.

 

I saw that someone got it working but never posted a solution for it.

 

Thanks for any help

Link to comment
Share on other sites

It looks to be a block approx between 1373 and 1432 so i have it narrowed down.

I think its just the 2 queries along with this code that is confusing. otherwise i would have already done it ;-)

thanks again for any help.

Link to comment
Share on other sites

I cant seem to find the exact query in categories.php to make the mods to and even so im not sure how i might create the 2 queries to get this result properly.
Around lines 1360-4 of admin/categories.php:
    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 p.products_master");
   } 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 p.products_master");
   }

changing the two order by clauses to

order by IF(p.products_master_status, p.products_id, p.products_master), p.products_master_status DESC, p.products_id

might work. I haven't tried it. That's where you would need to make the changes though.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Firstly, thankyou to everyone who has worked on this contribution - its great!

 

But I do seem to have a bit of problem with it. Once Master Products is installed, does every product in the catalog have to be either a master of slave or can you still add 'normal' products? Because whilst all master/slave products are working fine, whenever I add a regular product I'm not able to add it to my cart. When I click 'add to cart' it just says 'your cart is empty'. I had this problem with master/slave products earlier and made the code changes to fix it mentioned earlier in this thread. But now the problem has changed so that I can't add regular products!

 

Is this just the way the contribution works, or have I got some incorrect settings somewhere?

 

Thanks in advance

 

boo

Link to comment
Share on other sites

It sounds like a problem with your installation. Isn't a 'normal product' just the same as a slave product with no master? I have never had a problem with this (using the original version).

Link to comment
Share on other sites

If I add a slave product to my cart. Go into my cart, click the slave product it takes me back to the slave product, i'd like it to take me back to the master product. Clicking the image in the cart does do this however -see screenshot. I think there is a solution posted earlier in the thread but it doesn't seem to work for me.

osc.jpg

Did you figure out how to do this? I could really use some help with this same problem.

 

cheers

boo

Link to comment
Share on other sites

Change the following line in catalog/shopping_cart.php:

 

<td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

 

to:

 

<td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $prod_link_id) . '"><b>' . $products[$i]['name'] . '</b></a>';

 

Matti

Link to comment
Share on other sites

THANKS MATT!! I have never tried to use such an order by clause before ;-)

 

BUt now that ive seen it I will be trying to use it more often to save me from doing multiple queries to save me server load in my other apps Yay !!

Link to comment
Share on other sites

Yanno somthing else that would be nice is in the add product form in the admin, is to make the select master drop down only display the master items from that particular category. Im gonna see if i can get that figured out. Ify ou know how already Id appreciate ya posting it ;-)

 

Thansk again for that Post matt That was a great help!

Link to comment
Share on other sites

Okay the Query I see is approx on line 520:

$products_master_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_master_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name");

 

And im making the assumption that the second half of cpath is the category id?

I would think that they already have those 2 items seperate into seperate variables so if so Please lemme know Otherwise i'll just use the following code to get teh cat id

 

$cpathparts = explode("_",$HTTP_GET_VARS['cPath']);

if(count($cpathparts) > 1) {

$currentcat = $cpathparts[1];

} else {

$currentcat = $cpathparts[0];

}

 

 

and use $currentcat as my var.

 

here is my recoded query:

 

$products_master_query = tep_db_query("

SELECT p.products_id, pd.products_name , ptoc.categories_id

FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd ,

products_to_categories ptoc

WHERE p.products_master_status = '1' and p.products_id = pd.products_id

AND pd.language_id = '" . (int)$languages_id . "'

AND p.products_id = ptoc.products_id

AND ptoc.categories_id = '".$currentcat."'

ORDER BY pd.products_name");

 

 

Hope this helps..

Link to comment
Share on other sites

Hey, if I have master products and the attribute option type feature contrib both installed can I use both? What I want is the customer to be able to choose what ring size they want. ideally they could put it in next to the quantity drop down box. I guess I don't need to use the other contrib but I would like to to show up in the shopping cart and for the admins invoice. Anyone know how I could do this?

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

Link to comment
Share on other sites

Another question, how would you set this:

 

If there is no picture for the slave, use the master products picture in the shopping cart and where ever else it would show up.

 

Thanks for the help

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

Link to comment
Share on other sites

Quick question & I would LOVE a reply... How do I get my slaves to appear in some sort of order? Instead of a nice list I have a messy one with the products listed what looks like randomly.

I believe the slaves are sorted alphabetically based on product name, which didn't suit me as my slaves are number sizes. I changed the order by clause around line 78 in /catalog/includes/modules/master_products.php from:

 

$master_sql .= " order by pd.products_name";

to:

$master_sql .= " order by p.products_id";

 

This gives me my slaves listed in the order I originally entered them. Obviously you could use a different field to sort on, but I think this is the area you should be looking at.

 

Matt

Link to comment
Share on other sites

Hallo,

 

My problem is that i can add only slave products to shopping cart. But i have also products that are neither master or slave.

It seems to me like the problem is the add_slave "function" in application_top.php

 

I tried a bit around but didn't get yet to something really working.

Link to comment
Share on other sites

Although it is about prodcut options it may give you an idea on how to do a numerical sort.

Unfortunately my slave names are not purely numeric:

 

"ABC 8m"

"ABC 12m"

 

So for now it's easier for me to insert data in the desired order than to insert the leading 0 on the fly. Perhaps I should've used the leading zero in the name, that looks kinda ugly though.

Link to comment
Share on other sites

I've made the change to hide slaves from search results but now have a problem with the advanced search. The problem occurs where I have the master set up as an umbrella product for the slaves. e.g:

 

Master: Product Overview, Manufacturer, Price=0

Slave1: Slave Description, Price=200

Slave2: Slave description, Price=300

...

 

Everything works fine until you do an advanced search and put in a 'Prices From' value. The slaves aren't found as they've been excluded (I only want the master after all), the master isn't found as its price is 0.

 

I know the idea of the master being returned if the search criteria is met by its slaves has come up before on this thread but I haven't seen a solution posted. Has anyone solved this?

 

Matt

Link to comment
Share on other sites

I know the idea of the master being returned if the search criteria is met by its slaves has come up before on this thread but I haven't seen a solution posted.
Around line 207 of advanced_search_result.php, change
  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";

to

  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";

Around line 223, 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

  $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";

 $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 p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

Around line 238, change

      $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";

to

      $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and pdm.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";

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) . "%'";

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

 

Hth,

Matt

Always back up before making changes.

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