Magento Forum

   
Where is code for displaying the price? 
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

Hi,

I have been trying to find the code that decides the logic to display the price of a product and have been going in circles trying to find it. I believe price conversions should be centralized and should be at some place. For example, I was trying to figure out how the ‘price’ column on the Admin -> Catalog summary page gets displayed.

I had drilled down till this level.
First the controller Mage_Adminhtml_Catalog_ProductController.indexAction() is called.
|__ which seems to be calling the block Mage_Adminhtml_Block_Catalog_Product_Grid._prepareCollection()
|__ Mage_Adminhtml_Block_Widget_Grid._prepareCollection()
|__ Mage_Catalog_Model_Entity_Product_Collection.load
|__ Mage_Eav_Model_Entity_Collection_Abstractold._loadAttributes()

After going this far I am again confused if I am going in the right direction. Please help. I am trying to look for this as for INR currency, the formatting seems to be render in a wierd manner. Whatever price I seem to enter gets rendered as
0≤Rs.|1≤Re.|1

Also I am looking to store currency at a product level and am customizing my store for the same and any pointers would be immensely helpful.

Thanks in advance!!
Srini

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Apparently that’s how it is defined in Zend Framework, take a look in Zend/Locale/Data/root.xml on line 1218.

Also, clean ZF test, put this code in Magento root and run:

<?php
set_include_path
('./lib'.PATH_SEPARATOR.get_include_path());
include_once 
'Zend/Currency.php';
$cur = new Zend_Currency('INR''en_US');
echo 
$cur->toCurrency(12.34);

 
Magento Community Magento Community
Magento Community
Magento Community
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

Oh! Seems a bug with the Zend framework then! But Moshe, from Magneto, which is the portion that handles rendering of currencies and convertions. Is it the Directory module?

Again Thanks for the inputs!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Ultimately it uses Mage_Core_Model_Locale::currency() method, but it does go through Mage_Directory_Model_Currency class.

The reason for that is legacy concept of storing currencies in database table, which was removed later.

This might be refactored soon though.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top