本文整理汇总了PHP中Mage_Sales_Model_Order_Item::getProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Item::getProduct方法的具体用法?PHP Mage_Sales_Model_Order_Item::getProduct怎么用?PHP Mage_Sales_Model_Order_Item::getProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Item::getProduct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isItemAvailableForReorder
/**
* Check item product availability for reorder
*
* @param Mage_Sales_Model_Order_Item $orderItem
* @return boolean
*/
public function isItemAvailableForReorder(Mage_Sales_Model_Order_Item $orderItem)
{
if ($orderItem->getProduct()) {
return $orderItem->getProduct()->getStockItem()->getIsInStock();
}
return false;
}
示例2: __construct
/**
* @param array $args Must contain key/values for:
* - item => Mage_Sales_Model_Order_Item
* - tax_records => EbayEnterprise_Tax_Model_Record[]
* - order_item_payload => eBayEnterprise\RetailOrderManagement\Payload\Order\IOrderItem
* May contain key/values for:
* - logger => EbayEnterprise_MageLog_Helper_Data
* - log_context => EbayEnterprise_MageLog_Helper_Context
* - payload_helper => EbayEnterprise_Tax_Helper_Payload
* - tax_config => EbayEnterprise_Eb2cCore_Model_Config_Registry
* - fees => EbayEnterprise_Tax_Model_Fee[]
* - duty => EbayEnterprise_Tax_Model_Duty
*/
public function __construct(array $args = [])
{
list($this->_item, $this->_taxRecords, $this->_orderItemPayload, $this->_logger, $this->_logContext, $this->_payloadHelper, $this->_taxConfig, $this->_fees, $this->_duty) = $this->_checkTypes($args['item'], $args['tax_records'], $args['order_item_payload'], $this->_nullCoalesce($args, 'logger', Mage::helper('ebayenterprise_magelog')), $this->_nullCoalesce($args, 'log_context', Mage::helper('ebayenterprise_magelog/context')), $this->_nullCoalesce($args, 'payload_helper', Mage::helper('ebayenterprise_tax/payload')), $this->_nullCoalesce($args, 'tax_config', Mage::helper('ebayenterprise_tax')->getConfigModel()), $this->_nullCoalesce($args, 'fees', []), $this->_nullCoalesce($args, 'duty', null));
$this->_indexTaxRecords();
// The order item *should* already have the associated product entity
// loaded but if it doesn't, load the product using the product id of the item.
$this->_itemProduct = $this->_item->getProduct() ?: Mage::getModel('catalog/product')->load($this->_item->getProductId());
}
示例3: init
/**
* Initialize block with order item
*
* @param Mage_Sales_Model_Order_Item $item
* @return SSE_EditCustomOptions_Block_Options
*/
public function init(Mage_Sales_Model_Order_Item $item)
{
$this->_item = $item;
$_product = $this->_item->getProduct();
Mage::helper('catalog/product')->prepareProductOptions($_product, $this->_getBuyRequest());
$this->addOptionRenderer('text', 'catalog/product_view_options_type_text', 'catalog/product/view/options/type/text.phtml')->addOptionRenderer('file', 'catalog/product_view_options_type_file', 'catalog/product/view/options/type/file.phtml')->addOptionRenderer('select', 'catalog/product_view_options_type_select', 'catalog/product/view/options/type/select.phtml')->addOptionRenderer('date', 'catalog/product_view_options_type_date', 'catalog/product/view/options/type/date.phtml')->setTemplate('catalog/product/view/options.phtml')->setProduct($_product);
return $this;
}
示例4: _getAllDiscounts
/**
* Get all applied discounts for particular order item
*
* @param Mage_Sales_Model_Order_Item $item
* @return array
*/
protected function _getAllDiscounts(Mage_Sales_Model_Order_Item $item)
{
$discounts = array();
$order = $item->getOrder();
/* @var $catalogRule Mage_CatalogRule_Model_Rule */
$catalogRule = Mage::getModel('catalogrule/rule');
$catalogRule->setWebsiteIds(Mage::app()->getStore()->getWebsiteId());
$catalogRule->setProductsFilter($item->getProductId());
$matchingProductIds = $catalogRule->getMatchingProductIds();
if (in_array($item->getProductId(), $matchingProductIds)) {
// @todo what if there's several catalog rules matching product? Work out this situation
$catalogRule->load($catalogRule->getConditions()->getId());
$product = $item->getProduct();
$rulePrice = $catalogRule->calcProductPriceRule($product, $product->getPrice());
$discountAmount = $product->getPrice() - $rulePrice;
$discounts[] = $this->_createPromotionalDiscount($catalogRule->getName(), $catalogRule->getDescription(), self::DISCOUNT_PRODUCT, $discountAmount);
}
if ($item->getDiscountAmount()) {
$discounts[] = $this->_createPromotionalDiscount($this->_order->getCouponCode(), $this->_order->getDiscountDescription(), self::DISCOUNT_SALE, $item->getDiscountAmount());
}
return $discounts;
}
示例5: _getOrderItemUrl
/**
* @param Mage_Sales_Model_Order_Item $item
*
* @return string
*/
protected function _getOrderItemUrl(Mage_Sales_Model_Order_Item $item)
{
if ($item->getRedirectUrl()) {
return $item->getRedirectUrl();
}
if ($item->getProduct()) {
return $this->_getProductUrl($item->getProduct());
}
$product = Mage::helper('bronto_common/product')->getProduct($item->getProductId(), $this->getStoreId());
if ($product->getId()) {
return $this->_getProductUrl($product);
}
return '';
}
示例6: getItemProduct
/**
* Get the product the item represents.
*
* @param Mage_Sales_Model_Order_Item
* @return Mage_Catalog_Model_Product
*/
protected function getItemProduct(Mage_Sales_Model_Order_Item $item)
{
// When dealing with configurable items, need to get tax data from
// the child product and not the parent.
if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
$sku = $item->getSku();
$children = $item->getChildrenItems();
if ($children) {
/** @var Mage_Sales_Model_Order_Item $childItem */
foreach ($children as $childItem) {
$childProduct = $childItem->getProduct();
// If the SKU of the child product matches the SKU of the
// item, the simple product being ordered was found and should
// be used.
if ($childProduct->getSku() === $sku) {
return $childProduct;
}
}
}
}
return $item->getProduct() ?: Mage::getModel('catalog/product')->load($item->getProductId());
}
示例7: _getOrderItemUrl
/**
* @param Mage_Sales_Model_Order_Item $item
*
* @return string
*/
protected function _getOrderItemUrl(Mage_Sales_Model_Order_Item $item)
{
if ($item->getRedirectUrl()) {
return $item->getRedirectUrl();
}
if ($item->getProduct()) {
return $item->getProduct()->getProductUrl();
}
$product = Mage::getModel('catalog/product')->setStoreId($this->getStoreId())->load($item->getProductId());
if ($product->getId()) {
return $product->getProductUrl();
}
return '';
}