Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
产品视图上的Magento自定义菜单_Magento - Fatal编程技术网

产品视图上的Magento自定义菜单

产品视图上的Magento自定义菜单,magento,Magento,我正在创建一个自定义菜单,而不是top.menu。 在新建顶部菜单.phtml中,我显示所有产品类别。在StaticBlock中,我添加了这个phtml模板文件 {{block type="catalog/product_list" template="catalog/new-top-menu.phtml"}} 在节中的page.xml文件中 <block type="page/html_header" name="header" as="header"> 用这个 <?ph

我正在创建一个自定义菜单,而不是top.menu。 在
新建顶部菜单.phtml
中,我显示所有产品类别。在StaticBlock中,我添加了这个phtml模板文件

{{block type="catalog/product_list" template="catalog/new-top-menu.phtml"}}
在节中的
page.xml
文件中

<block type="page/html_header" name="header" as="header">
用这个

<?php echo $this->getChildHtml('top-menu')  ?>

谢谢您的帮助。

据我所知,您制作了一个自定义菜单,需要在所有页面上显示

可以通过在布局文件中的正确位置添加块来完成此操作。为此,不需要使用静态块

在您自己的主题中,您必须将以下内容添加到
local.xml
布局文件中:

<default>
  <reference name="header">
     <block type="catalog/product_list" name="top-menu" 
            template="catalog/new-top-menu.phtml" />
  </reference>
</default>

确保已将
catalog/new top menu.phtml
添加到主题中。主题中的
header.phtml
副本应按照问题中的说明进行更新


这将在所有页面的标题中显示自定义菜单。正如您所看到的,您不需要一个静态块来实现这一点。除非您使用静态块还有其他原因?

据我所知,您制作了一个自定义菜单,需要在所有页面上显示

可以通过在布局文件中的正确位置添加块来完成此操作。为此,不需要使用静态块

在您自己的主题中,您必须将以下内容添加到
local.xml
布局文件中:

<default>
  <reference name="header">
     <block type="catalog/product_list" name="top-menu" 
            template="catalog/new-top-menu.phtml" />
  </reference>
</default>

确保已将
catalog/new top menu.phtml
添加到主题中。主题中的
header.phtml
副本应按照问题中的说明进行更新


这将在所有页面的标题中显示自定义菜单。正如您所看到的,您不需要一个静态块来实现这一点。除非另有原因,否则使用静态块?

最好将新模板文件添加到
base/default
主题。最好将新模板文件添加到
base/default
主题。
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

Trace:
#0 /lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `catalog...', Array)
#4 /lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `catalog...', Array)
#5 /lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /app/code/core/Mage/Eav/Model/Entity/Abstract.php(943): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))
#7 /app/code/core/Mage/Catalog/Model/Resource/Abstract.php(698): Mage_Eav_Model_Entity_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL)
#8 /app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Catalog_Model_Resource_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL)
#9 /app/code/core/Mage/Catalog/Block/Product/List.php(80): Mage_Core_Model_Abstract->load(Object(Mage_Catalog_Model_Category))
#10 /app/code/core/Mage/Catalog/Block/Product/List.php(141): Mage_Catalog_Block_Product_List->_getProductCollection()
#11 /app/code/core/Mage/Core/Block/Abstract.php(862): Mage_Catalog_Block_Product_List->_beforeToHtml()
#12 /app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#13 /app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('top-menu', true)
#14 /app/design/frontend/default/przewody/template/page/html/header.phtml(51): Mage_Core_Block_Abstract->getChildHtml('top-menu')
#15 /app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/sites/...')
#16 /app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#17 /app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#18 /app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#19 /app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#20 /app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('header', true)
#21 /app/design/frontend/default/przewody/template/page/2columns-right.phtml(42): Mage_Core_Block_Abstract->getChildHtml('header')
#22 /app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/sites/...')
#23 /app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#24 /app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#25 /app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#26 /app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#27 /app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#28 /app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#29 /app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#30 /app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#31 /app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->noRouteAction()
#32 /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#33 /app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#34 /app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#35 /app/Mage.php(683): Mage_Core_Model_App->run(Array)
#36 /index.php(90): Mage::run('', 'store')
#37 {main}
<default>
  <reference name="header">
     <block type="catalog/product_list" name="top-menu" 
            template="catalog/new-top-menu.phtml" />
  </reference>
</default>