Page 1 of 1

Triggers

Posted: Mon Dec 01, 2008 6:47 pm
by lsalton
Hi there,

Please I need some help here.

I'm work with payments and order status. I saw there are triggers to set status order depend on case. (For example, Order is set to "Payment Pending" when trigger "Order Placed" is actioned..)

I need to know how does trigger work in AbleCommerce?

Please, help me...

Tks.

L.Salton.

Re: Triggers

Posted: Tue Dec 02, 2008 6:53 am
by mazhar
I am not clear about the question. Are you want to perform some of your custom work against the trigger? If so you can not attach your custom code to these triggers because they are internal for AbleCommerce.

Re: Triggers

Posted: Tue Dec 02, 2008 7:51 am
by lsalton
Hi Mazhar, tks for your answer!

I understood what you said!

But what I want to know is how is related the trigger with status order.
How do I set a status order through triggers in AC?

For example:
There is a status order called "Problem" and for it there are 2 triggers "Payment Authorization Failed" and "Payment Capture Failed".

I understood when the payment authorizantion or payment capture fail the status order is set to "Problem", right?

Here is the question, how can I do that? How do I start the trigger to set a status order? Is it automatic or no?

Because I've been using an object Order to update status and I haven't seen a method that use trigger to do this.

Is it more clear now? I hope so!

Please help! Tks.

Salton.

Re: Triggers

Posted: Tue Dec 02, 2008 8:14 am
by mazhar
You can use these triggers with your order status to let the order change its status against these triggers. For example if you create a new order status let's say it MyCustomOrderStatus and assign it the OrderPlaced trigger. Now when ever some one place the order the trigger will be fired and it will update the order status to MyCustomOrderStatus

Re: Triggers

Posted: Tue Dec 02, 2008 8:22 am
by lsalton
Mazhar,

Can you show me a C# code that do this?: Now when ever some one place the order the trigger will be fired and it will update the order status to MyCustomOrderStatus

I need an example to fire a trigger (any trigger) to set a status order (any status order) in a specific order!

Re: Triggers

Posted: Tue Dec 02, 2008 8:46 am
by mazhar
There is no need of code. For example if you attached you custom order status with OrderPlaced trigger just go the store side and place an order and then on receipt page or from admin check the status of the order.

Re: Triggers

Posted: Fri Dec 05, 2008 6:04 am
by lsalton
Hi Mazhar,

I'm facing a freak problem with triggers here...

I've created a custom Order Status called "AUTHORIZED" and attached a trigger "Payment Authorized".

During a payment process when I see that everything was OK, the payment is AUTHORIZED!!

So I set the payment status like below:

myPayment.UpdateStatus(PaymentStatus.Authorized);
myPayment.Save();

The payment Status is changing, but the trigger don't work...the order status don't change!

Why? What I'm doing wrong?

Tks,

Salton.

Re: Triggers

Posted: Fri Dec 05, 2008 6:32 am
by alkasber
Help anyone?

We're asking for help because this is not a trivial customization to enhance AC7, it is a critical customization to make it work in Brazil.
We already made 80% of the modifications needed for AC7 work here, but now we're stuck in these triggers.

Thanks.

Re: Triggers

Posted: Sat Dec 06, 2008 3:39 am
by mazhar
Sounds like a cache problem. After changing the payment status try to load the order again as below

Code: Select all

 Order order = OrderDataSource.Load(orderId, false);
Response.write(order.OrderStatus.DisplayName);