coolguy Posted April 23, 2005 Share Posted April 23, 2005 Hi, I have downloaded and installed Local Delivery Option contribution. http://www.oscommerce.com/community/contributions,1993 It is so nice but it is not suitable for true local service as it is now. I am saying this in the sense that if we want to deliver in a City or Cities, it is not possible to do this now. Postal Code/Zip code option is there but entering all postal codes seperated by coma in a small text box is not possible as a big city has so many zip/postalcodes. Also creating a zone for a city is also not likely as Oscommerce is taking a Zone to be a state/Province and not City. I thought of a solution for the above problem that is using "City field" instead of "Zone" field. Now we have to enter postal codes seperated by coma's , instead we can enter cities seperated by coma's , as there will be few cities say at the max 5 that we deliver. I am pasting below the part of code which is dealing with the zone stuff, I request programmers here to have a look and give the code which uses city field instead of zone, or atleast please advice how to proceed. if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_DLY_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_DLY_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); $zipcodes=split (',',MODULE_SHIPPING_DLY_ZIPCODE); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { if ((in_array($order->delivery['postcode'],$zipcodes )) or (MODULE_SHIPPING_DLY_ZIPCODE=='')) $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { if ((in_array($order->delivery['postcode'],$zipcodes )or (MODULE_SHIPPING_DLY_ZIPCODE==''))) $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } I know it is very simple thing if we know how to do it, unfortunately I don't and I am up for help. Thanks. Link to comment Share on other sites More sharing options...
giftmaster Posted April 23, 2005 Share Posted April 23, 2005 Hi, I have downloaded and installed Local Delivery Option contribution. http://www.oscommerce.com/community/contributions,1993 It is so nice but it is not suitable for true local service as it is now. I am saying this in the sense that if we want to deliver in a City or Cities, it is not possible to do this now. Postal Code/Zip code option is there but entering all postal codes seperated by coma in a small text box is not possible as a big city has so many zip/postalcodes. Also creating a zone for a city is also not likely as Oscommerce is taking a Zone to be a state/Province and not City. I thought of a solution for the above problem that is using "City field" instead of "Zone" field. Now we have to enter postal codes seperated by coma's , instead we can enter cities seperated by coma's , as there will be few cities say at the max 5 that we deliver. I am pasting below the part of code which is dealing with the zone stuff, I request programmers here to have a look and give the code which uses city field instead of zone, or atleast please advice how to proceed. if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_DLY_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_DLY_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); $zipcodes=split (',',MODULE_SHIPPING_DLY_ZIPCODE); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { if ((in_array($order->delivery['postcode'],$zipcodes )) or (MODULE_SHIPPING_DLY_ZIPCODE=='')) $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { if ((in_array($order->delivery['postcode'],$zipcodes )or (MODULE_SHIPPING_DLY_ZIPCODE==''))) $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } I know it is very simple thing if we know how to do it, unfortunately I don't and I am up for help. Thanks. <{POST_SNAPBACK}> I know your problem. I did modify the mod to work with city. and you can also still use the zip code on the orig. :thumbsup: Ray Install this in shop/includes/modules/shipping. I change the file name to be dlyc.php C=city <?php /* $Id: dlyc.php,v 1.2 2004/11/18 16:29:56 ChBu Exp $ Dr. Bill Bailey, http://www.lowcarbnexus.com Zoe Lozada Almodovar, [email protected] VERY slight hack of dly.php by Dr. Bill Bailey, http://www.lowcarbnexus.com VERY slight hack of spu.php by dion made from original code by M. Halvorsen (http://www.arachnia-web.com) to allow local delivery from warehouse. Dr. Bill Bailey, http://www.lowcarbnexus.com Made to work with latest check-out procedure by Matthijs (Mattice) >> e-mail: [email protected] >> site: http://www.matthijs.org CHANGES (v1.2): - added selection of cities where this delivery is possible, it will not show up if the delivery is not in a selected city. CHANGES (v1.1): - added Minimum Total Order Value to configuration - updated code - added icon references CHANGES (v1.0): - formatted to work with latest checkout procedure - removed icon references - updated the db queries Released under the GNU General Public License */ class dlyc { var $code, $title, $description, $icon, $enabled; // class constructor function dlyc() { global $order; $this->code = 'dlyc'; $this->title = MODULE_SHIPPING_DLYC_TEXT_TITLE; $this->description = MODULE_SHIPPING_DLYC_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_DLYC_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_dly.gif'; // To remove icon change this line to: $this->icon = ''; $this->enabled = MODULE_SHIPPING_DLYC_STATUS; // Beg Minimum Order Total required to activate module $this->min_order = MODULE_SHIPPING_DLYC_MINIMUM_ORDER_TOTAL; if ( ($order->info['total']) < ($this->min_order) ) { $this->enabled = false; } // End Minimum Order Total required to activate module if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_DLYC_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_DLYC_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); $city=split (',',MODULE_SHIPPING_DLYC_CITY); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { if ((in_array($order->delivery['city'],$city )) or (MODULE_SHIPPING_DLYC_CITY=='')) $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { if ((in_array($order->delivery['city'],$city )or (MODULE_SHIPPING_DLYC_CITY==''))) $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order; $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_DLYC_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_DLYC_TEXT_WAY, 'cost' => MODULE_SHIPPING_DLYC_COST))); if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_DLYC_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enable Local Delivery', 'MODULE_SHIPPING_DLYC_STATUS', '1', 'Do you want to offer Local Delivery?', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Local Delivery Cost', 'MODULE_SHIPPING_DLYC_COST', '0.00', 'What is the Local Delivery cost? (The Handling fee will NOT be added.)', '6', '6', now())"); // Beg Minimum Order Total required to activate module tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Minimum Order Total', 'MODULE_SHIPPING_DLYC_MINIMUM_ORDER_TOTAL', '0.00', 'What is the Minimum Order Total required for this option to be activated.', '6', '7', now())"); // End Minimum Order Total required to activate module // Begin City tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zip codes', 'MODULE_SHIPPING_DLYC_CITY', '', 'Only enable this shipping method for these citys. Separate with comma if several, empty if all.', '6', '7', now())"); // End City tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_DLYC_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_DLYC_SORT_ORDER', '3', 'Sort order of display.', '6', '0', now())"); } function remove() { $keys = ''; $keys_array = $this->keys(); for ($i=0; $i<sizeof($keys_array); $i++) { $keys .= "'" . $keys_array[$i] . "',"; } $keys = substr($keys, 0, -1); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")"); } function keys() { return array('MODULE_SHIPPING_DLYC_STATUS', 'MODULE_SHIPPING_DLYC_COST', // Beg Minimum Order Total required to activate module 'MODULE_SHIPPING_DLYC_MINIMUM_ORDER_TOTAL', // End Minimum Order Total required to activate module // Begin City 'MODULE_SHIPPING_DLYC_CITY', // End City 'MODULE_SHIPPING_DLYC_SORT_ORDER', 'MODULE_SHIPPING_DLYC_ZONE'); } } ?> Here is your Language file it goes in shop/includes/languages/english/modules/shipping/dlyc.php <?php/* $Id: dly.php,v 1.0 2004/03/30 16:15:42 drbill Exp $ Slightly (very slightly!) hacked by Zoe Lozada Almodovar, [email protected] Slightly (very slightly!) hacked by Dr. Bill Bailey, http://www.lowcarbnexus.com Modified (slight hack) of spu by: Michael Halvorsen http://www.arachnia-web.com Copyright © 2002 Arachnia-web Development. Released under the GNU General Public License. May be used and modified without permission. */ define('MODULE_SHIPPING_DLYC_TEXT_TITLE', 'City Area Local Delivery Service'); define('MODULE_SHIPPING_DLYC_TEXT_DESCRIPTION', 'Delivered within a 10 mile radius of our warehouse location.'); define('MODULE_SHIPPING_DLYC_TEXT_WAY', 'Delivery will occur same day, or next business day, depending on when the order was received.'); ?> I hope this helps. Link to comment Share on other sites More sharing options...
coolguy Posted April 25, 2005 Author Share Posted April 25, 2005 Hello Ray, Thanks for the code, I did tried and have done the way you said above. But Local delivery is still showing up for the cities where Delivery is not available. Entering cities into the zipcodes text box is not having any effect. I entered into the box like, Nayagara, FortErie, StCatherines But shipping is Localdelivery is showing up for any city. Hope you will help with this thanks. Link to comment Share on other sites More sharing options...
giftmaster Posted April 25, 2005 Share Posted April 25, 2005 Hello Ray, Thanks for the code, I did tried and have done the way you said above. But Local delivery is still showing up for the cities where Delivery is not available. Entering cities into the zipcodes text box is not having any effect. I entered into the box like, Nayagara, FortErie, StCatherines But shipping is Localdelivery is showing up for any city. Hope you will help with this thanks. <{POST_SNAPBACK}> I had that problem at first, did you apply a zone to the mod in admin? I did not at first and it applied it to all cities. Let me know if this helps. Raymond Link to comment Share on other sites More sharing options...
coolguy Posted April 25, 2005 Author Share Posted April 25, 2005 Hi Ray, What you said above did the Job, now everything works as required for enabling Local delivery option in Selected cities which we set in admin. Thank you. For the rest of the people like me who are looking to do the same thing, there are few points to know to get this working. 1) Zone has to be set in order to get this Local delivery option with cities working. Zone mentioned here is not "Zones" in Location/Taxes in admin, it is "Tax Zones in Location/Taxes in admin" . On a stock OSC install(2.2 MS2) by default there is only one zone defined and it is "FLorida" To get this working you have to Define another Zone, i.e, the province in which the city you are going to deliver is located. Once you create a zone you have to click on that zone and insert the zone your city is located into it again, all you have to do is select the country and zone dropdowns and hit insert, by doing this we are done with the zones thing. Next is Just type in the cities you want to deliver seperated by coma into the "zipcode" text box and voila you got it working. Now on the front end when a customer checks out and if his Zone and city matches the Local delivery options values , the Local delivery option appears in shipping choices you have otherwise not. This contribution is real cool and very useful for people who deliver locally. My english is not great, someone who is good in english can make a nice readme.txt and put this files together and put in the contribution section so that it will be useful to others. Link to comment Share on other sites More sharing options...
Iggy Posted May 31, 2005 Share Posted May 31, 2005 Hi there, I went the other way with this and added all the zips. There are several places on the net to do zip look ups by city and it just seemed easier to me. You do have to modify the configuration_value field in configuration to blob in order to handle A LOT of zip codes but other than that it's cut/paste, enable zone, accept orders. I suppose if you have multiple states for local delivery you could just dupe the mod and set a new zone. Hope that helps someone! Iggy Everything's funny but nothing's a joke... Link to comment Share on other sites More sharing options...
giftmaster Posted May 31, 2005 Share Posted May 31, 2005 Hi there, I went the other way with this and added all the zips. There are several places on the net to do zip look ups by city and it just seemed easier to me. You do have to modify the configuration_value field in configuration to blob in order to handle A LOT of zip codes but other than that it's cut/paste, enable zone, accept orders. I suppose if you have multiple states for local delivery you could just dupe the mod and set a new zone. Hope that helps someone! Iggy <{POST_SNAPBACK}> Thanks for the tip on the configuration_value, That is the reason I went to cities beceause I had a lot of codes. This will help a lot on future sites :thumbsup: Link to comment Share on other sites More sharing options...
Skribble Posted July 19, 2005 Share Posted July 19, 2005 It works great, thanks for posting it I just wanted to know if there is a way to make it NOT case sensitive... Link to comment Share on other sites More sharing options...
Skribble Posted July 19, 2005 Share Posted July 19, 2005 It works great, thanks for posting it I just wanted to know if there is a way to make it NOT case sensitive... <{POST_SNAPBACK}> nevermind, i figured it out... Link to comment Share on other sites More sharing options...
Olleke Posted October 23, 2005 Share Posted October 23, 2005 How did you do it? :blink: And is it possible to use some kind of table rate? eg; up to 25 euro order the delivery cost is 5 euro and above 25 it's free. Link to comment Share on other sites More sharing options...
Olleke Posted October 23, 2005 Share Posted October 23, 2005 How did you do it? :blink: Some feature requests: Is it possible to use some kind of table rate? eg; up to 25 euro order the delivery cost is 5 euro and above 25 it's free. Oh, and can it be altered to use only the first 3 numbers of the postal code? :blink: Link to comment Share on other sites More sharing options...
irishcavan Posted October 27, 2005 Share Posted October 27, 2005 Oh, and can it be altered to use only the first 3 numbers of the postal code? :blink: Does anyone have the answer to this question? My shipping is based on zones (which is derived of the first 3 dig's of the zipcode), and depending on what zone and the amount of their order (ie $25 499.99, and above $500) their is a percentage added for shipping. thank, Irish Link to comment Share on other sites More sharing options...
queasyprawn Posted November 21, 2005 Share Posted November 21, 2005 Does anyone have the answer to this question? My shipping is based on zones (which is derived of the first 3 dig's of the zipcode), and depending on what zone and the amount of their order (ie $25 499.99, and above $500) their is a percentage added for shipping. thank, Irish I need to do this as well, does anyone know how to make this happen? Link to comment Share on other sites More sharing options...
spayce_girl Posted November 28, 2005 Share Posted November 28, 2005 Basically, you would have to create a new table of zip code prefixes. I ran into the same problem because having just one field for numerous zip codes wasn't acceptable. I also wanted separate prices for each zip code prefix. You can find a sample of this already existing in the fed ex mod http://www.oscommerce.com/community/contributions,490 Once you have entered your own zip code prefixes in the database, you need to update the catalog/includes/modules/shipping/dly.php file and query your database. Check the file included in the fed ex contribution I mentioned above. I am working on this update but won't be finished for a few days because I'm also adding the admin side to it. It will only work with defining zipcodes up to 4 digits (numbers and/or letters) and will find a match. Any specific questions just let pm me. My version has a slightly different logic than the fedex one but either will work. Best of luck to all! Link to comment Share on other sites More sharing options...
medved Posted August 30, 2006 Share Posted August 30, 2006 I had that problem at first, did you apply a zone to the mod in admin? I did not at first and it applied it to all cities.Let me know if this helps. Raymond Hi giftmaster, i downloaded the pages for the cities. It works. But in "Local Delivery Cost" i can enter only one price. Is ti possible to chnge it as it is in dly.php? There you have option to charge less for delivery if they order more. Please help. Link to comment Share on other sites More sharing options...
medved Posted August 31, 2006 Share Posted August 31, 2006 Basically, you would have to create a new table of zip code prefixes. I ran into the same problem because having just one field for numerous zip codes wasn't acceptable. I also wanted separate prices for each zip code prefix. You can find a sample of this already existing in the fed ex mod http://www.oscommerce.com/community/contributions,490 Once you have entered your own zip code prefixes in the database, you need to update the catalog/includes/modules/shipping/dly.php file and query your database. Check the file included in the fed ex contribution I mentioned above. I am working on this update but won't be finished for a few days because I'm also adding the admin side to it. It will only work with defining zipcodes up to 4 digits (numbers and/or letters) and will find a match. Any specific questions just let pm me. My version has a slightly different logic than the fedex one but either will work. Best of luck to all! Hi spayce_girl just wanted to ask if you made any contribution. I also need something like this. But i think i will not be able to do it without a step by step explanation Thank you very much, hopefully you answer soon. Link to comment Share on other sites More sharing options...
medved Posted September 7, 2006 Share Posted September 7, 2006 Is it possible for someone to modify this contribution ?Local Delivery v1.6? http://www.oscommerce.com/community/contributions,1993 so that only the post code prefixes could be entered? Plese help thank you very much. Link to comment Share on other sites More sharing options...
spayce_girl Posted September 8, 2006 Share Posted September 8, 2006 Hi Medved, I had forgotten about this. It was for a client. I'll package it up into a contribution and let you know when it's done. I'm working on a new php project so it will take 3 or 4 days. Best Regards! Link to comment Share on other sites More sharing options...
medved Posted September 8, 2006 Share Posted September 8, 2006 Hi Medved, I had forgotten about this. It was for a client. I'll package it up into a contribution and let you know when it's done. I'm working on a new php project so it will take 3 or 4 days. Best Regards! Ok thank you very much.. i will wait. let me know when i's done. i do appreciate your help. Link to comment Share on other sites More sharing options...
rforeman Posted October 20, 2006 Share Posted October 20, 2006 We have installed the Local Delivery contribution and it works fine. How do we handle cities where local delivery is not available? Because we want to prevent users from ordering when they are outside any of the the local delivery areas. Thanks Ron Foreman Ron Foreman EmpowerYou (647) 999-8543 Skype: RonForeman Link to comment Share on other sites More sharing options...
Guest Posted May 3, 2007 Share Posted May 3, 2007 Is it possible for someone to modify this contribution ?Local Delivery v1.6? http://www.oscommerce.com/community/contributions,1993 so that only the post code prefixes could be entered? Plese help thank you very much. Has anyone managed to resolve this yet? Thanks Ken Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.