首頁>Magento>source

我在Magento完成了一个網站.我面临一个必须修複的錯誤.

a:5:{i:0;s:70:"Invalid method Mage_Page_Block_Html::_redirect(Array
(
    [0] => 
)
)";i:1;s:2276:"#0    /home6/public_html/test/app/design/frontend/rwd/template/page/1column.phtml(735): Varien_Object->__call('_redirect', Array)
   #1/home6/public_html/test/app/design/frontend/rwd/template/page/1column.phtml(735): Mage_Page_Block_Html->_redirect('')
  #2/home6/public_html/test/app/code/core/Mage/Core/Block/Template.php(241): include('/home6/...')
   #3 /home6/public_html/test/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/rwd/my...')
   #4 /home6/public_html/test/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
   #5 /home6/public_html/test/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
   #6 /home6/public_html/test/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
 #7/home6/public_html/test/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
   #8 /home6/public_html/test/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
   #9 /home6/public_html/test/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
 #10/home6/public_html/test/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
 #11/home6/public_html/test/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
 #12/home6/public_html/test/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
 #13/home6/public_html/test/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
 #14 /home6/public_html/test/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
 #15 /home6/public_html/test/app/Mage.php(684): Mage_Core_Model_App->run(Array)
 #16 /home6/public_html/test/index.php(87): Mage::run('', 'store')
 #17{main}";s:3:"url";s:6:"/test/";s:11:"script_name";s:15:"/test/index.php";s:4:"skin";s:7:"default";}

有谁可以告诉我這个錯誤為什麼会發生?

我的代碼是1column.phtml:

               <div class="col-md-5 col-sm-12">
                <div class="subtitle text-center wow fadeInDown">
                        <h3>Enquiry</h3>
                    </div>
                    <div class="contact-form clearfix">
                    <?php
                    if(isset($_REQUEST['submit']))
                    {
                    $namefrm1 = $_POST['name'];                                     
                            $emailfrnd1 = $_POST['email'];
                            $messagefrnd1=$_POST['message'];
                            $event=$_POST['event'];
                            $mailto1='s[email protected]';
        $body = "Hello Sir,
    My details:
    Name : ".$namefrm1."    
    Category : ".$event."   
    Message / Notes : ".$messagefrnd1."     
    My contact details:
    E-mail : ".$emailfrnd1 ."
    Regards,
".$namefrm1; 
$mail = Mage::getModel('core/email');
$mail->setToName("My website");
$mail->setToEmail($mailto1);
$mail->setBody($body);
$mail->setSubject('Enquiry');
$mail->setFromEmail($emailfrnd1);
$mail->setFromName($namefrm1);
$mail->setType('text');// You can use 'html' or 'text'
try {
   $mail->send();
   Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
   $this->_redirect('');
}
  catch (Exception $e) {
      Mage::getSingleton('core/session')->addError('Unable to send.');
      $this->_redirect('');
  }
  }
                     ?>
                        <form action="#" method="post" enctype="multipart/form-data">
                            <div class="input-field">
                                <input type="text" class="form-control" name="name" placeholder="Your Name" required>
                            </div>
                            <div class="input-field">
                            <select name="event" class="form-control">
                               <option style="color:#b5b5b5">Select   category</option>
                              <option>Cakes</option>
                              </select>
                            </div>
                            <div class="input-field">
                                <input type="email" class="form-control" name="email" placeholder="Your Email" required>
                            </div>
                            <div class="input-field message">
                                <textarea name="message" class="form-control" placeholder="Your Message" required></textarea>
                            </div>
                            <!-- 01 <button type="submit" value="send" title="Submit" name="submit" class="btn btn-blue pull-right"><span><span>Submit</span></span></button>-->                                 
                           <button type="submit" value="send" name="submit" class="btn btn-blue pull-right">Submit</button>
                        </form>
                    </div> <!-- end .contact-form -->
                </div> <!-- .col-md-5 -->     
            </div>
        </div>
        </div>
最新回復
  • 2019-12-5
    1 #

    专欄:

    $this->_redirect('');
    

    應该是:

    Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl());
    exit(); // For phtml
    

    OR特定URL使用:

    $this->_redirectUrl('http://contus.com'); //For External URLs
    $this->_redirect('customer/account/login'); //For customer login page.
    

  • magento2:如何在Magento 2中呼叫外部代碼
  • magento 1.9:我在EC2上的域名有問题