我正在使用自定义主题的Magento 1.9.2.0版本,它运行顺畅,我想要的是主要类别的名称,而不是类别名称。我已经在这里测试了几个提示,网上有几个教程。但我不能这样做,可以指导我出错的地方吗?
1.1。我有这个代码在主页上显示类别和子类别:file top.phtml
<?php
Mage::helper('custommenu')->saveCurrentCategoryIdToSession();
$menuData = Mage::helper('custommenu')->getMenuData();
extract($menuData);
// ---
$txtLoading = '';
$txtMenu = $this->__('Menu');
$xRtl = $_rtl ? ' rtl' : '';
$wpInitContent = <<<HTML
<div id="custommenu-loading" class="$xRtl">
<div class="menu">
<div class="parentMenu menu0">
<a href="javascript:;">
<span>$txtLoading</span>
</a>
</div>
</div>
<div class="clearBoth"></div>
</div>
<div id="custommenu" class="$xRtl" style="display:none;">
<div class="menu">
<div class="parentMenu menu0">
<a href="javascript:;">
<span>$txtLoading</span>
</a>
</div>
</div>
<div class="clearBoth"></div>
</div>
<div id="custommenu-mobile" class="$xRtl" style="display:none;">
<div id="menu-button" onclick="wpMenuButtonToggle()">
<a href="javascript:void(0);">
<span>$txtMenu</span>
</a>
</div>
<div id="menu-content" style="display:none;">
<div id="menu-mobile-loading" class="menu-mobile level0">
<div class="parentMenu">
<a href="javascript:;">
<span>$txtLoading</span>
</a>
</div>
</div>
<div class="clearBoth"></div>
</div>
</div>
HTML;
?>
<div class="nav-container" id="wp-nav-container"></div>
<script type="text/javascript">
//<![CDATA[
var CUSTOMMENU_POPUP_WIDTH = <?php echo $_popupWidth; ?>;
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo $_popupTopOffset; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo $_popupDelayBeforeDisplaying; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo $_popupDelayBeforeHiding; ?>;
var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
var CUSTOMMENU_MOBILE_MENU_WIDTH_INIT = <?php echo $_mobileMenuWidthInit; ?>;
var wpCustommenuTimerShow = {};
var wpCustommenuTimerHide = {};
var wpActiveMenu = null;
var wpMobileMenuEnabled = <?php echo $_mobileMenuEnabled; ?>;
var wpMenuAjaxUrl = '<?php echo $_menuAjaxUrl; ?>';
var wpMoblieMenuAjaxUrl = '<?php echo $_moblieMenuAjaxUrl; ?>';
var wpPopupMenuContent = '';
var wpMobileMenuContent = '';
if ($('wp-nav-container') != undefined) {
$('wp-nav-container').update(<?php echo Mage::helper('core')->jsonEncode($wpInitContent); ?>);
}
<?php if (Mage::getStoreConfig('custom_menu/general/ajax_load_content')) : ?>
wpCustomMenuMobileToggle();
Event.observe(window, 'resize', function() {
wpCustomMenuMobileToggle();
});
<?php endif; ?>
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
Event.observe(document, 'dom:loaded', function(){
$$('.skip-nav').each(function(element) {
element.observe('click', function(event) {
wpMenuButtonToggle();
});
});
});
//]]>
</script>
** ThumbnailUrl $child=Mage::getSingleton('catalog/layer')->getCurrentCategory()->getId(); $imageSrc=Mage::getModel('catalog/category')->load($child)->getThumbnail(); $ThumbnailUrl=Mage::getBaseUrl('media').'catalog/category/'.$imageSrc; echo "<img src='{$ThumbnailUrl}' />";