Iggy Posted March 3, 2007 Share Posted March 3, 2007 (edited) Hi there, I'm trying to combine QTpro and Option Type Feature (probably a fool's errand but I do like a challenge :) Right off the bat it's going places I don't know how to take it so I'm hoping someone here would be willing to give me a quick lesson in syntax. Here's the problem: In QTpro for the admin products_attributes.php it specifies this update on line 109 tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_track_stock='" . (int)$track_stock . "',products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); In Option Type Feature 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 . "', products_options_comment = '" . $option_comment[$languages[$i]['id']] . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); So the question is how to go about combining these two statements? Or do I need to create a third "set some_option" to replace these two and then modify both contribs to use the value so they'll be happy? Or is there a third option I just don't know of? Thanks for any light you can shine on the subject or knowlegde you'd like to impart :lol: Iggy Edited March 3, 2007 by Iggy Quote Everything's funny but nothing's a joke... Link to comment Share on other sites More sharing options...
Zappo Posted March 19, 2007 Share Posted March 19, 2007 (edited) -------------Text Deleted to save some room------------- Edited March 19, 2007 by Zappo Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Zappo Posted March 19, 2007 Share Posted March 19, 2007 (edited) Hi there, I'm trying to combine QTpro and Option Type Feature (probably a fool's errand but I do like a challenge :) Right off the bat it's going places I don't know how to take it so I'm hoping someone here would be willing to give me a quick lesson in syntax. Here's the problem: In QTpro for the admin products_attributes.php it specifies this update on line 109 tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_track_stock='" . (int)$track_stock . "',products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); In Option Type Feature 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 . "', products_options_comment = '" . $option_comment[$languages[$i]['id']] . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); So the question is how to go about combining these two statements? Or do I need to create a third "set some_option" to replace these two and then modify both contribs to use the value so they'll be happy? Or is there a third option I just don't know of? Thanks for any light you can shine on the subject or knowlegde you'd like to impart :lol: Iggy Hello Iggy, I'm joining you in your quest! I found a similar problem on line 58 (Or somewhat nearby --> I've installed more cotribs) Here are the Original code, the QTPro code, and the Option Feature code after each other: tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "')"); tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id,products_options_track_stock) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . (int)$track_stock . "')"); tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id, products_options_type) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . $option_type . "')"); And I'll Merge this as follows: tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id, products_options_track_stock, products_options_type) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . (int)$track_stock . "', '" . $option_type . "')"); The trick here is in the original code, and comparing it against: 1. The code that needs to be added 2. The code you have at that moment (with other contribs as well) 3. The original QTPro code (sometimes) to see what other contribs have changed... See what QTPro has changed, and if you could add to that. Sometimes QTPro REPLACES stuff, and that's when things can become complicated... Mind you, I'm JOINING you in your quest, and haven't tested anything yet. This just seems logical to me... Greetings, Albert Whoops! Double post there; forgot the closing (code)'s Edited March 19, 2007 by Zappo Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Zappo Posted March 19, 2007 Share Posted March 19, 2007 Ow, and for many product_info.php changes, I've had to go for adding them to includes/classes/pad_base.php (because creating a new product attribute display plugin is beyond my comprehension...) Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Zappo Posted March 19, 2007 Share Posted March 19, 2007 I currently have modified/added the code from the following Option Feature Files: product_info.php shopping_cart.php checkout_process.php And am currently working on includes/application_top where I have the following problem: QTPro File: //++++ QT Pro: Begin Changed code $attributes=array(); if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) { $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']); foreach ($attrlist as $attr) { list($oid, $oval)=explode('-',$attr); if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval) $attributes[$oid]=$oval; } } if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) { foreach ($HTTP_POST_VARS['id'] as $key=>$val) { if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val) $attributes=$attributes + $HTTP_POST_VARS['id']; } } $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes); //++++ QT Pro: End Changed Code And the Option Feature File: // iii 030813 added: File uploading: save uploaded files with unique file names $real_ids = $HTTP_POST_VARS['id']; if ($HTTP_POST_VARS['number_of_uploads'] > 0) { require(DIR_WS_CLASSES . 'upload.php'); for ($i = 1; $i <= $HTTP_POST_VARS['number_of_uploads']; $i++) { if (tep_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] != 'none')) { $products_options_file = new upload('id'); $products_options_file->set_destination(DIR_FS_UPLOADS); if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i])) { if (tep_session_is_registered('customer_id')) { tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "')"); } else { tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "')"); } $insert_id = tep_db_insert_id(); $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename; $products_options_file->set_filename("$insert_id"); if (!($products_options_file->save())) { break 2; } } else { break 2; } } else { // No file uploaded -- use previous value $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = $HTTP_POST_VARS[TEXT_PREFIX . UPLOAD_PREFIX . $i]; } } } $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+1, $real_ids); // iii 030813 end of changes. In this case I don't know if I can just combine these as I did the above example, as the in the original file the last line of code is as follows: $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); In this case the code has been replaced, and I don't think just adding the "$real_ids" to the "$attributes" thingy would work.... Regards, Albert Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Zappo Posted March 19, 2007 Share Posted March 19, 2007 (edited) I'm gonna try placing both additions after each other, and add the ", $real_ids" after the "$attributes" (donno if I'm gonna do that twice tho...) Need to finish editing the other files first, then troubleshoot (probably :D ) Edited March 19, 2007 by Zappo Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Zappo Posted March 19, 2007 Share Posted March 19, 2007 (edited) First try, first error: 1146 - Table 'osCommerce.TABLE_PRODUCTS_OPTIONS_TYPES' doesn't exist select products_options_types_id, products_options_types_name from TABLE_PRODUCTS_OPTIONS_TYPES where language_id='4' order by products_options_types_id [TEP STOP] This occurs when in control panel, trying to go to product_attributes. I actually think I merged everything fine, except the "$cart->add_cart" problem I ran into above... (although that seems to have nothing to do with product_attributes.php) I eventually placed both filechanges after each other, except for the "$cart->add_cart"-line. In that last line I replaced the last $attributes with $real_ids Gonna try some other combo's on that file now (after a quick forum-check on the error message) Regards, Albert Edited March 19, 2007 by Zappo Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Iggy Posted March 19, 2007 Author Share Posted March 19, 2007 First try, first error: 1146 - Table 'osCommerce.TABLE_PRODUCTS_OPTIONS_TYPES' doesn't exist select products_options_types_id, products_options_types_name from TABLE_PRODUCTS_OPTIONS_TYPES where language_id='4' order by products_options_types_id [TEP STOP] This occurs when in control panel, trying to go to product_attributes. I actually think I merged everything fine, except the "$cart->add_cart" problem I ran into above... (although that seems to have nothing to do with product_attributes.php) I eventually placed both filechanges after each other, except for the "$cart->add_cart"-line. In that last line I replaced the last $attributes with $real_ids Gonna try some other combo's on that file now (after a quick forum-check on the error message) Regards, Albert Dang Albert! You are kicking but and taking names :thumbsup: I'm hoping to find a little time here in the next few days to come back to this. Hopefully with some results :rolleyes: Iggy Quote Everything's funny but nothing's a joke... Link to comment Share on other sites More sharing options...
Zappo Posted March 21, 2007 Share Posted March 21, 2007 Phffffff.... I've tried all kind of things, but didn't get any decent results... One of the bigger problems is that I have no idea what file (or files) the problem could be in. Also, I've installed QTPro, UltraPics, ActualAttributePrices, and Attribute Sorter and Copier before attempting this. Could be a conflict between one of those too... I'm putting this to rest for now, as I don't seem to be getting anywhere. Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.