Hi Rick
I really need help with the validation. Even with the two separate
zones, either country can still choose another zone's pricing. Not
sure how to proceed, and I've never written a valid zone checker
before, but what appears to be there already seems inadequate:
def valid(self, order=None):
"""
Check if shipping is valid for country and set zone
accordingly. Fallback
to default zone if set
"""
assert(self._calculated)
# I think its reasonable to assume this shipping method should
# not be used on an order that doesn't weigh anything.
if not self._price or self._price == Decimal('0.0'):
return False
if self._zone and self._cost:
return True
There should be a check here to see if the selected country belongs to
the zone, and if it doesn't it should check the next zone, right?
On Mar 8, 7:08 pm, Ricko <[email protected]> wrote:
> OK, so you have the module installed, good!
>
> So each shipping module will have two important methods, 'valid' and
> 'cost'. The valid method returns a boolean indicating if that module
> is a valid shipping module given the parameters of the order. So for
> you, you would need 2 modules, one based on the tiered shipping, one
> based on the flat shipping. In each 'valid' method you simply write
> some code to determine if the order is foreign or domestic. The
> 'valid' method passes in the order as a parameter, so you can get the
> details from that object instance. Only modules returning True will be
> displayed and used as a shipping method to the user.
>
> For the pricing, your 'cost' method will handle that, the flat
> international will be easy, the domestic will be based on the tiered
> module already existing in Satchmo. You set up the tiering in the
> admin page.
>
> Hope this helps,
>
> RIck
>
> On Mar 7, 4:51 pm, Scott <[email protected]> wrote:
>
> > Hi Ricko,
>
> > Sorry about that, yes, I can get Django to recognise the new shipping
> > module but being a complete newbie to Satchmo I'm not sure how what to
> > include. I know that it should determine a zone or multiple zones, and
> > then assign those zones one shipping option, while giving the
> > exclusive domestic zone (UK) one shipping option also.
>
> > At this stage it is simply structured-english, but I really would
> > appreciate to spend some time with a seasoned Satchmo developer and
> > learn how to do it.
>
> > Scott
>
> > On Mar 7, 6:00 pm, Ricko <[email protected]> wrote:
>
> > > Hi Scott,
>
> > > You'll have to explain a bit more about why you can't get your module
> > > to work. Can you just not get django to recognise your module, or you
> > > haven't written one yet?
>
> > > Cheers
> > > Rick
>
> > > On Mar 6, 6:21 pm, Scott <[email protected]> wrote:
>
> > > > Hi,
>
> > > > I really need help with implementing a custom shipping module. I tried
> > > > following the Satchmo documentation but I can't get what I need. Zone
> > > > based shipping doesn't work on it's own. In my setup, a selected
> > > > country can still choose shipping options from that of another zone
> > > > that is doesn't belong to.
>
> > > > I would like to have 2 shipping modules: a tiered weight for domestic
> > > > shipping, and a flat rate international price for international
> > > > shipping. International customers shouldn't be able to choose domestic
> > > > shipping from the UK and vice versa.
>
> > > > Where do I begin?
>
> > > > Thanks,
> > > > Scott
--
You received this message because you are subscribed to the Google Groups
"Satchmo users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/satchmo-users?hl=en.