我在管理员面板中看到了我的订单,并且所有订单都处于状态"等待"。
订单是否可以在没有管理员必须这样做的情况下自动确认?
答案 0 :(得分:1)
您可以为其制作自定义扩展程序,您可以从此处获得帮助。 http://www.atwix.com/magento/auto-invoice-and-custom-order-status-upon-checkout/ 要么 http://inchoo.net/magento/magento-orders/automatically-invoice-ship-complete-order-in-magento/
答案 1 :(得分:0)
是有一种方法可以实现这个使用下面的代码并在你的时间基础上从cron调用,代码将在下订单1小时后将状态从挂起更改为处理。
<?php
require_once('app/Mage.php');
Mage::app('admin');
$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('status','pending')
->addFieldToFilter('created_at', array('lt' => new Zend_Db_Expr("DATE_ADD('".now()."', INTERVAL -'60:00' HOUR_MINUTE)")))
->addAttributeToSelect('customer_email')
->addAttributeToSelect('increment_id');
Mage::log("cod diret run from script cron start");
foreach ($orders as $order) {
$incrementId = $order->getIncrementId();
$individualOrder = Mage::getModel("sales/order")->loadByIncrementId($incrementId);
try {
if(!$individualOrder->canInvoice())
{
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
}
$invoice = Mage::getModel('sales/service_order', $individualOrder)->prepareInvoice();
Mage::log("next");
if (!$invoice->getTotalQty()) {
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
}
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($invoice->getOrder());
$transactionSave->save();
}
catch (Mage_Core_Exception $e) {
}
$OrderStatus = Mage::getModel("sales/order")->loadByIncrementId($incrementId);
$OrderStatus->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
$orderid= $individualOrder->getEntityId();
$email = $order->getCustomerEmail();
}