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


PHP Mage_Core_Model_Abstract::getProduct方法代码示例

本文整理汇总了PHP中Mage_Core_Model_Abstract::getProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getProduct方法的具体用法?PHP Mage_Core_Model_Abstract::getProduct怎么用?PHP Mage_Core_Model_Abstract::getProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_Abstract的用法示例。


在下文中一共展示了Mage_Core_Model_Abstract::getProduct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStreetDateForBackorderableItem

 /**
  * Returns a Varien_Object containing the from and to date for a backorderable product that
  * doesn't make inventory detail call to ROM. If the ROM setting is configured to use
  * street date as estimated delivery date and the backorderable item has a valid date
  * that's in the future, then the from and to date will be constructed using the street date
  * in product and to date using the street date plus the configured number of days in the future.
  * If any of these conditions are not met, then this method will simply return null.
  *
  * @param Mage_Core_Model_Abstract
  * @return Varien_Object | null
  */
 public function getStreetDateForBackorderableItem(Mage_Core_Model_Abstract $item)
 {
     if ($this->coreConfig->isUseStreetDateAsEddDate) {
         /** @var Mage_Catalog_Model_Product $product */
         $product = $item->getProduct();
         /** @var string $streetDate */
         $streetDate = $this->getStreetDateFromProduct($product);
         if ($streetDate && $this->isStreetDateInTheFuture($streetDate)) {
             return $this->getNewVarienObject(['delivery_window_from_date' => $this->getNewDateTime($streetDate), 'delivery_window_to_date' => $this->getStreetToDate($streetDate)]);
         }
     }
     return null;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:24,代码来源:Data.php

示例2: _afterSave

 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $priceTable = $this->getTable('catalog/product_option_price');
     $titleTable = $this->getTable('catalog/product_option_title');
     //better to check param 'price' and 'price_type' for saving. If there is not price scip saving price
     if ($object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD || $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA || $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FILE || $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE || $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE_TIME || $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_TIME) {
         //save for store_id = 0
         if (!$object->getData('scope', 'price')) {
             $statement = $this->_getReadAdapter()->select()->from($priceTable)->where('option_id = ' . $object->getId() . ' AND store_id = ?', 0);
             if ($this->_getReadAdapter()->fetchOne($statement)) {
                 if ($object->getStoreId() == '0') {
                     $this->_getWriteAdapter()->update($priceTable, array('price' => $object->getPrice(), 'price_type' => $object->getPriceType()), $this->_getWriteAdapter()->quoteInto('option_id = ' . $object->getId() . ' AND store_id = ?', 0));
                 }
             } else {
                 $this->_getWriteAdapter()->insert($priceTable, array('option_id' => $object->getId(), 'store_id' => 0, 'price' => $object->getPrice(), 'price_type' => $object->getPriceType()));
             }
         }
         $scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
         if ($object->getStoreId() != '0' && $scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE && !$object->getData('scope', 'price')) {
             $baseCurrency = Mage::app()->getBaseCurrencyCode();
             $storeIds = $object->getProduct()->getStoreIds();
             if (is_array($storeIds)) {
                 foreach ($storeIds as $storeId) {
                     if ($object->getPriceType() == 'fixed') {
                         $storeCurrency = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
                         $rate = Mage::getModel('directory/currency')->load($baseCurrency)->getRate($storeCurrency);
                         if (!$rate) {
                             $rate = 1;
                         }
                         $newPrice = $object->getPrice() * $rate;
                     } else {
                         $newPrice = $object->getPrice();
                     }
                     $statement = $this->_getReadAdapter()->select()->from($priceTable)->where('option_id = ' . $object->getId() . ' AND store_id = ?', $storeId);
                     if ($this->_getReadAdapter()->fetchOne($statement)) {
                         $this->_getWriteAdapter()->update($priceTable, array('price' => $newPrice, 'price_type' => $object->getPriceType()), $this->_getWriteAdapter()->quoteInto('option_id = ' . $object->getId() . ' AND store_id = ?', $storeId));
                     } else {
                         $this->_getWriteAdapter()->insert($priceTable, array('option_id' => $object->getId(), 'store_id' => $storeId, 'price' => $newPrice, 'price_type' => $object->getPriceType()));
                     }
                 }
                 // end foreach()
             }
         } elseif ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) {
             $this->_getWriteAdapter()->delete($priceTable, $this->_getWriteAdapter()->quoteInto('option_id = ' . $object->getId() . ' AND store_id = ?', $object->getStoreId()));
         }
     }
     //title
     if (!$object->getData('scope', 'title')) {
         $statement = $this->_getReadAdapter()->select()->from($titleTable)->where('option_id = ' . $object->getId() . ' and store_id = ?', 0);
         if ($this->_getReadAdapter()->fetchOne($statement)) {
             if ($object->getStoreId() == '0') {
                 $this->_getWriteAdapter()->update($titleTable, array('title' => $object->getTitle()), $this->_getWriteAdapter()->quoteInto('option_id=' . $object->getId() . ' AND store_id=?', 0));
             }
         } else {
             $this->_getWriteAdapter()->insert($titleTable, array('option_id' => $object->getId(), 'store_id' => 0, 'title' => $object->getTitle()));
         }
     }
     if ($object->getStoreId() != '0' && !$object->getData('scope', 'title')) {
         $statement = $this->_getReadAdapter()->select()->from($titleTable)->where('option_id = ' . $object->getId() . ' and store_id = ?', $object->getStoreId());
         if ($this->_getReadAdapter()->fetchOne($statement)) {
             $this->_getWriteAdapter()->update($titleTable, array('title' => $object->getTitle()), $this->_getWriteAdapter()->quoteInto('option_id=' . $object->getId() . ' AND store_id=?', $object->getStoreId()));
         } else {
             $this->_getWriteAdapter()->insert($titleTable, array('option_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'title' => $object->getTitle()));
         }
     } elseif ($object->getData('scope', 'title')) {
         $this->_getWriteAdapter()->delete($titleTable, $this->_getWriteAdapter()->quoteInto('option_id = ' . $object->getId() . ' AND store_id = ?', $object->getStoreId()));
     }
     return parent::_afterSave($object);
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:69,代码来源:Option.php

示例3: getAllParentProductFromItem

 /**
  * Get current and parent product from the quote item.
  *
  * @param  Mage_Core_Model_Abstract
  * @return Mage_Catalog_Model_Product[]
  */
 protected function getAllParentProductFromItem(Mage_Core_Model_Abstract $item)
 {
     /** @var Mage_Catalog_Model_Product */
     $currentProduct = $item->getProduct();
     /** @var Mage_Catalog_Model_Product[] */
     $products = [$currentProduct];
     /** @var Mage_Sales_Model_Quote_Item */
     $parentItem = $item->getParentItem();
     if ($parentItem) {
         /** @var Mage_Catalog_Model_Product */
         $parentProduct = $parentItem->getProduct();
         if ($currentProduct->getId() !== $parentProduct->getId()) {
             $products[] = $parentProduct;
         }
     }
     return $products;
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:23,代码来源:Data.php

示例4: getStockItem

 /**
  * Get a passed in item product stock item.
  *
  * @param  Mage_Core_Model_Abstract
  * @return Mage_CatalogInventory_Model_Stock_Item
  */
 protected function getStockItem(Mage_Core_Model_Abstract $item)
 {
     return $item->getProduct()->getStockItem();
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:10,代码来源:Allocation.php


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