Is there any way to restrict some payment gateways to some products only? We're looking at redeveloping our existing shop and one of the products is a trial offer that is available via Direct Debit only. I can work out how to create a payment gateway to capture the additional DD information.
However, I need to restrict the payment gateways available on this trial product to be the DD gateway only. i.e. exclude PayPal, Stripe etc.
Any ideas on how I can go about this?
Second questions - is there someway of exporting all order details within one of the Sales collections?
You would need do a check in your controller. If you're using FastTrack you could create a new controller and inherit from the CheckoutPaymentMethodController and then override the method PaymentMethodForm method (from it's base)
public class MyPaymentMethodController : CheckoutPaymentMethodController
{
/// <summary>
/// Responsible for rendering the payment method form.
/// </summary>
/// <param name="view">
/// The optional view.
/// </param>
/// <returns>
/// The <see cref="ActionResult"/>.
/// </returns>
[ChildActionOnly]
public override ActionResult PaymentMethodForm(string view = "")
{
var model = CheckoutPaymentMethodModelFactory.Create();
// DO YOUR CHECKS HERE AND MODIFY THE MODEL
return view.IsNullOrWhiteSpace() ? PartialView(model) : PartialView(view, model);
}
}
Sorry missed the second question - there are several extension points - notifications, reporting, etc - but nothing in the core at the moment to export to a CSV or something.
Thanks for the response - sorry I was away for a few days.
Will take a look regarding overriding the PaymentMethodForm for limiting the payment types available for different products.
In terms of exporting, yes, I'd like to export all orders/invoices within a category to CSV file. At the moment, our fulfilment process is handled separately in a closed system (we'll develop this at some point and aim to use a notification provider to make an API call). So we need to export orders for the time being. CSV would be fine.
I'm also going to extend Merchello's IInvoice to include an ExtendedData collection so that we can store some additional information at the invoice level. Any advice for this?
I think the notification provider route is going to work well.
I've looked at adding another collection to the invoice at certain times - but always seem to come up with an easier way - I think if we added that to the core we'd wind up also needing to extend the item cache (basket, wishlist), the order and probably the shipments as well.
What sort of information are you looking to store in the new collection?
How do I get hold of a custom extended product property from my overridden CheckoutPaymentMethodContoller PaymentMethodForm function? I have to check if a flag is set on one of my products before I can use a certain payment gateway.
Re the new collection - I've decided to ditch it as I found a better way of doing it.
Exporting orders from a Sales collection would be useful but we'd need the ability to override what was exported due to custom fields etc.
The Basket property is still available in CheckoutPaymentMethodController via the base class ... so you should be able to get create a MerchelloHelper and instantiate the ProductContent from items in your basket.
Re: exporting orders - would you write up a feature request in issues.merchello.com explaining what you would like to see and how you believe it should work?
var merchello = new MerchelloHelper();
foreach(var item in Basket.Items.Where(t => t.LineItemType == Core.LineItemType.Product))
{
var wibble = merchello.TypedProductContent(item.ExtendedData["merchProductKey"]);
var tony = wibble.GetProperty("brief");
}
Merchello - restrict payment gateways to products
Hi,
Is there any way to restrict some payment gateways to some products only? We're looking at redeveloping our existing shop and one of the products is a trial offer that is available via Direct Debit only. I can work out how to create a payment gateway to capture the additional DD information.
However, I need to restrict the payment gateways available on this trial product to be the DD gateway only. i.e. exclude PayPal, Stripe etc.
Any ideas on how I can go about this?
Second questions - is there someway of exporting all order details within one of the Sales collections?
Thanks Simon
HI Simon,
You would need do a check in your controller. If you're using FastTrack you could create a new controller and inherit from the
CheckoutPaymentMethodController
and then override the methodPaymentMethodForm
method (from it's base)Sorry missed the second question - there are several extension points - notifications, reporting, etc - but nothing in the core at the moment to export to a CSV or something.
What are you looking to do?
Hi Rusty,
Thanks for the response - sorry I was away for a few days.
Will take a look regarding overriding the
PaymentMethodForm
for limiting the payment types available for different products.In terms of exporting, yes, I'd like to export all orders/invoices within a category to CSV file. At the moment, our fulfilment process is handled separately in a closed system (we'll develop this at some point and aim to use a notification provider to make an API call). So we need to export orders for the time being. CSV would be fine.
I'm also going to extend Merchello's
IInvoice
to include an ExtendedData collection so that we can store some additional information at the invoice level. Any advice for this?Thanks Simon
Hey Simon,
I think the notification provider route is going to work well.
I've looked at adding another collection to the invoice at certain times - but always seem to come up with an easier way - I think if we added that to the core we'd wind up also needing to extend the item cache (basket, wishlist), the order and probably the shipments as well.
What sort of information are you looking to store in the new collection?
Hi Rusty,
Thanks for your help so far!
How do I get hold of a custom extended product property from my overridden CheckoutPaymentMethodContoller PaymentMethodForm function? I have to check if a flag is set on one of my products before I can use a certain payment gateway.
Re the new collection - I've decided to ditch it as I found a better way of doing it.
Exporting orders from a Sales collection would be useful but we'd need the ability to override what was exported due to custom fields etc.
Cheers Simon
Hi Simon,
The
Basket
property is still available in CheckoutPaymentMethodController via the base class ... so you should be able to get create a MerchelloHelper and instantiate the ProductContent from items in your basket.Re: exporting orders - would you write up a feature request in issues.merchello.com explaining what you would like to see and how you believe it should work?
Hi Rusty
Thanks for that - worked it out.
Will add write up for the export orders function.
Many thanks Simon
is working on a reply...