- Posts: 5
- Thank you received: 0
Free Shipping method without product weight
- rodrigo1425
-
Topic Author
- Offline
Less
More
15 years 9 months ago #4079
by rodrigo1425
Free Shipping method without product weight was created by rodrigo1425
Hi, is it posible?
sorry for my english
Rodrigo
sorry for my english
Rodrigo
Please Log in or Create an account to join the conversation.
15 years 9 months ago #4081
by nicolas
Replied by nicolas on topic Re: Free Shipping method without product weight
Hi,
If you don't have a weight on a product, no shipping selection will be asked to the user.
If you don't have a weight on a product, no shipping selection will be asked to the user.
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4793
by brainforge
Replied by brainforge on topic Re: Free Shipping method without product weight
Would it be possible to change the shipping plug-in API to include a canDisplayShipping() method?
If not defined then behaviour is as at present.
i.e. when no weight defined then treat product(s) as virtual.
If defined then the shipping plug-in will decide for itself (e.g. from product fields) whether it is valid to display or not.
Shipping methods will display if any canDisplayShipping() method returns true, but will only display those methods for which canDisplayShipping() is true.
This avoids the need to add dummy / meaningless weights to products just to get the shipping options to display.
We are looking at 'Local Delivery' and 'Local Delivery with Installation' shipping options and weight may not be the primary variable.
E.G. installation offered with some products, not relevant with others.
If not defined then behaviour is as at present.
i.e. when no weight defined then treat product(s) as virtual.
If defined then the shipping plug-in will decide for itself (e.g. from product fields) whether it is valid to display or not.
Shipping methods will display if any canDisplayShipping() method returns true, but will only display those methods for which canDisplayShipping() is true.
This avoids the need to add dummy / meaningless weights to products just to get the shipping options to display.
We are looking at 'Local Delivery' and 'Local Delivery with Installation' shipping options and weight may not be the primary variable.
E.G. installation offered with some products, not relevant with others.
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4797
by nicolas
Replied by nicolas on topic Re: Free Shipping method without product weight
There is already the function onShippingDisplay which has this role.
The function onShippingDisplay is called with all the order information (in the variable $order) and the shipping methods (in the variable $dbrates) so that the shipping plugin can add the valid shipping methods (in the variable $usable_rates).
So in that function, you could parse the product information like this:
foreach($order->products as $k => $product){
//do something here
}
The function onShippingDisplay is called with all the order information (in the variable $order) and the shipping methods (in the variable $dbrates) so that the shipping plugin can add the valid shipping methods (in the variable $usable_rates).
So in that function, you could parse the product information like this:
foreach($order->products as $k => $product){
//do something here
}
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4812
by brainforge
Replied by brainforge on topic Re: Free Shipping method without product weight
From a further quick look at the code it still means that a weight must be specified somewhere in order to trigger a shipping method.
See controllers/checkout.php where you have code like this:
Could this be changed to something like:
Taking the manual shipping plugin as an example the first line of onShippingDisplay in manual/manual.php could then be changed from:
to:
This would maintain the existing behaviour while moving responsibility for the weight check into the shipping plug-in where it would be accessible to any developer writing a new shipping plug-in.
I notice this weight check occurs elsewhere in controllers/checkout.php so there might be other ramifications of this suggestion which would need investigation.
See controllers/checkout.php where you have code like this:
Code:
$shipping = ( bccomp(@$this->cartData->weight,0,5)>0 ? true : false );
if($shipping){
$class = hikashop::get('class.shipping');
$methods =& $class->getShippings($this->cartData);
Code:
$class = hikashop::get('class.shipping');
$methods =& $class->getShippings($this->cartData);
$shipping = !empty($methods);
if($shipping){
Code:
function onShippingDisplay(&$order,&$dbrates,&$usable_rates,&$messages){
if(empty($dbrates)){
Code:
function onShippingDisplay(&$order,&$dbrates,&$usable_rates,&$messages){
if (bccomp(@$order->weight,0,5)>0 ? false : true) {
return false;
}
if(empty($dbrates)){
I notice this weight check occurs elsewhere in controllers/checkout.php so there might be other ramifications of this suggestion which would need investigation.
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4824
by nicolas
Replied by nicolas on topic Re: Free Shipping method without product weight
Yes, that could be possible. We will look at doing that for next release. As you pointed out, there is more to it than just those two places and we will need to review the checkout carefully when doing it.
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4858
by brainforge
Replied by brainforge on topic Re: Free Shipping method without product weight
Thanks.
Please Log in or Create an account to join the conversation.
Time to create page: 0.177 seconds