English 中文(简体)
Magento:在习俗模板上设置障碍
原标题:Magento: placing block on custom template
  • 时间:2010-08-08 02:28:12
  •  标签:
  • magento

我们正在创建一个习惯网页,我们在这个网页上做了一些产品izar弄和最后步骤,我们希望在产品页上打上真正的<代码>catalog/product_view<>/code>。 显然,我们可以创建这块区块,并将其放入“条码”栏目。 方法,但我们面临的问题是,它的唯一障碍,没有儿童,自<条码>view.phtml以来。 在<代码>getChildHtml的顶点上拉动任何东西。

我认为,必须有一种办法,把产品观点的 block锁放在习俗非产品一页。 在不必设立每个儿童区块和他们的小区的情况下,是否有办法在像<条码>catalog_product_view上处理(<条码>)。

我们试图把它放在一页,使用习惯模板模板,我们在模板档案中做了大量的PHP,以做 w。

问题回答

你们是否尝试过这样的东西?

//save the product in the registry so the block knows which product to display
$product = Mage::getModel( catalog/product )->load($productId);
Mage::register( product , $product);

//get the block from the layout and render it to html
$Block = Mage::getSingleton( core/layout );
$product_view = $Block->createBlock( catalog/product_view );
$product_view->setTemplate( catalog/product/view.phtml );
$product_view->toHtml();

我在守则中取得了部分成功(产品观点部分被展示,然后我发现错误)。 希望能把你引向正确的方向。





相关问题
Magento addFieldToFilter allow NULLs

When using the Magento collection method addFieldToFilter is it possible to allow filtering by NULL values? I want to select all the products in a collection that have a custom attribute even if no ...

Get product link from Magento API

I am new to Magento and using their API. I need to be able to get the product url from the API call. I see that I can access the url_key and url_path, but unfortunately that s not necessarily what ...

magento extension installation

I want to install a Magento extension in WAMP, but not from the Magento connect system. How can I do this? I have the module (extension) code and I already installed the sample data in the Magento ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

How do I filter a collection by a YesNo type attribute?

I have a ‘featured’ attribute, which has a Yes/No select-list as the admin input. I presume that the values for Yes and No are 1 and 0, as they are for every other Yes/No list. However, if I try and ...

热门标签