AOMin Posted January 8, 2008 Share Posted January 8, 2008 ok, I am in the process of installing the OTF v2.02 manual installation and have run into a problem in the instructions. Using the "option_type_feature-v2.0.2_manual_installation(-new-).txt" instructions we find this for the catalog/includes/class/shopping_cart.php file: FIND: (around line 105) $this->contents[$products_id]['attributes'][$option] = $value; REPLACE with // OTF contrib begins //$this->contents[$products_id]['attributes'][$option] = $value; $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXT_PREFIX)); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; $this->contents[$products_id]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$products_id]['attributes'][$option] = $value; // OTF contrib ends Ok, here is my problem, the actual code in that area is this: if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id_string]['attributes'][$option] = $value; So what am I looking for? [$products_id] or [$products_id_string] Everything else in the instructions are exactly as the instructions tell me. So what do I do? Quote Link to comment Share on other sites More sharing options...
kortshop Posted January 9, 2008 Share Posted January 9, 2008 (edited) Okay, So I figured out how to fix my previous issue. Now I have more of a question. I want to use the radio button's to select from different font options. I want the font name displayed next to the radio box to actually typed in in the appropriate font. For example, if the first radio option is for Comic Sans MS, then I want it to say Comic Sans MS, but actually display in that font. Is this posible? Thanks. You may use the options as images contribution and create an image for each font type. Edited January 9, 2008 by kortshop Quote Link to comment Share on other sites More sharing options...
AOMin Posted January 11, 2008 Share Posted January 11, 2008 Ok, I solved the earlier language issue. Seems the previous change was being repeated in the one I referenced. Once I compared this to the complete sample file I found the problem. Now I have a new problem. I installed the OTF mod and now the download manager doesn't work. It seems that the mod changes whatever section modified the nature of the downloadable items and set them aside as unique. Any ideas? Quote Link to comment Share on other sites More sharing options...
Dhananjaya Posted January 13, 2008 Share Posted January 13, 2008 I found what I think was the problem. After sifting through this code, which I am not an expert on, I found a piece that was commented out for a contribution. I think the contribution was OTF, but I would have to confirm that. I can't believe nobody else had this problem.The shopping_cart.php in catalog was like this: if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { // BOF Option Type Value - Commented out php echo //echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); // EOF Option Type Value I removed the comment ("//") that blocked the echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); Don't know why that needed to be blocked, but it works now with it back in. if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { // BOF Option Type Value - Commented out php echo echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); // EOF Option Type Value Dude! Thanks for that! Mine was commented out for some stupid reason too. And uncommenting it out fixed it. And I was using version 2.02 from 12/14/2007 Quote I have moved on from oscommerce to magento and no longer monitoring this site. Link to comment Share on other sites More sharing options...
Dhananjaya Posted January 13, 2008 Share Posted January 13, 2008 I found what I think was the problem. After sifting through this code, which I am not an expert on, I found a piece that was commented out for a contribution. I think the contribution was OTF, but I would have to confirm that. I can't believe nobody else had this problem.The shopping_cart.php in catalog was like this: if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { // BOF Option Type Value - Commented out php echo //echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); // EOF Option Type Value I removed the comment ("//") that blocked the echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); Don't know why that needed to be blocked, but it works now with it back in. if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { // BOF Option Type Value - Commented out php echo echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); // EOF Option Type Value Dude! Thanks for that! Mine was commented out for some stupid reason too. And uncommenting it out fixed it. And I was using version 2.02 from 12/14/2007 Quote I have moved on from oscommerce to magento and no longer monitoring this site. Link to comment Share on other sites More sharing options...
AOMin Posted January 14, 2008 Share Posted January 14, 2008 Attributes disappearing when quantity is updated in shopping cart. Thanks to Bob O for solving the problem of attributes disappearing when quantity is updated in shopping cart. See… http://www.oscommerce.com/forums/index.php?s=&...t&p=1158833 The following instruction in Product Attributes - Option Type Feature (OTF) v. 2.02 Manual Installation breaks the store. Uncomment that line to fix it. OK, I just made the above change but the download manager is still broken. :'( Again, here is my dilemma. I have around 400 downloadable products along with around 100 books and cds that have to be shipped. When my customer orders a normal item it shows up in in his cart in red. When they order one of my mp3 downloads it shows in black. Obviously the rest is easy to figure out. When I drop this mod in ALL of my items order in red and no download options are offered to my customer. HAAAAALP! Quote Link to comment Share on other sites More sharing options...
jessegour Posted January 19, 2008 Share Posted January 19, 2008 ok, I am in the process of installing the OTF v2.02 manual installation and have run into a problem in the instructions. Using the "option_type_feature-v2.0.2_manual_installation(-new-).txt" instructions we find this for the catalog/includes/class/shopping_cart.php file: FIND: (around line 105) $this->contents[$products_id]['attributes'][$option] = $value; REPLACE with // OTF contrib begins //$this->contents[$products_id]['attributes'][$option] = $value; $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXT_PREFIX)); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; $this->contents[$products_id]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$products_id]['attributes'][$option] = $value; // OTF contrib ends Ok, here is my problem, the actual code in that area is this: if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id_string]['attributes'][$option] = $value; So what am I looking for? [$products_id] or [$products_id_string] Everything else in the instructions are exactly as the instructions tell me. So what do I do? Hello, I am new to all this and try to look up for the solution my self but unfortunately I cant find to solve this problem. Exactly the same with yours. How did u solve this? Did u change the [$products_id] or [$products_id_string] Please help..I am so afraid everything I have done will collapse. I took a lot of time doing this. but I did save the original though. Quote Link to comment Share on other sites More sharing options...
Guest Posted January 19, 2008 Share Posted January 19, 2008 Hi, I was having the similar issue where the attributes would disappear after updating the cart. I tried to uncomment out the mentioned line in shopping_cart.php but still see that the attributes are disappearing. The actual name of the Text Field remains on my cart page it just strips whatever the customer input for that value. Does anyone else have this issue? I double checked my shopping_cart.php file and this is the line I uncommented around line 81. echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); Thanks, Jason Quote Link to comment Share on other sites More sharing options...
jessegour Posted January 19, 2008 Share Posted January 19, 2008 Hi, I was having the similar issue where the attributes would disappear after updating the cart. I tried to uncomment out the mentioned line in shopping_cart.php but still see that the attributes are disappearing. The actual name of the Text Field remains on my cart page it just strips whatever the customer input for that value. Does anyone else have this issue? I double checked my shopping_cart.php file and this is the line I uncommented around line 81. echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); Thanks, Jason Hi, I still don't get in...after completing the feature i get this in my web site (have a look) www.kidzoasis.com/store Fatal error: Cannot redeclare unserialize() in /home2/kidz/public_html/store/includes/classes/shopping_cart.php on line 498 Now i don't know what I did wrong. I followed everything correctly :'( Quote Link to comment Share on other sites More sharing options...
jessegour Posted January 19, 2008 Share Posted January 19, 2008 Hi, I still don't get in...after completing the feature i get this in my web site (have a look) www.kidzoasis.com/store Fatal error: Cannot redeclare unserialize() in /home2/kidz/public_html/store/includes/classes/shopping_cart.php on line 498 Now i don't know what I did wrong. I followed everything correctly :'( Now I get this in my admin products attributes when i edit an option to adjust the lenght 1054 - Unknown column 'products_options_length' in 'field list' select products_options_name, products_options_length, products_options_comment from products_options where products_options_id = '5' and language_id = '1' :( someone please help me. Quote Link to comment Share on other sites More sharing options...
jessegour Posted January 19, 2008 Share Posted January 19, 2008 Now I get this in my admin products attributes when i edit an option to adjust the lenght 1054 - Unknown column 'products_options_length' in 'field list' select products_options_name, products_options_length, products_options_comment from products_options where products_options_id = '5' and language_id = '1' :( someone please help me. I am very very sorry I am posting bit by bit here as I continue to have some problem Now I don't understanf the Option Type Feature v2.0.1 manual installation at the bottom where it says to update the database with these sql commands. How and where should this databases be updated. :'( thank you. someone pls help!!!help!! Quote Link to comment Share on other sites More sharing options...
kortshop Posted January 20, 2008 Share Posted January 20, 2008 Hi, I was having the similar issue where the attributes would disappear after updating the cart. I tried to uncomment out the mentioned line in shopping_cart.php but still see that the attributes are disappearing. The actual name of the Text Field remains on my cart page it just strips whatever the customer input for that value. Does anyone else have this issue? I double checked my shopping_cart.php file and this is the line I uncommented around line 81. echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); Thanks, Jason I have the same problem when a customer has added text with linebreaks in a textarea field. When updating the shopping cart all attributes are removed. Also, when a customer click on a product with attributes in the shoppingcart the attributes are sometimes deleted (doesn't show up on the product_info page. I have almost no PHP knowledge so unable to fix this myself. It would have been nice if someone could confirm if this contriubution works with PHP5/MYSQL5/Apache2. Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted January 29, 2008 Share Posted January 29, 2008 (edited) Guys, for those of you having problems with attributes being lost after updating the cart, then the posted fix by bob O and posted by Dhananjaya in the contribution list is not the answer. (I think Bob O actually said the opposite to what has been posted, to uncomment that line!) Attributes disappearing when quantity is updated in shopping cart. Thanks to Bob O for solving the problem of attributes disappearing when quantity is updated in shopping cart. See… http://www.oscommerce.com/forums/index.php?s=&...t&p=1158833 The following instruction in Product Attributes - Option Type Feature (OTF) v. 2.02 Manual Installation breaks the store. Uncomment that line to fix it. Open catalog/shopping_cart.php ---------------------- FIND: (around line 81) echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); REPLACE with (comment out) // BOF Product Attributes - Option Type Feature (contribution 160) //echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); // EOF Product Attributes - Option Type Feature (contribution 160) This appeared to work but after a few trial orders it was clear it didn't. Actuall the fix is already in the contribution list and should be incorporated into the contribution when it is next updated. The fix was posted by dracono Hello After patching osC 2.2 with last PA-OTF I have noticed that quantity update in shopping_cart.php is broken. After updating all attributes vanished (?). I found in application_top.php some issue in /case 'update_product'/ part. $attributes doesn't use that fancy '+++N' and it should be: (near 360 line) $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i] : ''; AfterER So basically, in application_top.php find $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; and replace with $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i] : ''; This should now work :) (i didn't write this, i just stumbled across the solution) Regards Dave Edited January 29, 2008 by stubbsy Quote Link to comment Share on other sites More sharing options...
Swinglife Posted February 1, 2008 Share Posted February 1, 2008 (edited) Hello all, I have a question... I like this contribution very much, i use the last version. I want to add a dropdownlist to my attributes/options, because I have to much options for some products. Can anyone tell me how to add it? Thanks! Peter Edited February 1, 2008 by Swinglife Quote Link to comment Share on other sites More sharing options...
njgpeck Posted February 5, 2008 Share Posted February 5, 2008 Okay, so doing both of these fixed the shopping cart update issue. But now my attributes aren't transferring to the invoice, e-mail receipt, or the packing slip. Did I miss something on the install? I thought it was working fine before but now they are not there. Nic Guys, for those of you having problems with attributes being lost after updating the cart, then the posted fix by bob O and posted by Dhananjaya in the contribution list is not the answer. (I think Bob O actually said the opposite to what has been posted, to uncomment that line!) This appeared to work but after a few trial orders it was clear it didn't. Actuall the fix is already in the contribution list and should be incorporated into the contribution when it is next updated. The fix was posted by dracono So basically, in application_top.php find $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; and replace with $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i] : ''; This should now work :) (i didn't write this, i just stumbled across the solution) Regards Dave Quote Link to comment Share on other sites More sharing options...
rich89 Posted February 6, 2008 Share Posted February 6, 2008 I have a problem in that if the OTF text field filled out by the customer contains either single or double quotes, the customer will not be able to delete the item from the cart. Not sure why this is happening or if there is a documented fix (I'm guessing the field contents have to be escaped), but my cart's live and pretty busy, so if someone's fixed this already, I'd love to know how. Thanks in advance to anyone who might be able to help me out. I've spent many an hour over the last couple of days deleting items from customers' baskets in phpMyAdmin--be sweet not to have to do that anymore. Quote Link to comment Share on other sites More sharing options...
K3D Posted February 6, 2008 Share Posted February 6, 2008 I have a problem in that if the OTF text field filled out by the customer contains either single or double quotes, the customer will not be able to delete the item from the cart. Not sure why this is happening or if there is a documented fix (I'm guessing the field contents have to be escaped), but my cart's live and pretty busy, so if someone's fixed this already, I'd love to know how. Thanks in advance to anyone who might be able to help me out. I've spent many an hour over the last couple of days deleting items from customers' baskets in phpMyAdmin--be sweet not to have to do that anymore. I was having a similar situation with my cart and deletion of text fields with backslashes. I have now enabled magic_quotes_gpc via my .htaccess file as my host has it switched off in the php.ini file, all is working so I guess there is an unchecked update to the database that magic quotes is catching. To do this you can add: php_value magic_quotes_gpc on to the bottom of your .htaccess file Quote Link to comment Share on other sites More sharing options...
rich89 Posted February 7, 2008 Share Posted February 7, 2008 I was having a similar situation with my cart and deletion of text fields with backslashes. I have now enabled magic_quotes_gpc via my .htaccess file as my host has it switched off in the php.ini file, all is working so I guess there is an unchecked update to the database that magic quotes is catching. To do this you can add: php_value magic_quotes_gpc on to the bottom of your .htaccess file Would that be added to the .htacces file located in the root of the catalog? I tried it, but am still having the same problem. Would the htaccess fix have need to've been applied before the item was added to the basket, or doesn't it matter. Quote Link to comment Share on other sites More sharing options...
rich89 Posted February 10, 2008 Share Posted February 10, 2008 Would that be added to the .htacces file located in the root of the catalog? I tried it, but am still having the same problem. Would the htaccess fix have need to've been applied before the item was added to the basket, or doesn't it matter. I figured it out. Recent editions of OTF don't include a line in includes/classes/shopping_cart.php that was present in earlier versions of OTF (I found it in 1.71). The absence of this line makes it impossible for customers to delete items from their cart if one of the OTF text fields is populated by a value that includes either an apostrophe or quote marks. I haven't checked all versions, but I know this fix applies to 2.02, 2.01, and several of the manual installs. Hope this helps. Open includes/classes/shopping_cart.php // FIND function get_quantity($products_id) { if (isset($this->contents[$products_id])) { return $this->contents[$products_id]['qty']; } else { return 0; } } function in_cart($products_id) { if (isset($this->contents[$products_id])) { return true; } else { return false; } } function remove($products_id) { global $customer_id; unset($this->contents[$products_id]); ------------------------------------------------ // REPLACE WITH function get_quantity($products_id) { if (isset($this->contents[$products_id])) { return $this->contents[$products_id]['qty']; } else { return 0; } } function in_cart($products_id) { if (isset($this->contents[$products_id])) { return true; } else { return false; } } function remove($products_id) { global $customer_id; //CLR 030228 add call tep_get_uprid to correctly format product ids containing quotes $products_id = tep_get_uprid($products_id, $attributes); unset($this->contents[$products_id]); Quote Link to comment Share on other sites More sharing options...
CherryPieDesigns Posted February 13, 2008 Share Posted February 13, 2008 ok, I am in the process of installing the OTF v2.02 manual installation and have run into a problem in the instructions. Using the "option_type_feature-v2.0.2_manual_installation(-new-).txt" instructions we find this for the catalog/includes/class/shopping_cart.php file: FIND: (around line 105) $this->contents[$products_id]['attributes'][$option] = $value; REPLACE with // OTF contrib begins //$this->contents[$products_id]['attributes'][$option] = $value; $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXT_PREFIX)); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; $this->contents[$products_id]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$products_id]['attributes'][$option] = $value; // OTF contrib ends Ok, here is my problem, the actual code in that area is this: if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id_string]['attributes'][$option] = $value; So what am I looking for? [$products_id] or [$products_id_string] Everything else in the instructions are exactly as the instructions tell me. So what do I do? Is there an answer for this yet? I have the file open and ready to change, just need to know what to do TIA for any assistance. Quote Link to comment Share on other sites More sharing options...
jollyjumper Posted February 13, 2008 Share Posted February 13, 2008 Hi, have installed v2.02. It is possible to add new attributes for text, options, checkboxes and textareas in the admin area. But in the frontend all these attributes are ONLY drop down lists. So it is not possible to add a text into the text field. I guess i've done something wrong during installment, but don't know what. Any ideas? Maybe someone have had the same problem? Any idea would be helpful THX JJ Quote Link to comment Share on other sites More sharing options...
CherryPieDesigns Posted February 13, 2008 Share Posted February 13, 2008 I can't get a text area either :( Quote Link to comment Share on other sites More sharing options...
jollyjumper Posted February 13, 2008 Share Posted February 13, 2008 Hi,have installed v2.02. It is possible to add new attributes for text, options, checkboxes and textareas in the admin area. But in the frontend all these attributes are ONLY drop down lists. So it is not possible to add a text into the text field. I guess i've done something wrong during installment, but don't know what. Any ideas? Maybe someone have had the same problem? Any idea would be helpful THX JJ Have found the issue in my configuration of OSC. Have also installed the Simple Template System (STS) and using the product info feature. This feature don't pass the correct kind of text fields, radio buttons and checkboxes. After disable the product info feature of STS the attributes are shown correct. Hope that helps someone else. JJ Quote Link to comment Share on other sites More sharing options...
AOMin Posted February 14, 2008 Share Posted February 14, 2008 Is there an answer for this yet? I have the file open and ready to change, just need to know what to do TIA for any assistance. To my knowledge no one has solved this issue yet. I simply gave up on the entire mod in hopes that someone would eventually fix it. :-( Quote Link to comment Share on other sites More sharing options...
rich89 Posted February 14, 2008 Share Posted February 14, 2008 To my knowledge no one has solved this issue yet. I simply gave up on the entire mod in hopes that someone would eventually fix it. :-( There are two comments in classes/shopping_cart.php that read // insert into database, so we can use those as markers. Between those to comments, I have the following working: // insert into database // BOF Product Type Option //if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')"); if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')"); // EOF Product Type Option if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { // BOF Product Type Option //$this->contents[$products_id]['attributes'][$option] = $value; $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXT_PREFIX)); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; $this->contents[$products_id]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$products_id]['attributes'][$option] = $value; // EOF Product Type Option // insert into database Hope that helps! Cheers, RC Quote 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.