Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Option Type Feature v1.6 (for osc 2.2 MS2)


Guest

Recommended Posts

I just want to say great contribution! I'm having a bit of trouble making my text box staying a constant width. I run in to this trouble when i don't have any other attributes only the text box. When this happens the user is unable to see what they are going to type. All they see is the scroll bar.

 

Any help would be greatly appreciated since i'm new to php. Thanks! smile.gif

Link to comment
Share on other sites

  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

I cannot get v1.71 to work. I've compared and recompared my files, merged my files and still this is not working. I can add a text field, but when I try to add select or radio option values I'm only getting one option for the select or radio although I have chosen the same option value name and given 2 different option values.

 

I have the Minimum Order Quantity contribution installed and was wondering if that may have something to do with it. I am new to all of this and I don't know one thing about PHP.

 

opttypeproblem.gif

 

Could someone please help me.......

 

Thank you,

Sonia

Sonia,

Link to comment
Share on other sites

Are you certain that you compared your files properly? I got the contribution to work very easily, although it didn't work the first time. I downloaded WinMerge (free) and I found a few very minor differences in the code. As we all know, these small variances will absolutely affect the functionality of any contribution.

 

I have installed this several times - at least four - without issue, so if you make sure that the code is correct it will work. :thumbsup:

 

I cannot get v1.71 to work. I've compared and recompared my files, Could someone please help me.......

cdickson

Link to comment
Share on other sites

Are you certain that you compared your files properly? I got the contribution to work very easily, although it didn't work the first time. I downloaded WinMerge (free) and I found a few very minor differences in the code. As we all know, these small variances will absolutely affect the functionality of any contribution.

 

I have installed this several times - at least four - without issue, so if you make sure that the code is correct it will work. :thumbsup:

 

 

Thank you, at least now I know it will work! I needed to take a step back from this and I really think I have too many contributions installed. I was going a bit crazy so I'm going to start from scratch and really think about what I need and don't need. I'll start with the option type feature.

 

Thanks again,

Sonia

Sonia,

Link to comment
Share on other sites

I needed to take a step back from this and I really think I have too many contributions installed.

Adding multiple contributions can definitely be tricky. We keep a separate list for each project and note which contributions were installed and tested on which date because it helps to determine which ones don't work together. It is known, for example, that STS Template and Search Engine Friendly URLs don't work together. We also install the most important contributions first.

 

Our most recent installation includes the following contributions, and all of them work together just fine:

  • STS Template
  • State Abbreviation Fix
  • All Customers Report v2.0
  • Option Type Feature v1.71
  • Featured Products v1.5.5
  • Order Editor v1.75
  • Custom Error Page v1.4
  • FedEx Direct v2.04
  • Product Sort v1.4
  • Admin DHTML Menu v2.1
  • Store Pick Up v1.4

Good luck, Sonia!

cdickson

Link to comment
Share on other sites

Im wondering if anyone has tried or knows how to patch in a date calendar popup box next to one of the products options text boxes so that someone can select a date and have it popultate the text field...

 

of course i dont need this on every text box just on some so i guess another complete option would be needed.

 

anyone tried this?

Link to comment
Share on other sites

Hello.

Can someone please help me solve this problem with Option Type Features V1.71 and Options as Image contributions.

 

http://www.oscommerce.com/forums/index.php?act=ST&f=7&t=191188

I've been at it for sometime now and could use a hand.

 

Thank you.

 

ski

 

I've been able to modify the code to get it to work. The problem is in the options_images file where if the options are false it defaults to a drop down box and not putting the right input type for text. You will need to modify the product_info and options_images file. Where you place the include file in product_info will determine the option images. I place mine at the end. Here's the snippet of code that I changed:

 

 

options_images.php

--------------------------

 

if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

 

?>

 

<tr>

 

 

 

 

<?php

if ($products_options_name['products_options_images_enabled'] == 'true'){

?>

<td class="main" valign="top"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<?php

$count=0;

echo '<td class="main"><table><tr>';

foreach ($products_options_array as $opti_array){

echo '<td><table cellspacing="1" cellpadding="0" border="0">';

if (OPTIONS_IMAGES_CLICK_ENLARGE == 'true')

echo '<td align="center"><a href="java script:popupWindow(\'' . tep_href_link(FILENAME_OPTIONS_IMAGES_POPUP, 'oID=' . $opti_array['id']) .'\')">' . tep_image(DIR_WS_IMAGES . 'options/' . $opti_array['thumbnail'], $opti_array['text'], OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) . '</a></td></tr>';

else echo '<tr><td align="center">' . tep_image(DIR_WS_IMAGES . 'options/' . $opti_array['thumbnail'], $opti_array['text'], OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) . '</td></tr>';

echo '<tr><td class="main" align="center">' . $opti_array['text'] . '</td></tr>';

echo '<tr><td align="center"><input type="radio" name ="id[' . $products_options_name['products_options_id'] . ']" value="' . $opti_array['id'] . '" checked></td></tr></table></td>';

$count++;

if ($count%OPTIONS_IMAGES_NUMBER_PER_ROW == 0) {

echo '</tr><tr>';

$count = 0;

}

}

echo '</table>';

}

 

?>

</td></tr>

<?php

}

?>

</table>

<?php

}

?>

 

 

product_info.php (this modification is just duplicating the case type except for options)

----------------------

 

<?php

} //clr 030714 end if

}

?>

<?php

//Options as Images. This whole php clause needs to be added

if (OPTIONS_AS_IMAGES_ENABLED == 'true') {

$products_attributes_query = tep_db_query("select count(*) as total 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 . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>

</tr>

<?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_id");

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

// BOF: WebMakers.com Added: Attributes Copy and Sort

if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.products_options_sort_order, pov.products_options_values_name");

} else {

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.products_options_sort_order, pa.options_values_price");

}

// EOF: WebMakers.com Added: Attributes Copy and Sort

 

//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'])) .')';

}

?>

<tr>

<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<td class="main"><?php echo $tmp_html; ?></td>

</tr>

<?php

break;

 

case PRODUCTS_OPTIONS_TYPE_TEXTAREA:

//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 = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"

onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"

onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"

wrap="soft"

name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"

rows=5

id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"

value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . '"></textarea>

<div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>

<script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';?> <!-- DDB - 041031 - Form Field Progress Bar //-->

<tr>

<?php

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

?>

<td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ' ' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')'; ?></td>

<?php } else {

?>

<td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ')'; ?></td>

<?php }

?>

<td class="main"><?php echo $tmp_html; ?></td>

</tr>

<?php

break;

 

case PRODUCTS_OPTIONS_TYPE_CHECKBOX:

//CLR 030714 Add logic for checkboxes

$products_attribs_query = tep_db_query("select distinct patrib.options_values_id, 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);

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

echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

echo $products_options_name['products_options_comment'] ;

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

echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

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

break;

default:

//clr 030714 default is select list

//clr 030714 reset selected_attribute variable

$selected_attribute = false;

$products_options_array = array();

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

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

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

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

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

}

}

 

if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

?>

<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) . $products_options_name['products_options_comment']; ?></td>

</tr>

<?php

} //clr 030714 end switch

} //clr 030714 end while

?>

</table>

<?php

include ('options_images.php');

} //clr 030714 end if

}

?>

Link to comment
Share on other sites

Hey all,

 

I noticed on the demo page that in one instance, it was possible to have multiple attributes show up on the same line. For instance:

 

First Name: [text box] Last Name: [text box]

Size: [dropdown] Colour: [dropdown]

etc.

 

Does anybody know how to do this in practice? I'm racking my brain trying to figure it out.

 

Cheers,

 

B.

Link to comment
Share on other sites

Adding multiple contributions can definitely be tricky. We keep a separate list for each project and note which contributions were installed and tested on which date because it helps to determine which ones don't work together. It is known, for example, that STS Template and Search Engine Friendly URLs don't work together. We also install the most important contributions first.

 

Our most recent installation includes the following contributions, and all of them work together just fine:

  • STS Template
     
  • State Abbreviation Fix
     
  • All Customers Report v2.0
     
  • Option Type Feature v1.71
     
  • Featured Products v1.5.5
     
  • Order Editor v1.75
     
  • Custom Error Page v1.4
     
  • FedEx Direct v2.04
     
  • Product Sort v1.4
     
  • Admin DHTML Menu v2.1
     
  • Store Pick Up v1.4

Good luck, Sonia!

 

Thank you for your reply this is very good information. I did a fresh install and I'm still having a problem. I was able to add 2 radio buttons, 2 text boxes and 1 select and now all of a sudden when I try to add another radio or select box I get this error

dberror.gif

 

I know only the TEXT field should have 0, but why is it trying to add it as 0 when it didn't do that before? Should I change my database setting in product_option_values to auto increment? If I manually add without the admin page it works perfectly fine.

 

Any idea where I went wrong?

 

Thank you.

Sonia,

Link to comment
Share on other sites

The problem for me was that i had "options as images" contribution installed alongside the "option type" contribution. The two contributions need some tweaking in order to work together.

 

If you suspect this is your problem, i'll paste my product_info.php code here, as that is the problematic file.

 

-George

 

 

Can you post your code for this? i am trying to get the option type feature and options as images working together

Link to comment
Share on other sites

Can you give a little better instruction on how to do this? i dont really understand what you did

thanks!!

 

I've been able to modify the code to get it to work. The problem is in the options_images file where if the options are false it defaults to a drop down box and not putting the right input type for text. You will need to modify the product_info and options_images file. Where you place the include file in product_info will determine the option images. I place mine at the end. Here's the snippet of code that I changed:

options_images.php

--------------------------

 

if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

 

?>

 

<tr>

 

 

 

 

<?php

if ($products_options_name['products_options_images_enabled'] == 'true'){

?>

<td class="main" valign="top"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<?php

$count=0;

echo '<td class="main"><table><tr>';

foreach ($products_options_array as $opti_array){

echo '<td><table cellspacing="1" cellpadding="0" border="0">';

if (OPTIONS_IMAGES_CLICK_ENLARGE == 'true')

echo '<td align="center"><a href="java script:popupWindow(\'' . tep_href_link(FILENAME_OPTIONS_IMAGES_POPUP, 'oID=' . $opti_array['id']) .'\')">' . tep_image(DIR_WS_IMAGES . 'options/' . $opti_array['thumbnail'], $opti_array['text'], OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) . '</a></td></tr>';

else echo '<tr><td align="center">' . tep_image(DIR_WS_IMAGES . 'options/' . $opti_array['thumbnail'], $opti_array['text'], OPTIONS_IMAGES_WIDTH, OPTIONS_IMAGES_HEIGHT) . '</td></tr>';

echo '<tr><td class="main" align="center">' . $opti_array['text'] . '</td></tr>';

echo '<tr><td align="center"><input type="radio" name ="id[' . $products_options_name['products_options_id'] . ']" value="' . $opti_array['id'] . '" checked></td></tr></table></td>';

$count++;

if ($count%OPTIONS_IMAGES_NUMBER_PER_ROW == 0) {

echo '</tr><tr>';

$count = 0;

}

}

echo '</table>';

}

 

?>

</td></tr>

<?php

}

?>

</table>

<?php

}

?>

product_info.php (this modification is just duplicating the case type except for options)

----------------------

 

<?php

} //clr 030714 end if

}

?>

<?php

//Options as Images. This whole php clause needs to be added

if (OPTIONS_AS_IMAGES_ENABLED == 'true') {

$products_attributes_query = tep_db_query("select count(*) as total 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 . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>

</tr>

<?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_id");

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

// BOF: WebMakers.com Added: Attributes Copy and Sort

if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.products_options_sort_order, pov.products_options_values_name");

} else {

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.products_options_sort_order, pa.options_values_price");

}

// EOF: WebMakers.com Added: Attributes Copy and Sort

 

//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'])) .')';

}

?>

<tr>

<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<td class="main"><?php echo $tmp_html; ?></td>

</tr>

<?php

break;

 

case PRODUCTS_OPTIONS_TYPE_TEXTAREA:

//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 = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"

onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"

onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"

wrap="soft"

name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"

rows=5

id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"

value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . '"></textarea>

<div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>

<script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';?> <!-- DDB - 041031 - Form Field Progress Bar //-->

<tr>

<?php

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

?>

<td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ' ' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')'; ?></td>

<?php } else {

?>

<td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ')'; ?></td>

<?php }

?>

<td class="main"><?php echo $tmp_html; ?></td>

</tr>

<?php

break;

 

case PRODUCTS_OPTIONS_TYPE_CHECKBOX:

//CLR 030714 Add logic for checkboxes

$products_attribs_query = tep_db_query("select distinct patrib.options_values_id, 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);

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

echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

echo $products_options_name['products_options_comment'] ;

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

echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

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

break;

default:

//clr 030714 default is select list

//clr 030714 reset selected_attribute variable

$selected_attribute = false;

$products_options_array = array();

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

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

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

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

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

}

}

 

if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

?>

<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) . $products_options_name['products_options_comment']; ?></td>

</tr>

<?php

} //clr 030714 end switch

} //clr 030714 end while

?>

</table>

<?php

include ('options_images.php');

} //clr 030714 end if

}

?>

Link to comment
Share on other sites

hello, i installed this plug-in last week and thought it was working fine at first. but, when i try to scroll through the pages of product attributes it keeps reloading page one. the URL will say:

 

products_attributes.php?option_page=2

 

...but it will still only show page one. the same goes for:

 

products_attributes.php?option_order_by=products_options_id&value_page=2

and

products_attributes.php?attribute_page=2

 

i currently have 13 pages of attributes and can only see the first page! anyone know what i should try?

 

thanks!

Link to comment
Share on other sites

Hi there,

 

Might anyone have further information on the problem quoted below by Neil Willis? If you read the complete thread (16 pages, go for it!), you'll see he ended up going with the Imprint contribution, but before going that route I just wanted to check once more to see if anyone might have another idea as to what's going wrong.

 

Here's some more information which might hopefully lend some more light as to what might be happenin... When I add a Text, Radio, Checkbox or Textarea product option everything seems to function correctly... Problem is when I go to the front end of the website and navigate to a product page, all that's displayed is a dropdown with one option called TEXT, not unlike the dropdowns that show up with TEXT beside Name, and Passenger Name, in Neil's screenshot.

 

Based on my not so good but can sometimes figure it out when pressed php skills (fine, call me a hack, I'm comfortable with it), I'm thinking that the file /catalog/product_info.php cannot seem to figure out when to change the html based on the specific type of form input, always seeming to default to the ole standby dropdown.

 

When I complete a test order with the incorrectly displayed TEXT dropdowns, the word TEXT shows up in all the right places, so from what I can tell, everything else seems to be running just fine.

 

With respect to install, I've got an up to date 2.2 Milestone 2, and have just one other contribution installed... Simple Template System. I'm attempting to install the 1.7 version of this (Option Type Feature), but have tried with version 1.5 and got the exact same results :(

 

My apologies for being so long winded, hopefully someone out there has some idea as to what might be going wrong.

 

:blush:

 

Tanks!

 

Hi hobbyhen,

 

Can you let me know how you solved this? I think I have the same problem.

 

The install was fine; all the options are in Products Attributes. When i added a text box to a product is displayed it as dropdown box with the value what the box is. See below:

text.gif

(as you can see I tried a few times with different values)

 

Any ideas how I fix this?

Cheers

Neil

Link to comment
Share on other sites

I am a hack too, i do admin it as well, but i did manage to go Option Type Feature working with Options as Images. i will post my code in the morning. i will try to explain what i did as best i can.

 

Hi there,

 

Might anyone have further information on the problem quoted below by Neil Willis? If you read the complete thread (16 pages, go for it!), you'll see he ended up going with the Imprint contribution, but before going that route I just wanted to check once more to see if anyone might have another idea as to what's going wrong.

 

Here's some more information which might hopefully lend some more light as to what might be happenin... When I add a Text, Radio, Checkbox or Textarea product option everything seems to function correctly... Problem is when I go to the front end of the website and navigate to a product page, all that's displayed is a dropdown with one option called TEXT, not unlike the dropdowns that show up with TEXT beside Name, and Passenger Name, in Neil's screenshot.

 

Based on my not so good but can sometimes figure it out when pressed php skills (fine, call me a hack, I'm comfortable with it), I'm thinking that the file /catalog/product_info.php cannot seem to figure out when to change the html based on the specific type of form input, always seeming to default to the ole standby dropdown.

 

When I complete a test order with the incorrectly displayed TEXT dropdowns, the word TEXT shows up in all the right places, so from what I can tell, everything else seems to be running just fine.

 

With respect to install, I've got an up to date 2.2 Milestone 2, and have just one other contribution installed... Simple Template System. I'm attempting to install the 1.7 version of this (Option Type Feature), but have tried with version 1.5 and got the exact same results :(

 

My apologies for being so long winded, hopefully someone out there has some idea as to what might be going wrong.

 

:blush:

 

Tanks!

Link to comment
Share on other sites

I've gotten the latest version installed, however, I have a radio button option with two different choices. I want the next option to display depending on which radio button option is chosen.

 

Is this possible? i.e.:

 

Option 1 Radio button

 

Color: Red

Blue

Green

 

Option 2 Radio Button:

 

Color: Red

Yellow

Purple

 

The two radio button choices do not come in the same colors, so I can't just have a "color" value displayed. I need different colors for each different option. Clear as mud???

 

Is this possible? Or do I need another contrib that does this?

Link to comment
Share on other sites

Hi there,

 

Might anyone have further information on the problem quoted below by Neil Willis? If you read the complete thread (16 pages, go for it!), you'll see he ended up going with the Imprint contribution, but before going that route I just wanted to check once more to see if anyone might have another idea as to what's going wrong.

 

Here's some more information which might hopefully lend some more light as to what might be happenin... When I add a Text, Radio, Checkbox or Textarea product option everything seems to function correctly... Problem is when I go to the front end of the website and navigate to a product page, all that's displayed is a dropdown with one option called TEXT, not unlike the dropdowns that show up with TEXT beside Name, and Passenger Name, in Neil's screenshot.

 

Based on my not so good but can sometimes figure it out when pressed php skills (fine, call me a hack, I'm comfortable with it), I'm thinking that the file /catalog/product_info.php cannot seem to figure out when to change the html based on the specific type of form input, always seeming to default to the ole standby dropdown.

 

When I complete a test order with the incorrectly displayed TEXT dropdowns, the word TEXT shows up in all the right places, so from what I can tell, everything else seems to be running just fine.

 

With respect to install, I've got an up to date 2.2 Milestone 2, and have just one other contribution installed... Simple Template System. I'm attempting to install the 1.7 version of this (Option Type Feature), but have tried with version 1.5 and got the exact same results :(

 

My apologies for being so long winded, hopefully someone out there has some idea as to what might be going wrong.

 

:blush:

 

Tanks!

 

I had the same problem. I ended up finding out that the added lines in configure.php were not on my file. My web host installs OSCommerce with Fantastico. As a part of that installation script, the configure.php automatically gets file permissions set to "444" which prohibited me from uploading my modified configure.php file. I had to change the file permissions (I used "777" temporarily), re-upload my modified configure.php file, then changed the file permissions back to "444".

Link to comment
Share on other sites

I am a hack too, i do admin it as well, but i did manage to go Option Type Feature working with Options as Images. i will post my code in the morning. i will try to explain what i did as best i can.

 

 

Did you manage to dig out your code for this? I can't seem to get my textarea to work, it keeps coming up as a dropdown menu instead.

 

TIA

Link to comment
Share on other sites

Where does this contribution stand? Does it work well? Are there any big issues that have not been added to the latest update which is 17 Nov 2004? This mod is exactly what i need but I just installed a similar mod that turned out not to be ready for prime time. It had way to many bugs and I want to make sure this one is not the same.

Modules installed:

http://www.oscommerce.com/forums/index.php?showtopic=57259 - Options attributes

- wysiwyg editor

- cats on main page

- policies and terms

Link to comment
Share on other sites

A couple of things...

 

One thanks to all of the people who have worked on this. I hope I can get enough time one day to help contribute to make it better. Until then I will have to simply post my findings here so others can take advantage of them.

 

I added a order by clause to the mysql query in catalog/product_info.php to my code. It works very well. Basically it just provide a little organization to the select box query so that the items are listed by value in ascending order and then are listed by their option value id in DESC order. What did I do this? Well, it is because I am selling furniture and the price of the furniture cost more depending on the type of fabric. Then I needed a way to add colors of those fabrics to a list and keeped them grouped together such as Red (leather) blue (leather) green (woven) red (woven). You get the point. So here is the line from that file that will do this. All i added was the order by clause at the end of the already existing query line.

 

$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.options_values_price ASC, pa.options_values_id DESC");

 

Next, I found a big problem in /admin/product_attributes.php today and I am thinking that it already exist in the original os files. However I find it hard to beleive because the problem is that if you add enough products to make the option table or values table run over to another page and then you try to click to go to that next page it show the same first page values. I made a fix for this but its really ugly so I am not going to share it unless someone ask for it. It really still is not working properly and one day I will find the time and energy to re-write the file so that it does work properly but for now I am just looking for others to tell me if they are seeing the same thing or if i screwed up my files (including my original backups) somehow.

 

Till next time.

Modules installed:

http://www.oscommerce.com/forums/index.php?showtopic=57259 - Options attributes

- wysiwyg editor

- cats on main page

- policies and terms

Link to comment
Share on other sites

lookin like I'm hooped here, one last time? :blush:

 

Coastal

 

If you didn't get this fixed yet let me know. I had the exact same problem and finally figured it out. I missed one line of code when I did the merge of product_info.php into my store. I'll be glad to send you my file or send yours over and I'll fix it for you.

 

-- Mindy

Link to comment
Share on other sites

Well, let me start by saying the i'm BRAND new to this. However, I'm making progress and reading ALOT.

 

 

My questions:

1. Is editing the db easiest to do within the web hosting software such as php_my_admin ?

When i added the fields in the db, that portion of the instructions seemed to be OK.

 

2. Is WinMerge a good program to use for the merge? I did not merge the files on my first attempt at installation. I chose to overwrite using WS_FTP. (think this was bad idea?) And is WinMerge or another suggested program easy / do-able for a novice to follow and get Step 2 of the install completed?

 

3. For step 3 of the install, i looked at the Products_options_values_id. Within php_my_admin, is this the correct area to add a row with the "id" of "0" and the other related info?

 

4. Is step 4 really necessary for me to use? I can see no reason for me to use this feature.

 

Really any info that someone can provide would be AWESOME.

 

Darren Dugan

Link to comment
Share on other sites

Hi!

 

I have this contrib fully implemented since yesterday, and it is working nicely. I have one small issue though and it is with radio buttons. When I have two choices, both radio buttons are checked as default!

 

My code is as follows:

 

case PRODUCTS_OPTIONS_TYPE_RADIO:
		//CLR 030714 Add logic for radio buttons
		$tmp_html = '<table>';
		$products_options_query = 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 = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
		$checked = false;
		while ($products_options_array = tep_db_fetch_array($products_options_query)) {
		  $tmp_html .= '<tr><td class="main">';
		  $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
		  $checked = false;
		  $tmp_html .= $products_options_array['products_options_values_name'];
		  $tmp_html .=$products_options_name['products_options_comment'];
		  if ($products_options_array['options_values_price'] != '0') {
			$tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
		  }
		  $tmp_html .= '</tr></td>';
		}
		$tmp_html .= '</table>';
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>	  
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

 

As you can see I have both varibles - $checked - checked here. This way none of them are checked as default. If the first one is set to true, as per instructions, both of them stays checked and hence it's impossible to make a choice. In the code above it's possible to check one alternative but also both alternatives and in this case I want it either/or, not both: ie be able two toggle.

 

Obviously I would like to have it set up the way Chandra has it on her demo page, that is to be able to toggle between the two radio buttons.

 

Anyone who can see what's causing the problem from the code above? Or knows what else there might be involved?

 

Thanks

/kbking

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...