Php Magento--添加到购物车--url更改
在我的站点中,当我单击addtocart按钮时,它返回以下url: 但我需要下面的特定url:Php Magento--添加到购物车--url更改,php,magento,magento-1.7,Php,Magento,Magento 1.7,在我的站点中,当我单击addtocart按钮时,它返回以下url: 但我需要下面的特定url: 我可以知道在哪里编辑这个吗?当然,您可以在所有主题文件中更改它 但是,如果您想在站点范围内更改所有添加到购物车的行为,您可能需要扩展CartController并将添加操作转发到您自己的ajax模块 例如: app/code/local/MyCompany/Ajax/controllers/CartController.php: <?php require_once 'Mage/Check
我可以知道在哪里编辑这个吗?当然,您可以在所有主题文件中更改它 但是,如果您想在站点范围内更改所有添加到购物车的行为,您可能需要扩展CartController并将添加操作转发到您自己的ajax模块 例如: app/code/local/MyCompany/Ajax/controllers/CartController.php:
<?php
require_once 'Mage/Checkout/controllers/CartController.php';
class MyCompany_Ajax_CartController extends Mage_Checkout_CartController {
public function addAction() {
$this->_forward('add', 'index', 'ajax', $this->getRequest()->getParams());
}
}
我在app/code/local中没有本地文件夹。。。。我在Magento中安装了一个主题,您还可以在Mage\u Checkout\u Helper\u购物车中更改getAddUrl。如果你不熟悉模块写作,我在这篇文章中要解释的内容太多了。但是您可以创建本地目录。Magento会认出的。对不起,现在没有。如果您愿意,我可以将文件发送到app/code/local中?最终,app/code/local中缺少文件,必须解决查询属性isAjax=1上的500服务器错误。
<?xml version="1.0"?>
<config>
[...]
<frontend>
<routers>
<checkout>
<args>
<modules>
<mycompany_ajax before="Mage_Checkout">MyCompany_Ajax</mycompany_ajax>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>