Saturday, 24 February 2018

Display Currency Code Or Symbol in invoice pdf without changing core files

1.Download font that support Any Symbol Like  Indian Rupee symbol. recommended dejavu-sans font.
http://dejavu-fonts.org/wiki/Download
https://sourceforge.net/projects/dejavu/files/dejavu/2.36/dejavu-sans-ttf-2.36.zip/download

2.Place the font in lib directory(Magento Directory/lib).

3.open app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php and app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php

copy paste both files under local
  1.  app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php
  2. app/code/local/Mage/Sales/Model/Order/Pdf/Items/Abstract.php
and replace

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf');

with

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/dejavu-sans/DejaVuSans.ttf');

(in _setFontRegular(), _setFontBold(), _setFontItalic() functions in both files.)

Admin -> System --> Manage Currency -->Symbols --> Copy your symbol and save.

Saturday, 13 January 2018

Add Qty Increment Buttons In Magento

Magento provides simple input text field on product page for quantity. But to make it more attractive and easier for customers, you can add an increment quantity button in Magento.
Today, we are going to learn how to add quantity increment buttons to product page. We can do this by editing core files but it’s not the right approach. So, we’ll add quantity increment buttons to product page in Magento by using custom module.

Create Directories

We will use Rajendra as Namespace and Quantity as Module name.
Go to your module and create the following directories in it:
1.  etc
2.  Model
3.  Block
4.  Template

Configuration of Module

Go to app/code/local/Rajendra/Quantity/etc and create config.xml. Now place the following code in it:

Activation Of Module

Go to app/etc/modules and create Rajendra_Quantity.xml. Now place the following code in it:

Create Model

Go to app/code/local/Rajendra/Quantity/Model and create Observer.php. Now place the following code in it:

Create Block

Go to app/code/local/Rajendra/Quantity/Block and create Injection.php. Now place the following code in it:

Create Template File

Go to app/code/local/Rajendra/Quantity/template and create quantity.phtml. Now place the following code in it:

Add CSS

Go to skin/frontend/your theme/default/css in the root directory of Magento and create custom.css. Add the following code in it:
Now, to execute your custom css file, go to app/design/frontend/your theme/default/layout/page.xml and place following code before </default>:
Go to your product page now and you will see the result.
add quantity buttons magento

Final Words

After this tutorial, you should be able to add quantity increment buttons to product page. After you’ve done this, it will be easier for your customers to add the quantity of products. I hope that you had no problem in following the simple steps of the process. If you have a problem or would like to add to the discussion, leave a comment below!

Magento Cache System Basic Concepts

The Basics – How To Use Cache In this section we will see how to use cache in our custom modules. Suppose you have a custom module and w...