Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Option Type Question


MCousin76

Recommended Posts

I have the File Upload module installed and working. I just installed the Option Type module (for the textarea option). Everything seems to be working somewhat o.k., but whenever i try and load the page with the textarea box attribute... the page will not completely load. I've been playing around with the site for a while trying to figure it out.

 

1. Originally, textarea did not show up in the drop down selection (admin, attributes page). After searching around, I realized that there was not an option for textarea in the product_options_type table of the database.

 

2. Once i added that to the list it still wasn't showing up. After searching around again, I realized that textarea was not in the list on the (includes/local/configure.php) page. I added it to the list and gave it the value of (5).

 

==========================

includes/local/configure.php

==========================

<?php

// BOF Product Type Option

define('PRODUCTS_OPTIONS_TYPE_SELECT', 0);

define('PRODUCTS_OPTIONS_TYPE_TEXT', 1);

define('PRODUCTS_OPTIONS_TYPE_RADIO', 2);

define('PRODUCTS_OPTIONS_TYPE_CHECKBOX', 3);

define('PRODUCTS_OPTIONS_TYPE_FILE', 4);

define('PRODUCTS_OPTIONS_TYPE_TEXTAREA', 5);

define('TEXT_PREFIX', 'txt_');

 

define('PRODUCTS_OPTIONS_VALUE_TEXT_ID', 0); //Must match id for user defined "TEXT" value in db table TABLE_PRODUCTS_OPTIONS_VALUES

 

// EOF Product Type Option

?>

 

3. Whenever i change the number (5) in the list above, and i go back to my page and refresh the page... the textarea box is displayed as (radio button, checkbox, etc.) whatever i make the number. For some reason the (5) is not setup. I'm not sure where i need to do this???

 

Does anyone have any ideas?????

Link to comment
Share on other sites

Another option i found was in the database...

 

THESE ARE ALL PRESENT FOR (Select, Text, Radio, Checkbox and File) ..... TextArea is no where to be found.

=======================================

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (169, 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL, now(), now(), NULL, NULL);

 

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (170, 'Text product option type', 'PRODUCTS_OPTIONS_TYPE_TEXT', '1', 'Numeric value of the text product option type', 6, NULL, now(), now(), NULL, NULL);

 

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (171, 'Radio button product option type', 'PRODUCTS_OPTIONS_TYPE_RADIO', '2', 'Numeric value of the radio button product option type', 6, NULL, now(), now(), NULL, NULL);

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (172, 'Check box product option type', 'PRODUCTS_OPTIONS_TYPE_CHECKBOX', '3', 'Numeric value of the check box product option type', 6, NULL, now(), now(), NULL, NULL);

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (173, 'File product option type', 'PRODUCTS_OPTIONS_TYPE_FILE', '4', 'Numeric value of the file product option type', 6, NULL, now(), now(), NULL, NULL);

 

===============================================

 

INSERT INTO `products_options_types` (`products_options_types_id`, `products_options_types_name`, `language_id`) VALUES (0, 'Select', 1);

INSERT INTO `products_options_types` (`products_options_types_id`, `products_options_types_name`, `language_id`) VALUES (1, 'Text', 1);

INSERT INTO `products_options_types` (`products_options_types_id`, `products_options_types_name`, `language_id`) VALUES (2, 'Radio', 1);

INSERT INTO `products_options_types` (`products_options_types_id`, `products_options_types_name`, `language_id`) VALUES (3, 'Checkbox', 1);

INSERT INTO `products_options_types` (`products_options_types_id`, `products_options_types_name`, `language_id`) VALUES (4, 'File', 1);

 

 

=================================================

 

I already went into the "products_options_types" TABLE and inserted...

INSERT INTO `products_options_types` (`products_options_types_id`, `products_options_types_name`, `language_id`) VALUES (5, 'TextArea', 1)

 

As for the configuration table i inserted...

(280, ' TextArea product option type', 'PRODUCTS_OPTIONS_TYPE_TEXTAREA', '5', 'Numeric Value of the textarea product option type', 6, NULL, now(), NULL, NULL);

 

Still, nothing is working??? Am i missing something?????

Link to comment
Share on other sites

I found one other place to add the textarea information... it still doesn't work???

 

===============

includes/configure.php

===============

 

// CLR 020605 defines needed for Product Option Type feature.

define('PRODUCTS_OPTIONS_TYPE_SELECT', 0);

define('PRODUCTS_OPTIONS_TYPE_TEXT', 1);

define('PRODUCTS_OPTIONS_TYPE_RADIO', 2);

define('PRODUCTS_OPTIONS_TYPE_CHECKBOX', 3);

define('PRODUCTS_OPTIONS_TYPE_TEXTAREA', 5);

 

// iii 030813 added: File Uploading: FILE type and UPLOAD_PREFIX

define('PRODUCTS_OPTIONS_TYPE_FILE', 4);

define('UPLOAD_PREFIX', 'upload_');

define('TEXT_PREFIX', 'txt_');

define('PRODUCTS_OPTIONS_VALUE_TEXT_ID', 0); //Must match id for user defined "Text" value in db table TABLE_PRODUCTS_OPTIONS_VALUES

 

define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');

define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);

Link to comment
Share on other sites

These are the two contributions i installed...

 

http://addons.oscommerce.com/info/1540 (FILE UPLOAD)

http://addons.oscommerce.com/info/160 (OPTIONS TYPE FEATURE)

 

does anyone have any suggestions why i'm able to insert a (select, text, radio, checkbox, file) but not textarea?

 

When the page loads it only loads half way and shows the attribute name for the textarea box and then it shows about 1/4 of the textarea box - then the page dies...

 

If anyone has successfully installed both of these contributions can you please help me out? I am at a complete loss.

Link to comment
Share on other sites

UPDATE:

 

I'm still digging around to see what's going on with the site (i'm getting an operation aborted error box from internet explorer when the page begins to load).

 

If i hit the back button a few times or hit the refresh button a few times and then the back button, sometimes the page will load but the width of the textarea box is only wide enough for 1 character. and under the attribute name is ().... By chance i added a few words to see what would happen. I am able to type in as many characters as i assigned the length to be in the admin / attribute section. The box began to grow. I clicked on the add to basket button and my text appeared in the shopping cart.

 

So, my guess is that everything is setup the correct way except for the code on the product_info.php page. Does that sound right to anyone?

 

I'm not quite sure what to adjust on the page but here is the code for the textarea section.

 

Also, i'm not quite sure why the width of the textarea box is only 1 character wide, i need it to be wider than that. Any help would be great.

 

============

product_info.php

============

 

<?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" valign="top"><?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>

Link to comment
Share on other sites

UPDATE:

 

 

=========

PROBLEMS

=========

 

1.) The product_info.php page works every once and a while, most of the time it breaks. I have to keep hitting refresh or the back button for it to work.

 

2.) The width of the textarea box is only 1 character wide. How do i make the width larger?

 

================================================

product_info.php CODE (maybe someone can see what i'm doing wrong)

================================================

 

<?php

/*

$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 

//################## Added Enable / Disable Categories #################

// $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status = '1' and p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

//################## End Added Enable / Disable Categories #################

$product_check = tep_db_fetch_array($product_check_query);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[products_name]; ?></title>

 

<meta name="description" content="<?php echo $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[products_name] .' - ' . $header_tags[desc_tag]; ?>"><meta name="keywords" content="<?php echo $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[keywords_tag]; ?>" />

</title>

<meta name="description" content="<?php echo $header_tags['products_name'] . strip_tags($breadcrumb_tags->trail_tags(' ')); ?>">

<meta name="keywords" content="<?php echo $header_tags['products_name'] . strip_tags($breadcrumb_tags->trail_tags(', ')); ?>">

 

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

<script type="text/javascript" src="lightbox/prototype.js"></script>

<script type="text/javascript" src="lightbox/scriptaculous.js?load=effects"></script>

<link rel="stylesheet" href="lightbox/lightbox.css" type="text/css" media="screen">

<script type="text/javascript" src="lightbox/builder.js"></script>

<script type="text/javascript" src="lightbox/lightbox.js"></script>

 

<link rel="stylesheet" type="text/css" media="all" href="css/newbuild2.css" />

<link rel="stylesheet" type="text/css" href="css/style.css">

<link rel="stylesheet" type="text/css" href="css/standard.css" >

 

<style>

#phonechat {

width: 300px;

float: right;

font-size: 10px;

padding-top: 16px;

}

 

#phonechat a {

display: inline;

text-decoration: none;

}

#phonechat a, #phonechat p {

margin: 0;

padding: 0;

}

 

#contact_order, #contact_order a {

width: 70px;

background-image: url("/images/oicon.gif");

}

 

#contact_phone, #contact_phone a {

width: 70px;

background-image: url("/images/picon.gif");

}

 

 

#contact_chat, #contact_chat a {

width: 56px;

background-image: url("/images/cicon.gif");

}

 

#contact_email, #contact_email a {

width: 66px;

background-image: url("/images/eicon.gif");

 

}

 

.contact_menu {

float: right;

display: block;

height: 16px;

background-repeat: no-repeat;

background-position: 0px -16px;

margin-left: 8px;

}

 

#contact_email {

margin-left: 12px;

}

 

#contact_email a, #contact_chat a, #contact_phone a, #contact_order a {

display: block;

height: 16px;

background-repeat: no-repeat;

background-position: top left;

}

 

#contact_email a:hover, #contact_chat a:hover, #contact_phone a:hover, #contact_order a:hover {

background-image: none;

}

 

#customer {

float: right;

width: 266px;

height: 18px;

margin-bottom: 2px;

}

 

body {

margin-top: 0px;

margin-bottom: 0px;

}

</style>

 

 

<script language="javascript"><!--

function popupWindow(url) {

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le

ft=150')

}

// BOF Product Type Feature

/* DDB - 041031 - Form Field Progress Bar */

/***********************************************

* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/

* Modified by Dynamic Drive for minor changes

* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com

* Please keep this notice intact

***********************************************/

function textCounter(field,counter,maxlimit,linecounter) {

// text width//

var fieldWidth = parseInt(field.offsetWidth);

var charcnt = field.value.length;

// trim the extra text

if (charcnt > maxlimit) {

field.value = field.value.substring(0, maxlimit);

} else {

// progress bar percentage

var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;

document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";

document.getElementById(counter).innerHTML="Limit: "+percentage+"%"

// color correction on style from CCFFF -> CC0000

setcolor(document.getElementById(counter),percentage,"background-color");

}

}

function setcolor(obj,percentage,prop){

obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";

}

// EOF Product Type Feature

//--></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table width="771" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="1" valign="top" bgcolor="#cccccc"><img src="images/spacer.gif"></td>

<td width="0" valign="top" bgcolor="#ffffff">

 

<table width="159" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="159" height="8"></td>

</tr>

</table>

 

<table border="0" width="159<?php // echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<td width="1" valign="top" bgcolor="#cccccc"><img src="images/spacer.gif"></td>

<!-- body_text //-->

<?php

// iii 030813 added: File upload: 'enctype="multipart/form-data"'

// explicitly state post so that the parameters sections can be set

// It might be better to make this dependent on the presence of file fields

// in the future.

?>

<td width="100%" valign="top" bgcolor="#FFFFFF" align="center"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"'); ?><table border="0" width="602" cellspacing="0" cellpadding="0">

<tr>

<td><?php echo $messageStack->output('upload'); ?></td>

</tr>

<?php

if ($product_check['total'] < 1) {

?>

<tr>

<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.minorder, p.products_discount from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

 

} else {

 

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<br><font size="1" color="#999999">[' . $product_info['products_model'] . ']</font>';

} else {

$products_name = $product_info['products_name'];

}

 

//Minimum quantity code

// if (tep_not_null($product_info['minorder']) && MINIMUM_ORDERS == 'true') {

// $products_name .= '<br><span class="smallText">Minimum order: ' . $product_info['minorder'] . '</span>';

// }

//End: Minimum quantity code

 

?>

 

<tr>

<td align="left" height="50"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading" valign="top" height="20"><?php echo $products_name; ?></td>

 

 

<td class="pageHeading" align="right" valign="top"><?php //echo $products_price; ?>

</td>

</tr>

</table></td>

 

</tr>

<tr>

<td align="left">

 

<?php

if (tep_not_null($product_info['products_image'])) {

?>

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

<tr>

<td align="center" class="smallText">

<script language="javascript"><!--

document.write('<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="lightbox" title="'.$product_info['products_name'].'" >' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], /*SMALL_IMAGE_WIDTH*/325, /*SMALL_IMAGE_HEIGHT*/200, 'hspace="5" vspace="5"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="lightbox" title="'.$product_info['products_name'].'" >' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], /*SMALL_IMAGE_WIDTH*/325, /*SMALL_IMAGE_HEIGHT*/200, 'hspace="5" vspace="5"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>');

</noscript>

 

</td>

</tr>

</table>

<?php

}

?>

 

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

 

</td>

</tr>

<tr>

<td align="left" class="main">

 

<?php

// iii 030813 added: initialize $number_of_uploads

$number_of_uploads = 0;

$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);

 

?> <input name="quantity" value="1" type="hidden" /> <?php

 

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

?>

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

<tr>

<td class="main" colspan="2"><span class="subheader"><?php echo TEXT_PRODUCT_OPTIONS; ?></span><br><br></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_name");

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

}

?>

<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" valign="top"><?php echo $products_options_name['products_options_name'] . ':' ; ?></td>

<?php }

?>

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

</tr>

 

<?php

break;

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 = true;

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;

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;

// iii 030813 added: support for file fields

case PRODUCTS_OPTIONS_TYPE_FILE:

$number_of_uploads++;

$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)tep_db_input($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);

?>

<tr>

<td class="main">

 

<?php echo '' . $products_options_name['products_options_name'] . ':';

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

}

?>

</td>

<td class="main"><input type="file" name="id[<?php echo TEXT_PREFIX . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td>

</tr>

<?php

 

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

} //clr 030714 end if

?>

</td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

//*** <Reviews Mod>

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where approved = 1 and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

//*** </Reviews Mod>

$reviews = tep_db_fetch_array($reviews_query);

if ($reviews['count'] > 0) {

?>

<tr>

<td class="main" align="left"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

 

 

<?php

}

 

// Simple Price Break

if (tep_not_null($product_info['products_discount'])) {

if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {

$first = true;

$last = false;

$tab_aff = array();

echo '<tr><td align="left"> <b>Price Breaks</b><table cellpadding="2" width="105"><tr><td bgcolor="6ba41e">';

$info_box_contents = array();

//$info_box_contents[] = array('text' => '<span class="productSpecialPrice">' . TEXT_HEAD_REDUC_QTY . '</span>' );

if( $tranche = explode( ',', $product_info['products_discount'] ) ) {

$index = 0;

foreach( $tranche as $cle => $trn )

if( $qty_px = explode( ':', $trn ) ) {

$tab_aff[$index][0] = $qty_px[0];

$tab_aff[$index][1] = $qty_px[1];

$index++;

}

$new_price = tep_get_products_special_price($product_info['products_id']);

for( $i=0; $i<$index; $i++) {

if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));

else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

 

if( $i==0 ) {

if ( $new_price ) $products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

// $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1 );

 

 

if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );

 

 

else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );

 

 

}

elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );

 

 

else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );

}

}

new infoBox($info_box_contents);

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

}

?>

 

<tr>

<td align="left">

 

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

 

<tr>

<td class="main">

 

<?php

 

//Minimum quantity code

///if (tep_not_null($product_info['minorder']) && MINIMUM_ORDERS == 'true') {

echo '<span class="smallText">Quantity: ' . '</span>';

echo "<input type= \"text\" size=\"5\" value=" . $product_info['minorder'] ." name=\"quantity\">";

 

//} else echo "<input type= \"text\" size=\"5\" value=\"1\" name=\"quantity\">";

 

//End: Minimum quantity code

?>

 

</td>

</tr>

 

</table>

 

</td>

</tr>

 

 

<?php

}

// Simple Price Break

 

if (tep_not_null($product_info['products_url'])) {

?>

 

<tr>

<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {

?>

<tr>

<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>

</tr>

<?php

} else {

?>

 

<!--

 

<tr>

<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>

</tr>

 

-->

<?php

}

?>

 

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

 

<td class="main" align="right">

 

<?php //*** <Reviews Mod> ?>

<?php

if ($reviews['count'] > 0) {

echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>';

} else {

echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, tep_get_all_get_params()) . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>';

}

?>

<?php //*** </Reviews Mod> ?>

 

<?php echo '<a href="' . tep_href_link(FILENAME_TELL_A_FRIEND, tep_get_all_get_params()) . '">' . tep_image_button('button_tell_a_friend_extra.gif', IMAGE_BUTTON_TELL_A_FRIEND) . '</a>'; ?>

 

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

 

 

<tr>

<td width="100%" height="40" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="5" align="left">

<tr>

<td width="100%" align="left" class="lgblack2"><font color="#666666">Additional Product Information</font></td>

</tr>

</table></td>

</tr>

<tr>

<td height="1" bgcolor="cccccc"></td>

</tr>

 

 

 

<?php

 

// START: Extra Fields Contribution v2.0i with fix

list($products_id_clean) = split('{', $product_info['products_id']);

$extra_fields_query = tep_db_query("

SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value ,pef.products_extra_fields_status as status

FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef

LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf

ON ptf.products_extra_fields_id=pef.products_extra_fields_id

WHERE ptf.products_id=".$products_id_clean." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')

ORDER BY products_extra_fields_order");

 

while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {

if (! $extra_fields['status']) // show only enabled extra field

continue;

echo '

<tr>

<td align="left">

<table border="0" width="100%" cellspacing="0" cellpadding="3px"><tr>

<td class="main" align="right" valign="top" width="160"><b><font size="1" color="#666666">'.$extra_fields['name'].': </font></b></td>';

echo '<td class="main" align="left" valign="top"><font size="1" color="#666666">' .stripslashes($extra_fields['value']).'</font></td> </tr>

</table>

</td>

</tr>';

}

// END: Extra Fields Contribution

 

?>

 

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td>

<?php

//added for cross -sell

if ((USE_CACHE == 'true') && empty($SID)) {

echo tep_cache_also_purchased(3600);

include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);

} else {

include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);

// include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);

}

}

// iii 030813 added: File Uploading: hidden field carrying number of upload info to next file

?>

</td>

</tr>

<tr>

<td><?php echo tep_draw_hidden_field('number_of_uploads', $number_of_uploads); ?></td>

</tr>

</table></form>

 

<div align="center"><br />

<strong>CALL US TODAY FOR QUESTIONS AND ORDERING ASSISTANCE </strong><br />

<span class="navtitle5">813-944-2081</span>

</div>

<p style="margin-top: 3; margin-bottom: 2; line-height:150%"></p>

</td>

<td width="1" valign="top" bgcolor="#cccccc"><img src="images/spacer.gif"></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

I found out what the problem is with the page loading sometimes and not loading other times.

 

NOW I JUST NEED TO MAKE THE WIDTH OF THE TEXTAREA BOX LARGER THEN JUST ONE CHARACTER... Does anyone know how to do that?

 

============================

I HAVE THIS IN THE HEAD OF MY PAGE

============================

<script type="text/javascript" src="lightbox/prototype.js"></script>

 

 

I was going to go through the page and see if i can find out what could be causing the problem. Does anyone have any suggestions on what i should be looking for? there is about 4,000 lines of code. LOL

Link to comment
Share on other sites

THE BIG UPDATE:

 

The main problem is fixed. i was searching online and came upon a website which was titled, Operation Aborted: Going crazy!

 

Here is the post that helped me out... i hope it can help someone else out too.

 

====================

hebiki

Member

Posted 1 week ago #

WorldPress.org

====================

 

everyone, here's my "simple" fix for those that want to use lightbox.

 

instead of using the plug in, modify your footer.php and place all the required lightbox lines of code in the footer.

 

this code goes in the footer:

<script type="text/javascript" src="/js/prototype.js"></script>

<script type="text/javascript" src="/js/scriptaculous.js?load=effects,builder"></script>

<script type="text/javascript" src="/js/lightbox.js"></script>

<link rel="stylesheet" href="/css/lightbox.css" type="text/css" media="screen" />

 

once its in the footer.. it gets parsed by IE last..and doesnt throw up the error. ive only tested it on IE 6 because i dont have IE7 installed yet.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...