6

i have a class see

class Magestore_RewardPoints_Helper_Block_Spend extends Magestore_RewardPoints_Helper_Calculation_Abstract {

}

which with a function

getCheckboxRules() inside, i need to access this function in a app\design\frondend\default\mytheme\template\catalog\product\view.phtml

how can i do that?

hkguile
  • 2,221
  • 5
  • 45
  • 85

2 Answers2

7

I am not sure whether the class you mentioned above is a Block or Helper.

If it is Block, you can do:

Mage::getBlockSingleton('class_name/remaining_class_name')->getCheckboxRules();

and if it is Helper:

Mage::Helper('class_name/remaining_class_name')->getCheckboxRules();

Where

  • class_name is name of registered class name in Block/Model/Helper in your module. Check config.xml file of the module.

For Example:

If you want to use Mage_Core_Block_Template_Facade Block from core/Mage files. You can use:

Mage::getBlockSingleton('core/template_facade');

Where

  • core text in the above code can be found from core/Mage/Core/etc/config.xml

    <blocks>  <!-- line#91 in Magento 1.8.0 -->
        <core>
            <class>Mage_Core_Block</class>
        </core>
    </blocks>
    
  • From above, Mage_Core_Block can be converted to core

enter image description here

Mr_Green
  • 1,615
  • 4
  • 31
  • 50
3

if you want get of function of helper class then we below

For,helper:

Mage::helper('modulename/rest_ofclass')->yourFunction();

That means

For You case: Mage::helper('modulename/rest_ofclass')->yourFunction();

modulename/rest_ofclass

1) modulename depends on helper class deceleration on your config.xml.)

<helpers>
    <modulename>
        <class>Magestore_RewardPoints_Helper</class>
    </modulename>
</helper>

2) rest_ofclass (Magestore_RewardPoints_Helper)rest of class from Block_Spend

Saravanan DS
  • 1,126
  • 1
  • 18
  • 42
Amit Bera
  • 77,456
  • 20
  • 123
  • 237