Magento Tutorial

  1. Get current store Data , id and more in magento

    Here is the detail for Get current store id in magento

    Magento Get store data.


    Magento Store Id


    Magento Store code


    Magento Website Id


    Magento Store Name


    Magento Is Active


    Magento Store Home Url.


    Read more »
  2. How to integrate magento and wordpress

    You want to integrate your store to blog.simply follow my simple steps.

    Step 1:
       Goto magneto store files edit index.php add these lines

    if ( strpos($_SERVER['REQUEST_URI'], 'index.php/admin') === FALSE )
    define('WP_USE_THEMES', false);
    require_once('../wp-load.php');   // configure your WordPress location.

    Step 2:

    copy "Your-magento-folder/app/code/core/Mage/Core/functions.php"

    to   "Your-magento-folder/app/code/local/Mage/Core/functions.php"

    If u not have the folder structure create that folder and paste .

    Step 3:

    find "function __() " this line around 90 to 100  in "Your-magento-folder/app/code/local/Mage/Core/functions.php"

    thats look like 


    function __()
        return Mage::app()->getTranslator()->translate(func_get_args());
    U change it like this 

    if (!function_exists('__')) {
    function __()
        return Mage::app()->getTranslator()->translate(func_get_args());
    Read more »
  3. Create Vtiger module

    Step 1:

    Go to this folder "{Your vtiger root}/vtlib/ModuleDir/"  copy any of the folder you want to create module for which version if vtiger . Paste in to {Your vtiger root}/modules/{Your Module name}.

    Step 2:

    Go to following directory "{Your vtiger root}/modules/{Your Module name}/" . You have to change the files name as following. Replace "ModuleFile" into {Your Module name}

    ModuleFileAjax.php         ->      {Your Module name}Ajax.php

    ModuleFile.js                       ->      {Your Module name}.js

    ModuleFile.php                    ->      {Your Module name}.php

    Step 3:

    edit the following file in your faverot  editor "{Your vtiger root}/modules/{Your Module name}/{Your Module name}.php"

    change "payslip" into "{Your Module name}" case sensitive

    Change "ModuleClass" into "{Your Module name}"


    Read more »
  4. Magento get data from database

    In this tutorial we tell you how to retrive the content from database with the use of table name . here is the core help to fetch the content using select query . 

    $connection = Mage::getSingleton('core/resource')->getConnection('YOUR_DATABASE_NAME');

    //I assuming that you created the model for your table

    $result = $connection->fetchAll("SELECT *FROM YOUR_TABLE");

    ///just checking the result



    Hope this is helps you .

    Read more »

    1.1 Defining your module

    Once you've set up magento and entered into the root magento directory, go into app/code/local/. This will be where your module lives on the system. The first folder is your namespace, usually your company name. Then directory underneath this is your module name.

    All your module folder will live underneath this module directory. We will create many here, but for starters just create the etc/ and controllers/ directories. We will also create a file called config.xml in this etc/ directory. This is the main, and incredibly important, configuration file for your module.

    Create this folder structure now. Your directory layout should look as follows:










    The content of config.xml should be as follows. It adds this module to the rest of the <modules> in the magento system. And everything is in a module, even the 'core' magento classes live within modules.

    This config.xml specifies the full module name and a version number. The module name, NAMESPACE_MODULE, is derived from the aforementioned folder name. This is very common pattern in magento. Take note.

    FILE: app/code/local/NAMESPACE/MODULENAME/etc/config.xml

    But before the system can actually see your new module you need another config file. This is because the magento system won't traverse every folder in app/code/local looking for a config.xml file. Instead, it looks in app/etc/modules/ and processes every XML file there. This XML file is similar to the last, but without a version number. It specifies that the module is <active>. And that it lives in the local ‘codePool', which means it's in app/code/local. So create this file in app/etc/modules. Its name is the module name as above.

    FILE: app/etc/modules/NAMESPACE_MODULENAME.xml


    Now if we flush out magento cache in the admin panel (via System->Cache Management->Flush Magento Cache button), and go to System->Configuration->Advanced you should see your module in the list. 

    1.2 Declaring your controller 'routes'

    But our module doesn't actually do anything currently. We need to add a 'route' going from a URL to a class we define. This will in turn actually do something. Alter your config.xml like so to add that route.

    This modification we're adding to the <frontend> of the system (i.e. not the admin panel). And we're adding a router to the other <routers> in the system. We're giving that router a name, useful when dealing with layouts later on.

    Then we say it <use>s the ‘standard’ frontend router system. Then it defines the important arguments (<args>): It’ll go to the <module> we’ve just defined. And its all important url, called the <frontName>.

    FILE: app/code/local/NAMESPACE/MODULENAME/etc/config.xml

    1.3 Defining the controller class

    We’ll now define the PHP class that will be called via that route. Meaning, it will be called when the user goes to <magentourl>/URLNAME.

    This will call a class in your controllers/ module directory. The default class that it will call is IndexController.php. And within that class the default method it will call will be indexAction(). All controller class methods called from the outside must have 'Action' suffixed to their name.

    If you don’t use these defaults, you have to specify the controller name and action name after URLNAME i.e. [magentourl]/URLNAME/controllername/actionname, as opposed to just [magentourl]/URLNAME. [magentourl]/URLNAME/index/index is the same as just loading [magentourl]/URLNAME

    Let’s create that controllers/IndexController.php class now. Its name must be prepended by the Namespace and Module name. All controllers must must have the word Controller at the end. (But you don’t need to use the word 'Controller' should you need to specify the controller in the url.)

    The will extend Mage_Core_Controller_Front_Action to allow it to work as a controller and to give it access to various methods and properties of the system.

    FILE: app/code/local/NAMESPACE/MODULENAME/controllers/IndexController.php

    class NAMESPACE_MODULENAME_IndexController 
                   extends Mage_Core_Controller_Front_Action 
    public function indexAction() 
    echo 'hihi!';



    So if you go to <magentourl>/URLNAME you should see your new page. It will do nothing except display the words 'hihi'. Not impressive--but a start. 


    You may also want to define a route to the admin panel. But that topic will be dealt with after part I. This is because you will be applying much of what you have learnt dealing with magento's frontend.
    Read more »
  6. how to add wordpress header and footer in magento.

    how to add wordpress header and footer in magento.after complete my previus tutorial How to integrate magento and wordpress follow my simple steps.

    Step 1:(include wordpress header in Your magento store )

    Go to this link in your file manager


    in top of this file u add this simple wordpress function .

    <?php get_header();?>
    now You check in your magento store wordpress header show nice .

    Step 2:(include wordpress footer in Your magento store)

    Go to this link in your file manager


    open that file delete all coding in that file u add this simple wordpress function only.

    <?php get_footer();?>

    now You check in your magento store wordpress footer show nice .

    Note:after adding all this you see some errors in prototype.js file. how to clear this error in next tutorial.

    Read more »
  7. Magento download product links opening in browser

    I have a downloadable product. After I order the product and when my order is complete, I am able to download the product links from ‘My Downloadable Products’ menu in Customer Account section.

    I go to ‘My Downloadable Products’ section and I click on the links to download. However, the PDF file opens in the browser itself. I would like to have the feature that asks to download / save as instead of directly opening in the browser.


    It is fine with ZIP files. It asks to download and save. However, the PDF files, Images, HTML files, etc. are directly opened in the browser. I want them to download and save. So, a window appearing and asking to save and download the file is what I want.

    Download product links not work
    Download product links not work


    There is a very easy solution to this.

    By default, Magento has the Configuration settings to make those files open in the browser itself. You can adjust the configuration settings in Magento Admin to ask for download files instead of opening in the browser.

    - Go to System -> Configuration -> Catalog -> Downloadable Product Options -> Use Content Disposition
    - Change the setting from inline to attachment.

    Now, whenever you click the downloadable link, a pop window will always open and ask to download or open the file.

    Hope it helps. Thanks.

    Read more »
  8. jquery/prototype conflicts in Magento

    When you add jquery in your magento .

    if you are got following error comes.

    1)  You can`t add product in magento shopping cart,

    2)   Product image not shown correctly in product view.


    Solution :

    open the file in

    {magento root folder}/app/design/frontend/default/{your magento theme}/template/page/html/head.phtml


    Paste the following lines

    <script type="text/javascript">// <![CDATA[

    // ]]>


    <!--[if lt IE 7]>

    Read more »
  9. vTiger SalesOrder item detail view

    Here we discuse about how to add vTiger Sales Order item detail in any where in your vTiger , for example if you want to add Sales Order Item detail in your email .you just need that is just add simple function . if you want to add salesorder item view using single function.


     to youse the above function you got all the detail in your html format . 

    Read more »
  10. All Magento URL list

    Magento Mage Core, Admin Static Blocks, or Phtml edits are usually includes getting url path such as images, javascript, base url, media and store url. There are different ways to retrieve mentioned URL paths depending on which section you’re editing.

    To Retrieve URL path in STATIC BLOCK
    To get SKIN URL

    {{skin url='images/sampleimage.jpg '}}
    To get Media URL
    To get Store URL
    To get Base URL

    {{base url='yourstore/mypage.html'}}
    TO Retrieve URL path in PHTML
    Note: In editing PHTML don’t forget to enclode the following code with PHP tag

    Not secure Skin URL:

    getSkinUrl('images/sampleimage.jpg') ?>
    Secure Skin URL

    getSkinUrl('images/ sampleimage.gif', array('_secure'=>true)) ?>
    Get Current URL

    $current_url = Mage::helper('core/url')->getCurrentUrl();
    Get Home URL

    $home_url = Mage::helper('core/url')->getHomeUrl();
    Get Magento Media Url

    Get Magento Media Url

    Get Magento Skin Url

    Get Magento Store Url

    Get Magento Js Url


    Read more »
Copyright © 2016 Samdoit Infotech. All rights reserved.