Magento - Free shipping as default option - magento

We are using two shipping options. If under $50 than add $4.95 and free shipping when more than $50. Magento is only using the $4.95 also when the cart total amount it over $50. How to set the free shipping method as default?
as you can see there is also no option in our template to select the shipping method.

For this you need to enable two shipping method from admin panel.
Enable Free Shipping and Set Minimum Order Amount to $50
Enable Flat Rate Shipping method and set Price to 4.95
By this way Flat Rate shipping method always visible in the checkout and Free shipping method come when Order amount is minimum $50.
As when Free shipping method enable, we need to remove Flat Rate shipping method. For this you need to follow this process:
Copy Flatrate Carrier Model From Core pool to local pool.
From: app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php
To: app/code/local/Mage/Shipping/Model/Carrier/Flatrate.php
In the collectRates function add the below lines:
if ($request->getBaseSubtotalInclTax() >= Mage::getStoreConfig('carriers/freeshipping/free_shipping_subtotal')) {
return false;
}
After these lines:
if (!$this->getConfigFlag('active')) {
return false;
}

In the admin set your Shipping Method Rate to default 4.95 and in your shipping model (e.g Mage_Shipping_Model_Carrier_Flatrate) method collectRates, add a condition to check for the cart total:
if ($request->getBaseSubtotalInclTax() >= 50)
{
$method->setPrice(0.00);
$method->setCost(0.00);
$method->setCarrierTitle('Free Shipping');
}

Related

magento i need to apply discount 20% for the total if above 50euros but not to the discounted items

magento i need to apply discount 20% for the total if above 50euros but not to the discounted items if customers selects some already discounted items that should not include in the total can any one help
Thanks in advance
You need to create a custom module or say shopping cart price rule and an event observer to check whether the "special price" is zero or not. If it is "Zero" that means it is not a already discounted product or you can even check the "final price" with the "price" , if the final price is lesser than price it is already discounted.
If these conditions are satisfied get the prices of remaining products prices and discount them then add the already discounted products price to make the total amount.
I hope You understood this concept and write your own module.
you have to use a check in view page.
for example
$price = $product->getPrice();
$specialprice = $product->getFinalPrice();
if(!empty($specialprice)){
//then your price would be same
}
elseif(empty($specialprice)){
then price would be = $price*20/100;
}
hope this would help you and don't forget to like if it was helpful

Magento Flat Rate Shipping only if chart is over a certain amount

In Magento 1.7, is there any way to show Flat Rate Shipping only if chart is over a certain amount?
By rule the only option seems to be free shipping, but my goal is to have Flat Rate if sub total in chart is xx (if sub total is lower, normal rates will be used).
Not by default. It's easy to extend the flat rate shipping carrier method though to do this. Simply create a new module, extend the flat rate shipping system.xml so that there is a new option for minimum cart price (this will allow you to configure it through admin). Extend the following class Mage_Shipping_Model_Carrier_Flatrate and override the collectRates method to check the cart total vs the admin config value. Return false if the cart value is not enough and it will not show up as an option, otherwise it will return the cost set in the admin.
Edit: Something like the following would do it. Extend the class, don't mod the core!
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
// Get The Minimum Order Value From Admin Config & Compare To Cart Subtotal (Base Prices)
if (!$this->getConfigFlag('minimum_order') || $request->getBaseSubtotalInclTax() < $this->getConfigFlag('minimum_order')) {
return false;
} else {
return parent::collectRates($request);
}
}

How to access to the discount price in Magento?

I'm trying to rewrite a template for the cart.
I need to retrieve the discount amount but I was not able to find where.
Ie If my coupon code gives me $10 discount I want to retrieve 10, if I have a discount of 5% I want to retrieve 5 if the total price is $100.
Thank you.
you can debug your object by printing it out and observing what values it contains
print_r($this->getQuote()->getData());
I used the following code to access discount price. I was accessing the details of last order in a phtml file. For the last order if there was a discount coupon used then I used following code to access the Discount Amount.
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order=Mage::getModel('sales/order')->loadByIncrementID($lastOrderId);
if($lastOrderId) //If order was placed then only display coupon code
{
$coupon=$order->getCouponCode();
echo "<b>Discount coupon used during order:</b>".$coupon;
$disAmount=$order->getDiscountAmount();
echo "<br/>Discount Amount: ".$disAmount;
}

Magento - Using getPriceHtml on custom product collection doesn't return correct tax price

I have a product collection called using the following (set to show 6 items):
$_testproductCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->setPageSize(6);
$_testproductCollection->load();
then i get the 6 products details with a foreach:
foreach($_testproductCollection as $_testproduct){
echo "Price is ".$this->htmlEscape($this->getPriceHtml($_product, true))."<br/>";
};
this works ok until I set my store to show prices inclusive of tax. Instead of showing 2 different prices, for example:
Excl. Tax: $138.56
Incl. Tax: $149.99
it shows the same price for both. If I add a call to the loaded product collection again immediately after it's loaded:
$_productCollection=$this->getLoadedProductCollection();
...it works fine, the prices are correct, but then it's skipping the setPageSize function and returning the full store collection of products.
How can I get the correct tax prices to show, and what is it in the getLoadedProductCollection that corrects this? The function is in Mage/Catalog/Block/Product/List.php
See Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addTaxPercents
Also, the getLoadedProductCollection calls (via a catalog layer) the addMinimalPrice and addFinalPrice methods. From those docs you can see there are methods for adding tiered pricing and URL rewrites. That is nice to know.

Magento: Fixed shipping cost BELOW certain basket price

How can I set the shipping cost for Magento for all baskets that are below a certain point. For example, all baskets under £5 have fixed shipping of £1.99.
I think this is what you are looking for, unless I have the wrong thing. It seems to be called Table Rate Shipping.
the only way i've managed to get it working is to add an extra case statement in my shipping module.
$result = Mage::getModel('shipping/rate_result');
...
} else if ($request->getPackageValue() < 6) {
$price = '1.99';
...

Resources