本文整理汇总了PHP中Order::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getItems方法的具体用法?PHP Order::getItems怎么用?PHP Order::getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order::getItems方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createOrder
public static function createOrder(Order $order)
{
echo '以下の内容で注文データを作成しました' . PHP_EOL;
echo "商品番号\t" . "商品名\t" . "単価\t" . "数量\t" . "金額\t" . PHP_EOL;
foreach ($order->getItems() as $order_item) {
echo $order_item->getItem()->getId() . "\t" . $order_item->getItem()->getName() . "\t" . $order_item->getItem()->getPrice() . "\t" . $order_item->getAmount() . "\t" . $order_item->getItem()->getPrice() * $order_item->getAmount() . PHP_EOL;
}
}
示例2: distributeItems
/**
* Distribute Items.
*
* @param Order $order
* @param float $maxPricePerPackage
*
* @return void
*
* @throws \UnexpectedValueException
*/
public function distributeItems(Order $order, $maxPricePerPackage)
{
// Calculate initial number of packages
$numPackages = ceil($order->getTotalPrice() / $maxPricePerPackage);
if ($numPackages > count($order->getItems())) {
throw new \UnexpectedValueException('Some items will not fit into packages.');
}
$this->distributeItemsIntoPackages($order, $maxPricePerPackage, $numPackages);
}
示例3: createOrder
public static function createOrder(Order $order)
{
echo "注文完了しました。\n";
echo "商品番号\t商品名\t単価\t数量\t金額\n";
foreach ($order->getItems() as $order_item) {
echo $order_item->getItem()->getId() . "\t";
echo $order_item->getItem()->getName() . "\t";
echo $order_item->getItem()->getPrice() . "\t";
echo $order_item->getAmount() . "\t";
echo $order_item->getItem()->getPrice() * $order_item->getAmount();
echo "\n";
}
}
示例4: setOrdersShopp
protected function setOrdersShopp()
{
$time = strtotime($this->date . ' UTC');
$dateInLocal = date("Y-m-d H:i:s", $time);
global $wpdb;
/*$rows = $wpdb->get_results(
"SELECT * FROM " . $wpdb->prefix . "shopp_purchase WHERE modified > '" . $dateInLocal . "' and (txnstatus = 'authed' or txnstatus = 'captured') order by modified ASC"
, ARRAY_A);*/
$rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "shopp_purchase WHERE modified > '" . $dateInLocal . "' order by modified ASC", ARRAY_A);
//CREATE AN HOOK ON FUNCTION sc_orders_rows to allow customers to make changes
$rows = apply_filters('sc_orders_rows', $rows, $this);
foreach ($rows as $row) {
$orderObj = new Order($this->software, $this->date, $row);
$array = $orderObj->getItems();
if (!empty($array)) {
array_push($this->orders, new Order($this->software, $this->date, $row));
}
}
}
示例5: isDownloadable
function isDownloadable($software, $date, $row)
{
$toReturn = false;
global $wpdb;
$table = $wpdb->prefix . "postmeta";
$order = new Order($software, $date, $row);
$i = 0;
$j = 0;
foreach ($order->getItems() as $item) {
$i++;
$result = $wpdb->get_row("SELECT * FROM " . $table . " WHERE post_id = " . $item->getProductID() . " and meta_key = '_downloadable'", ARRAY_A);
if ($result['meta_value'] == "yes") {
$toReturn = true;
$j++;
}
}
if ($i != $j) {
$toReturn = false;
}
return $toReturn;
}
示例6: order
public static function order(Order $order)
{
$item_dao = ItemDao::getInstance();
//1.ItemDaoインスタンスを取得し、
foreach ($order->getItems() as $order_item) {
//2.在庫を引き当て、
$item_dao->setAside($order_item);
}
OrderDao::createOrder($order);
//3.注文結果を表示する
}
示例7: setNumber
protected function setNumber($date)
{
$time = strtotime($date . ' UTC');
$dateInLocal = date("Y-m-d H:i:s", $time);
global $wpdb;
$split = explode('.', $this->software->getVersion());
if ($this->software->isCompatible()) {
// Cas Shopperpress
if ('shopperpress' == $this->software->getSoftware()) {
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "orderdata WHERE CONCAT(order_date,' ',order_time) > '" . $dateInLocal . "' order by CONCAT(order_date,' ',order_time) ASC");
foreach ($orders as $order) {
$this->number++;
}
} else {
if ('Shopp' == $this->software->getSoftware()) {
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "shopp_purchase WHERE modified > '" . $dateInLocal . "' and (txnstatus = 'authed' or txnstatus = 'captured') order by modified ASC", ARRAY_A);
foreach ($orders as $order) {
$orderObj = new Order($this->software, $date, $order);
$array = $orderObj->getItems();
$this->number++;
}
} else {
if ('Woocommerce' == $this->software->getSoftware()) {
include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/woocommerce/functionsWoocommerce.php';
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_modified_gmt > '" . $dateInLocal . "' AND post_type = 'shop_order' order by post_modified_gmt ASC", ARRAY_A);
$count = 0;
foreach ($orders as $order) {
if ($count < 100) {
if (!isDownloadable($this->software, null, $order)) {
$this->number++;
$count = $count + 1;
}
} else {
break 1;
}
}
} else {
if ('WP eCommerce' == $this->software->getSoftware()) {
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "wpsc_purchase_logs WHERE date > '" . $time . "' order by date ASC", ARRAY_A);
foreach ($orders as $order) {
$this->number++;
}
} else {
if ('Cart66 Lite' == $this->software->getSoftware()) {
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "cart66_orders WHERE ordered_on > '" . $dateInLocal . "' order by ordered_on ASC", ARRAY_A);
foreach ($orders as $order) {
$this->number++;
}
} else {
if ('Cart66 Pro' == $this->software->getSoftware()) {
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "cart66_orders WHERE ordered_on > '" . $dateInLocal . "' order by ordered_on ASC", ARRAY_A);
foreach ($orders as $order) {
$this->number++;
}
} else {
if ('Jigoshop' == $this->software->getSoftware()) {
include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/jigoshop/functionsJigoshop.php';
$orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_modified_gmt > '" . $dateInLocal . "' AND post_type = 'shop_order' order by post_modified_gmt ASC", ARRAY_A);
foreach ($orders as $order) {
$this->number++;
}
}
}
}
}
}
}
}
}
}
示例8: mapToDTO
private function mapToDTO(Order $order)
{
return ['number' => $order->getNumber(), 'customer' => $order->getCustomer(), 'items' => array_map(function (OrderItem $item) {
return ['productName' => $item->getProductName(), 'price' => ['amount' => $item->getPrice()->getAmount(), 'currency' => $item->getPrice()->getCurrency()], 'quantity' => $item->getQuantity()];
}, $order->getItems())];
}