queasyprawn Posted December 27, 2004 Author Share Posted December 27, 2004 This error: Parse error: parse error, unexpected ';' in /home/heckys/public_html/outlet/admin/modules.php(216) : eval()'d code on line 1 is now fixed. However when I add $methods = array(); $force_shipping_allowed_methods[] = MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01; $force_shipping_allowed_methods[] = MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_02; $force_shipping = false; $products_in_cart = $order->products; $no_of_prdcts = sizeof($products_in_cart); $file_with_prdct_nos = DIR_FS_CATALOG . DIR_WS_MODULES .'shipping/list_prdcts_forced_ship.txt'; $fp = fopen($file_with_prdct_nos, "r") or die("Cannot open file with list of products that need forced shipping"); $filesize_fp = filesize($file_with_prdct_nos); $f_contents = fread($fp, $filesize_fp); @fclose($fp); $products_force_shipping = explode(",", $f_contents); array_walk($products_force_shipping, "remove_white_space"); // remove spaces and line endings to get "clean" product id's for ($x=0; $x < $no_of_prdcts; $x++) { if ( in_array ($products_in_cart[$x]['id'], $products_force_shipping) ) { $force_shipping = true; } } for ($i=0; $i < sizeof($upsQuote); $i++) { list($type, $cost) = each($upsQuote[$i]); // BOF limit choices if ($force_shipping == true && !in_array( $type, $force_shipping_allowed_methods)) { continue; } elseif (!exclude_choices($type)) continue; // EOF limit choices if ( $method == '' || $method == $type ) { $_type = $type; if (isset($this->servicesTimeintransit[$type])) { $_type = $_type . ", ".$this->servicesTimeintransit[$type]["date"]; } I get this error when I am on the shipping admin page: Parse error: parse error, unexpected $ in /home/heckys/public_html/outlet/includes/modules/shipping/upsxml.php on line 957 here is my UPSxml file: http://txcrew.coldyron.com/upsxml.phps let me know what you think Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 27, 2004 Share Posted December 27, 2004 txcrew, I see the problem. The "old" piece of code, that has been replaced by the bottom part of the lines of code you showed in your last post, should be taken out. To be precise, the following part (but take care, the new part looks very similar. It is right below the new part. ????????????for ($i=0; $i < sizeof($upsQuote); $i++) { ????????????????list($type, $cost) = each($upsQuote[$i]); ????????????????// BOF limit choices ????????????????if (!exclude_choices($type)) continue; ????????????????// EOF limit choices ????????????????if ( $method == '' || $method == $type ) { ???????????? $_type = $type; ???????????? ????if (isset($this->servicesTimeintransit[$type])) { ????????????????????$_type = $_type . ", ".$this->servicesTimeintransit[$type]["date"]; ????????????????} Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted December 27, 2004 Author Share Posted December 27, 2004 Bingo! Works perfectly! I'm still running some more tests on it, but thank you for such a great job on doing this! You really helped me out very much! 5/5 support! Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted December 27, 2004 Author Share Posted December 27, 2004 one more quick question: I want to remove one of the forced shipping methods in exchange for another. Current shipping methods that I use: Next Day Air, 2nd Day Air, Ground, 3 Day Select, Next Day Air Saver Current forced methods: Next Day Air, 2nd Day Air I would like to change, 2nd Day Air (forced) to Next Day Air Saver. What should I edit? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 27, 2004 Share Posted December 27, 2004 What should I edit?To add another one, add another line like this: $force_shipping_allowed_methods[] = MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_02; What it stands for can be found in the includes/languages/modules/shipping/upsxml.php file. To delete one... you can figure it out ;) Quote Link to comment Share on other sites More sharing options...
jonathn Posted December 30, 2004 Share Posted December 30, 2004 HI, I just installed the 19 Dec 2004 - UPS XML Rates and Services v1.1.4 and I'm getting the following errors: I too am getting the: Parse error: parse error, unexpected ';' in /home/canadacr/public_html/admin/modules.php(219) : eval()'d code on line 1 error... and I did not make any modifications to sql file. Also... I'm only getting one shipping method... i.e. UPS Standard. Is there any way to get other methods?? thanks jonathn You didn't change the column in one of the database tables from varchar(255) to text, or you did it after you installed UPS XML. What happens is that only part of the parameters is now in the database, therefore the error. Your second error I can't explain. The inserted code looks fine to me. Did you add the function remove_white_space to the bottom? : //****************************** function ready_to_shipCmp( $a, $b) { ? ?if ( $a['ready_to_ship'] == $b['ready_to_ship'] ) ? ?return 0; ? ?if ( $a['ready_to_ship'] > $b['ready_to_ship'] ) ? ?return -1; ? ?return 1; } //******************************* function remove_white_space(&$val, $key) { $val = trim($val); $val = (int)$val; ? ? } ?> Apparently, not the whole file could fit into the post. <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 31, 2004 Share Posted December 31, 2004 I too am getting the: Parse error: parse error, unexpected ';' in /home/canadacr/public_html/admin/modules.php(219) : eval()'d code on line 1 Read STEP 5 of the readme.txt included in the zip file and you know why that happened and what to do about it. After you corrected the problem I assume the other methods will show up too. Quote Link to comment Share on other sites More sharing options...
jonathn Posted January 1, 2005 Share Posted January 1, 2005 Thanks for the info... I did as you suggested but unfortunately, even tho I can choose all the different methods, when a customer buys something it only show UPS standard. I'm wondering if it has something to do with proximity or the fact the items will be shipping from Canada. Thanks again! jonathn Read STEP 5 of the readme.txt included in the zip file and you know why that happened and what to do about it. After you corrected the problem I assume the other methods will show up too. <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted January 1, 2005 Share Posted January 1, 2005 I'm wondering if it has something to do with proximity or the fact the items will be shipping from Canada.I wouldn't know, but if you enable logging (see the source code of includes/modules/shipping/upsxml.php for details) you can see the response of the UPS Server. If that only contains UPS Standard you know it is a UPS thing. If it contains several services (look for variations of "<RatedShipment><Service><Code>02</Code></Service>") in the logged response something else is wrong. Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted January 2, 2005 Author Share Posted January 2, 2005 my cart has been working fine up until today and now when I go to checkout I get this error: Fatal error: Call to undefined function: curl_init() in /home/heckys/public_html/outlet/includes/modules/shipping/upsxml.php on line 657 what could this be? Quote Link to comment Share on other sites More sharing options...
AussieFan Posted August 28, 2005 Share Posted August 28, 2005 To add another one, add another line like this: $force_shipping_allowed_methods[] = MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_02; What it stands for can be found in the includes/languages/modules/shipping/upsxml.php file. To delete one... you can figure it out ;) <{POST_SNAPBACK}> Hi there...Im new to all this code stuff...I simply want to remove some of the shipping options available to my customers. So far Ive been able to do it in USPS using the // in front of the shipping options on the usps.php file, but I dont know how to do for the international people and I also dont know how to remove options from UPS either...any help would be much appriciated. Thanks Oz Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 28, 2005 Share Posted August 28, 2005 I simply want to remove some of the shipping options available to my customers.I also dont know how to remove options from UPS either...any help would be much appriciated. If you use the standard UPS module that comes with osC, look in the contributions for UPS Choice. If you use UPSXML... well I guess by now you would have seen that it is a standard feature. Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 5, 2005 Author Share Posted November 5, 2005 Hey JanZ or anyone else who might know how to do this.... The hack to this contrib works, but I wanted to know how I can take this a step further and make this force shipping for everywhere but certain states, i.e., IL or MI. Hope you can help out! txcrew Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 5, 2005 Share Posted November 5, 2005 The hack to this contrib works, but I wanted to know how I can take this a step further and make this force shipping for everywhere but certain states, i.e., IL or MI. Wow, that is been a while. I assume you can add that since the variable $state has just been determined in the code and set to the zone_code from the table zones. So that would be IL and MI. This might work, change: if ($force_shipping == true && !in_array( $type, $force_shipping_allowed_methods)) { continue; } To: $force_shipping_allowed_states[] = 'IL'; $force_shipping_allowed_states[] = 'MI'; if ($force_shipping == true && !in_array($state, $force_shipping_allowed_states) && !in_array( $type, $force_shipping_allowed_methods)) { continue; } Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 5, 2005 Author Share Posted November 5, 2005 I assume you can add that since the variable $state has just been determined in the code and set to the zone_code from the table zones. So that would be IL and MI. This might work, change: What/Where do I add the zone codes? I assume that would be making IL=Illinois...correct? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 5, 2005 Share Posted November 5, 2005 What/Where do I add the zone codes? I assume that would be making IL=Illinois...correct? You don't need to add zone codes, those are in the default osC database tables. Just try the new piece of code :P Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 5, 2005 Author Share Posted November 5, 2005 Ahh, disregard that last message.... the code works as advertised!! One more question, how do I add 'Next Day Air Saver' as a forced shipping option? Thanks for all your help! Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 5, 2005 Share Posted November 5, 2005 txcrew, how do I add 'Next Day Air Saver' as a forced shipping option? As per post 30 on page 2 of this thread you should add to your catalog/includes/modules/shipping/upsxml.php file: $force_shipping_allowed_methods[] = MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_13; The upsxml.php file in catalog/includes/languages/english/modules/shipping defines that as Next Day Air Saver define('MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_13', 'UPS Next Day Air Saver'); Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 8, 2005 Author Share Posted November 8, 2005 Ok, here is a new one. I just decided to continue this thread instead of starting a new one because it is still relevant. I now have two products that are not able to be shipped, but are only available for in store pickup. I just installed the 'Store Pickup Shipping Module' contribution, found here: http://www.oscommerce.com/community/contri...ch,store+pickup With that being said, how do I enable the Store Pickup Shipping mod, and only this mod, for just these two products and none other. Please let me know when you get a chance. Thanks much! txcrew Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 10, 2005 Share Posted November 10, 2005 With that being said, how do I enable the Store Pickup Shipping mod, and only this mod, for just these two products and none other. This cannot be done with UPS XML. You have to alter the class shipping.php (/includes/classes/shipping.php). There the installed shipping modules are loaded with: if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); Borrowing the code from the function count_contents() in the class shopping_cart you can loop through the cart with that. Something like (haven't tried this): $pick_up_in_store = false; $product_to_pick_up_in_store_array = array('33', '44', '55', '66'); if (is_array($cart->contents)) { reset($cart->contents); while (list($products_id, ) = each($cart->contents)) { if (in_array($products_id, $product_to_pick_up_in_store_array)) { $pick_up_in_store = true; } } } If the variable $pick_up_in_store is true then make $this->modules only contain the store pickup shipping if it is false then unset the store pickup shipping mod from the array $this->modules. Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 13, 2005 Author Share Posted November 13, 2005 So should my shipping.php look like this? <?php /* $Id: shipping.php,v 1.23 2003/06/29 11:22:05 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class shipping { var $modules; // class constructor function shipping($module = '') { global $language, $PHP_SELF; if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); $pick_up_in_store = false; $product_to_pick_up_in_store_array = array('33', '44', '55', '66'); if (is_array($cart->contents)) { reset($cart->contents); while (list($products_id, ) = each($cart->contents)) { if (in_array($products_id, $product_to_pick_up_in_store_array)) { $pick_up_in_store = true; } } } $include_modules = array(); if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); } else { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); $include_modules[] = array('class' => $class, 'file' => $value); } } for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) { include(DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file']); include(DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']); $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']; } } } function quote($method = '', $module = '') { global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes; $quotes_array = array(); if (is_array($this->modules)) { $shipping_quoted = ''; $shipping_num_boxes = 1; $shipping_weight = $total_weight; if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) { $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT; } else { $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100); } if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT); $shipping_weight = $shipping_weight/$shipping_num_boxes; } $include_quotes = array(); reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if (tep_not_null($module)) { if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) { $include_quotes[] = $class; } } elseif ($GLOBALS[$class]->enabled) { $include_quotes[] = $class; } } $size = sizeof($include_quotes); for ($i=0; $i<$size; $i++) { $quotes = $GLOBALS[$include_quotes[$i]]->quote($method); if (is_array($quotes)) $quotes_array[] = $quotes; } } return $quotes_array; } function cheapest() { if (is_array($this->modules)) { $rates = array(); reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $quotes = $GLOBALS[$class]->quotes; for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) { if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'], 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')', 'cost' => $quotes['methods'][$i]['cost']); } } } } $cheapest = false; for ($i=0, $n=sizeof($rates); $i<$n; $i++) { if (is_array($cheapest)) { if ($rates[$i]['cost'] < $cheapest['cost']) { $cheapest = $rates[$i]; } } else { $cheapest = $rates[$i]; } } return $cheapest; } } } ?> Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 14, 2005 Author Share Posted November 14, 2005 I don't think that it should because that its not working... So, I guess the next step would be to find out where its going wrong. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 15, 2005 Share Posted November 15, 2005 I don't think that it should because that its not working... So, I guess the next step would be to find out where its going wrong. I understand you want to me to spell it out for you. Well, this is what the beginning of that file should look like: <?php /* $Id: shipping.php,v 1.23 2003/06/29 11:22:05 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class shipping { var $modules; // class constructor function shipping($module = '') { global $language, $PHP_SELF; if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); $include_modules = array(); $pick_up_in_store = false; global $cart; // $product_to_pick_up_in_store_array is an array with products_id's that need to trigger // the pick up in store module $product_to_pick_up_in_store_array = array('34', '44', '55', '66'); if (is_array($cart->contents)) { reset($cart->contents); while (list($products_id, ) = each($cart->contents)) { if (in_array($products_id, $product_to_pick_up_in_store_array)) { $pick_up_in_store = true; } } } // spu.php is the file name of the store pickup shipping module // http://www.oscommerce.com/community/contributions,164 if ($pick_up_in_store == false) { foreach($this->modules as $key=>$name_of_module_file) { if ($name_of_module_file == 'spu.php') { unset($this->modules[$key]); // removes the option of store pickup } } // end foreach } elseif ($pick_up_in_store == true) { foreach($this->modules as $key=>$name_of_module_file) { if ($name_of_module_file != 'spu.php') { unset($this->modules[$key]); // removes all shipping modules except store pickup } } // end foreach } if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); } else { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); $include_modules[] = array('class' => $class, 'file' => $value); } } Quote Link to comment Share on other sites More sharing options...
queasyprawn Posted November 16, 2005 Author Share Posted November 16, 2005 Works perfectly! Thank you so much!!! 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.