Tuesday, 20 November 2012

Display All Product Attribute in Mageto Shopping Cart

Open the location given below
note: path can differ according to templete

app\design\frontend\base\default\template\checkout\cart\item\default.phtml

use the Code below in default.phtml.

<?php
$product = Mage::getModel(‘catalog/product’)->load($this->getProduct()->getId());
$attributes = $product->getAttributes();

foreach ($attributes as $attribute) {
if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined()) {
$value = $attribute->getFrontend()->getValue($product);
if (strlen($value) && $product->hasData($attribute->getAttributeCode())) {
$data[$attribute->getAttributeCode()] = array(
‘label’ => $attribute->getFrontend()->getLabel(),
‘value’ => $value //$product->getData($attribute->getAttributeCode())
);
?>
<span style=”font-weight:bold;”><?php echo $data[$attribute->getAttributeCode()]['label']; ?></span>: <span><?php echo $data[$attribute->getAttributeCode()]['value']; ?></span>
<?php
}
}
}
?>

Magento Image Switcher On MouseOver

Step1. open file on location given below
app/design/frontend/default/default/template/catalog/product/view/media.phtml

 

Step2. Search the code in media.phtml file
<a onclick="popWin('&lt;?php echo $this-&gt;getGalleryUrl($_image) ?&gt;', 'gallery', 'width=300,height=300,left=50,top=50,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" href="#"> <!--nested img tag stays the same--></a>

 

Step 3. Replace searched code with code below.
<a title="&lt;?php echo $_product-&gt;getName();?&gt;" onmouseover="$('image').src = this.href; return false;" href="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($this-&gt;getProduct(), 'image', $_image-&gt;getFile()); ?&gt;"> <img src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($this-&gt;getProduct(), 'thumbnail', $_image-&gt;getFile())-&gt;resize(56); ?&gt;" alt="&lt;?php echo $this-&gt;htmlEscape($_image-&gt;getLabel()) ?&gt;" width="56" height="56" /></a>

Import/Export Magento Category Extension

Import/Export Magento Category Extension

Magento GooglePlusOne Extension

Magento GooglePlusOne Extension

Magento ajax add to cart extension

Magento ajax add to cart extension

Tuesday, 6 November 2012

Magento create order programatically

Magento create order programatically

Magento export order csv script

Magento export order csv script

php script to change order status

php script to change order status

Magento script to clear cache

clearcache magento script

Sending email from local system in magneto OR Sending email from magento in local system

1) make sure you did setting in php.ini

i'e

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.yourdomine.com
; http://php.net/smtp-port
smtp_port = 25

and in magento go to admin

System->Configuration->System->Mail Sending Setting->host

replace host from localhost to mail.yourdomine.com

Magento redirect url

Mage::app()->getResponse()->setRedirect(Mage::getUrl("checkout/cart/"));

Magento - How to get all Product details in magento Programmatically?

<?php
require_once 'app/Mage.php';
umask(0);
Mage::app('default');

function empty_pk($data){
if($data!=''){return $data;}
else {return "&nbsp;";}
}
$collection = Mage::getModel('catalog/product')->getCollection();

echo '<table border="1"> ';
echo '<tr>';
echo "<th>sku<th />";
echo "<th>name<th />";
echo "<th>qty<th />";
echo "<th>is_in_stock<th />";
echo "<th>price<th />";
echo '</tr>';

foreach ($collection as $product_all) {
//echo '<pre>';print_r($product);echo '</pre>';

$sku = $product_all['sku'];
// retrieve product id using sku
$product_id = Mage::getModel('catalog/product')->getIdBySku($sku);
// call product model and create product object
$product    = Mage::getModel('catalog/product');
// Load product using product id
$product ->load($product_id);

$pk_sku = empty_pk($product['sku']);
$pk_name = empty_pk($product['name']);

$stockData = $product->getStockData();

$pk_qty = empty_pk($stockData['qty']);
$pk_in_stock = empty_pk($stockData['is_in_stock']);
$pk_price = empty_pk($product['price']);

echo '<tr>';
echo "<td>".$pk_sku."<td />";
echo "<td>".$pk_name."<td />";
echo "<td>".$pk_qty."<td />";
echo "<td>".$pk_in_stock."<td />";
echo "<td>".$pk_price."<td />";

echo '</tr>';

}
echo '</table>';
?>

Magento - How to get all Magento Database hosting details?

<?php
require_once 'app/Mage.php';
umask(0);
Mage::app('default');
$resource = Mage::getConfig()->getNode('global/resources')->asArray();

echo '<pre>';

print_r($resource);
echo '</pre>';
$db_host = $resource['default_setup']['connection']['host'];
$db_user = $resource['default_setup']['connection']['username'];
$db_pass = $resource['default_setup']['connection']['password'];
$db_name = $resource['default_setup']['connection']['dbname'];

echo '<br />host : '.$db_host;
echo '<br />username : '.$db_user;
echo '<br />password : '.$db_pass;
echo '<br />dbname : '.$db_name;
?>