Thursday, 27 March 2014

How to set minimum quantity in magento cart?

Go to app\design\frontend\base\default\template\checkout\onepage\link.phtml


Put this code in this page


<?php if ($this->isPossibleOnepageCheckout()):?>
<?php if(Mage::helper('checkout/cart')->getCart()->getItemsQty() >= 3):?>
    <button type="button" title="<?php echo $this->__('Proceed to Checkout') ?>" class="button btn-proceed-checkout btn-checkout<?php if ($this->isDisabled()):?> no-checkout<?php endif; ?>"<?php if ($this->isDisabled()):?> disabled="disabled"<?php endif; ?> onclick="window.location='<?php echo $this->getCheckoutUrl() ?>';"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button>
<?php else:?>
<font style="color:red;">You must order a quantity of 3 or more to proceed.</font>
<?php endif?>
<?php endif?>


Then put this code into header.phtml page

<input type="hidden" id="get_cart" value="<?php echo Mage::helper('checkout/cart')->getCart()->getItemsQty(); ?>" />
<script type='text/javascript'>
        jQuery(document).ready(function() {
if(document.getElementById("get_cart").value < 3) {
jQuery(".top-link-checkout").attr("href", "javascript:void(0);")
}
        });

</script>

Then enjoy!!!!!!!!!!!!!!

Thursday, 13 March 2014

magento index.php was not found on this server error


If the magento installed under /magento or directory then add the following rules into ” /home/username/public_html/magento/.htaccess ” file.


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /magento/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /magento/index.php [L]
</IfModule>


Now Enjoy!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!




Tuesday, 18 February 2014

Magento Configuration product wrong price issues in create new order


1) Go to app\code\core\Mage\Sales\Model\Quote\Item\ then open Abstract.php page.
2) Write the following code in the public function getPrice() (line no - 484)


$_Pdetails = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->_getData('sku'));
 return $_Pdetails->getFinalPrice();


Code should be


public function getPrice()
    {
$_Pdetails = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->_getData('sku'));
                return $_Pdetails->getFinalPrice();  // Debendra on 17/02/2014
       /* Orginal Code
return $this->_getData('price');
*/
    }



Now the correct product price is going to show in the admin panel, when you create one order (Phone order).

Wednesday, 22 January 2014

Magento Tax Round Issue

Go to app\code\core\Mage\Core\Model\Store.php

Find the following function


 public function roundPrice($price)
    {
        return round($price, 2);
    }

Change to:-


public function roundPrice($price)
    {
        return round($price, 4);
    }



Enjoy..........

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;
}