Mage::app()->getStore()->getStoreId(); OR $this->helper(’core’)->getStoreId();

How to Get Store ID in Magento
Posted by
rajthegr8
at
1:43 PM
Thursday, December 6, 2012
Many times during coding we require the store ID of the magento store, We can get this by using the below code in magento :
Install Magento in Ubuntu
Posted by
rajthegr8
at
1:30 PM
To install magento in Ubuntu, first Open the terminal to run the commands.
Navigate to the directory (Inside www folder) where you need to install Magento.
Navigate to the directory (Inside www folder) where you need to install Magento.
$ cd /var/wwwDownload magento 1.7.0.0 files by using the following command:
$ wget http://www.magentocommerce.com/downloads/assets/1.7.0.0/magento-1.7.0.0-alpha1.tar.gzAfter the downloading process completes, just decompress the downloaded file:
$ tar -zxvf magento-1.7.0.0-alpha1.tar.gzNow you can find a new folder “magento”. Just get into it.
$cd magentoThen set permissions for some folders like media, var and app/etc to 777:
$ chmod -R 777 media var $ chmod 777 app/etc
Get All Items & Totals In Magento Shopping Cart
Posted by
rajthegr8
at
4:55 PM
Wednesday, October 31, 2012
This blog will show you how to get all items in a shopping cart and totals in a magento store :
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems(); foreach($items as $item) { echo 'Product ID: '.$item->getProductId(); echo 'Product Name: '.$item->getName(); echo 'Product Sku: '.$item->getSku(); echo 'Product Quantity: '.$item->getQty(); echo 'Product Price: '.$item->getPrice();
Price Currency Conversion in Magento
Posted by
rajthegr8
at
4:39 PM
This article is to show you how to convert price amount from one currency of the shop to another currency.
// Currency conversion rates have to be available in the target currency $fromCur = ‘USD’; // currency code to convert from – usually your base currency $toCur = ‘EUR’; // currency to convert to $price = Mage::helper(‘directory’)-> currencyConvert(1000, $fromCur, $toCur); // if you want it rounded: $converted_final_price = Mage::app()->getStore()->roundPrice($price);
How to show Category List in Magento
Posted by
rajthegr8
at
4:11 PM
You can show all categories present in magento.
There are different methods to get the category list. Below are some possible methods:-
Get all categories
The following code will fetch all categories (both active and inactive) that are present in your Magento Shop.
Get all active categories:
There are different methods to get the category list. Below are some possible methods:-
Get all categories
The following code will fetch all categories (both active and inactive) that are present in your Magento Shop.
$categories = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToSelect('*');
Get all active categories:
Emulation process in Magento
Posted by
rajthegr8
at
9:54 AM
Thursday, September 27, 2012
Recently,I had a task to send an custom transactional e-mail from admin panel on some event.And the email template was same as used in the frontend store. So, I was trying to make use of the same block and phtml of frontend theme to call in that email. But,i found that that,we cannot call frontend phtml files in the emails sending from admin.
There is a concept of emulation in magento which allow us to do the same.By using this method we can make use of frontend template files to call in mails sending from Admin.
This feature is available in magento 1.5 & above version.By using Emulation model a.k.a. Mage_Core_Model_App_Emulation class , we can emulate stores in magento.
Code to be used:
There is a concept of emulation in magento which allow us to do the same.By using this method we can make use of frontend template files to call in mails sending from Admin.
This feature is available in magento 1.5 & above version.By using Emulation model a.k.a. Mage_Core_Model_App_Emulation class , we can emulate stores in magento.
Code to be used:
$appEmulation = Mage::getSingleton('core/app_emulation'); //Start environment emulation of the specified store $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId); /* * Any code thrown here will be executed as we are currently running that store * with applied locale, design and similar */ //Stop environment emulation and restore original store $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);You will need something similar also,when you want to send custom transactional e-mail for all stores at the same time as cronjob. However, the problem is that e-mail had {{block}} inside and block template needed to respect different theme set for each store.
Debugging Magento Code with Net Beans IDE
Posted by
rajthegr8
at
1:57 AM
Sunday, September 23, 2012
Mostly people are aware of how the xdebug is used on debugging PHP applications. However there can be people out there, alone, killing their eyes trying to find out which class called which functions etc. Here is a quick tip for you! Especially if you are trying to find your way with Magento!
NetBeans is a great IDE with it’s support to PHP!By using NetBeans and xdebug, we can freely and easily debug our PHP applications. However as the web evolved, there are not anymore php files to debug but there are “user friendly” urls to debug. So you cannot give the filename to NetBeans and say debug! because most of the web applications out there are now MVC based as this is the new trend in the PHP world. MVC means, one file -index.php dispatches all the requests. So how to debug using friendly urls.
Well you can use your NetBeans IDE to listen requests coming from your browser. That’s what NetBeans does when you click on debug button, which opens the start page (index.php) with a get variable like: ?XDEBUG_SESSION_START=netbeans-xdebug. This value (netbeans-xdebug) can change from your NetBeans configuration (click on preferences and choose the PHP tab). When this parameter is given, you can send any request to the NetBeans and it will listen!
All you need to do:
Subscribe to:
Posts (Atom)
Blog Archive
Popular Posts
-
You can select,insert,update and delete data in the Magento wby using their models concept. For example,a table named ‘testdata‘ with the fo...
-
This article will explain how to create an extension to send all the emails through gmail or other servers.I have created an module to set u...
-
This is an article to show you ,how you can set MySql Master-slave replication in magento for scalability ,handle failover and performance. ...
-
Breadcrumb is necessary for making website pages user navigation friendly. It can be printed out in any of the php or phtml pages by below c...
-
This blog will show you how to get all items in a shopping cart and totals in a magento store : $items = Mage::getSingleton('checkout/...