Thursday, 14 November 2013

magento get all available shipping methods


function getAllAvailableShippingMethod()
{
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
$shipMethods = array();
foreach ($methods as $shippigCode=>$shippingModel)
{
    $shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
    $shipMethods[$shippigCode] = $shippingTitle;
}
return $shipMethods;
}

Magento get all available payment method


function getAllAvailablePaymentMethod()
{
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$payMethods = array();
foreach ($payments as $paymentCode=>$paymentModel)
{
    $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
    $payMethods[$paymentCode] = $paymentTitle;
}
return $payMethods;
}









Monday, 21 October 2013

Magento connect manager problem

If magento connect manager having problem whenever install any extension then go through following steps.

1) Remove Cache
2) Remove your browser cookie
3) Go to "downloader" folder and remove the "cache.cfg" & "connect.cfg" files as well.

Then logged into your magento connect manager. and enjoy.....








magento remove configurable product price from dropdown in admin panel

Go to app\design\adminhtml\default\default\template\catalog\product\composite\fieldset\configurable.phtml

Replace the script code



<script type="text/javascript">
   // var config = <?php echo $this->getJsonConfig() ?>;


Product.Config.prototype.formatPrice = function(){ return ''; }
var config = new Product.Config(<?php echo $this->getJsonConfig() ?>);



    if (window.productConfigure) {
        config.containerId = window.productConfigure.blockFormFields.id;
        if (window.productConfigure.restorePhase) {
            config.inputsInitialized = true;
        }
    }
    ProductConfigure.spConfig = new Product.Config(config);
</script>

Then  enjoy....

Sunday, 13 October 2013

Magento Reset "Use Secure in front end or Admin" in database

1. Open up your cPanel
2. Go to phpMyAdmin (if MySql)
3. Find your Magento Database
4. Find table 'core_config_data'
5. Look for the columns 'web/secure/use_in_frontend' and 'web/secure/use_in_adminhtml'
6. Edit both values, make them equal to '0'





















Thursday, 3 October 2013

Magento product collection by product type


$collectionSimple = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'simple'));

$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'configurable'));

$collectionBundle = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'bundle'));

$collectionGrouped = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'grouped'));

$collectionVirtual = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('type_id', array('eq' => 'virtual'));

Sunday, 15 September 2013

magento call static block in phtml

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_message')->toHtml(); ?>