Archives for the blog category


What are custom options in Magento?

Custom options provides an simple way to offer a selection of product variations to your customer.

How to create custom options to products?

  • Go to Admin Panel, Select Catalog → Manage Products
  • In the product Information panel on the left, Select Custom options
  • Click the Add New Option button

Add a Title to be used as a label for product custom option.

  • Choose the Input Type for this field, such as Drop-down or Text
  • Add Is Required to “Yes” if the customer must make an entry in this field
  • To control the sequence of options, enter a number in the Sort Order field to determine the sequence of this option when listed with other options

Magento product with  Custom Options Use of Custom Product Options in Magento

Now, open product SATCO Test under “Apparel” in Magento front-end.
You should see something like:

Magento product with Custom Options frontend Use of Custom Product Options in Magento

share save 171 16 Use of Custom Product Options in Magento

In Magento there are three types of Product Relations:

  • Upsell Product
  • Related Product
  • Cross sell Product

1. Upsell Products:

Upsell products are listed in the product informations page and thats mean, “You may also be interested in the following product(s) ”. From my point of view, usually here you should include more expensive products in this area.

2. Related Products:

Related products are listed in the product informations page and customer has the probabilistically of adding them to the cart at the same time as the main product

3. Cross sell Products:

Cross sell Products are listed in the cart page and mean, “People that bought these also bought….”. That is not exactly true for Magento because the links are made manually.

How to manage Up-sell, Related & Cross-sell products from admin side?

Go to Magento Admin: Catalog → Manage Products → Edit product →
Related Products/Up-sells/Cross-sells Tab

magento cross upsell related rule base setting 300x143 Upsell, Related, Cross sell products in Magento
share save 171 16 Upsell, Related, Cross sell products in Magento

What are the product attributes?

An product attribute is defined as any property of a product. This includes product related data… everything! You also do not require any columns to your database. Its all automatically managed by attribute manager. You have to just add or create the attribute from the admin and you can start adding data for Magento products using this custom or new attribute.

Types of Magento Product Attributes (System and Custom)

There are two types of Magento Product Attributes.

  • System Attributes
  • Custom Attributes

System Attributes: By default, Magento includes all the necessary System Attributes.

Following are the system attributes:

System Attributes How to call system attribute in phtml file?
 country_of_manufacture  $_product->getCountryOfManufacture();
 custom_design  $_product->getCustomDesign();
 custom_design_from  $_product->getCustomDesignFrom();
 custom_design_to  $_product->getCustomDesignTo();
 custom_layout_update  $_product->getCustomLayoutUpdate();
 description  $_product->getDescription();
 enable_googlecheckout  $_product->getAttributeText(“enable_googlecheckout”);
 gift_message_available  $_product->getAttributeText(“gift_message_available”);
 group_price  $_product->getGroupPrice();
 image  $_product->getImage();
 is_recurring  $_product->getAttributeText(“is_recurring”);
 meta_description  $_product->getMetaDescription();
 meta_keyword  $_product->getMetaKeyword();
 meta_title  $_product->getMetaTitle();
 msrp  $_product->getMsrp();
 msrp_display_actual_price_type  $_product->getAttributeText(“msrp_display_actual_price_type”);
 msrp_enabled  $_product->getAttributeText(“msrp_enabled”);

Custom Attributes: Custom attributes are those attributes which is created by the user that is called user-defined attributes.

How to create custom product attributes and product attribute set?

  • A) How to create new attribute?

    Go to Admin Catalog → Attributes → Manage Attributes

    • Click on Add New Attribute
    • Set Attribute Code and Manage label
    • After that, Click on Save Attribute
  • B) How to create new product attribute set?

    Go to Admin Catalog → Manage Attribute Set

    • Click on Add New Set
    • Add name and Click on Add Attribute Set
  • C) How to assign new attribute to any attribute set?
    • 1] Suppose, We assign new attribute to Shoes attribute set
    • 2] Then edit Shoes Attribute set and Our new attribute present in unassigned
    • 3] Attribute’s list Drag and Drop in Groups After that , click on Save Attribute set

How to get custom attribute value [As per type (eg date, price, Yes/No, dropdown)]?

  • For Date field:
    eg: arribute code = date_attribute

    $_dateValue = $_product->getDateAttribute();
    echo $_dateValue ;

  • For Price field:
    eg: arribute code = price_attribute

    $_priceValue = $_product->getPriceAttribute();
    echo $_priceValue ;

  • For Yes/No field:
    eg: arribute code = yesno_attribute

    $_yesNoValue = $_product->getAttributeText(yesno_attribute);
    echo $_yesNoValue;

  • For Dropdown field:
    eg: arribute code = dropdown_attribute

    $_dropDown = $_product->getAttributeText(dropdown_attribute);
    echo $_dropDown ;

share save 171 16 Magento Product Attributes

How to debug code? (through log)

Here we can see debugging code technique:

  • For File Log System:

    system log, exception log and your log file
    First need to Enable Log settings from admin:
    Go to Admin -> System -> Configuration -> Developer -> Log Settings -> Enable.
    The log files for both system and exception stores in {{base_dir}}/var/log.
    To do system log we have to use “Mage::log()” and to do exception log we have to use “Mage::logException()”.
    Write your log:
    Mage::log(“For Testing”);
    Mage::log(“For Testing”, null, “ourfile.log”);
    Mage::logException(“Test log Exception”);

  • Write Debug Backtrace:

    Put it in a function which we have to check where it is called
    $tracelog = Varien_Debug::backtrace(true, true);
    Mage::log(Varien_Debug::backtrace(true, true), null, ‘backtrace.log’);

  • Log Class/Method:

    Mage::log( get_class($object)) # name of class
    Mage::log( get_class_methods($object)) # methods of class

  • Write Your Profiler in between code:

    We can use following line for write a profile section with own tags/keyword
    We can use your own keyword which is display in profiler.
    Note: keyword must be same in start and stop

share save 171 16 Magento Debugging Environment

How to reduce indexing time?

For Catalog URL Rewrites

Que. How to reduce re-index processing time for Catalog URL Rewrites ?

Issue: catalog_url index take a more time when running indexing process.
We have analyzed and found there is need to check our database table core_url_rewrite related to url_rewrite data.

Following screen shots will clarify above statement.

08 300x144 How you can reduce catalog url rewrite indexing time?

Need to taken some steps:

  • We need to remove unwanted entries of core_url_rewrite table.
  • Or we can disable/Off entry generation. Change configuration for generating Permanent Redirect urls , the Permanent Redirect urls are generated behalf of id_path.

Go to Magento Admin:

Open: System → Configuration → Catalog → Search Engine Optimizations →
Create Permanent Redirect for URLs if URL Key Changed – OFF

Check following screen shots.

09 300x125 How you can reduce catalog url rewrite indexing time?

share save 171 16 How you can reduce catalog url rewrite indexing time?

How and why to set Front-End catalog flat indexing to true?

  • How to set Frontend catalog flat indexing to true

    Go to Magento Admin Panel

    System →Configuration→Catalog → Frontend →Use Flat Catalog Category
    Use Flat Catalog Product

    03 300x236 Catalog Flat Magento Indexing

  • Why Enable Flat Catalog?

    In Magento, all product and category connected data is stored in the database. The database consists of collection of tables. There are number of tables. When Magento found number of tables for different data that’s scattered, it can becomes slow. Hence, Enable Flat Catalog Category and Product which reducing the response time.

How to create Custom Indexes?

In this section, we will explain how to create custom indexes in Magento. There are following steps which is used to create indexes.

  • How to register indexer with Magento system?

    We need to add a row to table index_process.

    Before Added screenshot:

    04 300x110 Catalog Flat Magento Indexing
    05 300x143 Catalog Flat Magento Indexing

    From above screenshot, custom_indexer: This is a indexer code
    Model: the model to process the index

Which tables are used in Magento Indexing?

What is Magento index_event table

  • Structure of index_event table

    06 300x83 Catalog Flat Magento Indexing

What is Magento index_process table

  • Structure of index_process table

    07 300x90 Catalog Flat Magento Indexing

share save 171 16 Catalog Flat Magento Indexing

What is significance of each column in Admin related to indexing interface?

Index Status

A Magento index has following three statuses.

  • pending
  • working
  • require_reindex

You can check constants for these process statuses here
(Class Name:Mage_Index_Model_Process)
const STATUS_RUNNING = ‘working’;
const STATUS_PENDING = ‘pending’;
const STATUS_REQUIRE_REINDEX = ‘require_reindex’;

Index Process

This is basically a wrapper for the indexer itself and can be found in the table index_process. It has the following information:

  • Indexer code
  • Current indexer status
  • Start and end times
  • Mode

What are indexing present in Magento?

Following are the indexing types

  • Product Attribute’s
  • Product Price
  • Catalog URL Rewrites
  • Product Flat Data
  • Category Flat Data
  • Category Products
  • Catalog Search Index
  • Stock Status
  • Tag Aggregation Data
share save 171 16 Magento Indexing: Admin Interface Column

Why Magento needs indexing?

Indexing is used to improve speed or performance of our web store. Indexing is how Magento changes data such as products, categories etc. As data changes, the changes data must be changed or reindexed.
For Example: Suppose you change the price of an product from $4.99 to $3.99. Magento must reindex the price change to display it on your Front-End.

How to executing Magento Indexer?

There are different ways to executing Magento Indexer

  1. From Magento Admin (Admin Configuration)
  2. Through Shell
  3. Set by Cron
1. From Magento Admin (Admin Configuration)

To understand how indexing works and to reindex when needed. Go to Magento Admin Panel
System -> Index Management

01 300x86 Magento Indexing & its Execution
02 300x85 Magento Indexing & its Execution

2. Through shell:

Magento: Performing Magento Indexer from shell.

Magento uses re-index data from the Admin Panel. A good way to re-index data from command shell because in some condition when we want to re-index data we will get an error message and re-index process will be broken.
In Magento, there is a folder with name “shell” in this folder, you will find with name indexer.php.
This is a shell script for re-indexing.
Shell folder path: Go to your [ROOT FOLDER/shell]

  • First, cd [Your project url]/shell
  • After that, Get indexing info using following command

    Command: php indexer.php

    magento indexing php reindexer Magento Indexing & its Execution

  • Execute reindex-data using following command

    Command: php indexer.php –reindex

    magento indexing php indexer Magento Indexing & its Execution

    By default there are 8 indexes in Magento

    catalog_product_attribute Product Attributes
    catalog_product_price Product Prices
    catalog_url Catalog Url Rewrites
    catalog_product_flat Product Flat Data
    catalog_category_flat Category Flat Data
    catalog_category_product Category Products
    catalogsearch_fulltext Catalog Search Index
    cataloginventory_stock Stock status

    Following are the individual commands for re-indexing

    1. hp indexer.php –reindex catalog_product_attribute
    2. php indexer.php –reindex catalog_product_price
    3. php indexer.php –reindex catalog_url
    4. php indexer.php –reindex catalog_product_flat
    5. php indexer.php –reindex catalog_category_flat
    6. php indexer.php –reindex catalog_category_product
    7. php indexer.php –reindex catalogsearch_fulltext
    8. php indexer.php –reindex cataloginventory_stock
share save 171 16 Magento Indexing & its Execution

1] Use a secure and strong password password

Magento is the Most Powerful and Secure Framework in eCommerce. But there are certain tips that you can follow in order to make sure your Magento store is safe and sound. When you are select your Magento site password, select cleverly. Depending on your configurations and permissions, this password may give access to customer information.
    • Choose Difficult Password:
The Magento Admin Password must be different from Username and Special Character and Numerical Character. We ensure that your password is secure make it lengthy by adding as many characters as possible which are not only letters but punctuations and numbers too.
    • Use Secure FTP Password:
Most Of time loose and small password are reason of hacking the site. So use the powerful and difficult password to the FTP. Prevent your website from the Hacker using strong and lengthy password.
    • Do Not Save Password In Computer:
Some time Developer save there FTP and Admin Password in computer, to use regularly. But when the site is live that do not remove there password from computer. So that is easy to hack the website. To secure your website from Hacker do not save your FTP password. Also do not save password of admin on browser.

Here are some tips for creating a really secure and strong password:

  • Bigger is superior, use at least 10 characters.
  • Mix upper and lower case, punctuation, and numbers.
  • Making your password vocal can make it easier to remember and type quickly.

2] Do not use your Magento password for anything else:

Do not use Magento password with any other websites or web services. Third party sites may support SSL (Secure Sockets Layer) to login. In the event that a third party websites is hacked, your password may be vulnerable.

3] Change Your Magento Admin path:

Generally, you access your Magento Admin panel by your Using the path to your admin panel path easily guessable means that someone or something can try to guess your password. How NOT to change your Magento Admin path:
System → Configuration → Advanced → Admin → Admin Base Url

magento security magento admin path admin base url Keep Your Magento Secure

Most Important Note: Do not use the admin base URL settings. It will break your site.

How to change your Magento Admin path

There is an easy way to change your Magento Admin path.

1. Exist /app/etc/local.xml
2. Find <![CDATA[admin]]> and replace ‘admin’ with the path you would like to use So if your local.xml file says <![CDATA[testbackend]]>, your admin path will be /testbackend.

4] Expect HTTPS/SSL for all pages with logins:

In Magento, you can expect secure logins by selecting “Yes” for both “Use Secure URLs in
Frontend” and “Use Secure URLs in Admin” by going to the “Secure” section of the “Web” tab in the system configuration.magento security ssl secure Keep Your Magento Secure

5] Put up-to-date anti-virus software:

Computer viruses and Trojans can pick your data and log your key strokes.

6] Disallow Scripting Executatin under full permission folders like Media, Uploads:

1. If your server is Dedicated or VPS you can add following configuration in your httpd.conf to preventing scripts on Specific folder

<directory /your-dir-path>
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
2. If you Dont have an access for httpd.conf you can also set it with .htaccess like following

  • AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
  • Options -ExecCGI
  • Use 444 Permission for .htaccess after adding quote

NOTE :- Put that .htaccess code under the directory where you want to dis-allow scripting.

7] Allow Admin Login From Specific IP Address:

You can Apply that configuration under .htaccess to limit access for admin area

AuthName “Protected Area”
AuthType Basic
<Limit GET POST>
order deny,allow
deny from all
allow from
allow from 49.248.5.

8] Block countries where you are not doing business:

You can block it using IP tables Rule on Server

9] Set proper permissions and ownership settings:

The safe Magento is to set chmod 755 on directories and 644 on all files with the exception of often created/deleted files like session or cache files will need chmod 755.
For More Refer Magento Link:

10] Use Sftp Insted of FTP

11] Remove your RELEASE_NOTES.txt after Installation

12] Don’t save export files with sensitive information into folders accessible on the web

share save 171 16 Keep Your Magento Secure

Technical points related to Magento Speed Optimization considered by us while optimizing Magento for Speed:
In our series of Magento Speed Optimization blog, we will discuss on configuration, template, server points that will helps speed up your Magento site.
Speeding up Magento sites takes a long list to perform. You can go through the following tips for optimization.

A) Magento Template Related:

  • Use of image sprites to reduce number of request
  • Optimize images for size
  • Remove unwanted css code and minify or reduce your css code
  • Remove unwanted js code and minify or reduce your js code
  • Specify Image Dimensions
  • Apply javascript lazy-loader for images if you have lots of images on your site
  • Use some webtest tool to analyse number of requests and other html related data for download time

B) Magento Admin Configuration:

  • Make sure enable Flat Catalog
  • Make sure enable Compiler Mode
  • Merge css and js (Used Fooman Speedster Module)
  • Delete additional stores if not in use
  • As per requirement, Log should be minimized according to number of days
  • Disable Log Settings in magento
  • Remove Admin notification module
  • Improve magento database Log Cleaning via admin

C) Server Environment:

  • Enable Gzip compression in .htaccess
  • Use nginx
  • Use of APC
  • Use query cache
  • Use Apache mod_expires
  • Use a Content Delivery Network (CDN)
  • Enable Apache KeepAlives
  • Load cache on RAM if memory permits
  • Reduce hard disc file reads and try reads from RAM as this is faster
  • Upgrade PHP version to above 5.3
  • Session to be on RAM
  • Make sure cron is run so as to clean logs stored in data base
  • Your cron file should be run in specific hours
  • Disable the PHP open_basedir directive
  • Eliminate directory structure scans for .htaccess files

D) Additional Tips:

  • Use FPC.
  • Remove all modules not in use by removing there .xml file
  • If possible, use Ajax
  • Don’t use CMS blocks
  • Do not use many various external sources.
  • Abbreviate number of searchable attributes as these result in columns in flat catalog table and will slow down your search.
  • Use of Solr search. It already exists with EE version but it can be installed with CE.
  • Minimize customer group as suggested in comment.
  • Make sure your css code check through W3 validator because errors slow down the browser.
  • Use of getChildHtml (‘childName’) is recommended as this will cache block against direct use of block code in .phtml file.
  • Remove unwanted blocks. (Number of blocks are executed that are not used or displayed.)
  • If using FPC make sure your containers are cached and repeat request for container is delivered via cache. Improper placeholder definition results in container cache not being used but each time new container content getting generated.
  • Analyze page blocks and variables and if possible add those variables/blocks to cache.
  • Remove directory structure scans for .htaccess files.
  • Use Google page speed firefox extension like Yslow.
  • If on EE make sure that most pages are loaded without application initialization. If one container needs application initialization its going to effect execution speed.
share save 171 16 Technical points related to Magento Speed Optimization
Please visit our Magento Speed Optimization Service Page for further assistance.

1 2 3 22