There have been others with the same module(s) or others, generally speaking the process is the same. Sometimes the code goes in the __construct method, sometimes in the quote method.
For this (untested) it looks like could incorporate as follows:
At the end of the __construct method, the following code is expected:
Code:
if ($check_flag == false) {
$this->enabled = false;
}
}
}
Before the method's closing curly bracket, may want to add this for each of the methods:
Code:
if (IS_ADMIN_FLAG != true && $this->enabled == true) {
$weight = array();
$weight['use_min'] = false; // set to true/false if the min weight is needed for evaluation
$weight['use_max'] = true; // set to true/false if the max weight is needed for evaluation
$weight['min'] = 0; // enter smallest weight that is permitted for this method
$weight['max'] = 0.6; // enter weight under which this method still is available.
//if weight of order is outside the band of the allowed, then disable this method.
if (($weight['use_min'] && $order->total_weight < $weight['min']) || ($weight['use_max'] && $order->total_weight >= $weight['max'])) {
$this->enabled = false;
}
}
So the above would look like:
Code:
if ($check_flag == false) {
$this->enabled = false;
}
}
if ($this->enabled == true) {
$weight = array();
$weight['use_min'] = false; // set to true/false if the min weight is needed for evaluation
$weight['use_max'] = true; // set to true/false if the max weight is needed for evaluation
$weight['min'] = 0; // enter smallest weight that is permitted for this method
$weight['max'] = 0.6; // enter weight under which this method still is available.
//if weight of order is outside the band of the allowed, then disable this method.
if (($weight['use_min'] && $order->total_weight < $weight['min']) || ($weight['use_max'] && $order->total_weight >= $weight['max'])) {
$this->enabled = false;
}
}
}
For your min flat rate, would say that don't need to use the min value. This is as shown above.
For your mid rate, would need the low and high values and they need to be set accordingly.
For your high rate, you may want to limit to your highest weight you will ship, but otherwise would not use the max value.
Then there is the thought of incorporating those values into the setup instead of being coded with straight numbers as above. That too could be done so that the values are controllable in the admin instead of the file.
Shoot. I posted before verifying ->total_weight was the right value to use... won't have time to search and edit before post locks. If I'm wrong I'll have to make a separate post. Sorry... meant to search before posting.
Bookmarks