Skip to content

Commit 7ec548c

Browse files
committed
sf: account/order model. added method to get all order status history for order stepper
1 parent 2159e49 commit 7ec548c

File tree

1 file changed

+25
-0
lines changed
  • public_html/storefront/model/account

1 file changed

+25
-0
lines changed

public_html/storefront/model/account/order.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,4 +318,29 @@ public function prepareExtendedFields(array $list = [])
318318
}
319319
return $output;
320320
}
321+
322+
/**
323+
* @param int $order_id
324+
*
325+
* @return array
326+
* @throws AException
327+
*/
328+
public function getOrderStatusStepper(int $order_id)
329+
{
330+
if(!$order_id){
331+
return [];
332+
}
333+
$language_id = (int) $this->config->get('storefront_language_id');
334+
$query = $this->db->query(
335+
"SELECT os.name AS status, oh.order_status_id, max(oh.date_added) AS date_added
336+
FROM " . $this->db->table("order_history") . " oh
337+
LEFT JOIN " . $this->db->table("order_statuses") . " os
338+
ON oh.order_status_id = os.order_status_id
339+
WHERE oh.order_id = '" . $order_id . "'
340+
AND os.language_id = '" . $language_id . "'
341+
GROUP BY oh.order_status_id, status
342+
ORDER BY max(oh.date_added)"
343+
);
344+
return $query->rows;
345+
}
321346
}

0 commit comments

Comments
 (0)