- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
如何从主菜单中排除 Magento 类别并仍然将其保留在侧边栏中。我已经通过将默认的 magento 替换为这些代码来尝试在 Google 上搜索时获得的这两个代码,但它不起作用
这是代码
<?php $_menu = "" ?>
<?php if($_menu): ?>
<div class="nav-container">
<ul id="nav">
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php if(stristr('71,70,69', $_category->getId()) === FALSE) : ?>
<?php echo $this->drawItem($_category) ?>
<?php endif ?>
<?php endforeach ?>
<?php // echo $_menu ?>
</ul>
</div>
<?php endif ?>
这是第二段代码。我也是通过谷歌搜索得到的。
<?php $_menu = ''?>
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php $_menu .= $this->drawItem($_category) ?>
<?php endforeach ?>
<?php if ($_menu): ?>
<div class="nav-container">
<ul id="nav">
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php if (!in_array($_category->getId(), array(12,34,56))) : ?> <?php echo $this- >drawItem($_category) ?>
<?php endif; ?>
<?php endforeach ?>
</ul>
</div>
<?php endif; */ ?>
他们似乎都没有工作。我正在使用 magento 1. 7.1
谢谢你的帮助
最佳答案
从顶部导航菜单中排除一个类别,但在左侧菜单中保留该类别。菜单项是否应该显示在顶部导航菜单中可以在管理员中控制。您必须执行以下步骤:
首先,使用数据升级脚本创建一个代码为“use_in_navigation”的 bool 类别属性:
$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_category', 'use_in_navigation', array(
'type' => 'int',
'input' => 'select',
'label' => 'Use in navigation',
'required' => false,
'note' => '',
'user_defined' => '1',
'source' => 'eav/entity_attribute_source_boolean',
'default' => false));
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
'General Information',
'use_in_navigation',
100);
$installer->endSetup();
其次,覆盖“Mage_Page_Block_Html_Topmenu”中的“_getHtml”并跳过“use_in_navigation”为假的任何子项的呈现:
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass){
....
foreach ($children as $child) {
if(!$child->getUseInNavigation()){
continue;
}
....
}
}
按照这些思路应该可以解决问题。
注意:函数名称取自 Magento CE 1.8。它们可能与 Magento CE 1.7 不同。
关于php - 如何从主菜单中排除 Magento 类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26438115/
Magento 主题和 Magento 皮肤有什么区别?它们和 Magento 模块之间有什么关系? 最佳答案 主题是创建视觉体验的布局、模板、区域设置和/或外观文件的任意组合... 主题由以下任意或
我想在 Magento 之外获得购物车 Block。这是我的代码。 getLocale()->getLocaleCode(); //Solution Mage::getSingleto
我是 Magento 新手,使用 CE 1.7.0.2 开发了一个网站。现在可以上线了,但我遇到了页面加载缓慢的问题。 我的网站产品主页、列表和详细信息页面最初需要 10-13 秒的时间来加载页面,但
我在 magento 网站上工作。我有 4 个类别,其中两个使用其他主题(不是我的特定 magento 主题)。我如何配置我的主题以从我的默认主题而不是基本主题中获取丢失的文件。 谢谢 最佳答案 通常
我遇到了我的 magento 项目的要求,因此我需要为特定客户群的购买提供特别折扣。此折扣必须显示在客户帐户中,如果他们属于该特定组,并且当用户要使用该特定折扣时,必须根据该折扣优惠对该商品的价格进行
我在 Magento 主题开发中找到的大量教程建议从使用空白作为制作您自己的自定义主题的指南开始。很多这些文章已经很旧了,截至当前版本(1.7),情况仍然如此吗? 附言- 除了 Magento 的 o
似乎这应该是一个可以找到的问题,但我找不到它。 magento 数据库中存储的类别 NAME 在哪里?我可以看到 catalog_category_entity有 key ID,然后还有其他 EAV
我知道 magento 会根据需要调整原始产品图像的大小并以不同的大小对其进行多次缓存。 这些 chached 图像存储在哪里(路径)? 当您从缓存管理中刷新图像缓存时,它们会被删除吗? 如果我要手动
我在我的 magento 网上商店中使用这个扩展 http://www.manadev.com/seo-layered-navigation-plus (分层导航) 此扩展适用于简单的产品。 但就我而
我在 Magento 的一家商店下拥有某些产品的批发属性。我想设置它,以便这些特定属性仅出现在产品页面上,如果客户已登录并且他们在批发客户组中。 这可能吗? 最佳答案 像这样的事情应该可以工作,尽管我
和有什么区别和 在 Magento 中? 我将创建一个新模块,我必须决定在这两个事件中的哪一个事件中挂起我的观察者。 最佳答案 类别(和所有其他对象)保存在事务中。事件catalog_categor
好吧,这是一个似乎很容易解决的问题,但它让我望而却步...... 我的 Magento Web 上有一些类别,每个类别都有一些产品。我希望它们显示为 4 列计数,但它始终显示为 3 列计数,如下所示:
我已经在我的网站上添加了一些成员(member)跟踪代码。为了使跟踪工作正常进行,我需要向关联公司提供确认付款的网址。 我正在使用Magento,我不确定该版本,但几年内未对其进行更新。我需要知道订单
我们的网站遇到了问题。 系统 > 配置屏幕仅显示菜单、侧面菜单和页脚。当我们点击侧边菜单选项时,屏幕仍然黑屏,相关信息也没有出现。请看 this link .这就是出现的情况。当我们点击任何侧面菜单选
我想只使用一个 csv 文件来翻译前端 Magento 商店。所以我这样做了: 我创建了一个名为 Translator 的自定义模块。在其 config.xml 中,我放置了以下几行: ....
我添加了自定义订单状态选项。 有谁知道我如何通过API将其设置为自定义值? 最佳答案 感谢Diglin为我指出的正确位置。只是为了正确地给出答案: 您可以使用addComment方法来执行此操作,该方
目前,Magento 处理大规模操作的方式存在问题。无论分页如何,它都会返回一些 JS,其中包含当前集合和过滤器的每个 db id。这是为了支持网格标题中的“全选”与“全选可见”选项。当您的记录数量较
如何收集具有此角色的所有角色(系统->权限->角色)和用户? 谢谢。 最佳答案 获得所有角色 $roles = Mage::getModel('admin/roles')->getCol
如果能在我网站的各种应用程序之间进行通用登录,那将是一种巨大的用户体验。现在,我有一个 Magento 店面和一个 IPS 板社区。我正在尝试将它们集成到我的用户的一个通用登录中。 IPS 板提供多种
我正在为 Magento 社区 1.4.2 版中的时尚客户开发一个网站,作为该项目的一部分,我需要一些定制的主页促销块来展示特定产品或产品类别。为此,我想我会编写自己的小部件,并且除了如何处理图像外,
我是一名优秀的程序员,十分优秀!