Forums / Built-in Shipping and Payment Modules / freeoptions shipping method problem

freeoptions shipping method problem

Results 1 to 20 of 31
06 Feb 2012, 00:22
#1
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

freeoptions shipping method problem

Hello
how can I disable all shipping options when I turn on my freeoptions shipping method in the admin.
time to time we offer shipping value and we want to shut down all other shipping methods automatically as soon as i turn on the "freeoptions shipping method"
I can add some php code within the shipping method?

Tanks
06 Feb 2012, 14:44
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

What is the criteria of the Free shipping and is it for everyone or just a Zone when that criteria is met? :unsure:
06 Feb 2012, 14:52
#3
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Hello
thanks for answering. I have several zones in my shop but i want only to one zone. if i do a campaign and activate freeoptions shipping method in the admin, and if its value is €90, all purchases over €90 show only the option free shipping.
06 Feb 2012, 15:32
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

I have to admit that showing the Free Shipping Options freeoptions when the order is >= 90.00 and the customer is in the right Zone at the same time as the other shipping modules is way easier than trying to turn off all of the other shipping modules and only show this shipping module ...

Advantage: customer can choose other methods to expedite the shipping and you do not have have to do a heck of a lot of rewritting of the other shipping modules ...

What other shipping module(s) are you using? :unsure:
06 Feb 2012, 15:50
#5
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

shipping modules:
flat
flatClone
PayPal
flattransf
freeoptions
item
storepickup

I do not mind making changes shipping modules, i have made ​​many changes in payment modules. if i have the code so i can disconnect the modules...:clap:
06 Feb 2012, 16:03
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

You need to make a Zone Definition and set the DEFINE for who is allowed the Free Shipping Options freeoptions and set it on that shipping module with the Total >= 90 ...

Next, look at what the Zone Definition value is in the URL where you will see:
zID=XX

Now, say you wanted to customize the Flat Rate flat to turn off for this Zone Definition when the order is >= 90 ...

You can add the code in RED to do this:
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }

// bof: turn off for over 90 and zone 92
      if ( ($this->enabled == true) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . 92 . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }
        if ($check_flag == true && ($order->info['total'] - $order->info['shipping_cost']) >= 90) {
          $this->enabled = false;
        }
      }
// eof: turn off for over 90 and zone 92

    }

// class methods


Change the 92 to match your zID ...

Then adapt that to your other shipping modules ...
06 Feb 2012, 16:21
#7
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

thank you very much
I'll test and then say if it workes.
thanks again Ajeh
06 Feb 2012, 16:38
#8
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Ajeh:

You need to make a Zone Definition and set the DEFINE for who is allowed the Free Shipping Options freeoptions and set it on that shipping module with the Total >= 90 ...

Next, look at what the Zone Definition value is in the URL where you will see:
zID=XX

Now, say you wanted to customize the Flat Rate flat to turn off for this Zone Definition when the order is >= 90 ...

You can add the code in RED to do this:
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }

// bof: turn off for over 90 and zone 92
      if ( ($this->enabled == true) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . 92 . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }
        if ($check_flag == true && ($order->info['total'] - $order->info['shipping_cost']) >= 90) {
          $this->enabled = false;
        }
      }
// eof: turn off for over 90 and zone 92

    }

// class methods


Change the 92 to match your zID ...

Then adapt that to your other shipping modules ...


but tell me, if i put this code in the shipping modules and the module freeoptions is disabled, will the shipping modules Enables if the purchases Total >= 90?
06 Feb 2012, 16:48
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

Why would you have the Free Shipping Options freeoptions disabled?

You need that for orders over 90 and your Zone Definition that you make ...

If you need to turn off the code based on turning on or off a sales campaign that is giving this Free Shipping for the one zone and whatever the amount is ... you could customize the code further that the 90 amount is an amount that is set in something like the extras directory:
/includes/extra_configures

and a file such as:
extra_shipping_free_options.php

and set a session variable such as:
$_SESSION['free_shipping_options_amount'] = 90;

Then use that in the custom code ...

When you want to run that off, set the amount from 90 to something like:
$_SESSION['free_shipping_options_amount'] = 10000;
06 Feb 2012, 16:59
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

Why would you have the Free Shipping Options freeoptions disabled?

You need that for orders over 90 and your Zone Definition that you make ...

If you need to turn off the code based on turning on or off a sales campaign that is giving this Free Shipping for the one zone and whatever the amount is ... you could customize the code further that the 90 amount is an amount that is set in something like the extras directory:
/includes/languages/english/extra_definitions

and a file such as:
extra_shipping_free_options.php

and set a session variable such as:
$_SESSION['free_shipping_options_amount'] = 90;

Then use that in the custom code ...

When you want to run that off, set the amount from 90 to something like:
$_SESSION['free_shipping_options_amount'] = 10000;

That should trigger the session variable soon enough for the modules ...
06 Feb 2012, 17:12
#11
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

sorry but this is too much for me. I think I can not do this. Now is 5pm in Portugal (Europe) im going to try later but it will be difficult.
Tanks You are OK:bigups:
07 Feb 2012, 10:53
#12
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Ajeh:

You need to make a Zone Definition and set the DEFINE for who is allowed the Free Shipping Options freeoptions and set it on that shipping module with the Total >= 90 ...

Next, look at what the Zone Definition value is in the URL where you will see:
zID=XX

Now, say you wanted to customize the Flat Rate flat to turn off for this Zone Definition when the order is >= 90 ...

You can add the code in RED to do this:
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }

// bof: turn off for over 90 and zone 92
      if ( ($this->enabled == true) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . 92 . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }
        if ($check_flag == true && ($order->info['total'] - $order->info['shipping_cost']) >= 90) {
          $this->enabled = false;
        }
      }
// eof: turn off for over 90 and zone 92

    }

// class methods


Change the 92 to match your zID ...

Then adapt that to your other shipping modules ...


Hello. I try your code and works fine for one porpose. Tell me someting it´s not possible to install a code in the shipping modules to torn on and off the modules when freeoptions is on (only for one zone).
07 Feb 2012, 13:53
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

Can you give a little more detailed example of what you are trying to do? :unsure:
07 Feb 2012, 15:00
#14
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Ajeh:

Can you give a little more detailed example of what you are trying to do? :unsure:

ok
for zone 1 i have shipping models:
flat
store pickup
flattransf
flatclone
flatpaypal

i turn on the module freeoptions ( with >=90 ) everything is on (flat, store pickup, flattransf, flatclone and flatpaypal) if the order is <90 if the order is >=90 only the module freeoptions is on, the others shipping modules disappear. This is only for one zone.
07 Feb 2012, 15:21
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

That is how it is designed to work ... what is it you want to change? :unsure:
07 Feb 2012, 15:31
#16
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Ajeh:

That is how it is designed to work ... what is it you want to change? :unsure:


if i install the code that you give me in all the shipping modules they go off if order >=90 (if i have module freeoptions).
I want :
wall modules work normal if module freeoptions is off even the order is <90 or >=90
wall modules work normal if module freeoptions is on, but they go off if order >=90, only module freeoptions is on
07 Feb 2012, 15:38
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

Currently, if the order is >= 90 and the Zone is correct, then all the shipping modules except Free Shipping Options freeoptions turn off ...

But, if the Zone does not match, and the order is >= 90 all of the other shipping modules work, correct?

Is the problem that you are trying to turn off this feature sometimes? :unsure:
07 Feb 2012, 15:59
#18
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Ajeh:

Currently, if the order is >= 90 and the Zone is correct, then all the shipping modules except Free Shipping Options freeoptions turn off ...

But, if the Zone does not match, and the order is >= 90 all of the other shipping modules work, correct?

Is the problem that you are trying to turn off this feature sometimes? :unsure:


Can the modules go on or off depending the shipping cost of freeoptions module?
if i do >=500 the others modules go off, if i do >=40 the others modules go off, automatically they only go off depending of shipping cost of freeoptions module. the freeoptions module is always on
07 Feb 2012, 16:09
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: freeoptions shipping method problem

You could do this ...

Create a file called:
/includes/languages/english/extra_definitions/extra_free_shipping_options.php

and enter the code:
<?php
$_SESSION['free_shipping_options_amount'] = 90;


Change in the shipping modules the 90 to be:
$_SESSION['free_shipping_options_amount']

Now, when you want to use the Free Shipping Options with the 1 Zone, have the file:
/includes/languages/english/extra_definitions/extra_free_shipping_options.php

set to 90 ...

When you do not want to use this, set it to 10000 ...

Does this do what you are trying to do? :unsure:
07 Feb 2012, 16:21
#20
dinix avatar

dinix

Zen Follower

Join Date:
May 2006
Posts:
102
Plugin Contributions:
0

Re: freeoptions shipping method problem

Ajeh:

You could do this ...

Create a file called:
/includes/languages/english/extra_definitions/extra_free_shipping_options.php

and enter the code:
<?php
$_SESSION['free_shipping_options_amount'] = 90;


Change in the shipping modules the 90 to be:
$_SESSION['free_shipping_options_amount']

Now, when you want to use the Free Shipping Options with the 1 Zone, have the file:
/includes/languages/english/extra_definitions/extra_free_shipping_options.php

set to 90 ...

When you do not want to use this, set it to 10000 ...

Does this do what you are trying to do? :unsure:

i have this
if ( ($this->enabled == true) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . 6 . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == true && ($order->info['total'] - $order->info['shipping_cost']) >= 700) {
$this->enabled = false;
}
}

change to this???
if ( ($this->enabled == true) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $_SESSION['free_shipping_options_amount'] . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == true && ($order->info['total'] - $order->info['shipping_cost']) >= 700) {
$this->enabled = false;
}
}