Add code

Saturday, 18 March 2017

Top Magento Interview Questions & Answers

1) Mention what is Magento?
Magento is an e-commerce platform created on open source technology, which provides online merchants with an exceptional flexibility and control over the content, look and functionality of their e-commerce store.
2) Mention what is the architecture of Magento? What are the different versions of Magento?
Magento architecture is a typical PHP MVC (Model-View-Controller) application, where all the Controllers will be in one folder and all the Models in another, etc.  Based on their functionality files are grouped together, which are referred as modules in Magento.
Different version of Magento includes
  • Magento Enterprise
  • Magento .go
  • Magento Community
3) Mention what technology does Magento use?
Magento use PHP as a web server scripting language and MySQL for database.
4) Mention what is the difference between Mage::getModel() and Mage::getSingletone() in Magento?
  • Mage::getModel(): It always creates a new object
  • Mage: :getSingleton(): It always look for an existing object and if not then creates a new object
5) Mention what are the basic features of Magento?
Basic features of Magento includes
  • Reporting and Analytics
  • Product and Catalog Browsing
  • Customer Accounts
  • Order Management
  • Payment
  • Site Management
  • Shipping
  • Search engine optimization
  • Marketing promotions and tools
  • Checkout
  • International Support
6) Mention what is the limitation of Magento?
  • Magento is supported by PHP, comparatively to other e-commerce solutions, Magento might be slow in performance
  • It becomes a complex system if it is not using object-oriented programming
  • Magento requires much space and memory
7) Explain how you can enhance the Magento performance?
To enhance the Magento performance
  • Disable the Magento log
  • Combine external CSS/JS into one file
  • Disable any unused modules
  • MySQL Query Caching
  • Enable Magento caching
  • Enable Gzip compression
  • Optimize your image
8) Explain how you can show a certain number of products for guests in Magento?

In the toolbar block you will see
app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
there is a method:
Public function setCollection($collection);
Inside there is a piece of code:
$limit= (int)$this->get Limit();
If ($limit) {
$this ->_collection->setPageSize($limit);
}
You have to change variable $limit; you should override that block in the local pool, not change directly in the core.  In order to see whether the customer is a guest, you can use this code
Mage:: getSingleton(‘customer/session’) -> isLoggedIn()

9) Mention what all billing information can be managed through Magento?
From the client Magento account, you can do following things
  • Update your billing address
  • Add a credit card
  • View your billing history
  • Add a PayPal account
  • Produce a print ready receipt
10) Explain how you can change Magento Core API settings?
To change Magento Core API settings, you have to
  • Go to Admin menu, choose System -> Configuration
  • Select Magento Core API on the left side of the Configuration Panel, under Services
  • Tap on to expand the General Settings section and you can
  • Type the name of the Default Response Charset that you want to use
  • Determine the Client Session Timeout in seconds
  • Click the Save Config button when complete
11) Explain how Magento can be made more secure for the client?
Best practices for Magento includes
  • Using a strong password and changing them at regular interval
  • Disable remote access to Magento Connect Manager
  • Disable Downloader on production sites
  • Restrict access to safe IP addresses
12) Mention what is the benefit of applying Connect Patches in Magento?
In Magento, applying connect patch
  • It enables easy installation of packages with installation; it overwrites any existing translations for the same time
  • For enhancing security, by default Magento Connect uses HTTP to download extensions instead of FTP
  • With a dash character in the name, extension developers can now create extensions
  • Magento administrators will be informed now who tries to install an extension with insufficient file system privileges
13) Explain how you can move Magento to another Directory?
To move Magento to other Directory you have to follow the following steps.
  • Suppose you have Magento installed in the following location
http://www.domain.com/store/
  • On visiting your site, you want Magento to be the first thing to come up
http://www.domain.com
  • Let assume you have a directory structure like this
/home/username/public_html/
  • Which means Magento would be installed here
/home/username/public_html/store/
  • Login to the backend of the Magento first and go to
System -> Configuration -> Web
Update the Secure and Unsecure URL for your store and then link to your site via SSH and then go to the directory, where you will be shifting Magento
cd public_html/
  • Now, transfer all the files from the store directory to the directory you are in
mv store/* store/.htaccess
  • Delete the cache data
rm –vf var/cache/
Now Magento is moved to another directory.

14) Explain how you can reset Magento file & Directory permissions?
You can reset Magento file & Directory to their default and secure permissions, by following commands from the directory where Magento is installed
find . –type f –exec chmod 644 {} \;
find . –type d –exec chmod 755 {} \;
chmod +x mage

15) Explain how you can configure Magento to work with another domain?
To do that, in the admin area, you have to change the Magento Base URL option. To do this, visit to your Magento admin area> System > Configuration and click Web on the left menu. Select the Unsecure option after that edit the base URL field to change the URL that will be used for normal (HTTP) connections.

16) Why to use Magento?

The uses of Magento are:
Magento is open source E-commerce software.
it is scalable and offers small companies to build business.
It provides the searching and sorting of products in several ways.
Easily integrates with many of the third-party sites which are needed to run effective E-commerce website.
Using this, customer can order or purchase number of products. There are no limits on number of purchasing products.

17) List the Web-Hosting sites of Magento?


The Web-Hosting sites of Magento are:
  • SiteGround
  • BlueHost
  • HostGator
  • Inmotion
  • Arvixe
  • site5
18) What are disadvantages of Magento?

  • Magento uses larger disk space and memory.
  • It takes much time to build the customized functionality.
  • It is very slow compared to other E-commerce sites.
  • It needs proper hosting environment, if the hosting environment is improper the user can face the problems.
19) Name the web-server that supports Magento?

The Web-server that supports Magento are:
  • Apache 2.x
  • Nginx 1.7.x
20) What are Magento products?

Products are the items or things that are sold in Magento. Product can be anything that is capable of satisfying customer needs. This includes both physical products and services.

21) Name the product types that are available in Magento?

The product types available in Magento are:
  • Simple Products
  • Grouped Products
  • Configurable Products
  • Virtual Products
  • Bundled Products
  • Downloadable Products
22) What is Inventory?

Inventory allows setting a product's stock quantity. For instance, you have a product with 100 units in stock. If you set the stock availability to "Out of Stock" then it will force the item to be out of stock.

23) Name the categories of E-Commerce?

The categories of E-Commerce are:
  • Business to Business(B2B)
  • Business to Consumer(B2C)
  • Consumer to Consumer(C2C)
  • Consumer to Business(C2B)
24) What does Rate Percent mean in Manage Tax Rate window?

Rate Percent specify the percent of the tax rate.
25) What does Priority field specifies in Manage Tax Rules?

Priority field specifies when the tax should be applied to other tax rules.

26) What is the used of Zero Subtotal Checkout panel?

The Zero Subtotal Checkout panel is a payment option that displays when order total is zero and not required to enter payment details for the customer.

27) What is the used of 3D Secure Card validation field in Saved CC?

It is additional security functionality where customer needs to provide credit card password to complete the purchase order.

28) Which are the methods of PayPal Payment Gateways?

The two methods of PayPal Payment Gateways are:
  • Payflow Pro (Includes Express Checkout)
  • Payflow Link (Includes Express Checkout)
29) What is Payflow Pro?

The Payflow Pro option is customizable payment gateway which can be used with merchant account to process credit card transactions.

30) What is Payflow Link?

Payflow Link option often called as hosted payment gateway that keeps customer on your site by providing fast and easy way to add transaction processing to your site.
 

Friday, 17 March 2017

Delete All URL Rewrites In Magento-1 (Truncate all existed url i magento)

You may wish to delete all URL rewrites from URL Rewrite Management in Magento at some point, especially if you are frequently importing/exporting product and category data.

By using this following SQL Query.


  • SET FOREIGN_KEY_CHECKS = 0;
  • TRUNCATE TABLE `core_url_rewrite`;
  • SET FOREIGN_KEY_CHECKS = 1;

Wednesday, 1 March 2017

How to apply schedule for themes in magento-1 and magento-2 ?

Magento-1:

1) Login to Admin panel

2) Go to Content > Design > Schedule

3) Click on “Add new Design” theme

4) Select the theme,start date, from date and save the design theme

Magento-2:


1) Login to Admin panel

2) Go to Content > Design > Schedule

3) Click on “Add new Design” theme

4) Select the theme,start date, from date and save the design theme

Thursday, 20 October 2016

Magento1: How to reinstall magento website without re uploading all files

To reinstall the Magento website without uploading all files to the server, we need to follow the following steps:
  1. Log in to the database at phpmyadmin and select your database.
  2. Empty the particular database or drop all tables from the selected.
  3. Goto app->etc folder and remove the local.xml file from the existed files.
  4. Now start the installation by running your domain url.

How to Change default homepage in magento-1 ?

Go to

 Admin -> System -> Configuration -> General (Left) -> Web > Default Pages ->  CMS Home Page

Select your required home page from drop-down.

You will have to change to the website / store view that you want to change (the drop down in the upper left corner).

How to enable contact us page in magento -1 ?

 1. Login to admin panel
 2. Goto admin-->system-->configuration-->General-->contacts
 3. Enable Contact Us->Yes
 4. Email options-->Send emails to-->(Enter your email id which you want to receive)

How to change page title of a category in magento-1 ?

 1. Login to admin panel
 2. Goto catalog-->manage categories
 3. Select category which you want to change the title
 4. Goto display options and enter there your desire page title
 5. Save category
 6. clear cache and refresh website frontend.

Friday, 26 August 2016

How to enable login for custom cms page in magento-1.9

1) First of all, you need to create the page in admin panel for the custom page.
open  app/design/frontend/base/default/layout/customer.xml file  from your root folder.</br>
You need to write the following code out of <default>tag.

<customer_logged_in>
    <reference name="top.links">
        <action method="addLink" translate="label title" module="cms"><label>Bulk orders</label><URL><![CDATA[https://www.domain.com/customage/]]></URL><title>Bulk orders</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</customer_logged_in>


<customer_logged_out>
 <reference name="top.links">
     <action method="addLink" translate="label title" module="customer"><label>Bulk orders</label><url helper="customer/getLoginUrl"/><title>Bulk orders</title><prepare/><urlParams/><position>10</position></action>
 </reference>
</customer_logged_out>

Thursday, 28 July 2016

Shopping cart is going to empty after cancelled the payment at checkout page

Please `open app/code/core/Mage/Checkout/controllers/OnepageController.php`

Search for 

$this->getOnepage()->getQuote()->save();
 
 //this makes the cart empty (sets the quote as converted to order)
    if (isset($redirectUrl)) {
        $result['redirect'] = $redirectUrl;
    } 
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 
And replace this with the following.

if (isset($redirectUrl)) {
    $result['redirect'] = $redirectUrl;
    $this->getOnepage()->getQuote()->setIsActive(1) ;
}
$this->getOnepage()->getQuote()->save();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

Friday, 29 April 2016

How to Add the list of cities in states to Magento.


Adding the list of cities in states to Magento.
 I have tested this and worked for me on my server.
 I have used the Region & City Manager extension.
Region & City Manager extension allows you to add regions and cities for any countries in the world.

Check once the extension from here :

https://www.magentocommerce.com/magento-connect/catalog/product/view/id/30552/s/region-city-manager/

Monday, 21 March 2016

Hide Magento Attributes with no Value

This can be done with a small piece of code. Find and open the attributes.phtml file. This file can be found here:/app/design/frontend/[theme name]/[package name]/template/catalog/product/view/attribute.phtml
Open the file and search for the following lines:


<?php foreach ($_additional as $_data): ?>
    <tr>
        <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
    </tr>
<?php endforeach; ?>

Replace the entire foreach loop with the following lines of code:

<?php foreach ($_additional as $_data): ?>
    <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
    if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
    <tr>
        <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
    </tr>
    <?php } ?>
<?php endforeach; ?>

<?php foreach ($_additional as $_data): ?>
    <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
    if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
    <tr>
        <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
    </tr>
    <?php } ?>
<?php endforeach; ?>

Friday, 19 February 2016

How to move magento search bar from header to sidebar?

Edit "app/design/frontend/<your theme>/<your theme>/layout/catalogsearch.xml"

Fine the line:


<reference name="header">
    <block as="topSearch" name="top.search" template="catalogsearch/form.mini.phtml" type="core/template">
</block>
</reference>

Replace the reference name to left or right.

<reference name="left or right(your wish)">
    <block as="topSearch" name="top.search" template="catalogsearch/form.mini.phtml" type="core/template">
</block>
</reference>

Magento : 404 error is showing admin page

Hello, Sometimes we may get the error on admin page once done with the Magento installation. In that scenario, we have to do the following: ...