Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show Multiple Product Attribute Options in Columns


Guest

Recommended Posts

Have you ever had a problem showing multiple (organized) attributes on your osC Product_Info page? I have, it bugged me but adding 2 small pieces of code solved everything!

My example shows how 14 different Attribute Options become presented:

noattributes.gif

This is how the 14 Attributes look with my Fix:

yesattributes-fixed.gif

THE FIX

 

INSERT this code at approx. line 128 (Before <table border="0" cellspacing="0" cellpadding="2">):

<!-- Organize Attribute into Columns Fix Opens Here --><?php $attribute_count = 1; ?><!-- Organize Attribute into Colums Fix Closes Here -->

REPLACE THIS CODE at approx. Line 150:

	<tr>
   <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
   <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
  </tr>

WITH THIS CODE:

<!-- Organize Attribute into Columns Fix Opens Here -->
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>	   
<?php 
if ($attribute_count == 1){  
echo "<td width=7%></td>";
$attribute_count = $attribute_count + 1;}
elseif ($attribute_count == 2){
 echo "</tr>";
 $attribute_count = $attribute_count - 1;}
?><!-- Organize Attribute into Columns Fix Closes Here -->

 

Thats it!

This code fixed the Attributes for all of my products... ...And I haven't seen anybody give it out yet. :thumbsup:

{My first php fix. Please tell me what you think}

Link to comment
Share on other sites

really great thanks!!! Is there a way to put something above them? Like some titles?
Sure, you could put what ever you want above the attributes. Just add it to your code somewhere {ie. after a <table><tr><td> tag} above the lines are that you edited eariler. You can add whatever HTML code you'd like into the product_info.php website to spruce it up.
Link to comment
Share on other sites

hmm...sorry it does not work for me...just tested it
What did it do? :blink:

Can somebody please confirm 'it does not work' and leave details about what the error, problem or part that 'doesn't work' does? :thumbsup:

Link to comment
Share on other sites

  • 3 years later...

Ok I have to say after searching through this forum for 2 days now you sir are a friggin genius. Apparently your code was for an older release of osC but I managed to make this work with 2.3.1 and it works perfectly. I just had to creatively put some code in different places. I would share the knowledge but I am thinking that my cart is heavily modified and may not help anyone.

 

I may do a contribution once I get this clients site done and see if maybe it does help someone.

 

Thanks again, You are the greatest :)

Link to comment
Share on other sites

  • 2 months later...

Ok I have to say after searching through this forum for 2 days now you sir are a friggin genius. Apparently your code was for an older release of osC but I managed to make this work with 2.3.1 and it works perfectly. I just had to creatively put some code in different places. I would share the knowledge but I am thinking that my cart is heavily modified and may not help anyone.

 

I may do a contribution once I get this clients site done and see if maybe it does help someone.

 

Thanks again, You are the greatest smile.gif

How did you get this to work in 2.3.1?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...