Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 1 votes

Show Multiple Product Attribute Options in Columns


7 replies to this topic

#1 ryecandy

  • Community Member
  • 57 posts
  • Real Name:Ryan
  • Gender:Male
  • Location:Ontario

Posted 14 April 2008, 17:20

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:

[img]http://candybond.com/images/noattributes.gif[/img]

This is how the 14 Attributes look with my Fix:

[img]http://candybond.com/images/yesattributes-fixed.gif[/img]

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}
-- Many thanks osCommunity --
Too Many Product Attributes? Use 2 Columns

#2 tanicos

  • Banned
  • 152 posts
  • Real Name:cosminel

Posted 16 April 2008, 16:15

really great thanks!!! Is there a way to put something above them? Like some titles?

#3 tanicos

  • Banned
  • 152 posts
  • Real Name:cosminel

Posted 16 April 2008, 18:19

hmm...sorry it does not work for me...just tested it

#4 ryecandy

  • Community Member
  • 57 posts
  • Real Name:Ryan
  • Gender:Male
  • Location:Ontario

Posted 18 April 2008, 00:26

View Posttanicos, on Apr 16 2008, 12:15 PM, said:

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.
-- Many thanks osCommunity --
Too Many Product Attributes? Use 2 Columns

#5 ryecandy

  • Community Member
  • 57 posts
  • Real Name:Ryan
  • Gender:Male
  • Location:Ontario

Posted 18 April 2008, 00:33

View Posttanicos, on Apr 16 2008, 02:19 PM, said:

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:
-- Many thanks osCommunity --
Too Many Product Attributes? Use 2 Columns

#6 KaozDesigns

  • Community Member
  • 1 posts
  • Real Name:Terry W. Carter

Posted 26 August 2011, 20:15

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 :)

#7 waynesmith

  • Community Member
  • 8 posts
  • Real Name:Wayne Smith

Posted 08 November 2011, 10:58

View PostKaozDesigns, on 26 August 2011, 20:15, said:

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 [img]http://forums.oscommerce.com/public/style_emoticons/default/smile.gif[/img]
How did you get this to work in 2.3.1?

#8 DunWeb

  • Community Sponsor
  • 10,461 posts
  • Real Name:Chris Dunn
  • Gender:Male
  • Location:Tecumseh, Ontario, Canada N8N 1X8

Posted 08 November 2011, 15:39

You could also Google for Perfect Attributes Table as a ready made add on solution



Chris
:|: Was this post helpful ? Click the LIKE THIS button :|:

:|: Click Here to learn how I can help you with custom coding, add ons, security and templates :|:

:|: Need an Area Calculator, Pre-Paid Account, Virtual Pin, Auction or Layaway Add on ? Click Here :|: