我是 PHP 和 Magento 的新手,我正在尝试从 Magento 中删除客户,但出现此错误 -
Fatal error: Call to a member function deleteCustomer() on a non-object in /home/c42gor/public_html/app/code/local/Braintree/controllers/CustomerController.php on line 30
在其他时候我得到 -
Fatal error: Call to a member function deleteCustomer() on a non-object in /home/c42gor/public_html/app/code/local/Braintree/controllers/CustomerController.php on line 15
CustomerController.php 文件包含此代码 -
<?php
require('Mage/Adminhtml/controllers/CustomerController.php');
class Braintree_CustomerController extends Mage_Adminhtml_CustomerController
{
public function deleteAction()
{
$braintree = Mage::getModel('braintree/paymentMethod');
$customerId = $this->getRequest()->getParam('id');
if ($customerId)
{
$braintree->deleteCustomer($customerId);
}
parent::deleteAction();
}
public function massDeleteAction()
{
$customerIds = $this->getRequest()->getParam('customer');
if(is_array($customerIds))
{
$braintree = Mage::getModel('braintree/paymentMethod');
foreach ($customerIds as $customerId)
{
$braintree->deleteCustomer($customerId);
}
}
parent::massDeleteAction();
}
}