which satchmo version supports this code? also 0.8.1 ?

2010/9/9 davis <[email protected]>:
> Here's what I did:
>
> def add_order_note(sender, form, **kwargs):
>    """Add a Note field to the order."""
>    if 'notes' not in form.fields:
>        notes_attrs = {'rows': 4, 'cols': 50}
>        form.fields['notes'] = forms.CharField(label='Notes',
> required=False,
>                                    help_text='(Optional) Any special
> '
>                                    'instructions, etc.',
>
> widget=forms.Textarea(attrs=notes_attrs))
>
> form_init.connect(add_order_note, sender=SimplePayShipForm)
>
> And I added the 'notes' field to the base_pay_ship.html template:
>
> {% if form.notes %}
> <h4>Optional Notes/Comments</h4>
> <p id="notes">{{ form.notes }}</p>
> {% endif %}
>
>
> On Sep 8, 9:38 am, lzantal <[email protected]> wrote:
>> Hi,
>>
>> I tryed to use form_init signal but my notes never got saved.
>> Did you implemented this with that signal? If so could you share your
>> implementation?
>> I prefer to use signals over altering satchmo.
>>
>> Thank you
>>
>> lzantal
>>
>> On Sep 3, 7:46 pm, davis <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Satchmo was patched a while back to save the order form notes, so
>> > instead of altering Satchmo you can use a form_init signal listener to
>> > add the field to the form.
>>
>> > On Sep 3, 2:25 pm, lzantal <[email protected]> wrote:
>>
>> > > Yes it is:)
>> > > Looks pretty good.
>>
>> > > lzantal
>>
>> > > On Sep 3, 11:00 am, Stuart Laughlin <[email protected]> wrote:
>>
>> > > > Perfect timing... I just finished implementing this myself...
>>
>> > > > Isn't that always the way?!?  :) :)
>>
>> > > > Here's what I did...
>>
>> > > >    1) add 'notes' field to payment.forms.PaymentContactInfoForm
>> > > >       notes = forms.CharField(max_length=200, label=_('Shipping
>> > > > Notes'), required=False)
>>
>> > > >    2) update line of code that creates Order in
>> > > > payment.utils.get_or_create_order (line 45 or so)
>> > > >       order = Order(contact=contact, notes=data['notes'])
>>
>> > > >    3) add notes field to my template (shop/checkout/form.html for me)
>> > > >       <tr class="shiprow"><td><label>{% trans "Notes"
>> > > > %}</label></td><td>{{ form.notes }}</td></tr>
>> > > >       {% if form.notes.errors %}<tr><td class="error" colspan="2">***
>> > > > {{ form.notes.errors|join:", " }}</td></tr>{% endif %}
>>
>> > > > Pretty similar to yours in concept, I think.
>>
>> > > > Thanks for the input!!
>>
>> > > > --Stuart
>>
>> > > > On Fri, Sep 3, 2010 at 12:35 PM, lzantal <[email protected]> wrote:
>> > > > > Hi,
>>
>> > > > > I use this quick hack. it works great but you habe to keep in mind
>> > > > > that it alters satchmo core so you need to keep your eye on it when
>> > > > > you upgrade your satchmo.
>> > > > > 1; Add your note input field to templates/shop/checkout/form.html
>> > > > >   lets assume its name="ordernote"
>> > > > > 2; Add this in sathcmo/apps/payment/views/contact.py into function
>> > > > > contact_info(request, **kwargs):
>> > > > >  on line 70 in my version right after if form.is_valid():
>> > > > >  order.notes = new_data["ordernote"]
>> > > > >  order.save()
>>
>> > > > > That's all. Now the note is saved into the Order models notes field.
>>
>> > > > > Hope it helps
>>
>> > > > > lzantal
>>
>> > > > > On Sep 3, 8:30 am, Stuart Laughlin <[email protected]> wrote:
>> > > > >> Did anyone ever figure out how to get order notes working? The notes
>> > > > >> field is on the Order model and i see right where I want to put the
>> > > > >> field on step 1 of the checkout process.. so close I can taste it! 
>> > > > >> But
>> > > > >> I'm having some trouble figuring out exactly what's going on in the
>> > > > >> backend and how to get order notes working properly. There's some
>> > > > >> pretty dynamic code in there!
>>
>> > > > >> Thanks!
>>
>> > > > >> --Stuart
>>
>> > > > >> On Thu, Apr 1, 2010 at 9:55 PM, davis <[email protected]> wrote:
>> > > > >> > This is something I've been wanting to do as well, but I haven't 
>> > > > >> > had
>> > > > >> > the time to figure it out. Hopefully, someone else has done it.
>>
>> > > > >> > On Apr 1, 8:16 pm, GuyBrush <[email protected]> wrote:
>> > > > >> >> Is it possible to use the notes field in the checkout page? I'm 
>> > > > >> >> trying
>> > > > >> >> to use it as a Gift Note form.
>> > > > >> >> I successfully added the form to the page but I'm not able to 
>> > > > >> >> save notes.
>> > > > >> >> I have been looking at satchmo code for the last couple of days 
>> > > > >> >> + trying
>> > > > >> >> to understand django forms better but still don't know how to do 
>> > > > >> >> this.
>>
>> > > > >> >> Can any one give me some clues?
>> > > > >> >> Any help is appreciated.
>> > > > >> >> Thanks!
>>
>> > > > >> > --
>> > > > >> > 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 
>> > > > >> > athttp://groups.google.com/group/satchmo-users?hl=en.
>>
>> > > > > --
>> > > > > 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 
>> > > > > athttp://groups.google.com/group/satchmo-users?hl=en.
>
> --
> 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.
>
>



-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

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

Reply via email to