How to set minimum purchase order amount - magento

When customer places an order, how to set minimum order amount?
i.e) Total amount of order not below than $500.
I know how to get total order amount. But I don't know where to place that code and where to check
sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$oOrder = Mage::getModel('sales/order')->load($sOrderId);
if($oOrder >=$500)
{
.....
}
If customer has purchased total less than $500, they won't allow to checkout at the cart.

Login as admin, then go to System->configuration, then select ‘Sales‘ from left Nav and click on ‘Minimum order amount‘.
Then select Yes from Enable dropdown, enter Minimum order amount, enter message and also enter error message that will be shown whenever the order will be less than specified amount at the shopping cart.
Thanks.

You need to change the scope of the minimum amount setting. For that you need a new module with a system.xml file that contains the same path to the minimum amount field and just changes the <show_in_store> value. Read more about this here.

Related

Magento Remove an items from Quote Items, Order total not updated

Trying to remove an item from the quote object, but cannot get order total updated.
For example, a customer adds product A ($2), and B ($3) to the cart, and then place the order.
After customer hits the place order button, I am trying to remove product B from the order.
Using the code below, I can successfully remove B from the order. But the total of the order is not updated.
$quote->getItemsCollection()->removeItemByKey($item->getId());
Say I have product B removed, then order should have a total of $2, but I checked from the order grid in backend, the total was $5.
//Try with the below code. not tested.
$quote->getItemsCollection()->removeItemByKey($item->getId());
$quote->save();
//I thing you need to remove items from order to reflect your changes in order.
foreach($order->getAllItems() as $item) {
$item->isDeleted(true);
}
Please note that this is not recommended to do things like this as per this link More details

Change Order Date when changing an order

I'm hoping someone will be able to solve an issue that takes us a lot of manual labour, the solution seems simple :-)
Summary:
Is it possible to change the code that, when you Edit an order (invoiced or not yet invoiced) that is does not take the Order Date and Time of when you edited the order, but it uses the Order Date and Time of the original order?
Example:
Order 1000 was placed on 15/05/2015 at 12:00
Order 1000 was edited on 25/05/2015 at 14:00, the new order ID is 1000-1
We will credit or cancel order 1000, depending on the invoice state
Standard Magento will give order 1000-1 the Order date of 25/05/2015 14:00
But we would like order 1000-1 to receive the order date of 15/05/2015 12:00, the same as original order 1000.
Explanation:
We use a Magento Extension (Embedded ERP) which uses product reservations. If a customer orders a product, it does not remove the item from stock, but reserves stock. If the item is on backorder, the customer is placed in queue.
The system uses a first in, first out system. It uses the order date to check which customer is higher in queue than the other customers.
Because we use backorders, customer sometimes like to add or remove items to order, because they have to wait for items anyway. But when changing an order to add or remove items, the new order gets a new Order Date and Time. We want the customer to have the same product reservations as their original order. So now we manually change the product reservation of each item so it's the same as their original order.
I expect we can have the correct product reservations on the new order done automatically when the new order has the same order date and time of the original order.
Copy the file app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php into app/code/local/Mage/Adminhtml/Model/Sales/Order/. Keep the folder structure unchanged!
Find the option createOrder() and change this
if ($this->getSession()->getOrder()->getId()) {
$oldOrder = $this->getSession()->getOrder();
$this->getSession()->getOrder()->setRelationChildId($order->getId());
$this->getSession()->getOrder()->setRelationChildRealId($order->getIncrementId());
$this->getSession()->getOrder()->cancel()
->save();
$order->save();
}
with this:
if ($this->getSession()->getOrder()->getId()) {
$oldOrder = $this->getSession()->getOrder();
$this->getSession()->getOrder()->setRelationChildId($order->getId());
$this->getSession()->getOrder()->setRelationChildRealId($order->getIncrementId());
$this->getSession()->getOrder()->cancel()
->save();
$order->setCreatedAt($oldOrder->getCreatedAt());
$order->save();
}

Square Connect adjust inventory quantity to fixed

how i could adjust the quantity on square connect API as fixed type, for example:
on Square : 10 items
And on My System: 5 items
i want to update the quantity on square to 5 , and yes, i don't know what the quantity on square so i cant use -5 and adjustment type SALE.
is there any option for Inventory Adjustment Type to make it FIXED.
Thanks
It is not currently possible to set a variation's inventory quantity to an absolute amount. You can perform the following steps as a workaround:
Use the List Inventory endpoint to identify a particular variation's current quantity.
Use the Adjust Inventory endpoint to adjust the variation's quantity by the amount necessary to match your external system. You can set the adjustment_type parameter in your request to MANUAL_ADJUST to indicate that the adjustment is not related to a sale or increase in stock.
I've submitted a feature request to the API engineering team.

Why does magento generates random order id's

One of my magento site shows zig-zag order numbers from admin panel sales->orders. I guess, it should be auto incremented. There is possiblity to skip few numbers due to uncompleted orders. But i get unusual number for an order. Last order id was 100001922 and i get order id for latest order 100001300. can anybody help me as i need to figure out the reason.

Creating a new Quote Total be factored into Tax

We are creating a new total line item on the quote, such as an oversize charge and this needs to be taken into account when the tax calculation is calculated. We have set it to be before tax, but obviously when looking through the tax total file it doesn't appear to grab other totals or a way to say this total needs to have tax applied.
Has anyone came up with a solution to this?
From what I can remember all the 'footer' totals (I remember them as being in a <tfoot> normally) are based on the subtotal and not each other. If your 'oversize' total block modifies the subtotal after it has been displayed then maybe the tax will calculate the updated value.
In your collect method you can try to add the value to the Subtotal instead of the GradTotal ( $address->setSubtotal ). I'm not sure if it will work or if it will need further adjustments.

Resources