Post by ab-oc » Mon Dec 01, 2014 10:35 pm

Hello everybody,

I'm non experienced in SQL, so I need help :-\

I got the following sql-query within public function getOrder($order_id):

Code: Select all

$order_query = $this->db->query("SELECT *, (SELECT os.name FROM `" . DB_PREFIX . "order_status` os WHERE os.order_status_id = o.order_status_id AND os.language_id = o.language_id) AS order_status FROM `" . DB_PREFIX . "order` o WHERE o.order_id = '" . (int)$order_id . "'");
(opencart 1.5.6.4. catalog/model/checkout/order.php)

additionally I need the corresponding tax_rate_id to get the tax_rate_name, which I want to display in catalog\view\theme\kitro\template\mail\order.tpl (email which is sent right after checkout).

Hope someone can help me to "upgrade" the sql query :)

Thank you very much

Andreas

New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm

Post by Dhaupin » Tue Dec 02, 2014 9:08 am

Are you saying that the order email for the kitro theme does not include tax name and rate before the total? On mobile atm. but what does the default theme do? I figured it would show tax rate name as a "line item" like it does on other order stuff.

If you find that it displays on other order thingers, what function does it use? Could you leverage the function/SQL from that? Seems like it should be somewhere to re-use...

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by ab-oc » Wed Dec 03, 2014 3:21 am

Hello Dhaupin,

thanks for reply.
On the totals tax is all right. What I want to do is display the used tax for each product.
Step 6 on Checkout is already modified to do that. Here the sql queri is modified to:

Code: Select all

$query = $this->db->query("SELECT op.*, tr.* FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "tax_rule tr ON (p.tax_class_id = tr.tax_class_id) WHERE order_id = '" . (int)$order_id . "'");
in catalog\model\account\order.php.

I'm unable to modify the sql query to get also the tax_rate_id of the purchased product for the ordermail.
See screenshot attached

Regards

Andreas

Attachments

tax_rate_id.jpg

tax_rate_id.jpg (65.74 KiB) Viewed 777 times


New member

Posts

Joined
Tue Apr 29, 2014 11:22 pm
Who is online

Users browsing this forum: Amazon [Bot] and 43 guests