Stock Status in email order opencart

Hello my opencart version in 1.5.6.4 I am trying to make stock status to appear in email order. I tried this on catalog/model/checkout.order.php

$order_product_info = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product['product_id'] . "'");


'stock' => $order_product_info->row['stock_status_id'],

and in /template/mail/order.tpl I have this <?php echo $product['stock']; ?>

It is almost working but it appears as an id at the email. like (product_name) 5. But not appear status name... 5 s an example of stosck_status_is Any idea on how to make it appear as text like "Available"

Upvotes: 0

Views: 125

Answers (1)

K. B.
K. B.

Reputation: 1430

after you got an stosck_status_id you should retrieve from oc_stock_status table a name where the stosck_status_id is.

$order_product_status = $this->db->query("SELECT * FROM " . DB_PREFIX . "stock_status WHERE stosck_status_id = '" . (int)$order_product_info->row['stock_status_id'] . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");

'stock_name' => $order_product_status->row['name'],

Upvotes: 0

Related Questions