Triggers

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
lsalton
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Oct 01, 2008 9:38 pm

Triggers

Post by lsalton » Mon Dec 01, 2008 6:47 pm

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Triggers

Post by mazhar » Tue Dec 02, 2008 6:53 am

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.

lsalton
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Oct 01, 2008 9:38 pm

Re: Triggers

Post by lsalton » Tue Dec 02, 2008 7:51 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Triggers

Post by mazhar » Tue Dec 02, 2008 8:14 am

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

lsalton
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Oct 01, 2008 9:38 pm

Re: Triggers

Post by lsalton » Tue Dec 02, 2008 8:22 am

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!

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Triggers

Post by mazhar » Tue Dec 02, 2008 8:46 am

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.

lsalton
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Oct 01, 2008 9:38 pm

Re: Triggers

Post by lsalton » Fri Dec 05, 2008 6:04 am

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.

alkasber
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Thu May 15, 2008 2:50 pm
Location: Brazil

Re: Triggers

Post by alkasber » Fri Dec 05, 2008 6:32 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Triggers

Post by mazhar » Sat Dec 06, 2008 3:39 am

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);

Post Reply