News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

How to override specific templates?

Started by Ollie, August 25, 2016, 08:42:44 AM

Previous topic - Next topic

Ollie

I want to override email template (`/template/mail/order_confirm.tpl`) via my extension, but AbanteCart doesn't allow to do that for some reason. Also I'd like to modify products list, before sending email, but I don't see any `Init` or `Update` hooks inside the Order Model which performs sending (`admin/model/sale/order.php`), so I can't do that. The only `hk_confirm`
hook is called before products list generation, so it doesn't help.
Assistive technologies for people with special needs:
https://assistech.com/store/

eCommerce Core

I wonder why it is not allowed. You should be able to include this and it will automatically replace it.
Double check that you have it in correct directory and included file path in main.php of extension.
Extension should be enabled
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

Oleksandr

#2
Quote from: eCommerce Core on August 25, 2016, 09:10:31 AM
I wonder why it is not allowed. You should be able to include this and it will automatically replace it.

Email template is called using template->fetch method:
github.com/abantecart/abantecart-src/tree/master/public_html/storefront/model/checkout/order.php#L563

And it seems like this method doesn't look into extensions folder:
github.com/abantecart/abantecart-src/tree/master/public_html/core/lib/template.php#L28-L57

Am I wrong?

eCommerce Core

Now I get it. You are right. I was thinking of regular templates.

Currently, you can override it only with new template or replace this file in default template.


if (file_exists(DIR_TEMPLATE . $this->config->get('config_storefront_template') . '/template/' . $filename)){
$filename = $this->config->get('config_storefront_template') . '/template/' . $filename;
} else{
$filename = 'default/template/' . $filename;
}
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

Oleksandr

Quote from: eCommerce Core on August 26, 2016, 07:24:21 AM
Now I get it. You are right. I was thinking of regular templates.

Currently, you can override it only with new template or replace this file in default template.
Thank you.
So, there is no way to do that via extension?
1. I can't force Order model to use some other template, correct?
2. Replacing original template is not extension way.

Confirm, please.

eCommerce Core

Unfortunately, you are correct. You can not replace this with an extension approach.

We will try to put an extension override in here for 1.2.9 or 1.3

Let's keep this post open and we will come back once we will have a code change here.
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

Ollie

Quote from: eCommerce Core on September 09, 2016, 09:04:56 PM
We will try to put an extension override in here for 1.2.9 or 1.3
Let's keep this post open and we will come back once we will have a code change here.

Thank you. It would be great if you could include it in 1.2.9.
Assistive technologies for people with special needs:
https://assistech.com/store/

Forum Rules Code of conduct
AbanteCart.com 2010 -