Jump to content
georgei

Optional Related Products - how to modify?

Recommended Posts

I take part of that back. Dropping the products_options_products table would not prevent the SQL statement from inserting duplicate rows in the other two tables (configuration and configuration_groups).

Yeah... I know. But I didn't wanna say anything 'cause I didn't wanna rub it in... o:)

 

 

I've been checking the contribution page, and the new version isn't up yet. So I added just the sql file. The fewer people getting the wrong file the better. I was trying to make your lives a tiny bit easier, not add a mountain of frustration to the mix.

 

I know that once the all the kinks are worked out, this contribution will be helpful to a lot of people. I'm optimistic about 3.3-b being the final round of corrections.

 

And I really appreciate all the patience that has been floating through this thread.

 

I hope that those of you who've waded through the ups and downs of my first contribution will think it was worth the trouble.

 

-Skittles

Share this post


Link to post
Share on other sites
Good afternoon Skittles.

 

Almost there...

Many thanks to you for helping me out. Although I don't get the same error as before, I am seeing the following error:

That line is actually the last line of the code and it is blank.

 

Is there something you can tell me to fix this new error?

 

Thanks again!

 

Answering my own question....

 

I was able to get it working. I moved the second part of the code to elminate the space after the spot to add the second part. I'm not sure why it worked, but maybe it didn't like the empty space.

 

Thanks again to Skittles who helped me along the way.

Share this post


Link to post
Share on other sites
Yeah... I know. But I didn't wanna say anything 'cause I didn't wanna rub it in... o:)

I've been checking the contribution page, and the new version isn't up yet. So I added just the sql file. The fewer people getting the wrong file the better. I was trying to make your lives a tiny bit easier, not add a mountain of frustration to the mix.

 

I know that once the all the kinks are worked out, this contribution will be helpful to a lot of people. I'm optimistic about 3.3-b being the final round of corrections.

 

And I really appreciate all the patience that has been floating through this thread.

 

I hope that those of you who've waded through the ups and downs of my first contribution will think it was worth the trouble.

 

-Skittles

I fixed all 4 of the sites where I have this running. It really wasn't hard and didn't take but a few minutes to do, and by using my renaming technique I was able to salvage all of the work I did setting up the original database. I'm a BIG fan of this contrib!!

Share this post


Link to post
Share on other sites
Yeah... I know. But I didn't wanna say anything 'cause I didn't wanna rub it in... o:)

I've been checking the contribution page, and the new version isn't up yet. So I added just the sql file. The fewer people getting the wrong file the better. I was trying to make your lives a tiny bit easier, not add a mountain of frustration to the mix.

 

I know that once the all the kinks are worked out, this contribution will be helpful to a lot of people. I'm optimistic about 3.3-b being the final round of corrections.

 

And I really appreciate all the patience that has been floating through this thread.

 

I hope that those of you who've waded through the ups and downs of my first contribution will think it was worth the trouble.

 

-Skittles

 

Hi Skittles,

 

All works really FINE now! A very big THANK YOU!!! :lol: :lol: :lol:

 

Cheers,

Eric :D

Share this post


Link to post
Share on other sites

Hey guys, cdamianou would like to see this in action.

 

Do any of you have it working on a live shop? The only live store I have these changes on is totally different than this contrib, the t-shirt site I mentioned earlier, with the related products in the right column.

 

-Skittles

Share this post


Link to post
Share on other sites

Hi Guys,

 

I would also like to see this contrib in action before I install it.

 

Anyone???

 

Mark


Lifes a bitch, then you marry one, then you die!

Share this post


Link to post
Share on other sites
Hi Guys,

 

I would also like to see this contrib in action before I install it.

 

Anyone???

 

Mark

 

Hi Mark,

 

Just set up a brand new store (1 week old...) with still only a few

products in it: http://www.scoobyshop.nl

 

The Optional Related Products are to find in the Misc. section.

 

Let me know what you think of it ;-)

 

Cheers,

Eric :D :D :D

Share this post


Link to post
Share on other sites
Hey guys, cdamianou would like to see this in action.

 

Do any of you have it working on a live shop? The only live store I have these changes on is totally different than this contrib, the t-shirt site I mentioned earlier, with the related products in the right column.

 

-Skittles

I've got it running on http://www.baddogsales.com (see ProTrack under Altimeters, Multi-Function, for example).

Share this post


Link to post
Share on other sites
What is the Inherit button for when you add "Related Items"?

 

TIA

You can click that to make one product "inherit" the optional products listed for another product (so you don't have to enter all of them again if they relate to more than one product).

Share this post


Link to post
Share on other sites
What is the Inherit button for when you add "Related Items"?

 

TIA

 

 

Hi PuffDandEd,

 

I recently answered this question in another Related Products thread.

 

It goes into a little more detail than my buddy Baddog gave you.

 

And it includes a code correction for products_options.php that fixes the Update problem.

 

-Skittles

Share this post


Link to post
Share on other sites
Hi PuffDandEd,

 

I recently answered this question in another Related Products thread.

 

It goes into a little more detail than my buddy Baddog gave you.

 

And it includes a code correction for products_options.php that fixes the Update problem.

 

-Skittles

 

Thanks Skittles and Baddog!

Share this post


Link to post
Share on other sites

Hi All,

This mod is absolutely brilliant. I got it all working, set it in the database manually to 3 items per row and it's great! :thumbsup:

 

I have installed v3.3a and I may have missed something though.

It says:

 

"This is a complete package based on Version 3.2, described below. This version adds the following options:

 

1) Display items in multiple rows. Helpful if many items are associated with a product.

Set in Admin Configuration. Default is 'False'.

2) User defined maximum items displayed per row. Set in Admin Configuration. Default is 3.

3) Set a maximum number of items to be displayed. Set in Admin Configuration. Default is 0.

(Setting of '0' for unlimited items.)

4) Randomize sort order. Set in Admin Configuration. Default is 'False'."

 

I can see the thumbnail option, but cannot see any admin section for the other configs (e.g. number of items per row etc).

 

The only way I could set them was by going into the database manually. Maybe it's one of those days and I completely missed it for looking at the screen took hard :blink: ?

 

Any pointers appreciated, many thanks!

 

Best Regards,

Paul

Share this post


Link to post
Share on other sites
Hi All,

This mod is absolutely brilliant. I got it all working, set it in the database manually to 3 items per row and it's great! :thumbsup:

 

I have installed v3.3a and I may have missed something though.

It says:

 

"This is a complete package based on Version 3.2, described below. This version adds the following options:

 

1) Display items in multiple rows. Helpful if many items are associated with a product.

Set in Admin Configuration. Default is 'False'.

2) User defined maximum items displayed per row. Set in Admin Configuration. Default is 3.

3) Set a maximum number of items to be displayed. Set in Admin Configuration. Default is 0.

(Setting of '0' for unlimited items.)

4) Randomize sort order. Set in Admin Configuration. Default is 'False'."

 

I can see the thumbnail option, but cannot see any admin section for the other configs (e.g. number of items per row etc).

 

The only way I could set them was by going into the database manually. Maybe it's one of those days and I completely missed it for looking at the screen took hard :blink: ?

 

Any pointers appreciated, many thanks!

 

Best Regards,

Paul

 

 

 

Paul,

 

There is a problem in the related_products.sql. The corrected file is available by itself on the Related Products download page.

 

There are now incorrect entries in your configuration file which will continue to give you problems. These must be removed.

 

Follow the directions I gave Baddog in this post earlier in this thread. It includes the corrected sql code.

 

Follow the directions exactly and you'll save your data, not to mention saving yourself a lot of headaches!

 

PM me if your still having problems.

 

-Skittles

 

P.S. It really is a cool contrib, isn't it? Hat's off to Daniel B for getting it started, and to all the folks along the way that have made Optional Related Products what it is today. Thanks.

Share this post


Link to post
Share on other sites

When I ran product_info.php, it noticed:

 

1146 - Table '******.TABLE_PRODUCTS_OPTIONS_PRODUCTS' doesn't exist

 

select pop_products_id_slave, products_name, products_price, products_tax_class_id, products_image from TABLE_PRODUCTS_OPTIONS_PRODUCTS, products_description pa, products pb WHERE pop_products_id_slave = pa.products_id and pa.products_id = pb.products_id and language_id = '4' and pop_products_id_master = '40' and products_status='1' order by pop_order_id, pop_id

 

But table "PRODUCTS_OPTIONS_PRODUCTS" is exist.

 

And there are 3 "Related Product" in my admin panel!!

 

How to fix it? thanks.

Share this post


Link to post
Share on other sites

Follow the directions exactly and you'll save your data, not to mention saving yourself a lot of headaches!

 

PM me if your still having problems.

 

-Skittles

 

P.S. It really is a cool contrib, isn't it? Hat's off to Daniel B for getting it started, and to all the folks along the way that have made Optional Related Products what it is today. Thanks.

 

Nice! Thanks Skittles, I did exactly all that, and it's fixed and everything appears. Actually, I learnt a great deal too about how OSC and mySQL fits together, even though I understand most of it. Many thanks! :thumbsup:

 

You're a star!

 

Best Regards,

Paul

p.s. Out of interest - it shows the price "@$33.12" under the product. I can rem that out so it is not displayed. Would it be easy to shock a stock level there instead ? I can probably suss it out myself, any pointers ? I'd need to mysql query it somehow I think ?

 

Many thanks once again Skittles!

Share this post


Link to post
Share on other sites
When I ran product_info.php, it noticed:

 

1146 - Table '******.TABLE_PRODUCTS_OPTIONS_PRODUCTS' doesn't exist

 

select pop_products_id_slave, products_name, products_price, products_tax_class_id, products_image from TABLE_PRODUCTS_OPTIONS_PRODUCTS, products_description pa, products pb WHERE pop_products_id_slave = pa.products_id and pa.products_id = pb.products_id and language_id = '4' and pop_products_id_master = '40' and products_status='1' order by pop_order_id, pop_id

 

But table "PRODUCTS_OPTIONS_PRODUCTS" is exist.

 

And there are 3 "Related Product" in my admin panel!!

 

How to fix it? thanks.

 

Tao,

 

First, "1146 - Table '******.TABLE_PRODUCTS_OPTIONS_PRODUCTS' doesn't exist" indicates the table hasn't been defined in [catalog]/includes/database_tables.php. New tables must always be defined in both database_tables.php, one for the store in the includes folder, and one for the Admin in the admin/includes folder. As both files have the same name, it is easy to modify one, and think you've gotten it.

 

The other problem is a little more complicated.

 

There should be a "Related Products" navigation link in two sections of the Admin, one in "Configuration", and one in "Catalog". As the one in configuration is dependent on entries in the configuration table in the database, I'm guessing "Configuration" is where you're seeing the third instance.

 

That leads me to the conclusion you've tried to install this twice.

 

First thing to do is go to the contribution download page (here) and get version 3.3-c.

 

Then follow these directions exactly for the easiest way to fix the problem.

 

First: Export the products_options_products table, so you don't lose any work you've already done.

 

Second: Restore your database. (You did back up first, right?)

 

Third: load the SQL code from version 3.3-c that you just downloaded.

 

Fourth: Import your data back into the database (only use the INSERT INTO statements from the exported table.)

 

Fifth: Copy the products_options.php from version 3.3-c into the admin folder, replacing the file from the previous install. (It contains a fix that makes the update feature work).

 

Sixth: If you haven't already done so, open [catalog]/includes/database_tables.php and add:

// DANIEL: begin
 define('TABLE_PRODUCTS_OPTIONS_PRODUCTS', 'products_options_products');
// DANIEL: end

any where above the php end tag ( ?> )

 

Let us know how it goes.

-Skittles

Share this post


Link to post
Share on other sites
p.s. Out of interest - it shows the price "@$33.12" under the product. I can rem that out so it is not displayed. Would it be easy to shock a stock level there instead ? I can probably suss it out myself, any pointers ? I'd need to mysql query it somehow I think ?

Paul,

 

It should be possible to set up the configuration to select what to display, similar to "Product Listing" options. I'll take a look at it.

 

For now, however, I have a web site I'm integrating with osc, with lots of mods to make it look like the designers vision... It's a *real* challenge, but coming along. As I'm getting paid, I have to give it priority. :)

 

I'll add your wish to the list and see what I can do for the next release.

 

Cheers,

 

-Skittles

Share this post


Link to post
Share on other sites
I just finished modifying this contrib for a client. I used CSS, and put it in the right column, so what I did is quite a bit different than what you folks are trying to do. However, I may be able to help.

 

-Skittles

 

 

I am busy doing a customisation for someone who also for some reason wants the related products in the left column and after 2 days at it I am battling to get it working, not even sure which files to modify or how to create the infobox for it. I know that this is asking a lot but it would be hugely appreciated if you could share how you did this.

Share this post


Link to post
Share on other sites

I would like to move the Related Products table farther down the page (below the Add to Cart button) and thought I could figure it out but every time I try moving the Related Products code to where I think it will work I lose my right column (the right column ends up on the left side of the page at the bottom). Any suggestions? I know it has to be some little thing I'm missing when I move the code for Related Products.

Share this post


Link to post
Share on other sites
I would like to move the Related Products table farther down the page (below the Add to Cart button) and thought I could figure it out but every time I try moving the Related Products code to where I think it will work I lose my right column (the right column ends up on the left side of the page at the bottom). Any suggestions? I know it has to be some little thing I'm missing when I move the code for Related Products.

Hi Baddog!

 

Hope all is going well for you.

 

Down to businesss... Look for this code, (around line 264):

 

	  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
 }
?>

Put PLACEHOLDER_FOR_RELATED_PRODUCTS between the </tr> and <tr> like this:

 

	  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
PLACEHOLDER_FOR_RELATED_PRODUCTS
  <tr>
	<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
 }
?>

Now go back up, around line 165 and "cut" the related products code from:

 

<?php
// DANIEL: begin - show related products

through:

 

//DANIEL: end
?>

Paste the code you just removed into a new text document. Save the new file as related_products.php in the [catalog]/includes/modules/ folder. Now replace the placeholder with code to include the new file, like this:

 

	  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php include(DIR_WS_MODULES . 'related_products.php'); ?>
  <tr>
	<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
 }
?>

That should do it. And now you can easily move the include statement without getting lost in all that code. Just make sure it is always between rows!

 

Cheers,

-Skittles

 

Guess I should do another update to version 3.3, with this change... ;)

Share this post


Link to post
Share on other sites

Thanks for your reply. It really helps. I have one more question:

 

my online store sells digital magazines. One kind of magazines shares the same title, but each has a unique issue number. For example the April issue, September issue.

 

But now the problem is in Related Products section, the list shows just the title of the magazines but not the issue number. So the buyers may not be able to find the issue they need.

 

Thank you for your help.

Share this post


Link to post
Share on other sites
Thanks for your reply. It really helps. I have one more question:

 

my online store sells digital magazines. One kind of magazines shares the same title, but each has a unique issue number. For example the April issue, September issue.

 

But now the problem is in Related Products section, the list shows just the title of the magazines but not the issue number. So the buyers may not be able to find the issue they need.

 

Thank you for your help.

Tao,

 

How to display the issue depends on where you've stored that information and whether you want to include the name of the magazine or just the issue number.

 

For the sake of illustration, let's assume you store the issue number as the product model. Let's further assume you include "Issue # " as part of the model number (i.e. Issue # 213).

 

To include the model number field, you need to add 'products_model' to the query like this:

 

  $attributes = "select pop_products_id_slave, products_name, products_model, products_price, products_tax_class_id, products_image from " . TABLE_PRODUCTS_OPTIONS_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb WHERE pop_products_id_slave = pa.products_id and pa.products_id = pb.products_id and language_id = '" . (int)$languages_id . "' and pop_products_id_master = '".$HTTP_GET_VARS['products_id']."' and products_status='1' " . $orderBy;

The easiest way to make the change is to change the information stored in the variable '$products_name_slave'.

 

Locate the code that assigns the product name to the variable '$products_name_slave':

 

	while ($attributes_values = tep_db_fetch_array($attribute_query)) {
  $products_name_slave = ($attributes_values['products_name']);
  $products_id_slave = ($attributes_values['pop_products_id_slave']);

To use the model instead of the name use this:

 

	  $products_name_slave = ($attributes_values['products_model']);

To use the model following the name, use this:

 

	  $products_name_slave = ($attributes_values['products_name'] . ' ' . $attributes_values['products_model']);

This will look something like: Scientific American Issue # 213

 

You can, of course, use any text between the quotes. Just use what makes sense for your store:

  • ', '
  • ' - '
  • ' Issue # ' (if "Issue #" isn't stored with the model number)

Hope this helps.

-Skittles

Share this post


Link to post
Share on other sites
p.s. Out of interest - it shows the price "@$33.12" under the product. I can rem that out so it is not displayed. Would it be easy to shock a stock level there instead ? I can probably suss it out myself, any pointers ? I'd need to mysql query it somehow I think ?

Paul,

 

This is similar to the answer to Tao's problem. Include products_quantity in the $attributes query.

 

Look for this code:

 

	while ($attributes_values = tep_db_fetch_array($attribute_query)) {
  $products_name_slave = ($attributes_values['products_name']);
  $products_id_slave = ($attributes_values['pop_products_id_slave']);

Add a variable for stock quantity and comment out the code for finding the price, like this:

 

	while ($attributes_values = tep_db_fetch_array($attribute_query)) {
  $products_name_slave = ($attributes_values['products_name']);
  $products_id_slave = ($attributes_values['pop_products_id_slave']);
  $products_stock_slave = ($attributes_values['products_quantity']);
/*
  if ($new_price = tep_get_products_special_price($products_id_slave)) {
	$products_price_slave = $currencies->display_price($new_price, tep_get_tax_rate($attributes_values['products_tax_class_id']));
  } else {
	$products_price_slave = $currencies->display_price($attributes_values['products_price'], tep_get_tax_rate($attributes_values['products_tax_class_id']));
  }
*/

 

Now find the line that writes the information to the browser:

 

	  echo '<br> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'.$products_name_slave.'<br>@ '.$products_price_slave.'</a>';

 

And change it to...:

	  echo '<br> <a href="' 
				   . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' 
				   . $products_id_slave) . '">' 
				   . $products_name_slave . '<br>' 
				   . '[Optionally insert your text here...]'
				   . $products_stock_slave 
				   . '[... or here, depending on what works for your shop]'
				   . '</a>';

... where you replace the text and brackets with the appropriate text in the line(s) you prefer to use, and delete any line you don't use.

 

This would result in the name and stock being displayed something like this:

 

[image]

Fire Down Below

15 In Stock

or this:

 

[image]

Fire Down Below

Qty Available: 15

Or use both, if it works for you

 

[image]

Fire Down Below

Only 15 Left!

 

When you get done, post a link to your site, so we can all see the results :thumbsup:

 

-Skittles

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×