Dirty Butter Posted February 14, 2015 Share Posted February 14, 2015 You've helped me with this before, Bsmither, and it appears to be working correctly on the Storefront. I searched, but never could find the discussion, however. What I have now is in cubecart.class.php: This keeps the customer from seeing an error message when the estimated s/h charges do not show until the actual delivery address is provided. $gatway_proceed = ($_GET['_a']=='confirm' && isset($_POST['proceed'])) ? true : false; // BSMITHER HACK TO SIMPLIFY BASKET - ERROR MESSAGE COMMENTED OUT BELOW // Check shipping has been defined for tangible orders if (!isset($this->_basket['digital_only'])) { if (!isset($this->_basket['shipping'])) { //$GLOBALS['gui']->setError($GLOBALS['language']->checkout['error_shipping']); $gatway_proceed = false; } } This section prevents estimated shipping from showing: // BSMITHER HACK TO KEEP NUMBERS FROM SHOWING ON BASKET UNTIL DELIVERY ADDRESS IS KNOWN if ($GLOBALS['cart']->basket['delivery_address']['user_defined'] || $GLOBALS['user']->is()) { //END EXCEPT BRACE AFTER THIS SECTION ON LINE 1554 if (($shipping = $GLOBALS['cart']->loadShippingModules()) !== false) { $offset = 1; foreach ($shipping as $ship_name => $methods) { $label = (!is_numeric($ship_name) && !empty($ship_name)) ? str_replace('_', ' ', $ship_name) : null; foreach ($methods as $data) { if ($data['tax_inclusive']) $GLOBALS['tax']->inclusiveTaxRemove($data['value'], $data['tax_id']); $GLOBALS['tax']->exchangeRate($data['value'], (!empty($data['currency'])) ? $data['currency'] : $GLOBALS['config']->get('config', 'default_currency')); $value = array( 'offset' => $offset, 'name' => $ship_name.': '.$data['name'], 'value' => $data['value'], 'tax_id' => $data['tax_id'], // Kept for legacy 'tax' => $data['tax'] ); $shipping_values[] = $value; $data['name'] = empty($data['name']) ? '' : ' ('.$data['name'].')'; $data['desc'] = empty($data['desc']) ? '' : ' ('.$data['desc'].')'; $option = array( 'value' => base64url_encode(json_encode($value)), 'display' => (isset($data['name'])) ? $GLOBALS['tax']->priceFormat($data['value'], true).$data['name'] : $data['desc'] ); if(isset($this->_basket['shipping']) && $this->_basket['shipping']['offset'] == $offset) { $option['selected'] = ' selected="selected"'; // THIS IS CRAZY?! (float)4.30 !== (float)4.30 is returning TRUE?! Convert to string fixes. if((string)$value['value'] !== (string)$this->_basket['shipping']['value']) { $this->_basket['shipping'] = $value; $GLOBALS['cart']->save(); httpredir(currentPage()); } } else { $option['selected'] = ''; } $offset++; $shipping_list[$label][] = $option; } } // Lets try to choose cheapest shipping option // for them if they haven't chosen already if (!isset($this->_basket['shipping']) && !$digital_only) { foreach ($shipping_values as $value) { if (!isset($cheapest['value']) || $value['value'] < $cheapest['value']) { $cheapest = $value; } } if (!empty($cheapest)) { $GLOBALS['cart']->set('shipping', $cheapest); if(!isset($this->_basket['min_shipping_set'])) { $GLOBALS['cart']->set('min_shipping_set', true); httpredir(currentPage()); } } else if (!$GLOBALS['config']->get('config', 'allow_no_shipping')) { trigger_error('Shipping not setup or allow no shipping not enabled', E_USER_WARNING); } if (isset($this->_basket['digital_only'])) unset($this->_basket['digital_only']); // Digital good removed fix } else if ($digital_only) { $GLOBALS['cart']->set('digital_only', true); } } else { if ($digital_only || $GLOBALS['config']->get('config', 'allow_no_shipping')) { $GLOBALS['cart']->set('shipping', 0); if ($digital_only) $GLOBALS['cart']->set('digital_only', true); #gift card purchased only } else { trigger_error('Shipping not setup or allow no shipping not enabled', E_USER_WARNING); unset($GLOBALS['cart']->basket['shipping'],$GLOBALS['cart']->basket['min_shipping_set']); // past 5.0.9 } $shipping_list = false; } // Check if new shipping methods are avialble and notify if they are $shipping_hash = md5(serialize($shipping_list)); if(isset($GLOBALS['cart']->basket['shipping_hash']) && !empty($GLOBALS['cart']->basket['shipping_hash']) && $shipping_hash!==$GLOBALS['cart']->basket['shipping_hash']) { $GLOBALS['gui']->setNotify($GLOBALS['language']->checkout['check_shipping']); } $GLOBALS['cart']->basket['shipping_hash'] = $shipping_hash; if (!$digital_only && isset($this->_basket['digital_only'])){ unset($this->_basket['digital_only']); // Digital good removed fix } $GLOBALS['smarty']->assign('SHIPPING_VALUE', (isset($this->_basket['shipping'])) ? $GLOBALS['tax']->priceFormat($this->_basket['shipping']['value'], true) : '-'); $GLOBALS['smarty']->assign('HIDE_OPTION_GROUPS', $GLOBALS['config']->get('config','disable_shipping_groups')); if (!$digital_only && $shipping) { $GLOBALS['smarty']->assign('SHIPPING', $shipping_list); } } //END REST OF BSMITHER BASKET HACK - brace added above I'm not 100% sure that's all the code needed, or if I have forgotten to show something somewhere else. I ask, because I'm trying to track down another set of error messages in 5.2.16. I'm GUESSING that these are of no consequence, but merely backend complaining about no zip or shipping setup at the point where estimated numbers should be. Based on the time, the order triggering the following errors WAS completed a few minutes later. PHP Notice: USPS Error: Missing value for ZipDestination. in /xxx/public_html/plushcatalog/modules/shipping/USPS/shipping.class.php on line 149 PHP Warning: Shipping not setup or allow no shipping not enabled in /xxx/public_html/plushcatalog/classes/cubecart.class.php on line 1532 Is there any way to keep these error messages from being logged, IF they are apparently caused by the removal of estimated s/h? shipping.class.php if ($response) { $xml = new simpleXMLElement($response); if($this->_api==$this->_api_domestic) { if(isset($xml->Description)){ trigger_error(sprintf('USPS Error: %s',$xml->Description)); } else { cubecart.class.php if ($digital_only || $GLOBALS['config']->get('config', 'allow_no_shipping')) { $GLOBALS['cart']->set('shipping', 0); if ($digital_only) $GLOBALS['cart']->set('digital_only', true); #gift card purchased only } else { trigger_error('Shipping not setup or allow no shipping not enabled', E_USER_WARNING); unset($GLOBALS['cart']->basket['shipping'],$GLOBALS['cart']->basket['min_shipping_set']); // past 5.0.9 } $shipping_list = false; } Thank you so much for all your help!! Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 14, 2015 Share Posted February 14, 2015 The statements use PHP's function trigger_error(), which requests that PHP log the message specified into the error log. This happens because the script requests it, not because PHP found something wrong and is complaining about it. So, yes, make the statement a comment: // trigger_error('Shipping not setup or allow no shipping not enabled', E_USER_WARNING); and other trigger_error() statements in the script you do not want/need to know about. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted February 14, 2015 Author Share Posted February 14, 2015 Thought so, but don't understand enough to proceed without confirmation. Thanks!! You'd think eventually I'd get the hang of all this LOL 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.