Jump to:

2076 Posts in 857 Topics by 449 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Weight Based Shipping

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2017 Views
  • 3pointross
    Avatar
    Community Member
    18 Posts

    Weight Based Shipping Link to this post

    Has anyone gotten weight based shipping to work?

    It looks like you need to use an array to pass the weight and price values, however there is no example code that demonstrates how it should be done?

    /**
    * Calculates the shipping cost of an order, by taking the products
    * and calculating the shipping weight, based on an array set in _config
    * ASSUMPTION: The total order weight can be at maximum the last item
    * in the $shippingCosts array.
    */

    Any clues / ideas?

    Thanks in advance
    -Ross

  • Digital-Punk.co.uk
    Avatar
    Community Member
    51 Posts

    Re: Weight Based Shipping Link to this post

    Did you got ecommerce module working with weight based shipping?

  • Digital-Punk.co.uk
    Avatar
    Community Member
    51 Posts

    Re: Weight Based Shipping Link to this post

    I'm tried to put this code in config file:

    WeightShippingModifier::shippingCosts(array(
       '1' => 15,
       '3' => 30,
       '5' => 50,
    ));

    but it doesn't worked.

    Has anybody ideas or example how to ser weight based shipping?

  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    Re: Weight Based Shipping Link to this post

    Hi

    So that we can help you, please post a bit more information:

    • what is not working?
    • what error do you get?
    • what version of SS / ecommerce are you running?
    • how do you know you have an error?
    • have you done a dev/build/?flush=1 and cleared all your cookies (important for ecommerce)?

    Cheers

    Nicolaas

  • Digital-Punk.co.uk
    Avatar
    Community Member
    51 Posts

    Re: Weight Based Shipping Link to this post

    Sorry, here is more information.

    When I'm trying to set Weight based shipping array (see code above), I get this error message: Fatal error: Call to undefined method WeightShippingModifier::shippingcosts() in /var/www/vhosts/sandie.dev.bluwcreative.com/httpdocs/mysite/_config.php on line 111

    I used class "shippingcosts" because it was on the documentation:

    * Calculates the shipping cost of an order, by taking the products
    * and calculating the shipping weight, based on an array set in _config
    *
    * ASSUMPTION: The total order weight can be at maximum the last item
    * in the $shippingCosts array."

    Maybe this array code is wrong and I should use another class from WeightShippingModifier.php ?

    Thanks for any help!

    My System:
    ecommerce 0.6 beta 1
    silverstripe 2.3.2 (stable version)
    php 5.2.9
    mysql 5.0.83
    apache 2

  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    Re: Weight Based Shipping Link to this post

    ok, so what you want to do is to find the class WeightShippingModifier and see what static methods are available. I imagine that the module has been changed but that the documentation has not been updated yet. Let us know how that goes.

  • Digital-Punk.co.uk
    Avatar
    Community Member
    51 Posts

    Re: Weight Based Shipping Link to this post

    I didn't found there any static method (see attached file).

    Attached Files
  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    Re: Weight Based Shipping Link to this post

    those modifiers actually dont make any sense....

    have a look here:
    http://open.silverstripe.com/browser/modules/ecommerce/trunk/code/modifiers/SimpleShippingModifier.php

    and here:
    http://open.silverstripe.com/browser/modules/ecommerce/trunk/code/modifiers/WeightShippingModifier.php

    I think you will have to write your own shipping modifier for the time being as they seem incomplete. Simple Shipping M. makes a good start and so does Weight Shipping, but you really need a combination of the two. It makes me wonder if the WSM should actually extend the SimpleShippingModifier.

    You would be better off writing your own modifier using ideas from those two files.

    Cheers

    Nicolaas

    2017 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.