我在system/helper/wholesaler.php
以下輔助函數:
<?php
function is_wholesaler() {
return $this->customer->getCustomerGroupId() != 1 ? TRUE : FALSE;
}
?>
我裝在system/startup.php
的問題是助手,當我嘗試使用功能,我收到了致命錯誤「致命錯誤:使用$這個時候不在對象上下文中「。 有沒有辦法在助手中使用$ this?
一種替代的辦法是在is_wholesaler()
送$此作爲一個參數或library/customer.php
添加功能和與我Opencart的模板視圖文件$this->customer->is_wholesaler()
調用它。
致命錯誤:調用未定義功能get_instance() – Cris
那就試試我的編輯曾經 – Gautam3164
謝謝,但它不工作...未知:非靜態方法客戶:: getCustomerGroupId()不應被稱爲靜態 – Cris