Different shipping costs according to product size
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Different shipping costs according to product size
Hello everyone,
I've been struggling with the shipping costs for some time now. There are products that have different size and weight.
But I can only tell: Shipping costs: DHL: xx.xx€, UPS yy.yy€, etc.
Of course I can add costs for shipping to each product itself which is shown in the shopping basket. But on the delivery/shipping page there is "0.00€" next to each shipping provider and that's inconsistent and ugly.
I read about decorators and so forth but is there a simple way to do that in the backend?
I haven't found a good tutorial for the creation of decorators and how to use (size) attributes I created myself and I don't have time to learn this from scratch.
Does anyone have a clue on what to do?
Thank you very much!
I've been struggling with the shipping costs for some time now. There are products that have different size and weight.
But I can only tell: Shipping costs: DHL: xx.xx€, UPS yy.yy€, etc.
Of course I can add costs for shipping to each product itself which is shown in the shopping basket. But on the delivery/shipping page there is "0.00€" next to each shipping provider and that's inconsistent and ugly.
I read about decorators and so forth but is there a simple way to do that in the backend?
I haven't found a good tutorial for the creation of decorators and how to use (size) attributes I created myself and I don't have time to learn this from scratch.
Does anyone have a clue on what to do?
Thank you very much!
Re: Different shipping costs according to product size
If the shipping costs of your products is mainly based on their weight, you can use the Weight decorator which is available out of the box:
https://github.com/aimeos/aimeos-core/b ... Weight.php
Most of the documentation about services (and decorators) is available here:
https://aimeos.org/docs/Developers/Library/Service
https://github.com/aimeos/aimeos-core/b ... Weight.php
Most of the documentation about services (and decorators) is available here:
https://aimeos.org/docs/Developers/Library/Service
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Different shipping costs according to product size
Thank you for your answer.
I don't get along with this decorator thing. I searched for quite a long time now, but I don't find information on how to configure the decorators (for non-specialists). Is there somewhere a list of key-value-pairs to use? I guess I need a tutorial for dummies.
I see the reduction example with key 'reduction.basket-value-min' and value '{"EUR":"20"}'
That is pretty clear so far.
But how to trigger the weight decorator? Specifying the price of a product, you have to define a currency. That's where "EUR" comes from. 'Weight' is just a property with a value, no unit.
So what key and value do I have to use for the weight decorator? Is it like:
weight.max:{"kg":"10.0"}?
My decorator configuration does exactly... nothing!
I'm an absolute beginner so I hope you don't mind these questions. What should I see, if it was working?
Thank you very much
I don't get along with this decorator thing. I searched for quite a long time now, but I don't find information on how to configure the decorators (for non-specialists). Is there somewhere a list of key-value-pairs to use? I guess I need a tutorial for dummies.
I see the reduction example with key 'reduction.basket-value-min' and value '{"EUR":"20"}'
That is pretty clear so far.
But how to trigger the weight decorator? Specifying the price of a product, you have to define a currency. That's where "EUR" comes from. 'Weight' is just a property with a value, no unit.
So what key and value do I have to use for the weight decorator? Is it like:
weight.max:{"kg":"10.0"}?
My decorator configuration does exactly... nothing!
I'm an absolute beginner so I hope you don't mind these questions. What should I see, if it was working?
Thank you very much
Re: Different shipping costs according to product size
To use the "Weight" decorator in combination with e.g. the "Manual" delivery service provider, you have to enter
into the "Provider" input field in the service item detail view (expert mode, "Service" tab).
The weight decorator has two configuration options you can add on the right side of the service item detail view:
- weight.min
- weight.max
Both require almost a number without measure, e.g.
As you've already noted, there's no measure included. It's assumed that you always use the same measure for all package weights, e.g. kg, g, lbs, etc. that you enter in the "Physical values" tab of the product detail view in the simple mode admin interface. The example above would show the delivery service item using the "Manual" provider only if the sum of the weight of all products is between 10 and 15.75 (whatever measure you use).
Code: Select all
Manual,Weight
The weight decorator has two configuration options you can add on the right side of the service item detail view:
- weight.min
- weight.max
Both require almost a number without measure, e.g.
Code: Select all
weight.min 10.0
weight.max 15.75
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Different shipping costs according to product size
Thank you very much for that quick answer.
I configured everything exactly as you described it. I defined a product weight of 0.6 (kg).
I have defined a weight range from (weight.min) 0.6 to (weight.max) 10.0 (see image1).
Now I add the article 20 times to my shopping basket. But the behavior didn't change at all...
I get to the details of my shopping basket and it still calculates 20 times the shipping costs, etc.
I would be grateful if you could give me another hint on what I'm doing wrong.
I configured everything exactly as you described it. I defined a product weight of 0.6 (kg).
I have defined a weight range from (weight.min) 0.6 to (weight.max) 10.0 (see image1).
Now I add the article 20 times to my shopping basket. But the behavior didn't change at all...
I get to the details of my shopping basket and it still calculates 20 times the shipping costs, etc.
I would be grateful if you could give me another hint on what I'm doing wrong.
- Attachments
-
- image1.png (4.36 KiB) Viewed 5517 times
Re: Different shipping costs according to product size
There's still an error in reasoning. You've configured shippings costs in your product (costs per item) and if you add that product 20 times, you will get 20 times the shipping cost added (because it's per single item) in the basket.
The Weight decorator applies to the delivery option in the delivery page of the checkout process. It can show or hide delivery options depending if the weight of all products is in the configured range of the Weight decorator added to the delivery option or not. It doesn't change the shipping costs attached to a delivery option or the shipping costs per item!
Hence, remove the costs per item in your product and add three delivery options, each with its own price:
- Up to 0.6
- From 0.6 to 10.0
- Over 10.0
If you add the product (0.6kg) 20 times, only the delivery option for over 10kg will be shown.
The Weight decorator applies to the delivery option in the delivery page of the checkout process. It can show or hide delivery options depending if the weight of all products is in the configured range of the Weight decorator added to the delivery option or not. It doesn't change the shipping costs attached to a delivery option or the shipping costs per item!
Hence, remove the costs per item in your product and add three delivery options, each with its own price:
- Up to 0.6
- From 0.6 to 10.0
- Over 10.0
If you add the product (0.6kg) 20 times, only the delivery option for over 10kg will be shown.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Different shipping costs according to product size
Thank you very much, that did it!
I really appreciate your help and I'm very grateful!
I hope you grant me one last question:
If I use decorators in the future, where can I look up how the configuration (parameters) must look?
e.g.
JSON for Reduction -> reduction.basket-value-min:{"EUR":"200.00"}
Float values for Weight -> weight.max: 10.0, weight.min: 0.6
...
Thank you again for the great support!!!
I really appreciate your help and I'm very grateful!
I hope you grant me one last question:
If I use decorators in the future, where can I look up how the configuration (parameters) must look?
e.g.
JSON for Reduction -> reduction.basket-value-min:{"EUR":"200.00"}
Float values for Weight -> weight.max: 10.0, weight.min: 0.6
...
Thank you again for the great support!!!
Re: Different shipping costs according to product size
We've added the missing documentation for the Weight and Currency decorator in the meantime:Innonic wrote: If I use decorators in the future, where can I look up how the configuration (parameters) must look?
e.g.
JSON for Reduction -> reduction.basket-value-min:{"EUR":"200.00"}
Float values for Weight -> weight.max: 10.0, weight.min: 0.6
https://aimeos.org/docs/User_Manual/Adm ... decorators
Everything related to service decorators should be documented there.
If there's something missing or hard to understand (or examples missing), please drop us a note.
Thank you very much!Innonic wrote:Thank you again for the great support!!!
We hope that you enjoy working with Aimeos in your project besides such issues.
If you have any suggestions what we can make better to simplify your life, please don't hesitate and tell us. This feedback is what an Open Source project needs
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Different shipping costs according to product size
Hello again
I encountered another little issue.
I wrote my own decorators and would like to be able to debug them a little. To achieve this I added a method to my decorators to write some things into a log file (which I added to the same directory).
But whatever I do, it seems that "fopen" is not able to access the file.
I created another file that contains nothing except the code to write "Hello" to the log file. That works perfectly. Therefore I don't think it's a rights or permission problem.
Can you tell me, why the same code doesn't work within the decorator?
The code simply is:
Thanks in advance!
I encountered another little issue.
I wrote my own decorators and would like to be able to debug them a little. To achieve this I added a method to my decorators to write some things into a log file (which I added to the same directory).
But whatever I do, it seems that "fopen" is not able to access the file.
I created another file that contains nothing except the code to write "Hello" to the log file. That works perfectly. Therefore I don't think it's a rights or permission problem.
Can you tell me, why the same code doesn't work within the decorator?
The code simply is:
Code: Select all
$data = "Hello";
$filehandle = fopen("debug.txt","w");
fwrite($filehandle, $data);
fclose($filehandle);
Re: Different shipping costs according to product size
Better use
The output will be written to the madmin_log table.
Alternatively, you can use the error_log() method, which write the messages to the error.log of the web server.
Code: Select all
$this->getContext()->getLogger()->log( 'your message' );
Alternatively, you can use the error_log() method, which write the messages to the error.log of the web server.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star