Magento:在自定义模板上放置块
我们正在创建一个自定义页面,在其中制作产品向导,最后一步,我们想要拉入产品页面,实际上是 catalog/product_view
块。显然,我们可以创建该块并使用 renderview 方法将其设置在页面中,但我们遇到的问题是它只有该块而没有它的子块,并且由于 view.phtml< /code> 引入了大量的
getChildHtml
块,没有任何作用。
我认为必须有一种方法将产品视图块及其所有子视图放置在自定义非产品页面中。无需创建每个子块及其子块,是否有一种方法可以以编程方式拉取 xml 文件中的所有块,例如 catalog.xmlcatalog_product_view
句柄code> 并将其放在另一个页面上?
我们尝试将其放入的页面是一个使用自定义模板的类别页面,我们在模板文件中执行大量 PHP 操作来执行向导。
We are creating a custom page in which we are making something of a product wizard and the final step, we want to pull in the product page, really the catalog/product_view
block. Obviously we can create the block and set it in the page with the renderview
method but the problem we are having is its only that block and none of its children, and since the view.phtml
pulls in a ton of getChildHtml
blocks nothing works.
I am thinking there has to be a way to place the product view block with all of its children in a custom non product page. Without having to create every single child block and their child blocks, is there a way to programmatically pull in all the blocks that are in an xml file like the catalog_product_view
handle in catalog.xml
and place it on another page?
The page we are trying to put it on is a category page using a custom template where we are doing a lot of PHP in the template file to do the wizard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过这样的事情吗?
我使用此代码取得了部分成功(显示了部分产品视图块,然后出现错误)。希望它能为您指明正确的方向。
Have you tried something like this?
I've had partial success with this code (part of the product view block is displayed and then I get an error). Hopefully it will point you in the right direction.