Created
October 15, 2015 17:47
-
-
Save andyg5000/fca24f278a785a14ffe6 to your computer and use it in GitHub Desktop.
Add a method to determine if an orders changed date has been updated in the database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compares the given order's changed date against the database value. | |
* | |
* @param $order object | |
* A fully loaded order object. | |
* | |
* @return bool | |
* Boolean indicating whether or not the order object has changed. | |
*/ | |
function commerce_order_has_changed($order) { | |
$query = new EntityFieldQuery(); | |
$query | |
->entityCondition('entity_type', 'commerce_order', '=') | |
->propertyCondition('order_id', $order->order_id, '=') | |
->propertyCondition('changed', $order->changed, '>'); | |
$result = $query->execute(); | |
return (!empty($result)) ? TRUE : FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment