• Coding

    Block types in Magento

    Updated 3/25/11: TLDR; If you just want to make a block that displays the contents of a phtml file, use the block type core/template, like so

    
    

    Then you can use $this->getChildHtml(‘logos’) in the relevant parent block to display it.

    Original Post:
    Block types are used in the layout XML files, ex,

    Per this post, block types conform to the format “group/specific_class.”

    For example Mage_Core module declares “core” group, which introduces blocks such as:
    * “core/text” – simple block type to show text strings
    * “core/template” – made for rendering templates into html

    Each block type refers to specific class:
    * “core/text” – Mage_Core_Block_Text
    * “core/template” – Mage_Core_Block_Template

    So, how it works that defining the block type essentially modifies the object you get with $this, which affects the data / methods you can use in that phtml template. Here’s a list of the more useful ones:

    • core/template – very simple, inserts the pthml file specified in the template attribute. Example, <block type=”core/template” template=”page.phtml”>
  • Coding

    Deleting orders in Magento

    Using this blog as reference guide – perhaps slightly easier than bookmarking topics, and in case the internet eats the posts.

    Per this thread, to delete an order, do the following:

    SET @orderId = '100000001';
    
    SET FOREIGN_KEY_CHECKS = 1;
    
    DELETE FROM sales_flat_order
        WHERE increment_id = @orderId;
        
    DELETE FROM sales_flat_quote
        WHERE reserved_order_id = @orderId; 
    

    This works in Magento Community v 1.4.1.0 and Magento Enterprise 1.8.0.0. It deleted all mention of the order from the dashboard/reports.