I'm new to PHP and Magento, I'm trying to delete a Customer from Magento and I get this error -
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
At other times I get -
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
The CustomerController.php file contains this code -
<?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();
}
}