Php Magento模块随机停止工作
我在我创建的企业版上有一个Magento模块,当我最初设置它时,一切正常,没有任何问题。现在我回到它,Magento抛出一个(404 not found 2),在它正常工作之前,没有任何更改,权限也没有代码,我会在下面删除一些代码片段,但这里有一些基本的软件包信息,控制器在前端不工作,但后端控制器启动时没有错误 包名称/命名空间:JejamescyclesPhp Magento模块随机停止工作,php,xml,magento,module,package,Php,Xml,Magento,Module,Package,我在我创建的企业版上有一个Magento模块,当我最初设置它时,一切正常,没有任何问题。现在我回到它,Magento抛出一个(404 not found 2),在它正常工作之前,没有任何更改,权限也没有代码,我会在下面删除一些代码片段,但这里有一些基本的软件包信息,控制器在前端不工作,但后端控制器启动时没有错误 包名称/命名空间:Jejamescycles 课程名称:财务 代码池:社区 活动:真 第一个文件-app/code/community/Jejamescycles/Finance/con
课程名称:财务
代码池:社区
活动:真
第一个文件-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();
}
}
}
没有环境变量发生变化,模块本身是独立的,不依赖任何其他软件包,我一辈子都不明白为什么它不工作。我还检查了CMS页面,没有url键冲突。我已将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>
标准
Jejamescycles_金融
金融
Jejamescycles\u Finance\u Helper
Jejamescycles_财务_街区
Jejamescycles\u Finance\u Adminhtml
这已经起作用了,但仍然让我困惑,为什么它没有起作用,这是原始的config.xml文件,确实起作用了。我将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>
标准
Jejamescycles_金融
金融
Jejamescycles\u Finance\u Helper
Jejamescycles_财务_街区
Jejamescycles\u Finance\u Adminhtml
这已经起作用了,但我仍然不明白为什么它没有起作用,这是原始的config.xml文件,确实起作用了