Flat Rate Shipping

2 views
Skip to first unread message

hannesc

unread,
Jun 4, 2009, 2:02:21 AM6/4/09
to getpaid-dev
So with the payment processor I was working on, finally completed, I
moved over to the shipping. I want to use flat rate shipping for now.
When I install it however, there is no way of setting the values for
it, and even when I purchase a shippable object, the shipping is still
0 on checkout.

I started looking around, and I found that the Flat Rate Shipping has
no config page.

My question is this: Has anyone successfully used flat rate shipping
on GetPaid, and if so, how?

Thanks guys

Juan Carlos Coruña

unread,
Jun 4, 2009, 5:44:06 AM6/4/09
to getpa...@googlegroups.com
I had the same problem and didn't found the solution. some people already reported this.

I tried to add a plugin to getpaid.flatrateshipping in order to get the config panel, without success.

Finally, I decided to go with IShippingRateService (look at getpaid.ups for an example) instead of IShippingMethod.

2009/6/4 hannesc <han...@gmail.com>

danielle davout

unread,
Jun 5, 2009, 3:30:48 AM6/5/09
to getpa...@googlegroups.com
Do you make a difference between shipment and shipping ?
shipping being related to a cart (as a collection of items to be
shipped to anybody, anywhere), shipment to an order (labelled goods to
be received somewhere by somebody that would be charged for); indeed
how can you price a shipment if you don't know the destination of the
goods (if the client did not give the necessary informations in
"completing a bit" an order?)
Why in cart.py shipping and shipment are mixed ?
def getShippingCost( self ):
if not interfaces.IShipment.providedBy( self ):
return 0
return decimal.Decimal( str( self.shipping_cost ) )
I'm really confused...
2009/6/4 Juan Carlos Coruña <ogg...@gmail.com>:

Hannes Calitz

unread,
Jun 5, 2009, 4:23:16 AM6/5/09
to getpa...@googlegroups.com
What I require is some way of just charging a flat fee for any order to be shipped to anyone. As the client will only be shipping locally, he decided to just charge a single amount for every order.

Flat Rate shipping seemed like the solution, but alas, it doesn't work. :(

2009/6/5 danielle davout <daniell...@gmail.com>

danielle davout

unread,
Jun 5, 2009, 5:12:39 AM6/5/09
to getpa...@googlegroups.com
For me, today and as far as I "know" :
FlatRateShippping doesn't work out of the box fault of the missing
admin plugin, but if one follows the example of getpaid.ups as
Hannesc (or I did ) to make it, it is functional :
a selection of the shipping methods is proposed to the client via a form,
the shipping_cost of the order is computed (once a order is created =
self.createTransientOrder())
the problem is that getpaid.core.cart.CartItemTotals object has not
the right interface IShippableOrder when
the Shipping Price is wanted in the form cart-listing.....

danielle davout

unread,
Jun 5, 2009, 6:21:31 AM6/5/09
to getpa...@googlegroups.com
as Juan Carlos did :)

hannesc

unread,
Jun 8, 2009, 1:03:20 AM6/8/09
to getpaid-dev
Thanks for the feedback. Is there anyway that either of you might post
your working copy somewhere for me to have a look at? I am struggling
to get it working, and my client is in a bit of a rush. O.o

Thanks :)

On Jun 5, 12:21 pm, danielle davout <danielle.dav...@gmail.com> wrote:
> as Juan Carlos did :)
>
> On Fri, Jun 5, 2009 at 11:12 AM, danielle
>
> davout<danielle.dav...@gmail.com> wrote:
> > For me, today and as far as I "know" :
> > FlatRateShippping doesn't work out of the box fault of the missing
> > admin plugin, but if  one follows the example of getpaid.ups as
> > Hannesc (or I did ) to make it, it is functional :
> > a selection of the shipping methods is proposed to the client via a form,
> > the shipping_cost of the order is computed (once a  order is created =
> > self.createTransientOrder())
> > the problem is that getpaid.core.cart.CartItemTotals object has not
> > the right interface IShippableOrder when
> > the Shipping Price is wanted in the form cart-listing.....
>
> > On Fri, Jun 5, 2009 at 10:23 AM, Hannes Calitz<hann...@gmail.com> wrote:
> >> What I require is some way of just charging a flat fee for any order to be
> >> shipped to anyone. As the client will only be shipping locally, he decided
> >> to just charge a single amount for every order.
>
> >> Flat Rate shipping seemed like the solution, but alas, it doesn't work. :(
>
> >> 2009/6/5 danielle davout <danielle.dav...@gmail.com>
>
> >>> Do you make a difference between shipment and shipping ?
> >>> shipping being related to a cart (as a collection of items to be
> >>> shipped to anybody, anywhere), shipment to an order (labelled goods to
> >>> be received somewhere by somebody that would be charged for); indeed
> >>> how can you price a shipment if you don't know the destination of the
> >>> goods (if the client did not give the necessary informations in
> >>> "completing a bit" an order?)
> >>> Why in cart.py shipping and shipment are mixed ?
> >>>   def getShippingCost( self ):
> >>>        if not interfaces.IShipment.providedBy( self ):
> >>>            return 0
> >>>        return decimal.Decimal( str( self.shipping_cost ) )
> >>> I'm really confused...
> >>> 2009/6/4 Juan Carlos Coruña <ogg...@gmail.com>:
> >>> > I had the same problem and didn't found the solution. some people
> >>> > already
> >>> > reported this.
>
> >>> > I tried to add a plugin to getpaid.flatrateshipping in order to get the
> >>> > config panel, without success.
>
> >>> > Finally, I decided to go with IShippingRateService (look at getpaid.ups
> >>> > for
> >>> > an example) instead of IShippingMethod.
>
> >>> > 2009/6/4 hannesc <hann...@gmail.com>

Matt Barkau

unread,
Jun 10, 2009, 1:26:14 AM6/10/09
to getpa...@googlegroups.com
+1
Also, can anyone explain the syntax of context.context, in vocabularies.py ?:
def ShippingMethods( context ):
    adapters = component.getAdapters( (context.context,), interfaces.IShippingMethod )
Thanks!

hannesc

unread,
Jun 11, 2009, 1:17:05 AM6/11/09
to getpaid-dev
OK, so I got the admin part working. Now just to get the actual
shipping calculated.

When checking out, I get the following error:

Traceback (innermost last):
Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 42, in call_object
Module Products.PloneGetPaid.browser.checkout, line 353, in __call__
Module getpaid.wizard._wizard, line 38, in __call__
Module getpaid.wizard._wizard, line 28, in update
Module getpaid.wizard._wizard, line 263, in update
Module Products.PloneGetPaid.browser.checkout, line 743, in update
Module Products.PloneGetPaid.browser.checkout, line 729, in
setupShippingOptions
Module getpaid.flatrateshipping2.rates, line 33, in getRates
AttributeError: 'InterfaceClass' object has no attribute
'flatrate_option'

I had a look at the files, and I can't quite figure out what is wrong:

getpaid.flatrateshipping2.rates looks as follows: http://paste.plone.org/28429

The highlighted line is where the problem occurs. I went and had a
look, but *sigh* I don't know what the heck is wrong.

getpaid.flatrateshipping2.interfaces looks as follows: http://paste.plone.org/28430

There is probably a simple solution to my problem, but I don't know
what it is. Anyone have any ideas?

Thanks
Hannes

On Jun 10, 7:26 am, Matt Barkau <rmat...@gmail.com> wrote:
> +1
> Also, can anyone explain the syntax of context.context, in vocabularies.py
> ?:
> def ShippingMethods( context ):
>     adapters = component.getAdapters( (context.context,),
> interfaces.IShippingMethod )
> Thanks!
>

Lucie Lejard

unread,
Jun 11, 2009, 11:56:38 AM6/11/09
to getpa...@googlegroups.com
well, does the interface IFlatRateSettings have an attribute called
flatrate_option ?
--
S i x F e e t U p , I n c . | http://www.sixfeetup.com
Phone: +1 (317) 861-5948 x605
ANNOUNCING the first Plone Immersive Training Experience | Sept. 10-11-12, 2009
http://www.sixfeetup.com/immerse

Hannes Calitz

unread,
Jun 12, 2009, 12:09:27 AM6/12/09
to getpa...@googlegroups.com
Either I am understanding the entire process completely wrong, or yes it does, as displayed in the highlighted line here: http://paste.plone.org/28458

2009/6/11 Lucie Lejard <lucie...@gmail.com>

danielle davout

unread,
Jun 12, 2009, 2:18:26 AM6/12/09
to getpa...@googlegroups.com
sorry, I was out of reach of a connexion for several days and now I've
only one minute ..
here what I've got
rates.py.txt

Matt Barkau

unread,
Jun 15, 2009, 5:05:24 AM6/15/09
to getpa...@googlegroups.com
Hannes, as a test, what happens if you change rates.py line 33 from IFlatRateSettings to IFlatRateShippingSettings ?

Matt Barkau

unread,
Jun 15, 2009, 5:10:18 AM6/15/09
to getpa...@googlegroups.com
Also, can you paste the relevant portion of your configure.zcml?  Thanks.

Hannes Calitz

unread,
Jun 17, 2009, 12:34:38 AM6/17/09
to getpa...@googlegroups.com
Hey there Matt

See comments in Red below.

Also, if you would like to have a look at the Flate Rate Shipping I am working on in it's entirety, you can download it at http://www.opennetworks.co.za/getpaid.flatrateshipping2.tar.gz

Cheers
Hannes

2009/6/15 Matt Barkau <rma...@gmail.com>
Also, can you paste the relevant portion of your configure.zcml?  Thanks.
configure.zcml: http://paste.plone.org/28540
browser/configure.zcml: http://paste.plone.org/28541

On Mon, Jun 15, 2009 at 4:05 AM, Matt Barkau <rma...@gmail.com> wrote:
Hannes, as a test, what happens if you change rates.py line 33 from IFlatRateSettings to IFlatRateShippingSettings ?
I get the following error: 'module' object has no attribute 'IFlatRateShippingSettings'

danielle davout

unread,
Jun 19, 2009, 12:32:19 AM6/19/09
to getpa...@googlegroups.com
> What I require is some way of just charging a flat fee for any order to be
> shipped to anyone. As the client will only be shipping locally, he decided
> to just charge a single amount for every order.
I 've managed at last to have it working with in the cart.py of my product :

from Products.PloneGetPaid.browser.checkout import getShippingMethod

class CartItemTotals( OriginalCartItemTotals ):

def getShippingCost( self ):
# no choice of service_code by client
service_code = 'mine.01' #self.request.get('shipping_method_code')
method = getShippingMethod( self, service_code )
if method is None:
return 0
return method.cost

and the same rates.py that I've sent previously as a attached file

in my overrides.zcml I've put accordingly
<adapter
for="getpaid.core.interfaces.IShoppingCart"
provides="getpaid.core.interfaces.ILineContainerTotals"
factory=".browser.cart.CartItemTotals"
/>

Hannes Calitz

unread,
Jun 30, 2009, 1:13:29 AM6/30/09
to getpa...@googlegroups.com
Hey there guys.

I am still having trouble with this one. I had a look at Danielle's rates.py and changed mine accordingly. However I am getting the following error: http://paste.plone.org/28723

From the error, I got that the error is in my rates.py file. The file looks as follows (error line highlighted): http://paste.plone.org/28725

I don't think the error is there however. I think the error lies in my iterfaces.py file (http://paste.plone.org/28726).

If anyone could have look, I would really appreciate it.

Thanks
Hannes

2009/6/19 danielle davout <daniell...@gmail.com>

danielle davout

unread,
Jun 30, 2009, 1:48:19 AM6/30/09
to getpa...@googlegroups.com
indeed my interfaces.py looks very different , I"e got

class IMyRatesServiceSettings(interface.Interface):
"""
My Rates Service Options
"""

services = schema.List(title = _(u"My Services"),
required = True,
default = [],
description = _(u"The services to offer in
your store."),
value_type =
schema.Choice(title=u"my_services_choice",

vocabulary=MY_SHIPPING_SERVICES))

where
MY_SHIPPING_SERVICES = SimpleVocabulary([
SimpleTerm('01', 'next-day-air', _(u' Next Day Air')),
SimpleTerm('02', '2nd-day-air', _(u' 2nd Day Air')),
SimpleTerm('03', 'ground', _(u' Ground')),])

Hannes Calitz

unread,
Jul 1, 2009, 12:37:50 AM7/1/09
to getpa...@googlegroups.com
What I don't understand though, is that in the end, my settings class is implemented correctly (seeing as yours works). I simply do not get why I am getting a 'Could not adapt' error.

2009/6/30 danielle davout <daniell...@gmail.com>

danielle davout

unread,
Jul 1, 2009, 4:27:16 AM7/1/09
to getpa...@googlegroups.com
in my rates.py I use
from getpaid.flatrateshipping.flatrate import FlatRateShippingAdapter
FRSRA = FlatRateShippingAdapter(context)
FRSRA.settings.flatrate_option = FLATRATE_OPTION

your rates.py has
flatrate_settings = IFlatRateSettings(context)
if(flatrate_settings.settings.flatrate_option == "Percentage"):

Hannes Calitz

unread,
Jul 3, 2009, 1:45:29 AM7/3/09
to getpa...@googlegroups.com
Ah, thanks. I changed it. However, I am getting the following error:
Traceback (innermost last):
Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 42, in call_object
Module Products.PloneGetPaid.browser.checkout, line 353, in __call__
Module getpaid.wizard._wizard, line 38, in __call__
Module getpaid.wizard._wizard, line 28, in update
Module getpaid.wizard._wizard, line 263, in update
Module Products.PloneGetPaid.browser.checkout, line 743, in update
Module Products.PloneGetPaid.browser.checkout, line 729, in setupShippingOptions
AttributeError: getRates
Any ideas?

2009/7/1 danielle davout <daniell...@gmail.com>

danielle davout

unread,
Jul 3, 2009, 3:47:26 AM7/3/09
to getpa...@googlegroups.com
in my checkout.py I've got now

class CheckoutController(OriginalCheckoutController):

conditions = {'checkout-select-shipping': 'checkShippableCart'}
steps = ['checkout-address-info', 'checkout-review-pay']
# no more 'checkout-select-shipping' was
# steps = ['checkout-address-info', 'checkout-select-shipping',
'checkout-review-pay']

as I have not to select the shipping, my customers have no choice
although I had before the form presented without error

Hannes Calitz

unread,
Jul 6, 2009, 1:27:21 AM7/6/09
to getpa...@googlegroups.com
I finally got Flat Rate shipping working. Thank you to everyone for the help and support.

2009/7/3 danielle davout <daniell...@gmail.com>

Hannes Calitz

unread,
Jul 6, 2009, 5:32:24 AM7/6/09
to getpa...@googlegroups.com
So perhaps I spoke to soon.

Everything works perfect except for one thing. When checking out, flaterate.getCost (http://pastie.org/535446) grabs the default values from interfaces.py (http://pastie.org/535447) instead of the values saved in the admin section.

Why could this be happening?

Danielle, I think you'll be able to help, as I have been using a lot of the code you sent through to me.

Thanks
Hannes

2009/7/6 Hannes Calitz <han...@gmail.com>

danielle davout

unread,
Jul 6, 2009, 7:16:42 AM7/6/09
to getpa...@googlegroups.com
On Mon, Jul 6, 2009 at 11:32 AM, Hannes Calitz<han...@gmail.com> wrote:
> So perhaps I spoke to soon.
>
> Everything works perfect except for one thing. When checking out,
> flaterate.getCost (http://pastie.org/535446) grabs the default values from
> interfaces.py (http://pastie.org/535447) instead of the values saved in the
> admin section.
>
> Why could this be happening?
>
> Danielle, I think you'll be able to help >>>
I would be happy to ...
In my case I don't let choose the client a service and consequently I
don't use the step "checkout-select-shipping"
so I have just put MY choice in cart

Hannes Calitz

unread,
Jul 7, 2009, 2:48:17 AM7/7/09
to getpa...@googlegroups.com
Right, so I think I figured out why the shipping is only picking up the defaults in the interfaces.py file, and not reading the values I save in the shipping backend. I think there's a problem in my browser/admin.py file (I could be completely off the mark though). Unfortunately I have no idea what it is.

Now, this would not be a problem if I only ran one shop from the server, but the truth is that there will be about 6 running on the same machine, so the default values will not work as every client will have to set there own shipping costs.

I have uploaded the entire product to http://www.opennetworks.co.za/getpaid.flatrateshipping2.tar.gz

If anyone could have a look at it, I would be much obliged.

Thanks
Hannes

2009/7/6 danielle davout <daniell...@gmail.com>

danielle davout

unread,
Jul 7, 2009, 1:19:53 PM7/7/09
to getpa...@googlegroups.com
can't you have several shipping methods with a default service of
the same code ?

Hannes Calitz

unread,
Jul 8, 2009, 1:20:45 AM7/8/09
to getpa...@googlegroups.com
As a temporary fix, yes that would work. I have actually not thought of that. Thanks.

I would still like to sort this problem out though. It would be nice not having to load multiple shipping methods, but only have one where the clients can simply enter the required rate in the backend.

On this note, I finally got my hands on a decent IDE (WingIDE) which means I can now actually debug. w00t!!1 xD

I had a closer look at what is happening behind the seens, and the line

temp_settings = IFlatRateSettings(context)

in my rates.py (http://pastie.org/538153) file is throwing an attribute exception. Now this could be because of a faulty interfaces.py (http://pastie.org/538158), but to be honest, I have absolutely no idea why it is doing it.

2009/7/7 danielle davout <daniell...@gmail.com>
Reply all
Reply to author
Forward
0 new messages