| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Calling callback method to change transaction status. | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Calling callback method to change transaction status.
Hi,
I'm manage to call a callback method using this URL, <MYSITE>/callback.php This is the content of the callback.php Code:
Within this method, I have $_POST['order_id'], so how do i query the transaction that having this ID and update it status? I use this method Code:
Thanks.
__________________
Core version: 5.2.6 |
|||||||
#2
|
|||||||
|
|||||||
Re: Calling callback method to change transaction status.
Hi, any help?
__________________
Core version: 5.2.6 |
|||||||
#3
|
|||||||
|
|||||||
Re: Calling callback method to change transaction status.
How do i query the database and update the fields. Eg.
Code:
How can I achieve this?
__________________
Core version: 5.2.6 |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Calling callback method to change transaction status.
Quote:
The way you do it looks a bit hacky. Why don't you add a custom controller class? Quote:
What is $this->transaction? Where did this variable go from? Quote:
X-Cart 5 uses Doctrine ORM 2 library to work with the database. Did you check the documentation for developers? It has a number of tutorials and examples on working with database entities: http://kb.x-cart.com/
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#5
|
|||||||
|
|||||||
Re: Calling callback method to change transaction status.
Quote:
Yes, I already read through all the documentation but nothing seems to help. If you have any ideas or ways on how do i modified the Orders table after callback method being called will be helpful. Even searching for item using query builders or search method does not works, it returns all the things, instead of the only item that being searched. Thanks in advanced.
__________________
Core version: 5.2.6 |
|||||||
#6
|
|||||||||
|
|||||||||
Re: Calling callback method to change transaction status.
If you want to update an order field, you should:
1. Retrieve the order model (entity) into a variable 2. Update the model's properties by using "setter" methods 3. Flush the changes into the database if the page controller doesn't do it after finishing executing the action method These articles may help you to do the above: - http://kb.x-cart.com/display/XDD/Understanding+Models - http://kb.x-cart.com/display/XDD/Searching+entities+in+repositories Or do you want to add new fields to the order model? If so you should "decorate" the order model from your custom module and add the necessary fields.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#7
|
|||||||
|
|||||||
Re: Calling callback method to change transaction status.
Hi,
Thanks! I manage to set the payment status field, following the guide that you gives me, by using this method setPaymentStatus as "setter" But I cant see any "setter" for is_order field, can you point me to which function can i use to update is_order? Thanks is advance.
__________________
Core version: 5.2.6 |
|||||||
#8
|
|||||||||
|
|||||||||
Re: Calling callback method to change transaction status.
X-Cart 5 generates missing getter and setter methods for fields automatically.
However, is_order is not a regular field, but a "discriminator" column that allows X-Cart to determine if a database record is an entity of \XLite\Model\Cart class, or \XLite\Model\Order class (records for both the classes reside in the same database table). You can ask X-Cart to turn \XLite\Model\Cart into \XLite\Model\Order by using $cart->markAsOrder(). And use $order->markAsCart() to do the opposite.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#9
|
|||||||
|
|||||||
Re: Calling callback method to change transaction status.
Hi qualiteam!
Thanks again and again! Manage to get what I want to do now. Finally my callback is working. Im searching for markAsOrder as you mention, but what i found something better which is processSucceed, instead of updating status and update is_order manually, this processSucceed method do all this stuff for me automagically. Thanks again.
__________________
Core version: 5.2.6 |
|||||||
|
|
|||
X-Cart forums © 2001-2020
|