{"id":77050,"date":"2017-09-23T08:47:23","date_gmt":"2017-09-23T08:47:23","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=77050"},"modified":"2021-07-16T12:10:06","modified_gmt":"2021-07-16T12:10:06","slug":"optimizing-magento-magento2-part-1","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/","title":{"rendered":"Optimisation Tips For Magento and Magento2 &#8211; Part 1"},"content":{"rendered":"\n<p>Optimisation is the most critical part of any application. There are some common mistakes we do in magento or magento2.<br>There are some useful tips that will help you to optimise your code and application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Collection Size<\/h2>\n\n\n\n<p>If you need to check the collection size, don&#8217;t use <strong>$collection-&gt;count()<\/strong> or <strong>count($collection)<\/strong>. Instead of these use <strong>$collection-&gt;getSize()<\/strong> method. If you are using <strong>$collection-&gt;count()<\/strong> or <strong>count($collection)<\/strong>&nbsp;, it will load the whole collection and then give you the count of items in collection. But if you are using <strong>$collection -&gt;getSize()<\/strong> method it will simply execute a count sql query into database and give you the count.<\/p>\n\n\n\n<p>It is considered as the best way to find the count of a collection.<\/p>\n\n\n\n<p><strong>Bad Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">if ($collection-&gt;count()) {\n    \/\/custom code\n}<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">if (count($collection)) {\n    \/\/custom code\n}<\/pre>\n\n\n\n<p><strong>Good Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">if ($collection-&gt;getSize()) {\n    \/\/custom code\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Model Loading in Loop<\/h2>\n\n\n\n<p>Its&nbsp;a bad practice to load model in loop. This is very common mistake. We shouldn&#8217;t load model inside the loop. Instead of this we should use collection or join on collection.<\/p>\n\n\n\n<p><strong>Bad Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$productIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\nforeach ($productIds as $productId) {\n    $product = $objManager-&gt;create('Magento\\Catalog\\Model\\Product')-&gt;load($productId);\n    echo $product-&gt;getName();\n}<\/pre>\n\n\n\n<p><strong>Good Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$productIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n$collection = $objManager-&gt;create('Magento\\Catalog\\Model\\Product')\n                        -&gt;getCollection()\n                        -&gt;addAttributeToSelect(\"name\")\n                        -&gt;addFieldToFilter(\"entity_id\", [\"in\" =&gt; $productIds]);\nforeach ($collection as $product) {\n    echo $product-&gt;getName();\n}<\/pre>\n\n\n\n<p>Suppose we have a custom table in which we have order ids. and we need order details.<\/p>\n\n\n\n<p><strong>Bad Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$customCollection = $objManager-&gt;create('Vendor\\Custom\\Model\\ResourceModel\\Custom\\Collection');\nforeach ($customCollection as $item) {\n    $orderId = $item-&gt;getOrderId();\n    $order = $objManager-&gt;create('Magento\\Sales\\Model\\Order')-&gt;load($orderId);\n    echo $order-&gt;getIncrementId();\n}<\/pre>\n\n\n\n<p><strong>Good Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n\n$customCollection = $objManager-&gt;create('Vendor\\Custom\\Model\\ResourceModel\\Custom\\Collection');\n$resource = $objManager-&gt;create(\"Magento\\Framework\\App\\ResourceConnection\");\n$joinTable = $resource-&gt;getTableName('sales_order');\n$fields = ['*'];\n$customCollection-&gt;getSelect()-&gt;join($joinTable, 'main_table.order_id = sales_order.entity_id', $fields);\nforeach ($customCollection as $item) {\n    echo $item-&gt;getIncrementId();\n}\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">&nbsp;<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Product Attribute Value<\/h2>\n\n\n\n<p>In Magento or Magento2 if we need to get any attribute value of Product, we simply load the product and then we get value of attribute.<\/p>\n\n\n\n<p>There is a method in magento which is more faster.<\/p>\n\n\n\n<p><strong>Normal&nbsp;Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">\/\/Magento 1\n$productId = 1;\n$product = Mage::getModel(\"catalog\\product\")-&gt;load($productId);\necho $product-&gt;getName();\n\n\/\/Magento 2\n$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$productId = 1;\n$product = $objManager-&gt;create('Magento\\Catalog\\Model\\Product')-&gt;load($productId);\necho $product-&gt;getName();\n\n<\/pre>\n\n\n\n<p><strong>Good Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">\/\/Magento 1\n$productId = 1;\n$attributeCode = \"name\";\n$storeId = 1;\n$name = Mage::getResourceModel('catalog\/product')-&gt;getAttributeRawValue($productId, $attributeCode, $storeId);\necho $name;\n\n\/\/Magento 2\n$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$productId = 1;\n$attributeCode = \"name\";\n$storeId = 1;\n$name = $objManager-&gt;create('Magento\\Catalog\\Model\\ResourceModel\\Product\\Action')-&gt;getAttributeRawValue($productId, $attributeCode, $storeId);\necho $name;\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Fields in Collection<\/h2>\n\n\n\n<p>It happens most of the times. <strong>Suppose we need all increment ids of orders<\/strong>, then we will get the collection of order and then iterate it to get the increment ids. This is what we do most of the times. When we are loading collection that means we are selecting all fields from table. But instead of selecting all the fields or columns in collection, we should select only desired field or column from collection. We don&#8217;t need to select unnecessary fields or columns.<\/p>\n\n\n\n<p><strong>Bad Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$collection = $objManager-&gt;create('Magento\\Sales\\Model\\Order')-&gt;getCollection();\nforeach ($collection as $order) {\n    echo $order-&gt;getIncrementId();\n}<\/pre>\n\n\n\n<p><strong>Good Practice<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$objManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$collection = $objManager-&gt;create('Magento\\Sales\\Model\\Order')-&gt;getCollection()-&gt;addFieldToSelect(\"increment_id\");\n\nforeach ($collection as $order) {\n    echo $order-&gt;getIncrementId();\n}<\/pre>\n\n\n\n<p>You can use all these methods according to your need.<\/p>\n\n\n\n<p>I faced many optimisation issues in application and then i found these solutions.<br>If you have a large number of records then these methods will surely help you.<\/p>\n\n\n\n<p>Next time i will try to include more methods and approaches for optimisation.<br>If you have any doubt or query please comment below.<br>Thanks<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Optimisation is the most critical part of any application. There are some common mistakes we do in magento or magento2.There are some useful tips that will help you to optimise your code and application. Collection Size If you need to check the collection size, don&#8217;t use $collection-&gt;count() or count($collection). Instead of these use $collection-&gt;getSize() method. <a href=\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":21,"featured_media":73740,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,302],"tags":[2056,2460,5495],"class_list":["post-77050","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento","category-magento2","tag-magento","tag-magento-2","tag-optimisation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Optimisation Tips For Magento and Magento2 - Part 1 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Optimisation Tips For Magento and Magento2, Best way to get count of collection, Best way to get product attribute value, Best practice in Magento\" \/>\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\/optimizing-magento-magento2-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Optimisation Tips For Magento and Magento2 - Part 1 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Optimisation Tips For Magento and Magento2, Best way to get count of collection, Best way to get product attribute value, Best practice in Magento\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\" \/>\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=\"https:\/\/www.facebook.com\/rahul0989\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-23T08:47:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-16T12:10:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rahul Mahto\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rahul Mahto\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\"},\"author\":{\"name\":\"Rahul Mahto\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/3002e6bca8362f6cf1c61b2663496c4f\"},\"headline\":\"Optimisation Tips For Magento and Magento2 &#8211; Part 1\",\"datePublished\":\"2017-09-23T08:47:23+00:00\",\"dateModified\":\"2021-07-16T12:10:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\"},\"wordCount\":399,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png\",\"keywords\":[\"magento\",\"Magento 2\",\"Optimisation\"],\"articleSection\":[\"magento\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\",\"url\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\",\"name\":\"Optimisation Tips For Magento and Magento2 - Part 1 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png\",\"datePublished\":\"2017-09-23T08:47:23+00:00\",\"dateModified\":\"2021-07-16T12:10:06+00:00\",\"description\":\"Optimisation Tips For Magento and Magento2, Best way to get count of collection, Best way to get product attribute value, Best practice in Magento\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Optimisation Tips For Magento and Magento2 &#8211; Part 1\"}]},{\"@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\/3002e6bca8362f6cf1c61b2663496c4f\",\"name\":\"Rahul Mahto\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?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\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Rahul Mahto\"},\"sameAs\":[\"http:\/\/webkul.com\",\"https:\/\/www.facebook.com\/rahul0989\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/rahul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Optimisation Tips For Magento and Magento2 - Part 1 - Webkul Blog","description":"Optimisation Tips For Magento and Magento2, Best way to get count of collection, Best way to get product attribute value, Best practice in Magento","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\/optimizing-magento-magento2-part-1\/","og_locale":"en_US","og_type":"article","og_title":"Optimisation Tips For Magento and Magento2 - Part 1 - Webkul Blog","og_description":"Optimisation Tips For Magento and Magento2, Best way to get count of collection, Best way to get product attribute value, Best practice in Magento","og_url":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_author":"https:\/\/www.facebook.com\/rahul0989","article_published_time":"2017-09-23T08:47:23+00:00","article_modified_time":"2021-07-16T12:10:06+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png","type":"image\/png"}],"author":"Rahul Mahto","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Rahul Mahto","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/"},"author":{"name":"Rahul Mahto","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/3002e6bca8362f6cf1c61b2663496c4f"},"headline":"Optimisation Tips For Magento and Magento2 &#8211; Part 1","datePublished":"2017-09-23T08:47:23+00:00","dateModified":"2021-07-16T12:10:06+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/"},"wordCount":399,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png","keywords":["magento","Magento 2","Optimisation"],"articleSection":["magento","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/","url":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/","name":"Optimisation Tips For Magento and Magento2 - Part 1 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png","datePublished":"2017-09-23T08:47:23+00:00","dateModified":"2021-07-16T12:10:06+00:00","description":"Optimisation Tips For Magento and Magento2, Best way to get count of collection, Best way to get product attribute value, Best practice in Magento","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/02\/Magneto-Code-Snippet-1.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/optimizing-magento-magento2-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Optimisation Tips For Magento and Magento2 &#8211; Part 1"}]},{"@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\/3002e6bca8362f6cf1c61b2663496c4f","name":"Rahul Mahto","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?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\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Rahul Mahto"},"sameAs":["http:\/\/webkul.com","https:\/\/www.facebook.com\/rahul0989"],"url":"https:\/\/webkul.com\/blog\/author\/rahul\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/77050","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\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=77050"}],"version-history":[{"count":39,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/77050\/revisions"}],"predecessor-version":[{"id":296518,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/77050\/revisions\/296518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/73740"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=77050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=77050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=77050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}