0

I have Block class

class Abc_AddressManager_Block_Address_Book extends 

Mage_Customer_Block_Address_Book {
       public function getAdditionalAddresses() {
          $addresses = $this->getCustomer()->getAddresses();
          return $addresses;
      }
}

And Helper class

class Abc_AddressManager_Helper_Data extends Mage_Core_Helper_Abstract {...}

want to call getAdditionalAddresses() in Helper

Have tried

$addressBookBlock = $this->getLayout()->getBlockSingleton('Abc_AddressManager_Block_Address_Book');
$_pAddsses = $addressBookBlock->getAdditionalAddresses();

1 Answer 1

2

you should not call block methods in helpers.
Try it the other way around.
Declare your method in the helper and call it in your block using

Mage::helper('helper/alias_here')->abc();
2
  • Thanks for attention, not possible, as you can see in updated post, it is returning current customers address, then in helper, I have to load my customer, which I don't want. Commented Nov 23, 2016 at 11:58
  • you still have to load the customer in the helper. Because using it with getBlockSingleton() will most probably get an error because getCustomer may be null.
    – Marius
    Commented Nov 23, 2016 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.