Zen Cart Logo
Forums / General Questions / Ceon advanced shipper & cheapest rates

Ceon advanced shipper & cheapest rates

Views: 1,041

Results 1 to 10 of 10
29 Jul 2014, 21:16
#1
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Ceon advanced shipper & cheapest rates

Because the website is using Ceon's advanced shipper, his local pickup option is really just a $0 option.

So how can I change the cheapest shipping option to become the highest option instead so that the $0 shipping isn't default?

Looking at the code in class shipping.php, I'm just not seeing math that I can flip to most expensive instead.

Code hints anyone? Dealing with arrays is always a problem for me but I did expect to see something I could play with.

Commenting out the code means nothing is default.

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;
          $size = sizeof($quotes['methods']);
          for ($i=0; $i<$size; $i++) {
            //              if ($quotes['methods'][$i]['cost']) {
            if (isset($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'],
                               'module' => $quotes['id']
              );
            }
          }
        }
      }

      $cheapest = false;
      $size = sizeof($rates);
      for ($i=0; $i<$size; $i++) {
        if (is_array($cheapest)) {
          // never quote storepickup as lowest - needs to be configured in shipping module
          if ($rates[$i]['cost'] > $cheapest['cost'] && $rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'willquote' ) {
            $cheapest = $rates[$i];
          }
        } else {
          if ($rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'willquote') {
            $cheapest = $rates[$i];
          }
        }
      }
      $this->notify('NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST', $cheapest);
      return $cheapest;
    }
  }
29 Jul 2014, 21:27
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon advanced shipper & cheapest rates

Per this comment and associated logic, it looks like storepickup should never be considered the cheapest option if the remaining instruction is "followed":

//##never##quote##storepickup##as##lowest##-##needs##to##be##configured##in##shipping##module

29 Jul 2014, 21:37
#3
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Ceon advanced shipper & cheapest rates

Yup, but ceon's module does not use the local delivery module. If it did, there wouldn't be a problem. It's a $0 shipping cost.

29 Jul 2014, 22:34
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon advanced shipper & cheapest rates

delia:

Yup, but ceon's module does not use the local delivery module. If it did, there wouldn't be a problem. It's a $0 shipping cost.

So are you saying that if the cost is 0 that you don't want it to be displayed as the cheapest? Is there not a way wherever the in store pickup is identified to either identify that the module is storepickup or to disable it as a lowest fare option?

If you do decide that regardless of the shipping method that a value of 0 should be excluded from consideration as the lowest price then the following should do that.

Was the first if modified from < to > in the first comparison? I don't think that it was intended to be a greater than symbol. Also, if with the greater than symbol the most expensive option still isn't being selected, it would seem that there is somewhere else that is looking up information.

if##($rates[$i]['cost']##<##$cheapest['cost']##&&##$rates[$i]['module']##!=##'storepickup'##&&##$rates[$i]['module']##!=##'willquote'##&& $rates[$i]['cost'] != 0)##

if##($rates[$i]['module']##!=##'storepickup'##&&##$rates[$i]['module']##!=##'willquote' && $rates[$i]['cost'] != 0)##{ 

{
31 Jul 2014, 02:04
#5
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Ceon advanced shipper & cheapest rates

mc12345678:

So are you saying that if the cost is 0 that you don't want it to be displayed as the cheapest? Is there not a way wherever the in store pickup is identified to either identify that the module is storepickup or to disable it as a lowest fare option?

If you do decide that regardless of the shipping method that a value of 0 should be excluded from consideration as the lowest price then the following should do that.

Was the first if modified from < to > in the first comparison? I don't think that it was intended to be a greater than symbol. Also, if with the greater than symbol the most expensive option still isn't being selected, it would seem that there is somewhere else that is looking up information.

yes, I tried switching the < > and it didn't make a difference.

I commented out the code I found for the cheapest (in two places) so now nothing is chosen as default so I don't think there's anything else at work here.

It's not using the store pickup mod - that's the point. Ceon's advanced shipping mod doesn't use it. Instead a shipping method has been created inside the advanced shipper which presents only as a $0 method. I wouldn't begin to even consider trying to escape a $0 in his code. With Conor gone there really isn't anyone to answer questions about his mods - no matter what a certain company tries to tell you.

So the answer has to be in the two sets of code I found. The other is just another smidgen in the checkout_shipping header

if ( !$_SESSION['shipping'] || ( $_SESSION['shipping'] && ($_SESSION['shipping'] == false) && (zen_count_shipping_modules() > 1) ) ) $_SESSION['shipping'] = $shipping_modules->cheapest();

So the answer has to be in the longer code I posted above.

31 Jul 2014, 04:49
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon advanced shipper & cheapest rates

delia:

yes, I tried switching the < > and it didn't make a difference.

I commented out the code I found for the cheapest (in two places) so now nothing is chosen as default so I don't think there's anything else at work here.

It's not using the store pickup mod - that's the point. Ceon's advanced shipping mod doesn't use it. Instead a shipping method has been created inside the advanced shipper which presents only as a $0 method. I wouldn't begin to even consider trying to escape a $0 in his code. With Conor gone there really isn't anyone to answer questions about his mods - no matter what a certain company tries to tell you.

So the answer has to be in the two sets of code I found. The other is just another smidgen in the checkout_shipping header

if ( !$_SESSION['shipping'] || ( $_SESSION['shipping'] && ($_SESSION['shipping'] == false) && (zen_count_shipping_modules() > 1) ) ) $_SESSION['shipping'] = $shipping_modules->cheapest();

> 
> So the answer has to be in the longer code I posted above.

You said there were two areas, the one above is what appears to call the function I suggested modifying.  The function originally provided unless that function "cheapest" is listed elsewhere is yes what does the calculations.  If there is no other identifying information that can be entered in the shipping module for the method of shipping representing the store pickup, I would say you have three options, either continue with the cheapest option being to pickup, to have no identified cheapest option, or to modify the code as I suggested above, although I don't know if you see # symbol's like I seem to see. If you do, try your best to ignore them.  I've only recently seen them in posts that use a code or quote tag.  Kinda weird, anyways, I can only base my response on the limited amount of code provided. I have glanced at the product on another's site, but do not recall what options are/were available. Thing is seeing the work that was done for these type modules I would think that such a "naming" type option would be available... Just seems to have that style.
31 Jul 2014, 10:54
#7
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Ceon advanced shipper & cheapest rates

Perhaps my original post wasn't clear. I think I know what needs modifying. I don't know how to change it.

01 Aug 2014, 10:51
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon advanced shipper & cheapest rates

Or maybe it was clear enough and I don't have enough information.

I'm still wondering, the code first published, is that exactly how that code is provided in an original install?
The first if statement does not make sense on a cheapest perspective to set the cheapest amount if the tested amount is greater than the currently tracked cheapest value. This led me to believe that the posted code had already been modified (to show the most expensive).

Being advised that there is no additional modification availanle when. Setting up the option that is being used for instore pickup, without going into another part of the code to flag that option for not considering it, the only other option I see and with the existing setup/software, is to omit shipping values that result in a 0 fee.

The skipping of the $0 fee would affect other circumstance where shipping was 0, but it ppears the code is written to handle/adjust for instorepickup, so if that aspect is incorporated (ie, either through the advanced shipping options) or by using the in store pickup mod, then the problem would be resolved.

I apologize that I haven't looked into the operational requirements of the advanced shipping mod (ie, not to use any other shipping module, how to designate a shipping method assigned by this module to be an instore pickup or for that matter a willquote type shipping method, etc.

01 Aug 2014, 12:16
#9
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Ceon advanced shipper & cheapest rates

I appreciate your willingness to help.

02 Aug 2014, 17:18
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Ceon advanced shipper & cheapest rates

delia:

I appreciate your willingness to help.

So, was able to look at this module a little. What is the reluctance to install the store pickup module? The code specifically is written to recognize it and to omit it from the cheapest listing selection...

Further, once presented there should only be one method of shipping that can be selected at once, so it is not like there is a "loss" of functionality... Have there been some sort of rules created to prevent someone from a far away land (or fitting some other "requirement") to choose the store pickup option? If so, those rules could be incorporated into the storepickup module...