Jump to content

Macisle

Members
  • Content count

    15
  • Joined

  • Last visited

  1. Hi, all. I am trying to get Option Type Feature 1.7.2 working (I used the most recent manual install instruction file) on a heavily modded store that also uses QTPro 3.1. After finishing the install procedure (including the insert_text_option_value.sql insert not found in the manual text instructions), I am getting a parse error on admin/products_attributes.php. The error is Parse error: syntax error, unexpected T_CASE in .../admin/products_attributes.php on line 47. That's right where the code says case 'add_product_option_values': I have spent some time playing with syntax to try and make QTPro (adds the special value in the code below) and OTF work together, but it's just guessing as I am not a programmer. The code below this paragraph is how things stand. Any help would be greatly appreciated. My goal is to integrate a linked non-OSC html-based shop into my OSC shop so that the OSC shop can cover everything. However, the html store sells a small number of specialty products that require a lot of user text input (10 measurements and various other text information and radio options) on the order form (currently a php order form that sends the order via an email). Thank you very much! Macisle require('includes/application_top.php'); $languages = tep_get_languages(); $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); if (tep_not_null($action)) { $page_info = ''; if (isset($HTTP_GET_VARS['option_page'])) $page_info .= 'option_page=' . $HTTP_GET_VARS['option_page'] . '&'; if (isset($HTTP_GET_VARS['value_page'])) $page_info .= 'value_page=' . $HTTP_GET_VARS['value_page'] . '&'; if (isset($HTTP_GET_VARS['attribute_page'])) $page_info .= 'attribute_page=' . $HTTP_GET_VARS['attribute_page'] . '&'; if (tep_not_null($page_info)) { $page_info = substr($page_info, 0, -1); } switch ($action) { case 'add_product_options': $products_options_id = tep_db_prepare_input($HTTP_POST_VARS['products_options_id']); $option_name_array = $HTTP_POST_VARS['option_name']; $option_type = $HTTP_POST_VARS['option_type']; // Cont 160 insert - clr 030714 update to add option type to products_option $option_length = $HTTP_POST_VARS['option_length']; // Cont 160 insert - clr 030714 update to add option length to products_option $special=$HTTP_POST_VARS['special']?1:0; // QTPro 3.1 cont_888 added 113004. for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]); $option_comment = $HTTP_POST_VARS['option_comment']; // Cont 160 insert -clr 030714 update to add option comment to products_option // tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id, products_options_type, products_options_length, special, products_options_comment) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . $option_type . "', '" . $option_length . "', '" . $special . "', '" . $option_comment[$languages[$i]['id']] . "')"); // QTPro 3.1 cont_888 plus cont 160 mixed entry. if($option_type != 0 && $option_type != 2){ tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$products_options_id . "', '0')"); // } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'add_product_option_values': $value_name_array = $HTTP_POST_VARS['value_name']; $value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']); $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]); tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$value_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')"); } tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$option_id . "', '" . (int)$value_id . "')"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'add_product_attributes': $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']); $values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']); $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']); $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')"); if (DOWNLOAD_ENABLED == 'true') { $products_attributes_id = tep_db_insert_id(); $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']); $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']); $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']); if (tep_not_null($products_attributes_filename)) { tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . (int)$products_attributes_id . ", '" . tep_db_input($products_attributes_filename) . "', '" . tep_db_input($products_attributes_maxdays) . "', '" . tep_db_input($products_attributes_maxcount) . "')"); } } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'update_option_name': $option_name_array = $HTTP_POST_VARS['option_name']; $option_type = $HTTP_POST_VARS['option_type']; // Cont 160 - clr 030714 update to add option type to products_option $option_length = $HTTP_POST_VARS['option_length']; // Cont 160 -clr 030714 update to add option length to products_option $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]); $special=$HTTP_POST_VARS['special']?1:0; // QTPro 3.1 cont_888 added 113004. $option_comment = $HTTP_POST_VARS['option_comment']; // Cont 160 - clr 030714 update to add option comment to products_option tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . tep_db_input($option_name) . "', products_options_type = '" . $option_type . "', products_options_length = '" . $option_length . "', special = '" . $special . "', products_options_comment = '" . $option_comment[$languages[$i]['id']] . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); // QTPro 3.1 cont_888 mixed with cont 160. } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'update_value': $value_name_array = $HTTP_POST_VARS['value_name']; $value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']); $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]); tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . tep_db_input($value_name) . "' where products_options_values_id = '" . tep_db_input($value_id) . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); } tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " set products_options_id = '" . (int)$option_id . "' where products_options_values_id = '" . (int)$value_id . "'"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'update_product_attribute': $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']); $values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']); $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']); $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']); $attribute_id = tep_db_prepare_input($HTTP_POST_VARS['attribute_id']); tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "' where products_attributes_id = '" . (int)$attribute_id . "'"); if (DOWNLOAD_ENABLED == 'true') { $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']); $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']); $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']); if (tep_not_null($products_attributes_filename)) { tep_db_query("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_id = '" . (int)$attribute_id . "', products_attributes_filename = '" . tep_db_input($products_attributes_filename) . "', products_attributes_maxdays = '" . tep_db_input($products_attributes_maxdays) . "', products_attributes_maxcount = '" . tep_db_input($products_attributes_maxcount) . "'"); } } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'delete_option': $option_id = tep_db_prepare_input($HTTP_GET_VARS['option_id']); tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$option_id . "'"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'delete_value': $value_id = tep_db_prepare_input($HTTP_GET_VARS['value_id']); tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . (int)$value_id . "'"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'delete_attribute': $attribute_id = tep_db_prepare_input($HTTP_GET_VARS['attribute_id']); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . (int)$attribute_id . "'"); // added for DOWNLOAD_ENABLED. Always try to remove attributes, even if downloads are no longer enabled tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id = '" . (int)$attribute_id . "'"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; } } // Begin cont 160 insert //CLR 030312 add function to draw pulldown list of option types // Draw a pulldown for Option Types function draw_optiontype_pulldown($name, $default = '') { $values = array(); $values[] = array('id' => 0, 'text' => 'Select'); $values[] = array('id' => 1, 'text' => 'Text'); $values[] = array('id' => 2, 'text' => 'Radio'); $values[] = array('id' => 3, 'text' => 'Checkbox'); $values[] = array('id' => 4, 'text' => 'Textarea'); return tep_draw_pull_down_menu($name, $values, $default); } //CLR 030312 add function to translate type_id to name // Translate option_type_values to english string function translate_type_to_name($opt_type) { if ($opt_type == 0) return 'Select'; if ($opt_type == 1) return 'Text'; if ($opt_type == 2) return 'Radio'; if ($opt_type == 3) return 'Checkbox'; if ($opt_type == 4) return 'Textarea'; return 'Error ' . $opt_type; } // End cont 160 insert ?> (I have not included all the code in the file - just what I think is relevant for my current question.)
  2. I have installed the Credit Class & Gift Voucher contribution into OSC 2.2 MS2 (with Japanese Language Pack MS1) and have tested the discount coupons (not gift vouchers yet). Things are looking pretty good, but I have one issue that I believe is a conflict with another installed contribution, Actual Attribute Price v 1.2.2 (http://www.oscommerce.com/community/contributions,1716). Product prices which have attribute-specific pricing are not being calculated accurately for the cart. I tried adding (via copy/paste) the Actual Attribute Price code to the CCGV-modified catalog/shopping_cart.php file, but that didn't help. Is this a known issue - hopefully with a user-friendly solution? I have a second question: Is CCGV compatible with the QTpro v3.0 - Quantity Tracking Professional Contribution (http://www.oscommerce.com/community/contributions,888)? I am thinking of uninstalling Actual Attribute Price and replacing it with QTpro 3, but, in either case, I want to keep CCGV contribution installed. If someone can get back to me asap, that would be fantastic, as I'm kinda in a time crunch on this. Thank you VERY much! Macisle
×