Wednesday 20 February 2013

assign new related product in bundled product magento


$param = array(
           $productid=>array(
                  'position'=>0
            ),
            $productid=>array(
                  'position'=>0
            ));



$related_product = $product->getRelatedProductCollection();




foreach($related_product as $rproduct){
$rlateproduct = Mage::getModel('catalog/product')->load($rproduct->getId());
$data[$rlateproduct->getId()] = array('position'=>0);

}



if($data != ""){
$result = $param + $data;
}
else{
$result = $param;
}




$product->setRelatedLinkData($result);
$product->save();


Tuesday 19 February 2013

get user login magento

<?php

 $isloggedin = Mage::getSingleton('customer/session')->isLoggedIn();

it will return 1;


 ?>

Monday 18 February 2013

get Order data magento


$orderid = 1;
$orderdata = Mage::getModel('sales/order')->load($orderid);
$orderdetail = $orderdata->getData();
$items = $orderdata->getAllItems();
$orderdata->getShippingAddress()->getFirstname();
$orderdata->getShippingAddress()->getLastname();
foreach ($orderdata->getShippingAddress()->getStreet() as $street)
   {
    echo $street;
   }
$orderdata->getShippingMethod();
$orderdata->getPayment()->getMethodInstance()->getTitle();





if you wan to see hole order data


echo "<pre>";
print_r($orderdata);
echo "</pre>";

add new product magento

ADITYA: add new product programetically: /* udate product */ $_product = Mage::getModel('catalog/product')->load(4); /* Add product */ $_product = Mage::getModel('catalog/pro...