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 <[email protected]>
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 [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.

Reply via email to