Magento模块随机停止工作

时间:2016-06-01 09:26:22

标签: php xml magento module package

我在我创建的企业版上有一个Magento模块,当我最初设置它时它完全正常,没有任何问题,现在我已经回到它,Magento抛出一个(404不是发现2),在它工作正常之前,没有任何改变,Permissions避难所没有代码,我删除了一些片段,但是一些基本的包信息,控制器不在前端工作但是后端控制器启动时没有错误。

包名/命名空间:Jejamescycles
模块名称:财务
Codepool:社区
主动:真实

第一个文件 - app / code / community / Jejamescycles / Finance / controllers / IndexController.php

<?php

    class Jejamescycles_Finance_IndexController extends Mage_Core_Controller_Front_Action{
        public function indexAction(){

            $conn = Mage::getSingleton('core/resource')->getConnection('core_read');

            $conn->query("CREATE TABLE IF NOT EXISTS `v12_finance_sales`
            (
                `sales_id` INT(11) NOT NULL AUTO_INCREMENT, 
                `sales_reference` VARCHAR(50) NOT NULL UNIQUE, 
                `customer_id` INT(11) NOT NULL , 
                `products` TEXT NOT NULL , 
                `total_price` VARCHAR(255) NOT NULL , 
                `status` VARCHAR(4) NOT NULL , 
                PRIMARY KEY(`sales_id`)
            )");



            $this->loadLayout();

             $block = $this->getLayout()->createBlock(
                                                'Mage_Core_Block_Template',
                                                'v12content'
                                                )
                                   ->setTemplate('v12_finance/index.phtml');
            $this->getLayout()->getBlock('content')->append($block);

            $this->renderLayout();

        }
        private function _getCustomerSession() {
            Mage::getSingleton('core/session', array('name' => 'frontend'));
            return Mage::getSingleton('customer/session');
        }
        function successAction()
        {

            $reference = $_GET['REF'];
            $sales_reference = $_GET['SR'];
            $status = $_GET['Status'];
            $auth = $_GET['Auth'];

            $conn = Mage::getSingleton('core/resource')->getConnection('core/read');

            $confirmed = 0;

            if($status == 'A' || $status == 'S')
            {
                $confirmed = 1;
            }
            try{

                $conn->query("UPDATE `v12_finance_sales` SET `confirmed` = '$confirmed' , `status` = '$status' WHERE `sales_reference` = '$sales_reference'");

                $this->loadLayout();

                $this->renderLayout();

            }catch(Exception $e)
            {
                $fh = fopen("FINANCE_LOG.log" , "a+");
                fwrite($fh , "ERROR[" . date('H:i:s d-m-Y') . ']:EXCEPTION:' . $e->getMessage());
                fclose($fh);

                $conn->query("CREATE TABLE IF NOT EXISTS `v12_finance_errors`
                (
                    `error_id` int(11) not null AUTO_INCREMENT, 
                    `sales_reference` VARCHAR(200) NOT NULL , 
                    `status` VARCHAR(4) NOT NULL , 
                    PRIMARY KEY(`error_id`)
                )");

                $conn->query("INSERT INTO `v12_finance_errors`
                    (
                        `sales_reference` , 
                        `status`
                    ) VALUES (
                        '" . $sales_reference . "' , 
                        '$status'
                    )");

                die("There was an error processing this request, please contact <a href='mailto:support@jejamescycles.co.uk'>Support</a> with this URL");
            }

        }
        function basic_infoAction()
        {
            $conn = Mage::getSingleton('core/resource')->getConnection('core/read');

           // $conn->query("ALTER TABLE `v12_finance_sales` ADD COLUMN `status` varchar(4) NOT NULL");
            if(!Mage::getSingleton('customer/session')->isLoggedIn()){
                //not logged in

                header("Location: http://" . $_SERVER['SERVER_NAME'] . "/customer/account");

            }else{
                 $this->loadLayout();

                 $block = $this->getLayout()->createBlock(
                                                    'Mage_Core_Block_Template',
                                                    'v12content'
                                                    )
                                       ->setTemplate('v12_finance/finance_setup.phtml');
                $this->getLayout()->getBlock('content')->append($block);

                $this->renderLayout();
            }

        }
}

?>

和config.xml文件:

<config>
<!-- ... -->
    <frontend>
        <routers>
            <!-- the <helloworld> tagname appears to be arbitrary, but by
            convention is should match the frontName tag below-->
            <jejamescycles_finance>
                <use>standard</use>
                <args>
                    <module>Jejamescycles_Finance</module>
                    <frontName>jejamescycles_finance</frontName>
                </args>
            </jejamescycles_finance>
        </routers>
    </frontend>
    <global>
         <helpers>
            <finance>
                <!-- Helper definition needed by Magento -->
                <class>Jejamescycles_Finance_Helper</class>
            </finance>
        </helpers>
        <blocks>
          <jejamescycles_finance>
            <class>Jejamescycles_Finance_Block</class>
          </jejamescycles_finance>
        </blocks>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <jejamescycles_finance before="Mage_Adminhtml">Jejamescycles_Finance_Adminhtml</jejamescycles_finance>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
<!-- ... -->
</config>

没有环境变量发生变化,模块本身是独立的,并且不依赖于任何其他包,我无法弄清楚为什么它不起作用。我还检查了CMS页面,并且没有网址密钥冲突。

1 个答案:

答案 0 :(得分:0)

我已将config.xml更改为:

<config>
<!-- ... -->
    <frontend>
        <routers>
            <!-- the <helloworld> tagname appears to be arbitrary, but by
            convention is should match the frontName tag below-->
            <finance>
                <use>standard</use>
                <args>
                    <module>Jejamescycles_Finance</module>
                    <frontName>finance</frontName>
                </args>
            </finance>
        </routers>
    </frontend>
    <global>
         <helpers>
            <finance>
                <!-- Helper definition needed by Magento -->
                <class>Jejamescycles_Finance_Helper</class>
            </finance>
        </helpers>
        <blocks>
          <jejamescycles_finance>
            <class>Jejamescycles_Finance_Block</class>
          </jejamescycles_finance>
        </blocks>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <jejamescycles_finance before="Mage_Adminhtml">Jejamescycles_Finance_Adminhtml</jejamescycles_finance>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
<!-- ... -->
</config>

这已经奏效了,它仍然让我感到困惑,为什么它还没有工作,这是原始的config.xml文件并且确实有效。