Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-13 Thread akos1234
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.



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
>
> 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 mol...@gmail.com  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
>>
>> 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
>>
>> 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 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 

Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-13 Thread akos1234
Hi Akhlaq,

The only closest one I came across was this -

http://mezzanine-users.narkive.com/AOk7Y6Kl/cartrige-custom-shipping-by-country-and-product-category

even that it seems he was not quiet heading for the right direction.

Regards

On Saturday, 5 November 2016 02:03:34 UTC, Akhlaq Rao wrote:
>
> Thanks a lot Danny, is there a good example about how to set the shipping 
> rules based on country?
>
> On Fri, Nov 4, 2016 at 7:12 PM, Danny  
> 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
>>
>> 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 mol...@gmail.com  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
>>>
>>> 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
>>>
>>> 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 are probably the key things you may need.
>>>
>>> Hope this helps a little.
>>>
>>> Seeya. Danny.
>>>
>>> -- 
>>> You received this 

Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-04 Thread Akhlaq Rao
Thanks a lot Danny, is there a good example about how to set the shipping
rules based on country?

On Fri, Nov 4, 2016 at 7:12 PM, Danny  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/36ab544df43efb224719d300761612
> a4#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 molo...@gmail.com 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
>>
>> 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
>>
>> 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 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 mezzanine-users+unsubscr...@googlegroups.com.
>> 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 

Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-04 Thread Danny

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

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 molo...@gmail.com 
 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

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

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 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 mezzanine-users+unsubscr...@googlegroups.com
.
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 mezzanine-users+unsubscr...@googlegroups.com 

Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-04 Thread Akhlaq Rao

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






On Thu, Nov 3, 2016 7:31 PM, Danny molo...@gmail.com
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

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

suggested 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

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 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 mezzanine-users+unsubscr...@googlegroups.com.
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-04 Thread akos1234
Hello Danny,

Thank you so much for your prompt reply. I will have a look and update here.

Regards

Akos

On Thursday, 3 November 2016 23:31:58 UTC, Danny S 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
>
> 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
>
> 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 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Cartrige custom shipping by country

2016-11-03 Thread Danny

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

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

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 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Cartrige custom shipping by country

2016-11-03 Thread akos1234
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

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?


Regards



-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Cartrige custom shipping by country and product category

2014-10-02 Thread Josh Cartmell
Hey Mat, could you go into more detail about what you mean by location +
category.  I'm not sure what you are trying to do so it's hard to make a
recommendation =)

On Wed, Oct 1, 2014 at 12:11 PM, Mat Caissy matsi...@gmail.com wrote:

 Hey everyone,

 After browsing on the forum, I successfully setup a custom billship_hander
 depending on the country from the order_form

 SHOP_HANDLER_BILLING_SHIPPING = myapp.checkout.custom_billship_handler

 def custom_billship_handler(request, order_form):

 if order_form is not None:
 if not request.session.get(free_shipping):
 settings.use_editable()


 if order_form.cleaned_data[shipping_detail_country] ==
 Canada:
 set_shipping(request, CanadaPost Regular, 5.00)


 elif order_form.cleaned_data[shipping_detail_country] ==
 US:
 set_shipping(request, CanadaPost US Regular, 7.90)


 else:
 set_shipping(request, _(Flat rate shipping), settings.
 SHOP_DEFAULT_SHIPPING_VALUE)



 But now, is there a way to filter my shipping by location + category, or
 product type as defined in my child_categories ?

 I've been trying with the cart and order instance, but it doesn't work:

 #cart = Cart.objects.from_request(request)
 #cart_test = request.cart.has_items()
 #order = Order.objects.from_request(request)

 Any tips is appreciated! Thanks

 --
 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 mezzanine-users+unsubscr...@googlegroups.com.
 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Cartrige custom shipping by country and product category

2014-10-02 Thread Mat Caissy
Hi Josh, thx for your reply!

Sorry for the confusion. What (and how) I'm trying to do is to calculate 
the shipping by location with the shipping_detail_country (works good) from 
the order_form AND the product custom shipping class and fields that I 
injected in the product model and the admin.

I git cloned the cartridge.shop 0.9.5 to have it locally as an app under 
the name cucashop (that way I can modify the models and stuff I need; I'm 
happy with the version and won't need an update)

Added a custom shipping model:

In *cucashop.models.py *

class ProductShipping(models.Model):


COUNTRIES = (
('CA', _('Canada')),
('US', _('United States of America')),


Country = models.CharField(choices=COUNTRIES, max_length=100)
Cost = fields.MoneyField(_(Cost of 1 item))
with_another_item = fields.MoneyField(_(extra cost with another item))


product = models.ForeignKey(Product, related_name=shipping)


def __unicode__(self):
return self.Country

In *cucashop.admin.py*


#  SHIPPING  #



class ProductShippingAdmin(TabularDynamicInlineAdmin):
model = ProductShipping


##
#  PRODUCTS  #
##

...


class ProductAdmin(DisplayableAdmin):

...

inlines = (ProductImageAdmin, ProductShippingAdmin, 
ProductVariationAdmin)


Basically trying to add customs shipping fields by product in the admin. 
This works great.


Now the *problem*:

How can I have access to the product instance and this new shipping class 
in my custom *checkout.py* custom_billship_handler from the cart?

That way if I have a user buying a product and selecting Canada in the 
shipping form, I can calculate or show the cost for that product with this 
location.

If that helps I also posted the code here

https://bitbucket.org/buddweeze/test-shipping-cartridge/overview

Many thanks, let me know if this makes more sense or if a better approach 
could be suggested.


On Thursday, October 2, 2014 7:31:42 AM UTC-7, Josh Cartmell wrote:

 Hey Mat, could you go into more detail about what you mean by location + 
 category.  I'm not sure what you are trying to do so it's hard to make a 
 recommendation =)

 On Wed, Oct 1, 2014 at 12:11 PM, Mat Caissy mats...@gmail.com 
 javascript: wrote:

 Hey everyone,

 After browsing on the forum, I successfully setup a custom 
 billship_hander depending on the country from the order_form

 SHOP_HANDLER_BILLING_SHIPPING = myapp.checkout.custom_billship_handler

 def custom_billship_handler(request, order_form):

 if order_form is not None:
 if not request.session.get(free_shipping):
 settings.use_editable()


 if order_form.cleaned_data[shipping_detail_country] == 
 Canada:
 set_shipping(request, CanadaPost Regular, 5.00)


 elif order_form.cleaned_data[shipping_detail_country] == 
 US:
 set_shipping(request, CanadaPost US Regular, 7.90)


 else:
 set_shipping(request, _(Flat rate shipping), settings.
 SHOP_DEFAULT_SHIPPING_VALUE)



 But now, is there a way to filter my shipping by location + category, or 
 product type as defined in my child_categories ?

 I've been trying with the cart and order instance, but it doesn't work:

 #cart = Cart.objects.from_request(request)
 #cart_test = request.cart.has_items()
 #order = Order.objects.from_request(request)

 Any tips is appreciated! Thanks 

 -- 
 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 mezzanine-use...@googlegroups.com javascript:.
 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Cartrige custom shipping by country and product category

2014-10-02 Thread Melvyn Sopacua
Hi Mat,

On Thursday 02 October 2014 10:28:17 Mat Caissy wrote:

 Now the *problem*:
 
 How can I have access to the product instance and this new shipping class
 in my custom *checkout.py* custom_billship_handler from the cart?
 
 That way if I have a user buying a product and selecting Canada in the
 shipping form, I can calculate or show the cost for that product with this
 location.
 
 If that helps I also posted the code here
 
 https://bitbucket.org/buddweeze/test-shipping-cartridge/overview
 
 Many thanks, let me know if this makes more sense or if a better approach
 could be suggested.

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.
-- 
Melvyn Sopacua

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Cartrige custom shipping by country and product category

2014-10-02 Thread Josh Cartmell
I think I understand now, I've done something like this in the past

skus = cart.items.values_list('sku', flat=True)variations =
ProductVariation.objects.filter(sku__in=skus).select_related('product')

Then for each variation you could access .product and look up the
associated shipping class.

Hopefully that helps!

On Thu, Oct 2, 2014 at 4:18 PM, Melvyn Sopacua m.r.sopa...@gmail.com
wrote:

 Hi Mat,

 On Thursday 02 October 2014 10:28:17 Mat Caissy wrote:

  Now the *problem*:
 
  How can I have access to the product instance and this new shipping class
  in my custom *checkout.py* custom_billship_handler from the cart?
 
  That way if I have a user buying a product and selecting Canada in the
  shipping form, I can calculate or show the cost for that product with
 this
  location.
 
  If that helps I also posted the code here
 
  https://bitbucket.org/buddweeze/test-shipping-cartridge/overview
 
  Many thanks, let me know if this makes more sense or if a better approach
  could be suggested.

 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.
 --
 Melvyn Sopacua

 --
 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 mezzanine-users+unsubscr...@googlegroups.com.
 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.