Jump to content

choose shipment type based on volume and not according to the weight


Recommended Posts

Hello, for my e-commerce website i need to choose shipment type based on volume of products and not according to their weight, is this possible to do?

Example:

i have to ship this 2 products

product 1 - 3kg - 1m^3
product 2 - 1kg - 0,5m^3

the amout of m^3 is 1,5, so i want the user can only choose shipment n.2

PS: i'm sorry for my bad english, i'm not so good at it..

Thankyou for your answers, cheers :)

Link to comment
Share on other sites

it's not possible without modifying core files and database, there is no newbie solution from my point of view.

but some general lines:
1. add for ps_product a new field called volume, decimal(4,2)
2. modify classes/Product.php to fit the new field volume (check the weight field for instance where it appears and just duplicate the same thing for volume)
3. in admin/tabs/AdminProducts.php duplicate what you have for weight for volume (so you can add volume for each product)
4. in classes/Carrier.php modify the function getCarriers: loop through the cart items to sum the volume up and depending on the value take out some carriers from the $carriers array

a second solution for points 1-3 is using product features but here you are left with no validation of the volume field (mandatory, integer)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...