The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

9

Please try this code:- $layout = Mage::app()->getLayout(); $block_header = $layout->createBlock('block/block')->setTemplate('template_url'); $block_links1 = $layout->createBlock('block/block','block_name')->setTemplate('template_url'); $block_header->setChild('block_as',$block_links1); $block_links2 = $layout->...


8

...at some point magento will need to ... stream it's html data to the client. At what point does this happen? See Mage_Core_Controller_Varien_Front::dispatch() - there's a code comment which answers your question directly: public function dispatch() { //(snip...) // This event gives possibility to launch something before sending output (allow ...


8

The easier way to find out what template is used is to enable the template path hints. But here is the stacktrace you need to follow. Mage_Checkout_Block_Cart_Totals::renderTotals calls renderTotal for each total. This one calls _getTotalRenderer that works like this: if there is a block with the name $code_total_renderer in the page ($code is the code of ...


6

Try like this: $this->loadLayout(); $layout = $this->getLayout(); $block = $layout->getBlock("hello"); echo $block->toHtml(); For ajax requests do this: $this->getResponse()->setBody($block->toHtml());


6

You can use the event controller_action_layout_render_before if you want to alter the html for all the pages. If you want it for a specific page page use the event controller_action_layout_render_before_[module_name]_[controller_name]_[action_name]. For example for the product view page the event is controller_action_layout_render_before_catalog_product_view,...


6

Solution 1: 1) change customer_group_id to varchar instead of integer 2) add this before$model->setData($postData); $postData['customer_group_id']=implode(',',$postData['customer_group_id']); $model->setData($postData); Solution 2: 1) remove customer_group_id from your current table 2) make new table to store customer_group_id and your primary ...


6

For render price template in the specific block, you need to call function like below, public function getPrice(\Magento\Catalog\Model\Product $product) { $priceRender = $this->getLayout()->getBlock('product.price.render.default'); if (!$priceRender) { $priceRender = $this->getLayout()->createBlock( \Magento\Framework\...


4

add this before$model->setData($postData); $postData['customer_group_id']=implode(',',$postData['customer_group_id']); $model->setData($postData);


4

app/code/Package/Modulename/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\Locale\Format" type="Vendor\Currency\Model\Format" /> </config> app/code/Package/...


4

Finding the layout of your module In your module etc/config.xml you can find the following: <layout> <updates> <module module="Vendor_Module"> <file>path/to.xml</file> </module> </updates> </layout> If this node is located under the <frontend> node you'll will that ...


3

in ui listing xml add below code in side columns tag <column name="manufacturers" class="NAMEPACE\MODULENAME\Ui\Component\Listing\Column\Product\Manufacturers"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="component" xsi:type="string">...


2

You can just re-call the toHtml() function. Make sure to perform your logic for whatever will stop the recursion before calling toHtml(). <?php if (!$this->getStopRecursive()): $this->setStopRecursive(true); echo $this->toHtml(); endif;?> Update: You can change the template on the fly: Layout XML <block type="Vendor_Module/...


2

There are two types of categories, non-anchor and anchor categories. Each on of these have a different layout handle. Your code appears to only be using the non-anchor version, if you are dealing with anchor categories you will also need to use the handle catalog_category_layered. You can check if a category is an anchor category via the category manage ...


2

This code from the catalog xml moves the product.info.options.wrapper and product.info.options.wrapper.bottom blocks to the container but it does not create them. This is the code that creates them (from the base/default theme): <reference name="content"> ... <block type="catalog/product_view" name="product.info.options.wrapper" as="...


2

The issue is caused by inability to load address attributes from EAV tables in the database. Magento assumes values of certain IDs invariant and thus they're hard-coded in a PHP code for performance optimization purposes. Attribute set ID = 2 is hard-coded for address attributes. However, the field eav_attribute_set.attribute_set_id is AUTO_INCREMENT and ...


2

Try this {{block type="checkout/agreements" name="checkout.onepage.all" as="agreementsaa" template="checkout/onepage/agreements.phtml"}} Or goto your Admin >cms> page> select your cms page and the click on Design tab>Layout Update XML and put this code: <reference name="content"> <block type="checkout/agreements" name="checkout....


2

I tried the below code : $layout = Mage::app()->getLayout(); $block_header = $layout->createBlock('page/html')->setTemplate('page/html/upper.phtml'); $block_links1 = $layout->createBlock('grana_checkout/sidebar','grana_checkout_topbar')->setTemplate('grana/checkout/topbar.phtml'); $block_header->setChild('grana_topbar',$...


2

You need to optimize code in your custom block in this case. In whatever way you are going to include your block in your layout, it will eventually call Mage_Core_Block_Template::renderView() and will take time to render it. Content of block tablisting/list is what makes problem here. From the type name, I believe you have a collection associated with that ...


2

You can use the afterRender custom binding provided by the Magento core. Here is an example from the core. The template adds afterRender="setStickyNode" which calls the setStickyNode function on the ViewModel. Here is another basic example: My template: <div afterRender="doSomething" id="example1"> <h1>This is a test</h1> </div&...


2

As stated by Fabian in the comment your child class method signature is different from the parent class. The parent method from AbstractRenderer is public function render(DataObject $row) { if ($this->getColumn()->getEditable()) { $result = '<div class="admin__grid-control">'; $result .= $this->getColumn()->getEditOnly(...


2

Magento identifies the handler from the url. So if you have defined routes as auths and calling it from index method and action then your handler should be auths_index_index.xml Rename your xml file from authunpw_index_index.xml To auths_index_index.xml


2

You will need to wrap your productCollection within any custom HTML id. Once done you will need to append it to the product wrapper like create block and use plugin to rewrite CategoryViewBlock And do something like:- class CategoryViewBlock { const PRODUCT_LISTING_WRAPPER = 'custom-ajax-wrapper'; public function afterToHtml(\Magento\Catalog\Block\...


1

If your block extend "AbstractProduct" (namespace Magento\Catalog\Block\Product) Then you can use different Price Render or create your own, example found in the core code : echo $block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW, [ '...


1

Not in the way you want it. The problem is that at the time the header is rendered, you can't know if another block will be rendered at a later point. As you already noticed, there are other factors besides the block being part of the layout hierarchy, for example: will getChildHtml() of the parent block be called? is module output disabled? is the block ...


1

Some mistakes which I can see in your files; 1. layout file declaration is placed in wrong place Layout definition should be inside frontend node. ie code should look like <frontend> <routers> <cardreload> <use>standard</use> <args> <module>Php_CardReload</...


1

Replace your code with this: <?xml version="1.0"?> <config> <modules> <Php_Cardreload> <version>0.0.1</version> <active>true</active> <codePool>local</codePool> </Php_Cardreload> </modules> ...


1

AFAIK there is no out of the box way of checking if you are in a page environment or in an email environment. But you can specify this from your layout files or from your e-mail configuration. For example if you have this code in the layout file that displays your block <block type="type/here" template="template/here.phtml" name="some.name" /> you ...


1

Test Which Template is called in HTML Steps to get Template Path Hints: Login to Magento Admin panel Go to System->Configuration. The Template Path and Block name will only appear for current website. So change the Current Configuration Scope to Main Website. Go to the Advanced section and click on Developers. Expand the Debug tab. Set the Template ...


1

Magento overwrites these templates. You can overwrite them in the backend under System > Configuration > Transactions mails But I can't tell you how to see, whether this is already the case.


1

Your renderer should extend the Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg. That is the one used for rendering textareas in the category add/edit form. You can see that from the method Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes::_getAdditionalElementTypes protected function _getAdditionalElementTypes() { return array( 'image' =&...


Only top voted, non community-wiki answers of a minimum length are eligible