Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 81

denotes questions about the `Block` classes.

7 votes
Accepted

Agressive block level caching

Magento is a flexible system and so the core developers assumed that most blocks can change dynamically. … When you figure out that in your specific use case (your specific shop) some blocks are more or less static, the easiest way to cache them for a while would be to overwrite the cache lifetime using a local.xml …
Alex's user avatar
  • 14k
3 votes
1 answer
903 views

Check whether a skin file actually exists

I want to check if a file exists in any skin and thus the result of $block->getSkinUrl('foo.png') points to a valid URL. How can I accomplish that?
Alex's user avatar
  • 14k
1 vote
Accepted

Check whether a skin file actually exists

This seems to work /** * Get skin URL of image in language specific version - fall back to English (en) * @param $ressource string - %s for language */ public function getSkinUrlFallback($resource …
Alex's user avatar
  • 14k
1 vote
1 answer
143 views

Nice way to inject the main block to a viewmodel

We want to follow the best practice to add additional functionality to a block template without "rewriting" (i.e. a DI preference) the block. Is there a nice way to inject the main block (which metho …
Alex's user avatar
  • 14k
14 votes
Accepted

Equivalent of the CMS Directive {{media url="..."}} in Normal Block Templates

The rendering of this such URLs is done when displaying CMS pages or blocks in \Mage_Core_Model_Email_Template_Filter::mediaDirective: public function mediaDirective($construction) { $params = $this …
Alex's user avatar
  • 14k
2 votes
Accepted

Use template/block in a helper

You can create blocks on the fly and fetch the HTML Simple example: $tempBlock = Mage::app()->getLayout()->createBlock('core/template') ->setTemplate('template/checkout/cart/sidebar/default.phtml …
Alex's user avatar
  • 14k
1 vote

Magento 2 How to Remove product information tabs

You might want as well just to un-check the option "show on product detail page" for all attributes. To do this for all attributes run a mysql query: update catalog_eav_attribute set is_visible_on_f …
Alex's user avatar
  • 14k
14 votes
2 answers
25k views

Equivalent of the CMS Directive {{media url="..."}} in Normal Block Templates

What is the equivalent of {{media url="wysiwyg/image.jpg"}} which can be used in CMS pages if we want to use this in a normal .phtml file (of the type core/template)
Alex's user avatar
  • 14k
9 votes
3 answers
9k views

How to overwrite a template via module in Magento2

I am creating a module and want to overwrite the template app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml. Is this possible in a module (not a theme) Unfortunate …
Alex's user avatar
  • 14k
21 votes
1 answer
7k views

Block with Cachable=false not rendered on product view page

If I understood the page cache correctly, it should load such blocks via an AJAX call. …
Alex's user avatar
  • 14k