Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product attributes...Help


kagg

Recommended Posts

Hello,

 

Adding product attributes, one option is with product price i.e. option price is 0 with prefix 0.

 

But when the product is displayed, the attributes comes in sorting order. I want the product attribute with the default option selected.

 

Is it possible...?

 

I belive I have explained what I want to say?? :?

 

kagg

Link to comment
Share on other sites

I have searched the contributions..... but did not find my solution.

 

I want a particular option (option where option price is 0) selected in Attributes drop down menu.

 

I think some modifications need to be done in product_info.php in following code:

 

<?php

if ($products_attributes == '1') {

$products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

echo '<b>' . TEXT_PRODUCT_OPTIONS . '</b><br>';

echo '<table border="0" cellpading="0" cellspacing"0">';

while ($products_options_name_values = tep_db_fetch_array($products_options_name)) {

$selected = 0;

$products_options_array = array();

echo '<tr><td class="main">' . $products_options_name_values['products_options_name'] . ':</td><td>' . "n";

$products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

while ($products_options_values = tep_db_fetch_array($products_options)) {

$products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name']);

if ($products_options_values['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_values['price_prefix'] . $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) .') ';

}

}

echo tep_draw_pull_down_menu('id[' . $products_options_name_values['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name_values['products_options_id']]);

echo '</td></tr>';

}

echo '</table>';

}

?>

 

Can anyone suggest here??

 

Thanks in advance .

kagg

Link to comment
Share on other sites

You could get my Attribute Sorter v4.0 from my site. I pulled it out of the Free Call for Price v4.0 for people who just wanted that peice of the code.

 

This lets you set a manual sort order to all attributes.

 

You can also use Attribute Sort Groups to group like attributes in a drop down and then they will sort by the default for price or name depending on the setting you chose.

Link to comment
Share on other sites

Hi Linda,

 

Thanks!

 

I have just replaced the follwong line in product_info.php:

 

$products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

 

with:

 

$products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by pa.options_values_price");

 

 

And I got what I wanted to sort product attributes option sorted by their price value.

 

Thanks again

 

:D

kagg

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...