{"id":621,"date":"2012-12-16T18:41:00","date_gmt":"2012-12-16T18:41:00","guid":{"rendered":"http:\/\/techblog.vifashion.vn\/?p=116"},"modified":"2012-12-16T18:41:00","modified_gmt":"2012-12-16T18:41:00","slug":"design-patterns-which-are-used-in-magento","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/design-patterns-which-are-used-in-magento\/","title":{"rendered":"Design patterns which are used in Magento"},"content":{"rendered":"
A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise.<\/p>\n
from wikipedia.<\/em><\/p><\/blockquote>\n
Factory:<\/b><\/p>\n
$product = Mage::getModel(‘catalog\/product’);<\/p>\n
Singleton:<\/b><\/p>\n
$category = Mage::getSingleton(‘catalog\/session’);
\n<\/p>\nRegistry:<\/b><\/p>\n
$currentCategory = Mage::registry(‘current_category’);<\/p>\n
Prototype:<\/b><\/p>\n
Mage:getModel(‘catalog\/product’)->getTypeInstance();<\/p>\n
<\/p>\n
<\/p>\n
Event\/Listeners:<\/b><\/p>\n
Mage::dispatchEvent(‘model_load_before’, $params);<\/p>\n
<\/p>\n
Object Pool:<\/b><\/p>\n
$id = Mage::objects()->save($object);<\/p>\n
$object = Mage::objects($id);<\/p>\n
Iterator:<\/b><\/p>\n
Mage::getModel(‘catalog\/product’)->getCollection();<\/p>\n
<\/p>\n
Decorator<\/b><\/p>\n
<script type=”text\/javascript”]]>decorateTable(‘product_comparison’);<\/script><\/p>\n
View Helper<\/b><\/p>\n
Mage::helper(‘core’);<\/p>\n
<\/p>\n
updating…<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"
A list of design pattern applied in Magento, with descriptions.<\/p>\n","protected":false},"author":1,"featured_media":117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,60,45],"tags":[59,61,62],"aioseo_notices":[],"views":5,"_links":{"self":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/621"}],"collection":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/comments?post=621"}],"version-history":[{"count":0,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/621\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/"}],"wp:attachment":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media?parent=621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/categories?post=621"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/tags?post=621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}