{"id":1395,"date":"2013-03-05T00:09:56","date_gmt":"2013-03-05T00:09:56","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=1395"},"modified":"2013-03-05T01:10:29","modified_gmt":"2013-03-05T01:10:29","slug":"magento-block-series-day-two","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/","title":{"rendered":"Magento Block Series &#8211; Day Two"},"content":{"rendered":"<p>Magento Blocks &#8211; we have explained the basic block assignment and block postion changing in our <a title=\"magento blocks\" href=\"http:\/\/webkul.com\/blog\/magento-block-series-day-one\/\">last article<\/a>\u00a0 . \u00a0we&#8217;ll dive deep this time<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Magento blocks on particular page-\u00a0<\/strong><br \/>\n<\/span><\/p>\n<p>This is quite\u00a0interesting\u00a0and very important for all magento developers, how some of the block calls on some of the pages only like account page or checkout page .<\/p>\n<p>to understand this logic we should have strong understanding of magento routing system , how controllers works and how\u00a0associated\u00a0block works based on the urls . Everything in magento is a module , so all the modules have theri controllers which are used for url routing system . lets take an example of url e.g <strong>http:\/\/example.com\/index.php\/customer\/account\/index\/<\/strong><\/p>\n<p>module routes in this way <strong>module_controller_action<\/strong><\/p>\n<p>as you can see here module is customer , controller is accountcontroller and action is indexaction (all magento controller action works in this manner e,g editAction = edit on URL \u00a0deleteAction = delete). You can verify by visiting this path \u00a0\/app\/code\/core\/Mage\/Customer\/controllers<\/p>\n<p>also related xml can be found under\u00a0\/app\/design\/frontend\/base\/default\/layout customer.xml<\/p>\n<p><strong>\u00a0Magento Reference Block\u00a0<\/strong><\/p>\n<p>Now its time to explain\u00a0reference\u00a0block as its name suggests reference block is help ful to give a\u00a0reference\u00a0to your block . Suppose you want to integrate your block in left postion of the store then you can easily call &lt;reference name=&#8221;left&#8221;&gt;<\/p>\n<pre class=\"brush:xml\">&lt;reference name=\"left\"&gt;\r\n&lt;block type=\"core\/template\" after=\"-\" \r\nname=\"sleek\" template =\"Sleekaccordian\/new.phtml\" \/&gt;&lt;\/reference&gt;<\/pre>\n<p><strong>\u00a0Reference Action Method\u00a0<\/strong><\/p>\n<p>Under\u00a0reference\u00a0tag we can call functions as well using action method \u00a0as per the\u00a0given\u00a0example for newsletter.xml<\/p>\n<pre class=\"brush:xml\">&lt;reference name=\"customer_account_navigation\"&gt;\r\n&lt;action method=\"addLink\" translate=\"label\" module=\"newsletter\"&gt;\r\n&lt;name&gt;newsletter&lt;\/name&gt;&lt;path&gt;newsletter\/manage\/&lt;\/path&gt;\r\n&lt;label&gt;Newsletter Subscriptions&lt;\/label&gt;&lt;\/action&gt;\r\n&lt;\/reference&gt;<\/pre>\n<p>this refrence (customer_account_navigation) is defined under customer.xml<\/p>\n<pre class=\"brush:xml\">&lt;block type=\"customer\/account_navigation\" name=\"customer_account_navigation\" \r\nbefore=\"-\" template=\"customer\/account\/navigation.phtml\"&gt;\r\n&lt;action method=\"addLink\" translate=\"label\" module=\"customer\"&gt;\r\n&lt;name&gt;account&lt;\/name&gt;&lt;path&gt;customer\/account\/&lt;\/path&gt;&lt;label&gt;Account Dashboard&lt;\/label&gt;&lt;\/action&gt;\r\n&lt;action method=\"addLink\" translate=\"label\" module=\"customer\"&gt;\r\n&lt;name&gt;account_edit&lt;\/name&gt;&lt;path&gt;customer\/account\/edit\/&lt;\/path&gt;\r\n&lt;label&gt;Account Information&lt;\/label&gt;&lt;\/action&gt;\r\n&lt;action method=\"addLink\" translate=\"label\" module=\"customer\"&gt;\r\n&lt;name&gt;address_book&lt;\/name&gt;&lt;path&gt;customer\/address\/&lt;\/path&gt;&lt;label&gt;Address Book&lt;\/label&gt;&lt;\/action&gt;\r\n&lt;\/block&gt;<\/pre>\n<p>now as per the block class if you&#8217;ll visit<\/p>\n<p>\/app\/code\/core\/Mage\/Customer\/Block\/Account then you&#8217;ll find <strong>addLink<\/strong> function under\u00a0Navigation.php<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento Blocks &#8211; we have explained the basic block assignment and block postion changing in our last article\u00a0 . \u00a0we&#8217;ll dive deep this time Magento blocks on particular page-\u00a0 This is quite\u00a0interesting\u00a0and very important for all magento developers, how some of the block calls on some of the pages only like account page or checkout <a href=\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1395","post","type-post","status-publish","format-standard","hentry","category-magento"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento Block Series - Day Two - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento Block Series - Day Two - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Magento Blocks &#8211; we have explained the basic block assignment and block postion changing in our last article\u00a0 . \u00a0we&#8217;ll dive deep this time Magento blocks on particular page-\u00a0 This is quite\u00a0interesting\u00a0and very important for all magento developers, how some of the block calls on some of the pages only like account page or checkout [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:author\" content=\"http:\/\/facebook.com\/webkul\" \/>\n<meta property=\"article:published_time\" content=\"2013-03-05T00:09:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-03-05T01:10:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vipin Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/vipinsahu\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vipin Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\"},\"author\":{\"name\":\"Vipin Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/8ed13bf168e6e8fe92fe499c470111f1\"},\"headline\":\"Magento Block Series &#8211; Day Two\",\"datePublished\":\"2013-03-05T00:09:56+00:00\",\"dateModified\":\"2013-03-05T01:10:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\"},\"wordCount\":300,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"articleSection\":[\"magento\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\",\"url\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\",\"name\":\"Magento Block Series - Day Two - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2013-03-05T00:09:56+00:00\",\"dateModified\":\"2013-03-05T01:10:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magento Block Series &#8211; Day Two\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/8ed13bf168e6e8fe92fe499c470111f1\",\"name\":\"Vipin Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/98597dd669d66735fc160e891e1207c749a444ebea1b172de18a92f1435045c0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/98597dd669d66735fc160e891e1207c749a444ebea1b172de18a92f1435045c0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Vipin Sahu\"},\"description\":\"Executionist and Hardcore Planner to drive out best of the best. Want to boost up the E-Commerce industry with his concoct conception.\",\"sameAs\":[\"http:\/\/webkul.com\",\"http:\/\/facebook.com\/webkul\",\"https:\/\/x.com\/https:\/\/twitter.com\/vipinsahu\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Magento Block Series - Day Two - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/","og_locale":"en_US","og_type":"article","og_title":"Magento Block Series - Day Two - Webkul Blog","og_description":"Magento Blocks &#8211; we have explained the basic block assignment and block postion changing in our last article\u00a0 . \u00a0we&#8217;ll dive deep this time Magento blocks on particular page-\u00a0 This is quite\u00a0interesting\u00a0and very important for all magento developers, how some of the block calls on some of the pages only like account page or checkout [...]","og_url":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_author":"http:\/\/facebook.com\/webkul","article_published_time":"2013-03-05T00:09:56+00:00","article_modified_time":"2013-03-05T01:10:29+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Vipin Sahu","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/vipinsahu","twitter_site":"@webkul","twitter_misc":{"Written by":"Vipin Sahu","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/"},"author":{"name":"Vipin Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/8ed13bf168e6e8fe92fe499c470111f1"},"headline":"Magento Block Series &#8211; Day Two","datePublished":"2013-03-05T00:09:56+00:00","dateModified":"2013-03-05T01:10:29+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/"},"wordCount":300,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"articleSection":["magento"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/","url":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/","name":"Magento Block Series - Day Two - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2013-03-05T00:09:56+00:00","dateModified":"2013-03-05T01:10:29+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/magento-block-series-day-two\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/magento-block-series-day-two\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Magento Block Series &#8211; Day Two"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/8ed13bf168e6e8fe92fe499c470111f1","name":"Vipin Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/98597dd669d66735fc160e891e1207c749a444ebea1b172de18a92f1435045c0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/98597dd669d66735fc160e891e1207c749a444ebea1b172de18a92f1435045c0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Vipin Sahu"},"description":"Executionist and Hardcore Planner to drive out best of the best. Want to boost up the E-Commerce industry with his concoct conception.","sameAs":["http:\/\/webkul.com","http:\/\/facebook.com\/webkul","https:\/\/x.com\/https:\/\/twitter.com\/vipinsahu"],"url":"https:\/\/webkul.com\/blog\/author\/admin\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/1395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=1395"}],"version-history":[{"count":5,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/1395\/revisions"}],"predecessor-version":[{"id":1397,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/1395\/revisions\/1397"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=1395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=1395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=1395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}