1.When I create the voucher (product) in admin, I need to set thebatch_id so it knows where to pull the voucher from. How can this beachieved?
2. What do I need to modify to get spree to select the voucher frombatch on successful payment?
3. How can this be added to the customer's account as an order?
Looking forward to your suggestions.
--You received this message because you are subscribed to the Google Groups "Spree" group.To post to this group, send email to spree...@googlegroups.com.To unsubscribe from this group, send email to spree-user+...@googlegroups.com.For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
Thanks for the reply. Think I'm happy with step one having played a
little this morning.
Am not quite as sure about step two. Will read through now..
On Feb 13, 8:37 am, Brian Quinn <br...@spreecommerce.com> wrote:
> > 1.When I create the voucher (product) in admin, I need to set the
> > batch_id so it knows where to pull the voucher from. How can this be
> > achieved?
>
> You can just add a migration to extend the spree_products table to include the new batch_id column, and then create on products_decorator.rb that class_eval's the Product class to include the belongs_to :batch association.
>
> Finally, you need to define a Deface override to include the batch drop down / form input on the products admin form. These steps are all covered in the customization section of the Spree Guides.
>
>
>
> > 2. What do I need to modify to get spree to select the voucher from
> > batch on successful payment?
>
> I think an ActiveRecord Observer on the Order model's state_machine is the way to go, take a look at the state_machine gems docs here:
>
> https://github.com/pluginaweek/state_machine
>
> You basically want to select the voucher on :complete
>
> > 3. How can this be added to the customer's account as an order?
>
> I'd suggest on step 2 above, that you associate the voucher with line_item in the order that way you can track back which order received which voucher(s). And you can always re-display the customer their voucher by looping through their orders.
>
>
>
>
>
>
>
>
>
> > Looking forward to your suggestions.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Spree" group.
> > To post to this group, send email to spree...@googlegroups.com (mailto:spree-user@googlegroups.com).
> > To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com (mailto:spree-user+unsub...@googlegroups.com).
> > For more options, visit this group athttp://groups.google.com/group/spree-user?hl=en.
Thanks for the reply. Think I'm happy with step one having played a
little this morning.
Am not quite as sure about step two. Will read through now..
On Feb 13, 8:37 am, Brian Quinn <br...@spreecommerce.com> wrote:
> > 1.When I create the voucher (product) in admin, I need to set the
> > batch_id so it knows where to pull the voucher from. How can this be
> > achieved?
>
> You can just add a migration to extend the spree_products table to include the new batch_id column, and then create on products_decorator.rb that class_eval's the Product class to include the belongs_to :batch association.
>
> Finally, you need to define a Deface override to include the batch drop down / form input on the products admin form. These steps are all covered in the customization section of the Spree Guides.
>
>
>
> > 2. What do I need to modify to get spree to select the voucher from
> > batch on successful payment?
>
> I think an ActiveRecord Observer on the Order model's state_machine is the way to go, take a look at the state_machine gems docs here:
>
> https://github.com/pluginaweek/state_machine
>
> You basically want to select the voucher on :complete
>
> > 3. How can this be added to the customer's account as an order?
>
> I'd suggest on step 2 above, that you associate the voucher with line_item in the order that way you can track back which order received which voucher(s). And you can always re-display the customer their voucher by looping through their orders.
>
>
>
>
>
>
>
>
>
> > Looking forward to your suggestions.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Spree" group.
> > To post to this group, send email to spree...@googlegroups.com (mailto:spree-user@googlegroups.com).
> > To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com (mailto:spree-user+unsub...@googlegroups.com).
if :prepaid_voucher?self.generate_voucherend
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/1wlLgjiE_RoJ.
To post to this group, send email to spree...@googlegroups.com.
To unsubscribe from this group, send email to spree-user+...@googlegroups.com.