New Zenner
- Join Date:
- Mar 2009
- Posts:
- 36
- Plugin Contributions:
- 0
Minimum shipping fee
*** duplicate post deleted *** Please do not post in more than one thread.
Views: 9,364
New Zenner
*** duplicate post deleted *** Please do not post in more than one thread.
New Zenner
Just curious... does the handling fee show a separate charge from the shipping charge during checkout so the customer can differentiate between the two?
Oba-san
No they are combined together ...
Totally Zenned
Ajeh:
umm ... well ... I'd search for the word:
cost
I did as you said and broke the USPS module. The module would not appear unless I undid everything.
How should it have been written?
This breaks it::unsure:
if ($cost < 6.00) {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => (6.00 + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
Oba-san
Probably a misplaced bracket ...
The original code reads:
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
$this->quotes['methods'] = $methods;
The code should read when changed:
if ($cost < 6.00) {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => (6.00 + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
}
$this->quotes['methods'] = $methods;
Totally Zenned
It's a beautiful thing!:clap:
Perhaps you'd like to create a new contribution to include all of these minimum shipping prices?
Oba-san
Glad you have this working now ... :smile:
Get enough examples and who needs an add-on? :cool:
New Zenner
Hi, im new to all this and was wondering if I could do a per item rate with a minimum shipping fee? thanks!
Oba-san
I want a Minimum of $9.00 shipping fee ... but just $1.50 per Item after that ...
I set the Item Rate item charges as:
Handling: 7.50
Per Item: 1.50
Now I get $9.00 plus $1.50 per additional item ... :smile:
Totally Zenned
Ajeh:
Probably a misplaced bracket ...
The original code reads:
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
$this->quotes['methods'] = $methods;
>
> The code should read when changed:
> ```
if ($cost < 6.00) {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => (6.00 + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
}
$this->quotes['methods'] = $methods;
Thanks for your new USPS update. How should this look now?:D
Oba-san
I do no t believe you'd need to make any changes to that since it is run off the $cost ...
Be sure to test it out ... :smile:
Totally Zenned
The cost did not work. I uploaded the new USPS.php and then went in and made the change. Was there something else?
Oba-san
Could you post the code from lines 218, start of the FOR loop to the end of the FOR loop in there?
Totally Zenned
Anything for you.:wink:
218 is a blank line, just for the record.
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
$cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
FYI- Priority Shipping went up $0.50 online. At east there is a slight discount for using Priority Flat rate envelopes.
Totally Zenned
That was dumb.
This is everything:
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
/
/ $cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
$this->quotes['methods'] = $methods;
*/
// BOF: USPS Minimum Shipping
if ($cost < 6.00) {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => (6.00 + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
}
$this->quotes['methods'] = $methods;
// EOF: USPS Minimum Shipping
Works Today!
Oba-san
You code works great but you appear to have commented out this line:
$cost = preg_replace('/[^0-9.]/', '', $cost);
Totally Zenned
Yeah that line of code could be useful :blush:
I inserted it right below where I added the tag BOF Minimum Shipping
Oba-san
Glad to hear that this still works for you ... :smile:
Good place to put the code so you don't exclude it in the future ... :cool:
Zen Follower
How can I make a minimum shipping fee of 9.50 across the board? We're using the UPS shipping module.
Oba-san
Adapt the USPS code above for UPS and use 9.50 instead of 6.00 ...
The UPS shipping module is at:
/includes/modules/shipping/ups.php
Tell staff why this post should be reviewed.