Nice, you also had to create a corresponding product, right?
On Monday, November 10, 2014 10:12:41 AM UTC-7, Josh Cartmell wrote:
>
> Hey Josh, that seems like a pretty good way to handle it. I had once
> dealt with allowing users to make donations to a site with Cartridge (not
> purchasing products for the donation, just straight donations) and did this:
>
> def add_donation_item(cart, price, notes=None): """ Adds a donation to
> the cart. donation is a product variation """ item, created =
> cart.items.get_or_create(sku=("DONATION-%s" % price), unit_price=price) if
> created: item.description = "$%s Donation" % price
> item.unit_price = price item.url = "/shop/donate/" item.notes =
> notes else: item.notes += notes item.quantity += 1 item.save()
>
> In my case I didn't create a particular Donation objects, but I think
> doing that makes things nicer/saner and I think it's a good approach.
>
> On Sun, Nov 9, 2014 at 1:18 AM, Josh B <[email protected]
> <javascript:>> wrote:
>
>> I am creating a store that has normal products and it also has donation
>> based products. With the donation products the user defines the price.
>>
>> Here is where I am at so far and want to see if someone else has a better
>> idea.
>>
>> I created an add_donation function that loads in the product details and
>> creates a new Donation object where I set the price to the user defined
>> price. This feels a little hacky to me but this might be the easiest way.
>> Thoughts?
>>
>>
>> https://gist.github.com/joshbatchelor/dc093ff99b129297d488#file-gistfile1-txt
>>
>> 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 [email protected] <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 [email protected].
For more options, visit https://groups.google.com/d/optout.