On 14/11/2016 7:48 AM, akos1234 wrote:
Hello Danny,
I am trying to work on the codes you have hear against what I have. I
wanted to see how the shipping by country is implemented checking out
your code. I have some errors trying to incorporate it into my project
not going so well for me
I hope to learn from what you have hear.
If I could sort out the errors and at least see how your codes works,
I may be able to do something with what I am looking for.
I'd suggest you work through things step-by-step from scratch. Given
that you want a simple shipping rule model with a set price for each
country,
you don't need anything as complicated as what I had to do.
First, write your own shipping handler function, and use it instead of
the standard one.
See http://cartridge.jupo.org/integration.html#billing-shipping
In that function, you should be able to set a shipping price based on
country. Do this using values within the function to start with.
Next, you can add your 'Shipping Rule' model (in models.py - you can
probably do this in your own app, rather than modifying cartridge like I
had to).
The model should probably just contain two fields: The country (or a
regexp for one) and the shipping cost.
In admin.py you can then register the model so it can be edited in the
Admin.
Then, modifying your shipping handler function to look up the set of all
shipping rules and match the order's country to a rule within the
database, getting the appropriate cost.
I hope this helps.
Seeya. Danny.
Regards
On Friday, 4 November 2016 23:12:44 UTC, Danny S wrote:
On 5/11/2016 4:18 AM, Akhlaq Rao wrote:
Hello Danny,
I am not seeing these options when creating a variation, all I
see the colour and size, do you now how do I enable these variations?
- Product Variations now have weight, and boolean "pickup
available"/"shipping available" options
Thanks,
Akhlaq
In my ProductVariation model, I've added these as fields. They
are not product options (which is what colour/size are in the
default settings).
When you edit the details on a variation, you can add things like
price, sale price etc; What I've done is add weight, pickup
available and shipping available as other fields there.
https://gist.github.com/molokov/36ab544df43efb224719d300761612a4#file-models-py-L8
<https://gist.github.com/molokov/36ab544df43efb224719d300761612a4#file-models-py-L8>
If all you want to do is add shipping rules based on country, you
don't need these fields - I just have them because we sell some
items that are "virtual"
(e.g. tickets) that have no weight; and we have other items that
can only be picked up (and never shipped).
Seeya. Danny.
On Thu, Nov 3, 2016 7:31 PM, Danny [email protected] <javascript:>
wrote:
On 4/11/2016 5:31 AM, akos1234 wrote:
Hello everyone,
I am trying to attempt to create the shipping for my site.
I was looking at this post -
http://mezzanine-users.narkive.com/AOk7Y6Kl/cartrige-custom-shipping-by-country-and-product-category
<http://mezzanine-users.narkive.com/AOk7Y6Kl/cartrige-custom-shipping-by-country-and-product-category>
which I thought was at the right track. I need to set
shipping cost for countries as well as different cost for
quantity.
If more than 5 items bought, the calculation of shipping
would cost more than one item.
However, Melvyn Sopacua
*su*ggested something I did not quiet understand.
here as quoted -
If this is the extent of your shipping rules, you may get
away with this
approach. From experience with other shopping carts, I
highly suggest you
implement a rule-based approach as opposed to a property
approach.
Approach like an email filter:
- You define a state formulated by a set of conditions
- Which result in one or more actions
- And has post-processing flags, like "stop further rule
processing if used"
The implementation is more complex, but the resulting
flexibility is worth it
and much of the code can be reused for different types of
business logic, like
follow-up emails, discounts and available payment methods:
- Send a "please review our product" reminder, if customer
has not reviewed
and has received product x days ago.
- Give 10% cart discount to customers who have spent at
least x ammount last
year and don't apply any other cart discount rules
- Offer "Pay within 30 days" payment method only to
customers of the customer
group "B2B" with credit limit > order ammount
- Don't offer 24 hour delivery if shipper api qualifies
customer address as
'rural'
My 2c.
--
Has anyone done the shipping and is it possible to view the
code?
I've got some custom shipping rules in my variation of
Cartridge (along with a number of other changes).
I've tried to summarise all the shipping rule related changes
in this gist:
https://gist.github.com/molokov/36ab544df43efb224719d300761612a4
<https://gist.github.com/molokov/36ab544df43efb224719d300761612a4>
Essentially:
- Product Variations now have weight, and boolean "pickup
available"/"shipping available" options
- There's a ShippingRule model which allows you to define the
rules within admin.
The rules define a) a weight range, b) whether you care
about the pickup/shipping options, and c) a country regexp -
and a corresponding price. The order of the rules is important.
- Users are presented with valid shipping options in a drop
down during the payment step of checkout (after entering
their shipping address). If there's no matching rule, an
error will be shown.
What I have is probably beyond what you need, and as you can
see I've touched the code in a lot of places (and mind you,
this was over a year ago, so my cartridge fork isn't quite up
to date with the latest master), but hopefully it will point
you in the right direction.
The changes to checkout.py (especially
shippingrule_billship_handler) and models.py/admin.py
<http://models.py/admin.py> are probably the key things you
may need.
Hope this helps a little.
Seeya. Danny.
--
You received this message because you are subscribed to the
Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected]
<javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the
Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected] <javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mezzanine
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.