Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Dear Friends,

 

 

I have spent several hours trying to discover how to use the extraship contribution to charge a fee for certain post codes, and to not charge anything to others.

 

 

The module allows to configure post code ranges for certain prices, example

 

post codes: 1000;1500;2000;2500

prices: 10,00;20,00;30,00;40,00

 

 

The problem is that I want to have some post codes with 0 cost, but If I configure one post code to 0 cost, I can't go on to the next step on checkout_shipping.php, I only can go on if I configure the checkout_shipping.php to allow free shipping, so I have trye to set up an If statement here:

 

if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {

$pass = false;

 

switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {

case 'national':

if ($order->delivery['country_id'] == STORE_COUNTRY) {

$pass = true;

}

break;

case 'international':

if ($order->delivery['country_id'] != STORE_COUNTRY) {

$pass = true;

}

break;

case 'both':

$pass = true;

break;

}

 

$free_shipping = false;

if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {

$free_shipping = true;

 

include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');

}

}

 

else {

if ($shipping_cost = 0) {

$free_shipping = true;}

 

else {

$free_shipping = false;}}

 

 

 

This statement works fine, cause if I change to "> 0" it uses the shipping module and adds the shipping cost, if I use "= 0" it allows free shipping. The problem is that the $shipping_cost variable is empty, so the value is allways 0. This variable comes from the extrashipping module, and I guess that it is only loaded after this statement cause it apears on the html output.

 

If anyone can help me to get this variable from the shipping module, or with another way to do this I'll apreciate.

 

Regards

David

Posted

Well after all I put all like it was and changed only the module file.

 

if ($extraship_cost <= 0 || $total_weight <= 0) {

$error = true;

} else {

$shipping_cost = $extraship_cost;

$shipping_method = MODULE_SHIPPING_EXTRASHIP_TEXT_WAY . ' ' . $dest_shipping . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_EXTRASHIP_TEXT_UNITS;

}

 

 

 

The new code:

 

if ($extraship_cost <= 0 || $total_weight <= 0) {

$shipping_cost = $extraship_cost;

$shipping_method = '<b>' . $dest_postcode . ' </b>' . MODULE_SHIPPING_EXTRASHIP_TEXT_WITHOUT;

 

} else {

$shipping_cost = $extraship_cost;

$shipping_method = $dest_postcode . ' = ' . $shipping_cost . ' ' . MODULE_SHIPPING_EXTRASHIP_TEXT_UNITS;

}

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...