Sunday, 25 August 2013

Magento Parse error: syntax error, unexpected 'endforeach' (T_ENDFOREACH), Short Open Tag Error

This error you can solved by your end. Please find the following solutions.

Go to C:\xampp\php\php.ini

Then set
short_open_tag = on

And restart your Apache Server.













Wednesday, 21 August 2013

magento get all products with child products


$collection = Mage::getModel('catalog/product')->getCollection();
foreach($collection as $assProducts)
{
$product = Mage::getModel('catalog/product')->load($assProducts->getId());
echo $product->getName().'<br>';
if($assProducts->getTypeId() == "configurable") {
       $product = Mage::getModel('catalog/product')->load($assProducts->getId());
$childProducts = Mage::getModel('catalog/product_type_configurable')
                    ->getUsedProducts(null,$product);  
foreach($childProducts as $child) {
    echo '---------'.$child->getName().$child->getId().'<br>';
}
}

}






php first element of array


$array = array( 2 => 'orange', 4 => 'banana', 9 => 'apple' )
echo reset($array); //Output : "orange"














Magento get store list from all websites


$allWebsites = Mage::app()->getWebsites();
<select id="store" name="stire" onChange="">
<?php
foreach ($allWebsites as $website) {
foreach ($website->getGroups() as $group) {
$stores = $group->getStores();
foreach($stores as $_eachStoreId => $val)
{
$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
$_storeId = Mage::app()->getStore($_eachStoreId)->getId();
$webid = $website->getId();
?>
<option value="<?php echo $webid; ?>"><?php echo $_storeName;?></option>
<?php
}
}
}
?>
</select>








Thursday, 8 August 2013

Magento Passing data between a controller and a block

In the controller write the bellow code
Mage::register('demodata', $demodata);
In the controller write the bellow code 
$data = Mage::registry('demodata');
Hope it will help you.


Tuesday, 30 July 2013

magento multi vendor extension free

Give your vendors the freedom to manage their own products, and notify them automatically of their new orders.

Site link ishttp://www.magentocommerce.com/magento-connect/super-simple-multi-vendor-marketplace-free-2295.html

Magento Connecthttp://connect20.magentocommerce.com/community/Junaidbhura_Jbmarketplace

Please copy the above magento connect and install in into your store.


















Magento File System

The File System Magento extension is an indispensable tool for every website administrator. With File System, you can manage your Magento files exactly from the administration panel. Now you don't have to open your FTP client every time you need to make some slight changes in your files.

Forget about these FTP or SSH connections which are too expensive and difficult to use. With the File System Magento extension, you can easily do all the necessary operations. Just install this MagPlesure module and enjoy the simplicity of use!

This a free magento extension.
Link : http://www.magentocommerce.com/magento-connect/file-system.html