Sometime you need to play with the price format. magento default add 2 precision format for the price. now if you want to remove precision or want to keep 3 decimal point for price then you need to do following
1) Open /lib/zend/Currency.php file
2) Find 'precision' => 2 near line no. 78
here is the place, you need to change precision decimal
Change 'precision' => 0 if you want to keep 0 decimal
3/23/2009
3/17/2009
How to Rename The Top Links in Magento
Many times you found some demand or requirement from the client to change the top links of magento.
Yes, I am talking about top links.

You can rename this by two way
1) Searching this string in Magento's Core File (Never follow this)
Or
2) Magento has provide very good features of language management. you can rename any text by adding it's replacement text in translate.csv file
You will get this file in /app/design/frontend/default/[theme_name]/locale/en_US/ folder. You have to enter all substitute of text in every new line. In csv file, first mention the text that you want to change and after putting comma(,) mention it's replacement text.
for example,
To change "My Cart" to "My Bag", you have to insert line as
"My Cart","My Bag"
I am here mentioning some advance language replacement for you.
1) When you add any product in cart, top link will display like "My Cart (1 item)". now if you want to change this string to like "My Cart (1 item)" then you can do it by writing below code in csv file
"My Cart (%s item)","My Cart <b class='redfont'>(%s item)</b>"
2) When you add any product in wishlist, top link will display like "My Wishlist (1 item)". now if you want to change this string to like "My Wishlist (1 item)" then you can do it by writing below code in csv file
"My Wishlist (%d item)","My Wishlist <b class='redfont'>(%d item)</b>"
Hope, this will help to someone like me
thanks
Yes, I am talking about top links.

You can rename this by two way
1) Searching this string in Magento's Core File (Never follow this)
Or
2) Magento has provide very good features of language management. you can rename any text by adding it's replacement text in translate.csv file
You will get this file in /app/design/frontend/default/[theme_name]/locale/en_US/ folder. You have to enter all substitute of text in every new line. In csv file, first mention the text that you want to change and after putting comma(,) mention it's replacement text.
for example,
To change "My Cart" to "My Bag", you have to insert line as
"My Cart","My Bag"
I am here mentioning some advance language replacement for you.
1) When you add any product in cart, top link will display like "My Cart (1 item)". now if you want to change this string to like "My Cart (1 item)" then you can do it by writing below code in csv file
"My Cart (%s item)","My Cart <b class='redfont'>(%s item)</b>"
2) When you add any product in wishlist, top link will display like "My Wishlist (1 item)". now if you want to change this string to like "My Wishlist (1 item)" then you can do it by writing below code in csv file
"My Wishlist (%d item)","My Wishlist <b class='redfont'>(%d item)</b>"
Hope, this will help to someone like me
thanks
3/16/2009
How to Display Featured Product in Magento
What is featured product?
The Featured Product is a product with an attribute added from the administrative UI. When the administrator selects "Yes" in the "Featured" attribute, that product will be displayed in a content block on the category page.
Step to follow to achieve this
1) Create new "Featured" attribute
Create a new attribute by going to Catalog > Attributes > Manage Attributes > Add New Attribute.
Attribute Properties
* Attribute Identifier: featured
* Scope: Store View
* Catalog Input Type for Store Owner: Yes/No
* Unique Value (not shared with other products): No
* Values Required: No
* Input Validation for Store Owner: None
* Apply To: All Product Types
Front End Properties
* Use in quick search: No
* Use in advanced search: Yes
* Comparable on Front-end: No
* Use In Layered Navigation (Can be used only with catalog input type ‘Dropdown’): No
* Visible on Catalog Pages on Front-end: Yes
Manage Label/Options
* Default: Featured Product
* English: Featured Product
Save the new attribute and go to Catalog ? Attributes ? Manage Attributes Sets to add the attribute to the default feature set.
2) Add Block configuration to catalog.xml
Open MyCompany/app/design/frontend/default/default/layout/catalog.xml. We want to add a new right above the product list block in the default category layout.
Insert the block configuration on line 73 (default catalog.xml).
<block type="catalog/product_featured" name="product_featured" as="product_featured" template="catalog/product/featured.phtml"></block>
3) Create new block class that will instantiate the featured product
Create a new file, and directories: app/code/local/MyCompany/Catalog/Block/Product/Featured.php
<php
class MyCompany_Catalog_Block_Product_Featured extends Mage_Catalog_Block_Product_Abstract
{
public function getFeaturedProduct()
{
// instantiate database connection object
$categoryId = $this->getRequest()->getParam('id', false);
$resource = Mage::getSingleton('core/resource');
$read = $resource->getConnection('catalog_read');
$categoryProductTable = $resource->getTableName('catalog/category_product');
//$productEntityIntTable = $resource->getTableName('catalog/product_entity_int'); // doesn't work :(
$productEntityIntTable = (string)Mage::getConfig()->getTablePrefix() .'catalog_product_entity_int';
$eavAttributeTable = $resource->getTableName('eav/attribute');
// Query database for featured product
$select = $read->select()
->from(array('cp'=>$categoryProductTable))
->join(array('pei'=>$productEntityIntTable), 'pei.entity_id=cp.product_id', array())
->joinNatural(array('ea'=>$eavAttributeTable))
->where('cp.category_id=?', $categoryId)
->where('pei.value=1')
->where('ea.attribute_code="featured"');
$row = $read->fetchRow($select);
return Mage::getModel('catalog/product')->load($row['product_id']);
}
}
?>
4) Extend Mage_Catalog_Block_Category_View
Create a new file, and directories, called app/code/local/MyCompany/Catalog/Block/Category/View.php. We’re extending the core class here so our module will be separate from the core code base. When upgrading, we won’t have to worry about our code not working or having to patch files.
<php
class MyCompany_Catalog_Block_Category_View extends Mage_Catalog_Block_Category_View
{
public function getFeaturedProductHtml()
{
return $this->getBlockHtml('product_featured');
}
}
?>
5) Modify the templates
Edit app/design/frontend/default/default/template/catalog/category/view.phtml and add the following code:
<?=$this->getFeaturedProductHtml()?>
right above this line:
<?=$this->getProductListHtml()?>
Create app/design/frontend/default/default/template/catalog/product/featured.phtml and add some product info HTML to show the featured product. Here is an example that simply displays a link to the product:
<?php $_product=$this->getFeaturedProduct() ?>
Check this out: <a href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a>>
6) Add new blocks to the app/etc/local.xml
<blocks>
<catalog>
<rewrite> <product_featured>MyCompany_Catalog_Block_Product_Featured</product_featured>
</rewrite>
<rewrite>
<category_view>MyCompany_Catalog_Block_Category_View</category_view>
</rewrite>
</catalog>
</blocks>
I hope this helps you add a “Featured Product” feature. It certainly feels thorough, but if I left anything out, please let me know and I’ll be happy to help.
Source: http://www.magentocommerce.com/wiki/how_to_create_a_featured_product
The Featured Product is a product with an attribute added from the administrative UI. When the administrator selects "Yes" in the "Featured" attribute, that product will be displayed in a content block on the category page.
Step to follow to achieve this
1) Create new "Featured" attribute
Create a new attribute by going to Catalog > Attributes > Manage Attributes > Add New Attribute.
Attribute Properties
* Attribute Identifier: featured
* Scope: Store View
* Catalog Input Type for Store Owner: Yes/No
* Unique Value (not shared with other products): No
* Values Required: No
* Input Validation for Store Owner: None
* Apply To: All Product Types
Front End Properties
* Use in quick search: No
* Use in advanced search: Yes
* Comparable on Front-end: No
* Use In Layered Navigation (Can be used only with catalog input type ‘Dropdown’): No
* Visible on Catalog Pages on Front-end: Yes
Manage Label/Options
* Default: Featured Product
* English: Featured Product
Save the new attribute and go to Catalog ? Attributes ? Manage Attributes Sets to add the attribute to the default feature set.
2) Add Block configuration to catalog.xml
Open MyCompany/app/design/frontend/default/default/layout/catalog.xml. We want to add a new
Insert the block configuration on line 73 (default catalog.xml).
<block type="catalog/product_featured" name="product_featured" as="product_featured" template="catalog/product/featured.phtml"></block>
<php
class MyCompany_Catalog_Block_Product_Featured extends Mage_Catalog_Block_Product_Abstract
{
public function getFeaturedProduct()
{
// instantiate database connection object
$categoryId = $this->getRequest()->getParam('id', false);
$resource = Mage::getSingleton('core/resource');
$read = $resource->getConnection('catalog_read');
$categoryProductTable = $resource->getTableName('catalog/category_product');
//$productEntityIntTable = $resource->getTableName('catalog/product_entity_int'); // doesn't work :(
$productEntityIntTable = (string)Mage::getConfig()->getTablePrefix() .'catalog_product_entity_int';
$eavAttributeTable = $resource->getTableName('eav/attribute');
// Query database for featured product
$select = $read->select()
->from(array('cp'=>$categoryProductTable))
->join(array('pei'=>$productEntityIntTable), 'pei.entity_id=cp.product_id', array())
->joinNatural(array('ea'=>$eavAttributeTable))
->where('cp.category_id=?', $categoryId)
->where('pei.value=1')
->where('ea.attribute_code="featured"');
$row = $read->fetchRow($select);
return Mage::getModel('catalog/product')->load($row['product_id']);
}
}
?>
Create a new file, and directories, called app/code/local/MyCompany/Catalog/Block/Category/View.php. We’re extending the core class here so our module will be separate from the core code base. When upgrading, we won’t have to worry about our code not working or having to patch files.
<php
class MyCompany_Catalog_Block_Category_View extends Mage_Catalog_Block_Category_View
{
public function getFeaturedProductHtml()
{
return $this->getBlockHtml('product_featured');
}
}
?>
Edit app/design/frontend/default/default/template/catalog/category/view.phtml and add the following code:
<?=$this->getFeaturedProductHtml()?>
<?=$this->getProductListHtml()?>
<?php $_product=$this->getFeaturedProduct() ?>
Check this out: <a href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a>>
<blocks>
<catalog>
<rewrite> <product_featured>MyCompany_Catalog_Block_Product_Featured</product_featured>
</rewrite>
<rewrite>
<category_view>MyCompany_Catalog_Block_Category_View</category_view>
</rewrite>
</catalog>
</blocks>
Source: http://www.magentocommerce.com/wiki/how_to_create_a_featured_product
3/15/2009
Magento and OsCommerce Comparision
Magento
This new and trail blazing package scores highest for its look and feel, features, and 'translatability'. The back-end is well organised and most bases are thoroughly covered (as against osCommerce which is fairly basic until modules are added) including re-writable URLs which are a must for a well optimised online store.
There is a great range of user experience enhancing features such as 'related products', 'add to wishlist' and 'compare products'. In turn, these also benfit the store owner as the time a consumer spends on your site is proportional to the amount they spend. These such functions are all well administrated from the back-end, with cross referencing being much easier than in osCommerce owing to the emphasis placed on SKU numbers.
Magento, too, has something called 'Store View' which, although difficult to get ones head around, affords online shop keepers the ability to set up multiple stores, with the same products, at different prices, and even in different languages, all from one admin area.
As for translating a Magento store - many language packs are already available, meaning all the hard coded static content and navigation (add to basket, subscribe to newsletter, invoices, checkout, my basket etc) is good to go at the click of a button (thankfully, all the while keeping the admin area in your native language).
So, if all that wasn't enough to at least prick your ears up to the fiscal punch you could be packing with a multilingual eCommerce site, then consider this…
As a nation, we spend more on foreign soil - or in foreign cyber space at least - than any other country: an eye watering £2.3 billion in fact. France and Germany are but mere spots on the horizon in comparison, with overseas sales totalling a meagre £857 million. That gap is expected to close so what's stopping you from becoming a gleeful recipient of that increased foreign spend?
Nothing. Exactly.
This is, by no means, a comprehensive analysis of the different packages out there, rather a discussion of the ones we are most familiar with and have used extensively. I will be sure to add to this as our experiences grow.
osCommerce….
osCommerce has been around a while and, as such, there is a very well established community whom are fairly responsive to any unfathomable problems you may have, should you post within their forums.
There are also innumerable 'contributions' or 'modules' to be found on the OS site. These are invaluable and mean your site can be as tailored to your needs as you wish and, importantly, are easy to add owing to osCommerce's flexibility.
Need a CMS on your site? It's there. Need to make and dispatch money off coupons? Sorted. Want the increasingly popular lightbox effect on your images? All doable. The modules come with clear instructions and, on the whole, are regularly updated with bug fixes so if you get one that's a few months old, chances are it'll work just fine.
But the real beauty of osCommerce is in its palpable willingness to be translated and localised into any language. The structure of the site, written in php and using definitions, means all the text you see on an (unhacked!) osCommerce site is handily stored in reference files which contain only plain text for translation, thus minimising the risk of file corruption by an inexperienced web page translator.
In the meantime, if you have any specific questions about Magento Customization or osCommerce Customization, leave a comment below and I promise I'll get back to you!
This new and trail blazing package scores highest for its look and feel, features, and 'translatability'. The back-end is well organised and most bases are thoroughly covered (as against osCommerce which is fairly basic until modules are added) including re-writable URLs which are a must for a well optimised online store.
There is a great range of user experience enhancing features such as 'related products', 'add to wishlist' and 'compare products'. In turn, these also benfit the store owner as the time a consumer spends on your site is proportional to the amount they spend. These such functions are all well administrated from the back-end, with cross referencing being much easier than in osCommerce owing to the emphasis placed on SKU numbers.
Magento, too, has something called 'Store View' which, although difficult to get ones head around, affords online shop keepers the ability to set up multiple stores, with the same products, at different prices, and even in different languages, all from one admin area.
As for translating a Magento store - many language packs are already available, meaning all the hard coded static content and navigation (add to basket, subscribe to newsletter, invoices, checkout, my basket etc) is good to go at the click of a button (thankfully, all the while keeping the admin area in your native language).
So, if all that wasn't enough to at least prick your ears up to the fiscal punch you could be packing with a multilingual eCommerce site, then consider this…
As a nation, we spend more on foreign soil - or in foreign cyber space at least - than any other country: an eye watering £2.3 billion in fact. France and Germany are but mere spots on the horizon in comparison, with overseas sales totalling a meagre £857 million. That gap is expected to close so what's stopping you from becoming a gleeful recipient of that increased foreign spend?
Nothing. Exactly.
This is, by no means, a comprehensive analysis of the different packages out there, rather a discussion of the ones we are most familiar with and have used extensively. I will be sure to add to this as our experiences grow.
osCommerce….
osCommerce has been around a while and, as such, there is a very well established community whom are fairly responsive to any unfathomable problems you may have, should you post within their forums.
There are also innumerable 'contributions' or 'modules' to be found on the OS site. These are invaluable and mean your site can be as tailored to your needs as you wish and, importantly, are easy to add owing to osCommerce's flexibility.
Need a CMS on your site? It's there. Need to make and dispatch money off coupons? Sorted. Want the increasingly popular lightbox effect on your images? All doable. The modules come with clear instructions and, on the whole, are regularly updated with bug fixes so if you get one that's a few months old, chances are it'll work just fine.
But the real beauty of osCommerce is in its palpable willingness to be translated and localised into any language. The structure of the site, written in php and using definitions, means all the text you see on an (unhacked!) osCommerce site is handily stored in reference files which contain only plain text for translation, thus minimising the risk of file corruption by an inexperienced web page translator.
In the meantime, if you have any specific questions about Magento Customization or osCommerce Customization, leave a comment below and I promise I'll get back to you!
Subscribe to:
Posts (Atom)