0

First of all I am explaining settings and scenario of my magento.

  1. I have add a link ‘go to form’ on product view page and call my custom controller on click.
  2. I add following code in my controller.

    public function indexAction()
    {
      $this->loadLayout();
      $block = $this->getLayout()->createBlock(
                  'Mage_Core_Block_Template',
                   mycompany.mylink,
                   array(
                   'template' => mycompany/mylinkform.phtml'
                    )
             ) ->setData('varNameOne', 1')
               ->setData('varNameTwo', 2');
    
      $this->getLayout()->getBlock('content')->append($block);
      $this->_initLayoutMessages('core/session');
      $this->renderLayout();
    }
    
  3. On frontend, theme is look like custom theme. If I start template path I can see path like: frontend/default/theme name/..
  4. But on backend theme name is set as ‘Default’.

Now, issue is: ‘go to form’ is open in custom theme which has a path like frontend/default/theme name/template/.... But when I click on this link, my form is open in default theme which has a path like frontend/default/default/template/…

So why this is happening? When I click on link, my form must open in custom theme but I will redirected to default theme and open over there.

I have add .phtml file of form in both the theme.

Please help me on this.

This is a back end theme setting. enter image description here

1 Answer 1

0

This is because mycompany/mylinkform.phtml is not present or misconfigured in your custom theme.

In order to use mycompany/mylinkform.phtml from your custom theme, you need to ensure two things.

  1. In the Admin side, you need to set current theme as your custom theme. For the sake of illustration, I am calling theme name as custom_theme

  2. Then you need to put your phtml template at app\design\frontend\default\custom_theme/mycompany/mylinkform.phtml.

Note :- Here I assume, package is default.

So make sure that file does exist in your custom theme. Clear all cache and then try again.

6
  • Well it is not good to say client for change theme name from default to custom theme name in backend. Other thing,I already install my file in custom theme but then also it is redirected to default theme.
    – Krupali
    Mar 26, 2015 at 5:40
  • show your backend theme configuration. We cant help you without seeing that. Update your question with a screenshot of admin theme configuration. As per your comment, Magento is not going to use your custom theme. Because your theme is set to default. So magento will look in default theme directory only. Mar 26, 2015 at 5:43
  • Please have look on screenshot.
    – Krupali
    Mar 26, 2015 at 15:51
  • @Krupali As I guess, your package name is default and you didnt set any theme in backend. Put your custom theme at default field will solve every problem Mar 26, 2015 at 15:53
  • Sorry but can you please elaborate this.How and where set ? In File structure at frontend/defalut/custom_theme or at back end ?
    – Krupali
    Mar 26, 2015 at 16:14

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.