Home  • Framework • Laravel

Magento Ecommerce

Basic Overview: Current Version : magento - 1.9.1.0 (Sample sql file is recommanded to install) amount of files : 10,000+ Generally Used to make a reliable shopping cart, Yeah, the codeigniter users uses cart class to make a shopping cart, so there is a question, "What do these 10,000+ file do ?" Well, the answer is "It is the most secure platform for ecommerce puspose, and it used the configurable blocks to perform it's operations" The answer is ambigous and difficult to understand at first glance, don't worry, after a little practice it will be clear to all of us. let us know the structure of a magento package: Working directory for the new bies: +-------Community(will available 2 co..) + ----------- Code ------->|------- Core (Reserve) + ----------- Design +-------Local(Best for practice) Magento->app-|------------ etc + ----------- locale + ----------- Mage.php Under the "Code" directory, every root is known as codePoll, so for our practice local is the best choice. Now we are going to create our own namespace in the local codePoll, Consider : Our nameSpace is : VcampusPractice Module is : firstModule and let's create some directory in our module : firstModule/Block firstModule/controllers firstModule/etc firstModule/etc/config.xml firstModule/Helper firstModule/Model firstModule/Model/Product.php firstModule/sql On this stage our local codePoll structure is as follows: +----Block +----controllers Local-->VcampusPractice->firstModule --------|----etc->config.xml +----Helper +---Model->Product.php +---sql Now we need to register our modules: to do that we have to open ->apps/etc/modules now we need to create an xml file, lets name it VcampusPractice_firstModule.xml and put the code on it:
<?xml version="1.0"?>
<config>
    <modules>
        <VcampusPractice_firstModule>
            <active>true</active>
            <codePool>local</codePool>
        </VcampusPractice_firstModule>
    </modules>
</config>
now we may checkout our module registration by visiting localhost/magentoInstallDir/admin and after log in: system->->Configuration :: Advanced->advanced let us continue the procedire: now we will add code to the Product.php file, that we have created location : app/code/local/ VcampusPractice/firstModule/Model/Product.php
   <?php
     // it must be followed for the magento class naming convention
     // Namespace_Modules_ModelType_FileName

	 class VcampusPractice_firstModule_Model_Product{
	 	function sayHello(){
	 	echo "Hello Vcampus! We just created a new module in Magento";
	 	}
	 }

  ?>
Now let's create a file called test.php on the magento root directory. magento/test.php and add some code here;
<?php
   require_once('app/Mage.php');
   $product = new VcampusPractice_firstModule_Model_Product;
   $product->sayHello();

?>

now we can check by visiting http://localhost/magentoInstallDir/test.php If every things work and no error occur we will find the hard coded sentence on the browser screen. too much work for getting a sentence in output, huh ( Don't throw it away. )

Comments 0


Share

About Author
Md Fahad
Copyright © 2024. Powered by Intellect Software Ltd