Magento is an open source based ecommerce web application that was launched on March 31, 2008. It was developed by Varien (now Magento Inc) with help from the programmers within the open source community but is owned solely by Magento Inc.. Magento was built using the Zend Framework.It uses the Entity-attribute-value (EAV) database model to store data.
Some Basic Code in magento :
( I ) Getting Product details, by using Product ID :
<?php
$model = Mage::getModel(‘catalog/product’) //getting product model
$_product = $model->load($productid); //getting product object for particular product id
echo $_product->getShortDescription(); //product’s short description
echo $_product->getDescription(); // product’s long description
echo $_product->getName(); //product name
echo $_product->getPrice(); //product’s regular Price
echo $_product->getSpecialPrice(); //product’s special Price
echo $_product->getProductUrl(); //product url
echo $_product->getImageUrl(); //product’s image url
echo $_product->getSmallImageUrl(); //product’s small image url
echo $_product->getThumbnailUrl(); //product’s thumbnail image url
?>
( II ) Getting ProductID, by using Product Name :
<?php
$product_name = ‘Test Product’; //product name
$model = Mage::getModel(‘catalog/product’) //getting product model
$collection = $model->getCollection(); //products collection
foreach ($collection as $product) //loop for getting products
{
$model->load($product->getId());
$pname = $model->getName();
if(strcmp($pname,$product_name)==0)
{
$id = $product->getId();
}
}
echo ‘Required ID->’.$id; //id of product
?>