我在catalog.xml中为block添加了这段代码,我得到了以下错误 -
致命错误:在第759行调用成员函数addToChildGroup()app/code/core/Mage/Core/Block/Abstract.php
<!-- custom change here-->
<block type="catalog/product_list_related" name="catalog.product.related" as="product_additional_data" after="product.info.upsell" template="catalog/product/list/related.phtml"/>
<action method="setColumnCount"><columns>4</columns></action>
<action method="setItemLimit"><type>related</type><limit>4</limit></action>
</block>
<!-- custom change here-->
Run Code Online (Sandbox Code Playgroud) 我有一个在实时电子商务服务器上运行的Magento站点.
我在开发环境中下载了整个站点以供离线使用.我更改了数据库中的基本URL值并编辑了local.xml文件,但我的本地开发站点仍然指的是在线商店.
我该如何纠正?
您好我已在管理员中添加了Google分析帐号,我是否还需要在要跟踪的文件中添加Google跟踪代码,在Google中它仍显示
未在您网站的主页上检测到Google Analytic跟踪代码
请告诉我如何将Google分析设置到我的网站.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'xxxxxxxx']);//fake
_gaq.push(['_setDomainName', 'fake.com']);//fake
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Run Code Online (Sandbox Code Playgroud)
我需要在文件中添加此类代码吗?
我想知道如何通过phtml文件在magento中运行sql查询.查询本身非常复杂,需要连接.有任何想法吗?
为您提供信息:
我有的产品有3个自定义属性(城镇,地区,城市).现在我想要实现的是按字母顺序排列AZ的城镇列表.点击这个城镇时,它会过滤与城镇相关的产品.
希望它有意义.
任何帮助深表感谢.
朱利安
我已经实现了表速率,它看起来像 
如果我的订单总数是350或500或800所有情况下,我得到35运费价格
我选择条件为"价格与目的地".
所以请指教
我正在一个网站上工作,我正在显示与当前类别相关的所有子类别的列表.下面的代码可以正常工作,但我想改变子类别列表的排序方式.目前,它按类别ID排序.我希望它以Magento用户在管理员中放置类别的任何顺序显示(他们可以通过拖放来更改类别顺序).感谢任何帮助!
<?php
$currentCat = Mage::registry('current_category');
if ( $currentCat->getParentId() == Mage::app()->getStore()->getRootCategoryId() )
{
// current category is a toplevel category
$loadCategory = $currentCat;
}
else
{
// current category is a sub-(or subsub-, etc...)category of a toplevel category
// load the parent category of the current category
$loadCategory = Mage::getModel('catalog/category')->load($currentCat->getParentId());
}
$subCategories = explode(',', $loadCategory->getChildren());
foreach ( $subCategories as $subCategoryId )
{
$cat = Mage::getModel('catalog/category')->load($subCategoryId);
if($cat->getIsActive())
{
echo '<a href="'.$cat->getURL().'">'.$cat->getName().'</a>';
}
}
?>
Run Code Online (Sandbox Code Playgroud) 我正在使用magento 1.7.0.2。
我已经禁用了magento admin中的某些产品,并刷新了所有magento缓存并正确地重新索引了所有数据。但是禁用的产品仍显示在magento前端上。
我只希望启用的产品显示在前端。
嘿,我是一个完整的magento菜鸟,但我们将我们的版本升级到最新版本,现在当您完成结账并完成付款时,您会看到此错误.
我已经像大家似乎建议的那样截断了日志表,我已经检查了重复的skus.我已经考虑重新索引我们的产品价格,因为它说它需要重新编制索引,但是当我这样做时,我会看到:'重建索引过程存在问题.'.
这是结账时的错误.任何帮助或方向将不胜感激!
处理您的请求时出错.SQLSTATE [23000]:完整性约束违规:1062重复条目"100002112"表示密钥
我试图覆盖Mage_Checkout_CartController的默认indexAction().我在app/local中创建了以下文件:
MyNamespace/cartStockCheck/controllers/CartController.php MyNamespace/cartStockCheck/etc/config.xml
还有app/etc/modules:MyNamespace_CartStockCheck.xml
似乎Magento拿起了我的扩展程序,因为我可以看到它在高级部分的管理员后端中列出,但除此之外我打开购物车时没有任何反应.
编辑:没有其他插件覆盖CartController.我还修复了indexAction中不正确的调用.仍然看不到我的文字在购物车中回响
编辑2:检查下面的答案.有用!
CartController.php的内容是:
<?php
require_once 'Mage/Checkout/controllers/CartController.php';
class MyNamespace_CartStockCheck_CartController extends Mage_Checkout_CartController
{
public function addAction()
{
echo 'test addAction';
parent::addAction();
}
public function indexAction()
{
echo 'test indexAction';
parent::addAction();
}
}
?>
Run Code Online (Sandbox Code Playgroud)
config.xml的内容:
<?xml version="1.0"?>
<config>
<modules>
<MyNamespace_CartStockCheck>
<version>0.1.0</version>
</MyNamespace_CartStockCheck>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<MyNamespace_CartStockCheck before="Mage_Checkout">MyNamespace_CartStockCheck</MyNamespace_CartStockCheck>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
Run Code Online (Sandbox Code Playgroud)
MyNamespace_CartStockCheck.xml的内容:
<?xml version="1.0"?>
<config>
<modules>
<MyNamespace_CartStockCheck>
<active>true</active>
<codepool>local</codepool>
</MyNamespace_CartStockCheck>
</modules>
</config>
Run Code Online (Sandbox Code Playgroud) 我正在研究magento 1.7版本.在这里我有一个数组中的数据.我使用json编码json_encode并插入到数据库中.但我得到的错误就像
连接已重置.
如果我插入正常值,那么它工作正常.在数据库中,我有字段类型longtext.我使用mysql_real_escape_string(),base_63_encode(),serialize()但没有成功.我正在使用以下代码
$table = Mage::getSingleton('core/resource')->getTableName('checkout_prescription_details');
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$custom = json_encode($customoptions);
$query = "insert into {$table} set `data`='$custom';
$write->query($query);
Run Code Online (Sandbox Code Playgroud)
在这时我echo $query然后它显示编码数据,当我从phpmyadmin插入它然后它插入数据库,但使用$write->query($query);它不插入数据库.
请提出相关建议.
magento ×10
magento-1.7 ×3
php ×3
database ×2
controller ×1
installation ×1
json ×1
mysql ×1
overriding ×1
shipping ×1
xml ×1