Developer forum

Forum » Development » order state change by custom development

order state change by custom development

Rui Silva
Reply

Hi,

I've a custom development that is triggered on the order template extender to read a remote service and based on the response we may change the state id of the user orders.

Everything works fine, but on the customer center the list of orders when an order is updated by the custom development is not updated on the tags being generated to the template. If I refresh the page them the updated orders are rendered correctly.

Is there any way to update the tags for the template execution, or should I use another event/notification to run the custom development before the tags are rendered?

Thanks,

Rui Silva


Replies

 
Nicolai Pedersen
Reply

Hi Rui.

How do you update the order state? Directly on DB or using the order instance that is passed to the template extender?

The template extender is to extend the template - not to do other stuff. You could do what you do in your extender and add your own custom template tag to the template instance and render that instead - in that way you have complete control over the text.

BR Nicolai

 
Rui Silva
Reply

Hi Nicolai,

For this what I really need is a way to execute the custom development for each time the user goes to the order history page, because the orders that are updated can be the ones generated for the page in the customer center or other not visible(rendered). The custom development reads the order with the API (using a custom SQL query) and updates the orders using the API.

Thanks,

Rui Silva

 
Nicolai Pedersen
Reply

Hi Rui

That is the problem - you load another set of orders than what you display.

  1. Dynamicweb loads the orders to display in the customer center
  2. It starts rendering them
  3. Creates a new instance of the template extender
  4. In your custom extender, you query another instance of the potentially same order, and make your change
  5. The order(s) queried in 1 is still the one being rendered - it was loaded from the DB before you made your change
  6. You cannot see what was changed in your template.

So you need to fix this.

 

You must be logged in to post in the forum