本文整理汇总了PHP中Mage_Sales_Model_Quote_Item_Abstract::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item_Abstract::getId方法的具体用法?PHP Mage_Sales_Model_Quote_Item_Abstract::getId怎么用?PHP Mage_Sales_Model_Quote_Item_Abstract::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item_Abstract
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item_Abstract::getId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: itemToOrderItem
/**
* Convert quote item to order item. Most part of the code was taken from Mage_Sales_Model_Convert_Quote::itemToOrderItem()
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @param null|Mage_Sales_Model_Order_Item $orderItem
* @return Mage_Sales_Model_Order_Item
*/
public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item, $orderItem = null)
{
if (is_null($orderItem)) {
$orderItem = Mage::getModel('sales/order_item');
}
$orderItem->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setQuoteParentItemId($item->getParentItemId())->setProductId($item->getProductId())->setProductType($item->getProductType())->setQtyBackordered($item->getBackorders())->setProduct($item->getProduct())->setBaseOriginalPrice($item->getBaseOriginalPrice());
$options = $item->getProductOrderOptions();
if (!$options) {
$options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
}
$orderItem->setProductOptions($options);
Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
if ($item->getParentItem()) {
$orderItem->setQtyOrdered($orderItem->getQtyOrdered() * $item->getParentItem()->getQty());
}
if (!$item->getNoDiscount()) {
Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
}
Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
return $orderItem;
}
示例2: _injectItemData
/**
* Inject general item data into the order item payload.
*
* @return self
*/
protected function _injectItemData()
{
$this->_orderItem->setLineNumber($this->_item->getId())->setItemId($this->_item->getSku())->setQuantity((int) $this->_item->getQty())->setDescription($this->_item->getName())->setHtsCode($this->_taxHelper->getProductHtsCodeByCountry($this->_itemProduct, $this->_address->getCountryId()))->setManufacturingCountryCode($this->_itemProduct->getCountryOfManufacture());
return $this;
}
示例3: createLineItem
/**
* build out an ILineItem payload and add it to the ILineItemIterable.
*
* @param Mage_Sales_Model_Quote_Item_Abstract
* @param ILineItemIterable
* @param string
* @return self
*/
public function createLineItem(Mage_Sales_Model_Quote_Item_Abstract $item, ILineItemIterable $lineItems, $currencyCode)
{
$lineItem = $lineItems->getEmptyLineItem();
$lineItem->setName($this->helper->__($item->getProduct()->getName()))->setSequenceNumber($item->getId())->setQuantity($item->getTotalQty())->setCurrencyCode($currencyCode);
if ($this->canIncludeAmounts($item)) {
$lineItem->setUnitAmount($item->getPrice());
}
$lineItems->offsetSet($lineItem, null);
}
示例4: apply
public function apply(Mage_Sales_Model_Quote_Item_Abstract $item)
{
# Do not apply any discount if Ext is Disabled
if (Mage::helper('referafriend')->getExtDisabled()) {
return $this;
}
$this->_quote = $quote = $item->getQuote();
if ($item instanceof Mage_Sales_Model_Quote_Address_Item) {
$address = $item->getAddress();
} elseif ($quote->isVirtual()) {
$address = $quote->getBillingAddress();
} else {
$address = $quote->getShippingAddress();
}
# allow additional discount logic start
$hasAdditional = $item->getQuote()->getCouponCode() ? true : false;
$helper = Mage::helper('referafriend/referrer');
$baseSubtotal = $address->getBaseSubtotal();
$clearUse = array();
if (!$this->_discount) {
Mage::helper('referafriend')->setCustomerDiscount(0);
$customer = $quote->getCustomer();
$referrerId = $customer->getId();
$discounts = Mage::getResourceModel('referafriend/discount_collection')->loadByReferrer($referrerId);
if (count($discounts)) {
foreach ($discounts as $discount) {
$rule = Mage::getSingleton('referafriend/rule')->load($discount->getRuleId());
if ($rule->getDiscountUsage() == 0 || $rule->getDiscountUsage() > $discount->getDiscountUsed()) {
# allow additional discount logic
if ($hasAdditional && $rule->getAllowAdditionalDiscount() || !$hasAdditional) {
$this->_discount[$discount->getId()] = $discount;
} else {
$clearUse[] = $discount->getId();
}
}
}
}
}
if (!count($this->_discount)) {
# Reset used discount
$customer = Mage::getSingleton('customer/session');
if ($customer->isLoggedIn()) {
$customer->setDiscountUsed(array());
}
return $this;
}
$this->_getCouponCode();
// $this->_couponCode = $this->_getCouponCode();
$customer = Mage::getSingleton('customer/session');
if ($customer->isLoggedIn()) {
$discountUsed = (array) $customer->getDiscountUsed();
}
$rafDiscount = Mage::helper('referafriend')->getCustomerDiscount(false) ? Mage::helper('referafriend')->getCustomerDiscount(false) : 0;
$notUsed = array();
foreach ($this->_discount as $discountId => $discount) {
$discountAmount = 0;
$baseDiscountAmount = 0;
$rule = Mage::getModel('referafriend/rule')->load($discount->getRuleId());
switch ($discount->getType()) {
case self::TYPE_PERCENT:
$discountPercent = min(100, $discount->getAmount());
$discountAmount = ($item->getRowTotal() - $item->getDiscountAmount()) * $discountPercent / 100;
$baseDiscountAmount = ($item->getBaseRowTotal() - $item->getBaseDiscountAmount()) * $discountPercent / 100;
$checkDiscountAmount = $baseSubtotal * $discountPercent / 100;
if (!($rule->getDiscountGreater() && $checkDiscountAmount < $rule->getDiscountGreater()) && !($rule->getTotalGreater() && $baseSubtotal < $rule->getTotalGreater())) {
if (isset($discountUsed)) {
if (!isset($discountUsed[$discountId])) {
$discountUsed[$discountId] = false;
}
}
$rafDiscount += $baseDiscountAmount;
$discountAmount = min($discountAmount + $item->getDiscountAmount(), $item->getRowTotal());
$baseDiscountAmount = min($baseDiscountAmount + $item->getBaseDiscountAmount(), $item->getBaseRowTotal());
//$discountPercent = min(100, $item->getDiscountPercent()+$percentDiscount);
$item->setDiscountPercent(min(100, $item->getDiscountPercent() + $discountPercent));
$discountAmount = $quote->getStore()->roundPrice($discountAmount);
$baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
$item->setDiscountAmount($discountAmount);
$item->setBaseDiscountAmount($baseDiscountAmount);
} else {
$notUsed[] = $discountId;
if (isset($discountUsed[$discountId])) {
unset($discountUsed[$discountId]);
}
}
break;
case self::TYPE_FLATRATE:
$discountAmount = min($item->getRowTotal() - $item->getDiscountAmount(), $quote->getStore()->convertPrice($discount->getAmount()));
$baseDiscountAmount = min($item->getBaseRowTotal() - $item->getBaseDiscountAmount(), $discount->getAmount());
$checkDiscountAmount = $discount->getAmount();
if (!($rule->getDiscountGreater() && $checkDiscountAmount < $rule->getDiscountGreater()) && !($rule->getTotalGreater() && $baseSubtotal < $rule->getTotalGreater())) {
if (isset($discountUsed)) {
if (!isset($discountUsed[$discountId])) {
$discountUsed[$discountId] = false;
}
}
$rafDiscount += $baseDiscountAmount;
$this->_discount[$discountId]->setAmount($discount->getAmount() - $baseDiscountAmount);
/*$discountAmount = $quote->getStore()->roundPrice($discountAmount);
$baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);*/
//.........这里部分代码省略.........
示例5: fillOutShippingItem
public function fillOutShippingItem(IOrderItem $itemPayload, Mage_Sales_Model_Quote_Item_Abstract $item, Mage_Customer_Model_Address_Abstract $address)
{
$shippingMethod = $this->shippingHelper->getUsableMethod($address);
$itemPayload->setItemId($item->getSku())->setLineId($item->getAddressItemId() ?: $item->getId())->setQuantity($this->quantityHelper->getRequestedItemQuantity($item))->setGiftWrapRequested($this->isItemGiftWrapped($item))->setAddressLines($address->getStreet(static::ADDRESS_ALL_STREET_LINES))->setAddressCity($address->getCity())->setAddressCountryCode($address->getCountryId())->setShippingMethod($this->shippingHelper->getMethodSdkId($shippingMethod))->setAddressMainDivision($address->getRegionCode())->setAddressPostalCode($address->getPostcode())->setShippingMethodDisplayText($this->shippingHelper->getMethodTitle($shippingMethod));
}
示例6: itemToQuantityItem
/**
* Transfer data from a quote item to a quantity
* request item payload.
*
* @param Mage_Sales_Model_Quote_Item_Abstract
* @param IQuantityItem
* @return IQuantityItem
*/
public function itemToQuantityItem(Mage_Sales_Model_Quote_Item_Abstract $item, IQuantityItem $itemPayload)
{
return $itemPayload->setItemId($this->inventoryHelper->getRomSku($item->getSku()))->setLineId($item->getId());
}
示例7: getQuoteItemId
/**
* Get quote item id from a passed in sales/quote_item instance. Ensure
* that if the passed in quote item has child product that it's the child quote
* item id that get returned.
*
* @param Mage_Sales_Model_Quote_Item_Abstract
* @return int
*/
protected function getQuoteItemId(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$children = $item->getChildren() ?: [];
foreach ($children as $childItem) {
return $childItem->getId();
}
return $item->getId();
}
示例8: itemToOrderItem
/**
* Convert quote item to order item
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @return Mage_Sales_Model_Order_Item
*/
public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$orderItem = Mage::getModel('sales/order_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setSuperProductId($item->getSuperProductId())->setParentProductId($item->getParentProductId())->setSku($item->getSku())->setName($item->getName())->setDescription($item->getDescription())->setWeight($item->getWeight())->setIsQtyDecimal($item->getIsQtyDecimal())->setQtyOrdered($item->getQty())->setOriginalPrice($item->getOriginalPrice())->setAppliedRuleIds($item->getAppliedRuleIds())->setAdditionalData($item->getAdditionalData())->setPrice($item->getCalculationPrice())->setTaxPercent($item->getTaxPercent())->setTaxAmount($item->getTaxAmount())->setRowWeight($item->getRowWeight())->setRowTotal($item->getRowTotal())->setBasePrice($item->getBaseCalculationPrice())->setBaseOriginalPrice($item->getPrice())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotal($item->getBaseRowTotal());
if (!$item->getNoDiscount()) {
$orderItem->setDiscountPercent($item->getDiscountPercent())->setDiscountAmount($item->getDiscountAmount())->setBaseDiscountAmount($item->getBaseDiscountAmount());
}
Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
return $orderItem;
}
示例9: itemToOrderItem
/**
* Convert quote item to order item
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @return Mage_Sales_Model_Order_Item
*/
public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$orderItem = AO::getModel('sales/order_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setQuoteParentItemId($item->getParentItemId())->setProductId($item->getProductId())->setProductType($item->getProductType())->setProductOptions($item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()))->setQtyBackordered($item->getBackorders());
AO::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
if ($item->getParentItem()) {
$orderItem->setQtyOrdered($orderItem->getQtyOrdered() * $item->getParentItem()->getQty());
}
// ->setSku($item->getSku())
// ->setName($item->getName())
// ->setDescription($item->getDescription())
// ->setWeight($item->getWeight())
// ->setIsQtyDecimal($item->getIsQtyDecimal())
// ->setQtyOrdered($item->getQty())
// ->setOriginalPrice($item->getOriginalPrice())
// ->setAppliedRuleIds($item->getAppliedRuleIds())
// ->setAdditionalData($item->getAdditionalData())
//
// ->setPrice($item->getCalculationPrice())
// ->setTaxPercent($item->getTaxPercent())
// ->setTaxAmount($item->getTaxAmount())
// ->setRowWeight($item->getRowWeight())
// ->setRowTotal($item->getRowTotal())
//
// ->setBasePrice($item->getBaseCalculationPrice())
// ->setBaseOriginalPrice($item->getPrice())
// ->setBaseTaxAmount($item->getBaseTaxAmount())
// ->setBaseRowTotal($item->getBaseRowTotal());
if (!$item->getNoDiscount()) {
AO::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
// $orderItem->setDiscountPercent($item->getDiscountPercent())
// ->setDiscountAmount($item->getDiscountAmount())
// ->setBaseDiscountAmount($item->getBaseDiscountAmount());
}
AO::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
return $orderItem;
}
示例10: __construct
/**
* @param array $args Must contain key/value for:
* - order_item => eBayEnterprise\RetailOrderManagement\Payload\TaxDutyFee\ITaxedOrderItem
* - item => Mage_Sales_Model_Quote_Item_Abstract
* - address_id => int
* - quote_id => int
* May contain key/value for:
* - tax_factory => EbayEnterprise_Tax_Helper_Factory
*/
public function __construct(array $args)
{
list($this->_orderItem, $this->_item, $this->_addressId, $this->_quoteId, $this->_taxFactory) = $this->_checkTypes($args['order_item'], $args['item'], $args['address_id'], $args['quote_id'], $this->_nullCoalesce($args, 'tax_factory', Mage::helper('ebayenterprise_tax/factory')));
$this->_itemId = $this->_item->getId();
}