Magentoの中に新しいIAMが、私が注文 を作成するためのスクリプトを作成したい、私はたくさんのスクリプトで検索しましたし、私はこれを取得:Magento1.8 - 注文を作成するのに最適なスクリプトは何ですか?
<?php
require_once 'app/Mage.php';
Mage::app();
$quote = Mage::getModel('sales/quote')
->setStoreId(Mage::app()->getStore('default')->getId());
// for guesr orders only:
$quote->setCustomerEmail('[email protected]');
// add product(s)
$product = Mage::getModel('catalog/product')->load(431);
$buyInfo = array(
'qty' => 1,
// custom option id => value id
// or
// configurable attribute id => value id
);
$quote->addProduct($product, new Varien_Object($buyInfo));
$addressData = array(
'firstname' => 'Test',
'lastname' => 'Test',
'street' => 'Sample Street 10',
'city' => 'Somewhere',
'postcode' => '123456',
'telephone' => '123456',
'country_id' => 'SA',
);
$billingAddress = $quote->getBillingAddress()->addData($addressData);
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
$shippingAddress->setCollectShippingRates(true)->collectShippingRates()
->setShippingMethod('freeshipping_freeshipping')
->setPaymentMethod('cashondelivery');
$quote->getPayment()->importData(array('method' => 'cashondelivery'));
$quote->collectTotals()->save();
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$order = $service->getOrder();
printf("Created order %s\n", $order->getIncrementId());
?>
をしかし、私はこのスクリプトを実行すると、それは私にエラーを与える「ページが動作していません"
これを修正したり、注文を作成するスクリプトを教えてもらえますか?
注私はかつてこれを試してみましたが、それは動作します "www.site.com/createorder.php
おかげ
エラーの添付ファイル – bxN5