Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ordering Attributes


Recommended Posts

Hi again!

 

I've almost got my cart the way I want, with everything working! Woohoo!

 

However, I installed the Product Attributes - Option Type Feature and am wondering if there is a way to control the order these mods are in? It looks like it's alphabetical by default.

 

As you can see, that makes it look really silly on this site:

http://www4.ssldomain.com/labelandfound/ll...?products_id=30

 

Is there a way to change that? All I'm looking to do is keep the text boxes together and/or have it sort by the order I added the attributes. Does that make any sense?

 

So, ideally it would look something like this:

 

Quantity: (drop down)

Style: (drop down)

Name: (text box)

Address: (text box)

City: (text box)

etc...

 

 

Thanks for any tips!

 

Warmly,

Amy

Link to comment
Share on other sites

Hi again!

 

I've almost got my cart the way I want, with everything working! Woohoo!

 

However, I installed the Product Attributes - Option Type Feature and am wondering if there is a way to control the order these mods are in? It looks like it's alphabetical by default.

 

As you can see, that makes it look really silly on this site:

http://www4.ssldomain.com/labelandfound/ll...?products_id=30

 

Is there a way to change that? All I'm looking to do is keep the text boxes together and/or have it sort by the order I added the attributes.  Does that make any sense?

 

So, ideally it would look something like this:

 

Quantity: (drop down)

Style: (drop down)

Name: (text box)

Address: (text box)

City: (text box)

etc...

Thanks for any tips!

 

Warmly,

Amy

 

You can order them by ID which would be the order in which you enter(ed) the options - you just have to plan this out as it is difficult to insert an option later...

 

Look for this code in product_info.php:

 

 	 //clr 030714 update query to pull option_type
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

 

Change the last part to:

 

order by popt.products_options_id");

Brian Neuman

Link to comment
Share on other sites

Thank you - this is what I'm looking for. :)

 

However, when I made the change, I got this error in my cart:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by popt.products_options_id' at line 1

 

select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from products_options popt, products_attributes patrib where patrib.products_id='28' and patrib.options_id = popt.products_options_id and popt.language_id = '1' order by order by popt.products_options_id

 

[TEP STOP]

 

Available Options:

 

Here's what my coding looks like:

 

<?php
	 //clr 030714 update query to pull option_type
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by order by popt.products_options_id");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
   //clr 030714 add case statement to check option type
       switch ($products_options_name['products_options_type']) {
         case PRODUCTS_OPTIONS_TYPE_TEXT:
           //CLR 030714 Add logic for text option
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
           $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'];
           if ($products_attribs_array['options_values_price'] != '0') {
             $tmp_html .= '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')';
           }
?>

 

Any suggestions?

Link to comment
Share on other sites

Thank you - this is what I'm looking for. :)

 

However, when I made the change, I got this error in my cart:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by popt.products_options_id' at line 1

 

select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from products_options popt, products_attributes patrib where patrib.products_id='28' and patrib.options_id = popt.products_options_id and popt.language_id = '1' order by order by popt.products_options_id

 

[TEP STOP]

 

Take a look at your code:

 

order by order by popt.products_options_id");

 

See the extra "order by"? Delete it...

Brian Neuman

Link to comment
Share on other sites

  • 1 month later...

Okay this thread helped me get the Product Options in the right order.

 

My question is how can I get Product Attributes in the correct order?

 

Example, I have the Product Option, Wood Selection with Option Values of Walnut, Alder, and Cherry.

 

As I enter these attributes, (I need 3 of them for each product)

 

they do not seem to stay in the order I enter them, if I entered ID1= Walnut, ID2= Alder, ID3= Cherry

 

When I am done entering the IDs are not in order, they are not in order by Option Value (Cherry,Alder, Walnut) either.

 

The Id column reads ID 2 on top, then 1 and then 3 something like that.

 

Some of my options add additional price so I do not want these to be the default. Any help with ordering the Attributes after making the change as listed in the first fre posts about changing the order of the actual Product Options???

 

One additional bit of info. I had about 130 attributes set and then I deleted them all once I redid my Product Options order. Now my attributes still continue counting up in the 130s and 140s as far as the IDs go. is there a way to reset this back to 1, maybe that will fix this ordering issue?

Edited by DirtDemon
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...