To get all the ordered items of the order use the following code. <?php $order_id = 2314; //use your own…..
A collection of Code Snippets and articles of the latest
Technology and Open Source.
To show all the configurable attributes as array. Configurable attributes are attributes which have front-end type "select". [cr]This code will return an array of all the configurable attributes.[/cr] <?php //database read adapter $read = Mage::getSingleton("core/resource")->getConnection("core_read"); $select = $read->select()->from(array("a" => "eav_attribute"), array("attribute_code", "frontend_label")) ->join(array("ao' => "eav_attribute_option"), "a.attribute_id = ao.attribute_id", array()) ->order("frontend_label"); $data = $read->fetchPairs($select); var_dump($data); //an array of configurable attributes ?>
Slug is the seo friendly format of any text string. A slug is a text string contains alpha-numeric characters only,…..
We have customer email id and we want to get the other details of the customer. <?php $customer_email = “email@example.com”;…..
Magento is a complete and awesome MVC application. It’s fully moduler and easy to extend its features and functionality. All…..
Magento uses blocks terminology in its architecture to display the views. Blocks are classes in Magento modules which handles the…..
Removing or Adding top links in the header section of the theme is very easy via Layout.xml files. However we…..
One of the biggest feature Magento is famous for is its capabilities to develop multi-store and multi-language web stores. Each store can be completely different from its fellow stores. Store Emulation helps developers to emulate any store programmatically.
What’s the use of store emulator?
When a process run on backend for example cron jobs or email notifications, these processes work under admin store. No problem, but what if these codes need different store themes. For example product alert emails need to send store wise.
So each time a mail is sent it grabs the template from store view of the Emulated Store.
app/design/frontend/default/store1_theme/template/email/custom-email-block.phtml, for first store
app/design/frontend/default/store2_theme/template/email/custom-email-block.phtml for second store and so on.
So in that case store emulator play a very crucial role and help to create the store environment on the fly.
To emulate any store just copy the given code in any controller with specific store id.
<?php $appEmulation = Mage::getSingleton('core/app_emulation'); //Start environment emulation of the specified store $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId); //Emulation Started //Run any code here and it will use the emulated store //Stop environment emulation and restore original store $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo); ?>