ohiowebpro Posted August 23, 2014 Share Posted August 23, 2014 Working with the UPSXML addon in OSC v2.3. Everything is working fine except the option in the admin to disallow shipping methods using the check boxes. When I check any of the boxes and save, they do not stay checked. I confirmed the same thing with multiple browsers and thought maybe the database is recording, but the form is not populating correctly, but the options on the checkout page stay. Has anyone seen this before? Could it be a php settings issue? All the other settings save ok, it is just the checkboxes. I am thinking it could be an issue with OSC saving checkboxes in general and not necessarily related to upsxml. Was looking for another settings location with checkboxes and did not find on. Thank you. Quote Link to comment Share on other sites More sharing options...
ohiowebpro Posted August 26, 2014 Author Share Posted August 26, 2014 I bit more info that I figured out about my issue: The problem seems to lie in how the UPS XML module saves to the database. In the configuration table in the database for the disallowed shipping methods, the only thing that is saved in the value field is "Array" so when I add the methods I do not want as comma separated values, the methods are correctly removed from the checkout options. The problem with this as more than a temp solution is that if you go back to the options in admin and save, it resets back to "Array." Anyone know where there might be an array not being converted to the comma separated values? Hard to believe no one else has had this problem. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted August 26, 2014 Share Posted August 26, 2014 Many people have had this problem. Most of them look in the support thread for the module to find the answer. Answer: You didn't make the changes to admin/module.php. Go do that. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
ohiowebpro Posted August 26, 2014 Author Share Posted August 26, 2014 OK, so I should have done step three even though I have USPS Methods installed. Thank you! P.S. I searched the forum and I did not see this issue come up. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted August 26, 2014 Share Posted August 26, 2014 The forum search engine is nearly worthless. I use Google. Regards Jim opus_uno2001 1 Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
opus_uno2001 Posted March 3, 2015 Share Posted March 3, 2015 Find This code ***************************************** if (tep_not_null($action)) { switch ($action) { case 'save': reset($HTTP_POST_VARS['configuration']); while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) { *********************************************** INSERT THE FOLLOWING CODE AFTER THE ABOVE LINE: *********************************************** if (is_array($value) ) { $value = implode( ", ", $value); $value = preg_replace ("/, --none--/", "", $value); } Quote Link to comment Share on other sites More sharing options...
Supertex Posted October 26, 2015 Share Posted October 26, 2015 Well...I did follow the instructions, but apparently, going back to USPS Rates V7 (had to, in order to retain insured USPS) goofed up the UPS aspect of my modules.php. I never knew, because I never had to go back and change anything in the UPS shipping module...so previously-saved variables remained in place until I stupidly uninstalled it. Now, when I try to save the settings, it -appears- to work, except the methods don't stay checked. When I look at the configuration table in the DB, it just says "Array" where it should say "US_01, US_02" etc. Someone mind looking at this and tell me how to fix it so it saves my methods correctly without breaking the USPS module? if (tep_not_null($action)) { switch ($action) { case 'save': $module_name = ''; // detect custom modules.. if( array_key_exists('MODULE_SHIPPING_USPS_STATUS', $HTTP_POST_VARS['configuration']) ){ $module_name = 'usps'; } reset($HTTP_POST_VARS['configuration']); while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) { switch( $module_name ) { case 'usps': /* * TODO: review * USPS Methods */ if( is_array( $value ) ){ $value = implode( ", ", $value); $value = ereg_replace (", --none--", "", $value); } /* * /end */ break; } tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'"); } tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'])); break; case 'install': case 'remove': Quote osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
♥kymation Posted October 26, 2015 Share Posted October 26, 2015 I don't know why you have that switch() statement in there. Remove that, but keep the contents of the case 'usps', and all modules should work. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Supertex Posted October 27, 2015 Share Posted October 27, 2015 (edited) Thanks Jim. I finally got it working last night by changing it as follows: switch ($action) { case 'save': $module_name = ''; // detect custom modules.. if( array_key_exists('MODULE_SHIPPING_USPS_STATUS', $HTTP_POST_VARS['configuration']) ){ $module_name = 'usps'; } else if( array_key_exists('MODULE_SHIPPING_UPSXML_RATES_STATUS', $HTTP_POST_VARS['configuration']) ){ $module_name = 'ups'; } reset($HTTP_POST_VARS['configuration']); while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) { switch( $module_name ) { case 'usps': if( is_array( $value ) ){ $value = implode( ", ", $value); $value = ereg_replace (", --none--", "", $value); } break; case 'ups': if( is_array( $value ) ){ $value = implode( ", ", $value); $value = ereg_replace (", --none--", "", $value); } break; } tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'"); } tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'])); break; case 'install': case 'remove': Monkey-see, monkey-do, heh. Eagerly anticipating USPS Codes :) Edited October 27, 2015 by Supertex Quote osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
♥kymation Posted October 27, 2015 Share Posted October 27, 2015 That's a lot of unnecessary extra code, although it will still work. The heart of the code is if( is_array( $value ) ){ $value = implode( ", ", $value); } The if() statement triggers only on an array, so any module that does not use arrays will not be affected. Any variable that is an array will be turned into a comma-separated string, which then is safely stored in the database. This is really all that you need. You line $value = ereg_replace (", --none--", "", $value); will never execute, as it is a string function inside an if() that only runs when there is an array. In addition, ereg() is deprecated in PHP 5.3 and will throw a fatal error in later versions. I don't believe that it is actually needed; if it is you will need to replace it with a str_replace() and put that somewhere else in the code. Regards Jim Quote See my profile for a list of my addons and ways to get support. 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.