Questions tagged [blocks]

denotes questions about the Block classes.

It should be used to mark questions related to the layout blocks and the block system of Magento. (adding, removing, changing, rewriting, moving)

See also, for refinement:

  • for questions related to the layout XML
  • for questions related rewriting block classes
  • for questions related to block with a PHTML template
1814 questions
6
votes
2 answers

How to access a function in block class from phtml?

i have a class see class Magestore_RewardPoints_Helper_Block_Spend extends Magestore_RewardPoints_Helper_Calculation_Abstract { } which with a function getCheckboxRules() inside, i need to access this function in a…
hkguile
  • 2,221
  • 5
  • 45
  • 85
6
votes
1 answer

Which block method should be used for preparing data

In a standard template block i.e. extends Mage_Core_Block_Template, which method should be used for preparing required block data? Is it beforeToHtml? or some other? Im looking to find the most accepted way to load the block with the required data…
Marty Wallace
  • 5,631
  • 13
  • 65
  • 90
5
votes
2 answers

Different methods for creating Blocks

What is the difference between below two pieces of code? Code 1 $block = $this->getLayout()->createBlock('CLASS_GROUP_NAME/PATH_TO_BLOCK_FILE')->toHtml(); $this->getResponse()->setBody($block); Code 2 $block =…
Anshu Mishra
  • 8,950
  • 7
  • 40
  • 88
3
votes
2 answers

how to print a list of available blocks from a template?

I am trying to find an existing block to call it from my template is it possible to use something like: getLayout()->getAllBlocks() );?> this gives me a 505 error
Matoeil
  • 607
  • 1
  • 9
  • 23
3
votes
2 answers

remove global messages not working

I need to remove global messages. I did put following to local.xml but messages still appear. I also tried to comment out following lines in page.xml
ruuter
  • 1,079
  • 3
  • 19
  • 30
2
votes
1 answer

Clear the sub-blocks while reserving the frame of parence layout?

i mean remove all the sub blocks but keep the space of their parent block . i write in the custom layout of the admin panel. but this seems don't work, i change the "-" with "*" ,still no…
robertshare
  • 172
  • 1
  • 7
2
votes
1 answer

Add block in left column if it was removed in the default file

I have a 2 columns - left layout for the checkout_cart_index. In the checkout.xml file, the left column is removed: How can I add a block in the left…
Claudiu Creanga
  • 6,247
  • 2
  • 49
  • 88
2
votes
1 answer

Modify contents of head from body

Continuing previous question. I successfully retrieved a URL of the next catalog page from catalog pager block (Mage_Page_Block_Html_Pager). Now I'm trying to add this URL to the head block (e.g.
Marvin3
  • 639
  • 4
  • 13
  • 26
2
votes
1 answer

The following abstract class don't have any abstract method?

Mage_Catalog_Block_Product_Abstract this class don't have any abstract method, what is the use of declaring this class as abstract? is there any coding standard/genetic involved?
manokarthick karthick
  • 841
  • 1
  • 10
  • 34
2
votes
1 answer

Nested Block Reference

While I am studying the Magento Basic Tutorial, there is a question confused me. I noticed that in the /template/page/html/header.phtml rendered a child block called 'topSearch'. getChildHtml('topSearch') ?> However, I opened…
Leongelis
  • 585
  • 8
  • 21
2
votes
1 answer

Check if block has already been rendered

During an observer is there a way to determine if a block has been rendered or not? I can grab the block like so: Mage::app()->getLayout()->getBlock('the_block_layout_name'); But i want to check if it has already been rendered - i..e its toHtml has…
Marty Wallace
  • 5,631
  • 13
  • 65
  • 90
1
vote
1 answer

How to create a block title?

I created a block to home page, the code is: {{block type="catalog/product_new" column_count="6" products_count="12" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}} but the block title not show in the…
Brian
  • 13
  • 2
1
vote
1 answer

Pass Data From PHTML To Block Controller

It seems wrong to me to put methods in the PHTML file. I need to loop through products in a PHTML file, but I want to call a method inside the foreach loop: getLatestOrder(); $orderItems =…
Jongosi
  • 1,511
  • 6
  • 24
  • 41
1
vote
1 answer

Use product view block in product list

I am trying to use a block from catalog/product_view in catalog/product_list but I can't get the block to render. Below is the code that I'm trying to call from template/catalog/product/list.phtml. getChildHtml('additional') ?>
1
vote
1 answer

Terms and conditions in payments.phtml

I want display Terms and Conditions in file payments.phtml, how i can do better? when i try add getChildHtml('agreements') ?> in payments.phtml - not working and block Terms and Conditions not display. Where wrong? Thanks
Sergey
  • 251
  • 1
  • 4
  • 13
1
2 3