Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I want to offer local deliveries only, I've tried installing both the "City Delivery" & "Local Delivery Option" modules. They both allow me to only set one fixed rate for a list of cities, my question is, how can I set a second rate for a second group of cities?

 

Also, I diabled all other shipping module options, except the "Local Delivery Service" & the "Zone Rates" module. The "Local Delivery Service" module does give the correct shipping rate for the specified cities, however, since the "Zone Rates" module only allow me to select the Country, screening out only Countries and not States, the system allows orders with shipping addresses in other States to proceed without a shipping charge. Any idea how I can prevent customers from proceeding to checkout if the shipping address is outside my specified State??

Posted

simply create new module which will say the Local Delivery

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Posted
simply create new module which will say the Local Delivery

 

Thanks for your reply Alex. But I'm not sure if I know exactly what you mean, correct if I'm wrong, here's what I did, I made a dulipate copy of the "Local Delivery" module like you suggested, and named it "dly_2.php" as oppose to the original "dly.php". I've uploaded all the files, below are what I've uploaded:

 

catalog\includes\modules\shipping\dly_2.php

catalog\includes\languages\english\modules\shipping\dly_2.php

catalog\images\icons\shipping-dly.gif

 

I didn't do any adjustment to the files itself (because I don't know how, and I suspect that's the problem), except renaming them.

 

After the upload, everything from my admin's "Shipping Modules" control panel disappeared, the previously installed "Local Delivery" option, the "Flat Rate" option, the "Per Item" option, ect... everything gone, the only module that's left was the newly installed "Local Delivery" option. On top of that, I couldn't do anything with it, because the edit option panel is also gone. So I had to delete all the "dly_2.php" files and everything's back to normal.

 

I've looked at the original "dly.php" file using Dreamweaver, below is a copy of it, can you be so kind to instruct me as to what needs to be changed in order for the "dly_2.php" file to work please.

 

Also, any idea to my 2nd question from my original post? (how to rule out other States??)

Thank you so much in advance. :D

 

 

*/

 

class dly {

var $code, $title, $description, $icon, $enabled;

 

// class constructor

function dly() {

global $order;

$this->code = 'dly';

$this->title = MODULE_SHIPPING_DLY_TEXT_TITLE;

$this->description = MODULE_SHIPPING_DLY_TEXT_DESCRIPTION;

//Make module able to include taxe

$this->tax_class = MODULE_SHIPPING_ZONES_TAX_CLASS;

//Make module able to include taxe

$this->sort_order = MODULE_SHIPPING_DLY_SORT_ORDER;

$this->icon = DIR_WS_ICONS . 'shipping_dly.gif'; // To remove icon change this line to: $this->icon = '';

$this->enabled = MODULE_SHIPPING_DLY_STATUS;

// Beg Minimum Order Total required to activate module

$this->min_order = MODULE_SHIPPING_DLY_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_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");

$city_up = MODULE_SHIPPING_DLY_CITY;

$city_up=strtoupper($city_up);

$city_up=str_replace (" ", "", $city_up);

$citycodes=split (',',$city_up);

$order->delivery['city']=strtoupper($order->delivery['city']);

$order->delivery['city']=str_replace (" ", "", $order->delivery['city']);

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

if ((in_array($order->delivery['city'],$citycodes )) or (MODULE_SHIPPING_DLY_CITY==''))

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->delivery['zone_id']) {

if ((in_array($order->delivery['city'],$citycodes )or (MODULE_SHIPPING_DLY_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_DLY_TEXT_TITLE,

'methods' => array(array('id' => $this->code,

'title' => MODULE_SHIPPING_DLY_TEXT_WAY,

'cost' => MODULE_SHIPPING_DLY_COST)));

 

if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

//Make module able to include taxe

if ($this->tax_class > 0) {

$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

}

//Make module able to include taxe

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_DLY_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_DLY_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_DLY_COST', '0.00', 'What is the Local Delivery cost? (The Handling fee will NOT be added.)', '6', '6', now())");

//Make module able to include taxe

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 ('Tax Class', 'MODULE_SHIPPING_ZONES_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");

//Make module able to include taxe

// 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_DLY_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 ('City names', 'MODULE_SHIPPING_DLY_CITY', '', 'Only enable this shipping method for these cities. 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_DLY_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_DLY_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_DLY_STATUS',

'MODULE_SHIPPING_DLY_COST',

//Make module able to include taxe

'MODULE_SHIPPING_ZONES_TAX_CLASS',

//Make module able to include taxe

// Beg Minimum Order Total required to activate module

'MODULE_SHIPPING_DLY_MINIMUM_ORDER_TOTAL',

// End Minimum Order Total required to activate module

// Begin City

'MODULE_SHIPPING_DLY_CITY',

// End City

'MODULE_SHIPPING_DLY_SORT_ORDER',

'MODULE_SHIPPING_DLY_ZONE');

}

}

?>

Posted

Yeah, you have to edit the files to reflect the new filename. Something like where it says

MODULE_SHIPPING_DLY

change to

MODULE_SHIPPING_DLY_2

Posted
Yeah, you have to edit the files to reflect the new filename. Something like where it says

MODULE_SHIPPING_DLY

change to

MODULE_SHIPPING_DLY_2

 

Thanks Leslie, I finally got the local delivery module working now.

But I'm still having trouble with the system allowing orders outside of my delivery region to go through, any idea how to fix this?

 

Here are the dilemmas,

 

1. if I enable only the "Local Delivery" module and nothing else, orders with shipping addresses to all Countries & all States or Provinces will be processed without any delivery charge.

 

2. if I enable the "Zone Rates" module, put in only the Country that I'm in, orders with shipping addresses to all other Countries will not be able to proceed. But, orders with shipping addresses to all States / Provinces within the defined Country will still be processed.

 

3. if I enable the "Zone Rates" module, put in only the Country that I'm in, orders with shipping addresses to within the defined Cities (under the "Local Delivery" module) will not only get the "local delivery rate", the "zone rate" will also appear as an option for the customer to choose. Even if I set the "zone rate" to $0.00, it will still appear as an option at the checkout, very confusing to customers, below is what it looks like:

 

 

Shipping Method

 

Please select the preferred shipping method to use on this order.

 

Local Delivery Service

Delivery will occur same day, or next business day, depending on when the order was received. $15.00

 

Zone Rates

The shipping rate cannot be determined at this time $0.00

 

 

Any idea?? Is there a Code that I can put into the "Local Delivery" module, or elsewhere, to permit only the specified Country and the specified State / Province?

Posted
Thanks Leslie, I finally got the local delivery module working now.

But I'm still having trouble with the system allowing orders outside of my delivery region to go through, any idea how to fix this?

 

Here are the dilemmas,

 

1. if I enable only the "Local Delivery" module and nothing else, orders with shipping addresses to all Countries & all States or Provinces will be processed without any delivery charge.

 

2. if I enable the "Zone Rates" module, put in only the Country that I'm in, orders with shipping addresses to all other Countries will not be able to proceed. But, orders with shipping addresses to all States / Provinces within the defined Country will still be processed.

 

3. if I enable the "Zone Rates" module, put in only the Country that I'm in, orders with shipping addresses to within the defined Cities (under the "Local Delivery" module) will not only get the "local delivery rate", the "zone rate" will also appear as an option for the customer to choose. Even if I set the "zone rate" to $0.00, it will still appear as an option at the checkout, very confusing to customers, below is what it looks like:

Shipping Method

 

Please select the preferred shipping method to use on this order.

 

Local Delivery Service

Delivery will occur same day, or next business day, depending on when the order was received. $15.00

 

Zone Rates

The shipping rate cannot be determined at this time $0.00

Any idea?? Is there a Code that I can put into the "Local Delivery" module, or elsewhere, to permit only the specified Country and the specified State / Province?

You need to configure your zones to work in the zones module. Done by using the two letter country codes.

 

You need to set zip codes/postcodes to work with LDY, plus shipping zone (your country zone).

Posted
You need to configure your zones to work in the zones module. Done by using the two letter country codes.

 

You need to set zip codes/postcodes to work with LDY, plus shipping zone (your country zone).

 

Thanks Leslie, I've been playing around with your suggestions all day today & yesterday, but I still don't know why I can't seem to get it. I don't know what I'm missing.

 

Here are my encounters:

 

If I've enabled the "Local Delivery" modules only, in that I've defined the Cities, and set up their rates.

This allows the system to pick out the appropriate rate when the customer's delivery address falls within those defined Cities. But if the delivery address is anything other than my pre-defined Cities, ie. other Countries or other States/Provinces, the system proceeds to the checkout without any delivery charge, that's no good.

 

If I enable both the "Local Delivery" modules & the "Zone Rates" module, keeping all the settings in the "Local Delivery" modules the same, and setting the "Zone Rates" module to the Country of my store only. The system does elimate all delivery addresses except the Country of my choice, and displays a message saying "No shipping available to the selected country", and disallowing further proceedings, which is all good. But, 2 problems arose with this setup:

 

1. with delivery addresses within the defined "Zone", ie. Country, but in a different State/Province, or even in a different City that I did not include in the "Local Delivery" modules (which means areas that I don't deliver),

the system states:

 

Zone Rates

The shipping rate cannot be determined at this time $0.00

but still allows the customer to proceed to the checkout without any delivery charge.

 

2. since the "Zone Rates" module is activated, for delivery addresses within the defined "Local Delivery" modules, ie. Cities, the system displays both the "Local Delivery" rate and the "Zone Rate" for the customer to choose,

 

Local Delivery Service

Delivery will occur same day, or next business day, depending on when the order was received. $10.00

 

Zone Rates

The shipping rate cannot be determined at this time $0.00

 

 

If what I'm trying to achieve is totally not possible by using those shipping modules, is it possible to change the "checkout_shipping_address.php". During the checkout, when it asks for "New Shipping Address", instead of asking for data input into the "City", "States/Province" & "Country" text fields, can that be changed into a drop down menu with just the cities, states/provinces & countries of my choice?? If this is viable, can you or anyboby show me how to modify the "checkout_shipping_address.php" plus any other related files that needs to be modified. It will be very much appreciated.

Posted (edited)

Can anybody help me modify the following code, so that it can become a drop down list menu with only "USA & Canada" as the only two choose. I don't want to delete the rest of the countries from my country list under my admin page. This is from the "checkout_new_address.php" page, and the result should be sent to the "address_book.php". Thanks.

 

 

<tr>

<td class="main"><?php echo ENTRY_COUNTRY; ?></td>

<td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

</tr>

Edited by vernal
Posted
Can anybody help me modify the following code, so that it can become a drop down list menu with only "USA & Canada" as the only two choose. I don't want to delete the rest of the countries from my country list under my admin page. This is from the "checkout_new_address.php" page, and the result should be sent to the "address_book.php". Thanks.

<tr>

<td class="main"><?php echo ENTRY_COUNTRY; ?></td>

<td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

</tr>

Look at post number 10 here http://www.oscommerce.com/forums/index.php?showtopic=59366

Posted

 

I've tried that already, it only puts the country of your choice on top of the list, it doesn't elimate the rest. I've also tried installing the "Active Countries" contribution, that didn't work for me either. Since I only offer delivery to one State/Province in one Country, but do accept orders from all over the world. With this contribution, the Country part works for me, but the Zone part doesn't. When I active the one country of my choice for shipping, all the zones (meaning all states/provinces) within that country are active by default. So if I deactive the rest of the zones within that country, leaving the one zone of my choice active, those zones that I've deactivated will not showup under the drop down list in the Create Account & the Billing forms.

 

I have no prior experience with php or programing in that matter, as one might noticed, so I've looked through tons of postings, and have read many guide books, but still no success :( . Any help would be much appreciated.

 

 

Below is what I've done to the "checkout_new_address.php" file:

  <tr>
<td class="main"><?php echo ENTRY_CITY; ?></td>
<td class="main"><?php 

	$city_array[] = array('id' => '','text' => PULL_DOWN_DEFAULT);
	$city_array[] = array('id' => '1','text' => 'Vancouver');
	$city_array[] = array('id' => '2','text' => 'Richmond');
	$city_array[] = array('id' => '3','text' => 'Burnaby');
	$city_array[] = array('id' => '4','text' => 'Surrey');
	$city_array[] = array('id' => '5','text' => 'Langley');
	$city_array[] = array('id' => '6','text' => 'North Vancouver');
	$city_array[] = array('id' => '7','text' => 'West Vancouver');

echo tep_draw_pull_down_menu('city', $city_array) . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
 </tr>

<?php
 if (ACCOUNT_STATE == 'true') {
?>
 <tr>
<td class="main"><?php echo ENTRY_STATE; ?></td>
<td class="main"><?php echo tep_draw_hidden_field('state') . ' ' . (tep_not_null(ENTRY_STATE_DELIVERY) ? '<span class="inputRequirement">' . ENTRY_STATE_DELIVERY . '</span>': ''); ?></td>
 </tr>

<?php
 }
?>

 <tr>
<td class="main"><?php echo ENTRY_COUNTRY; ?></td>
<td class="main"><?php echo tep_draw_hidden_field('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_DELIVERY) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_DELIVERY . '</span>': ''); ?></td>
 </tr>

 

 

Below is the result of the above codes:

89700099_o.jpg

 

 

Problems:

1. Got the following error messages:

i. Your City must contain a minimum of 3 characters. (even though there is a drop down list, the system doesn't seem to acknowledge it.)

ii. Please select a state from the States pull down menu.

iii. You must select a country from the Countries pull down menu.

 

2. The text became red instead of black.

 

 

Any idea???

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...