Wordpress

  1. 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 »
  2. 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 »
  3. 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


    print_r($result);

     

    Hope this is helps you .

    Read more »
  4. CREATE YOUR MAGENTO MODULE

    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:

    [magentodir]/

    app/

    code/

    local/

                         NAMESPACE/

    MODULENAME/

    etc/

    config.xml

    controllers/

    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


    <config>
    <modules>
    <NAMESPACE_MODULENAME>
    <version>0.1.0</version>
    </NAMESPACE_MODULENAME>
    </modules>
    </config>
     
    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

     
    <config>
    <modules>
    <NAMESPACE_MODULENAME>
    <active>true</active>
    <codePool>local</codePool>
    </NAMESPACE_MODULENAME>
    </modules>
    </config>

    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
     
    <config>
    <modules>
    <NAMESPACE_MODULENAME>
    <version>0.1.0</version>
    </NAMESPACE_MODULENAME>
    </modules>
       <frontend>
    <routers>
    <ITSROUTERNAME>
    <use>standard</use>
    <args>
    <module>NAMESPACE_MODULENAME</module>
    <frontName>URLNAME</frontName>
    </args>
    </ITSROUTERNAME>
    </routers>
    </frontend>

    </config>
     
     
    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

     
    <?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 »
  5. 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

    "
    YOUR-MAGENTO-FOLDER/app/design/frontend/default/YOUR-THEME/template/page/html/header.phtml
    "

    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

    "YOUR-MAGENTO-FOLDER/app/design/frontend/default/YOUR-THEME/template/page/html/footer.phtml"

    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 »
Page
Copyright © 2016 Samdoit Infotech. All rights reserved.