中本地工作的特殊处理
嘿,伙计们,希望你们一切顺利:!!
我需要你的帮助;我的问题是,我想在myaccount.tpl 中使用HistoryController的智能变量
例如,是否可以更改某些内容,以便在myaccount 中也使用该变量
复制代码的一部分在MyaccountController中定义所需的变量不是一个选项,因为我需要做一个仅在HistoryController/
为什么不使用MyAccountController的覆盖并将其放在override>controllers>front中?
像这个
<?php
class MyAccountController extends MyAccountControllerCore
{
public function initContent()
{
parent::initContent();
$total_orders = 0;
if ($orders = Order::getCustomerOrders($this->context->customer->id))
$total_orders = count($orders);
$this->context->smarty->assign('total_orders', $total_orders);
}
}
不要忘记删除cache/class_index.php