当前位置: 首页>>代码示例>>PHP>>正文


PHP unknown_type::getAllItems方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:guohuadeng,项目名称:stampApp,代码行数:51,代码来源:Premiumrate.php

示例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();
             }
         }
     }
 }
开发者ID:sohagan,项目名称:magento-modules,代码行数:24,代码来源:Direct.php


注:本文中的unknown_type::getAllItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。