1

i tried below code :

$helper = Mage::helper('catalog/product_view')->getvalofk('Mark');

i get result but when i call it dynamically like

$helper = Mage::helper('catalog/product_view')->getvalofk('.$_REQUEST["id"].');

or

$helper = Mage::helper('catalog/product_view')->getvalofk("'.$_REQUEST["id"].'");

i am doing some syntax mistake. what am i misisng here ?....

 public function getvalofk($code)
    {
        $_option = array(
            'Blush Opaque'  => array(
                'option' => array(
                    'Turquoise',
                    'Pearl',
                    'Lapis'
                ),
                'price' => 0

            )

            ,
            'Blush Vitreous'  => array(
                'option' => array(
                    'Peridot',
                    'Amethyst',
                    'Blue Topaz',
                    'Smoky Quartz',
                    'Citrine'
                ),
                'price' => 0
            ),
           );

        return $_option[$code];
    }
1

There are no need from quotes, just:

$helper = Mage::helper('catalog/product_view')->getvalofk($_REQUEST["id"]);
5
  • not working as value is string Nov 23 '14 at 21:21
  • What is the code of the function getvalofk? Please paste it. What is the error?
    – michael
    Nov 23 '14 at 21:25
  • check?.. ne error just blank value Nov 23 '14 at 21:29
  • yeah working just some other error Nov 23 '14 at 21:31
  • I'm not sure what are you trying to do. But maybe we have to check before the return: if (isset($_option[$code])) { return $_option[$code]; } else { return array(); }
    – michael
    Nov 23 '14 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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