本文整理匯總了PHP中unknown_type::getAllItems方法的典型用法代碼示例。如果您正苦於以下問題:PHP unknown_type::getAllItems方法的具體用法?PHP unknown_type::getAllItems怎麽用?PHP unknown_type::getAllItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類unknown_type
的用法示例。
在下文中一共展示了unknown_type::getAllItems方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setTotalPrice
/**
* NOTE: This code is 1.4/1.5 specific - do not overwrite with 1.3 code
* @param unknown_type $request
* @return number
*/
private function setTotalPrice($request, $discounted, $taxed)
{
$totalPrice = 0;
$totalWeight = 0;
$totalQty = 0;
$temp = '';
$includeVirtual = false;
$useParent = true;
$cartFreeShipping = false;
$useBase = false;
$items = $request->getAllItems();
if (is_array($items)) {
foreach ($items as $item) {
$price = 0;
$weight = 0;
$qty = 0;
if ($item->getProduct()->isVirtual()) {
if (!Mage::helper('wsacommon/shipping')->getVirtualItemTotals($item, $weight, $qty, $price, $useParent, $request->getIgnoreFreeItems(), $temp, $discounted, $cartFreeShipping, $useBase, $taxed, $includeVirtual)) {
continue;
}
} else {
if (!Mage::helper('wsacommon/shipping')->getItemTotals($item, $weight, $qty, $price, $useParent, $request->getIgnoreFreeItems(), $temp, $discounted, $cartFreeShipping, $useBase, $taxed)) {
continue;
}
}
$totalPrice += $price;
$totalQty += $qty;
$totalWeight += $weight;
}
if (Mage::helper('wsalogger')->isDebug('Webshopapps_Premiumrate')) {
Mage::helper('wsalogger/log')->postDebug('premiumrate', 'Original Package Weight', $request->getPackageWeight());
Mage::helper('wsalogger/log')->postDebug('premiumrate', 'Original Package Value', $request->getPackageValue());
Mage::helper('wsalogger/log')->postDebug('premiumrate', 'Original Package Qty', $request->getPackageQty());
Mage::helper('wsalogger/log')->postDebug('premiumrate', 'New Package Weight', $totalWeight);
Mage::helper('wsalogger/log')->postDebug('premiumrate', 'New Package Value', $totalPrice);
Mage::helper('wsalogger/log')->postDebug('premiumrate', 'New Package Qty', $totalQty);
}
if (Mage::helper('core')->isModuleEnabled('Webshopapps_Dropship') && Mage::getStoreConfig('carriers/dropship/active') && Mage::getStoreConfig('carriers/dropship/use_cart_price')) {
$request->setPackageValue($request->getCartValue());
} else {
$request->setPackageValue($totalPrice);
}
$request->setPackageWeight($totalWeight);
$request->setPackageQty($totalQty);
}
}
示例2: addOrderedItemsToStock
/**
* Re-add the order items to the stock to balance the incorrect stock management before a payment is completed
*
* @param unknown_type $order
*/
public function addOrderedItemsToStock($order)
{
$nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
$isCustomStockManagementEnabled = Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('customstockmanagementenabled');
if ($isCustomStockManagementEnabled) {
$items = $order->getAllItems();
foreach ($items as $itemId => $item) {
// ordered quantity of the item from stock
$quantity = $item->getQtyOrdered();
$productId = $item->getProductId();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
$stockManagement = $stock->getManageStock();
if ($stockManagement) {
$stock->setQty($stock->getQty() + $quantity);
$stock->save();
}
}
}
}