本文整理汇总了PHP中Mage_Sales_Model_Quote_Item::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item::getId方法的具体用法?PHP Mage_Sales_Model_Quote_Item::getId怎么用?PHP Mage_Sales_Model_Quote_Item::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildUpdateResponse
protected function _buildUpdateResponse($controllerAction)
{
$result = $this->_buildCommonResponse($controllerAction, '%s was updated in your shopping cart.', 'Cannot update the item.');
if ($this->_lastUpdatedItem !== null) {
$result['product_addtocart_form_action'] = Mage::getUrl('checkout/cart/updateItemOptions', array('id' => $this->_lastUpdatedItem->getId()));
}
return $result;
}
示例2: importQuoteItem
public function importQuoteItem(Mage_Sales_Model_Quote_Item $quoteItem)
{
$this->setQuoteItemId($quoteItem->getId())->setProductId($quoteItem->getProductId())->setProduct($quoteItem->getProduct())->setSuperProductId($quoteItem->getSuperProductId())->setSuperProduct($quoteItem->getSuperProduct())->setSku($quoteItem->getSku())->setImage($quoteItem->getImage())->setName($quoteItem->getName())->setDescription($quoteItem->getDescription())->setWeight($quoteItem->getWeight())->setPrice($quoteItem->getPrice())->setCost($quoteItem->getCost());
if (!$this->hasQty()) {
$this->setQty($quoteItem->getQty());
}
$this->setQuoteItemImported(true);
return $this;
}
示例3: setItem
/**
* Get gifregistry params by quote item
*
* @param Mage_Sales_Model_Quote_Item $newItem
* @return Enterprise_GiftRegistry_Block_Cart_Product_Mark
*/
public function setItem($newItem)
{
if ($this->hasItem() && $this->getItem()->getId() == $newItem->getId()) {
return $this;
}
if ($newItem->getGiftregistryItemId()) {
$this->setData('item', $newItem);
$entity = Mage::getModel('enterprise_giftregistry/entity')->loadByEntityItem($newItem->getGiftregistryItemId());
$this->setEntity($entity);
}
return $this;
}
示例4: getConfigureButtonHtml
/**
* Get button to configure product
*
* @param Mage_Sales_Model_Quote_Item $item
* @return mixed
*/
public function getConfigureButtonHtml($item)
{
$product = $item->getProduct();
$options = array('label' => Mage::helper('sales')->__('Configure'));
if ($product->canConfigure()) {
$options['onclick'] = sprintf('orderEditItems.showQuoteItemConfiguration(%s)', $item->getId());
} else {
$options['class'] = ' disabled';
$options['title'] = Mage::helper('sales')->__('This product does not have any configurable options');
}
return $this->getLayout()->createBlock('adminhtml/widget_button')->setData($options)->toHtml();
}
示例5: setQuoteItem
public function setQuoteItem(Mage_Sales_Model_Quote_Item $item)
{
$this->setQuoteItemId($item->getId());
$this->setQuoteId($item->getQuoteId());
$this->setProductId($item->getProductId());
$this->setStoreId($item->getStoreId());
$this->setQty($item->getQty());
$this->setIsActive(true);
$expireDateTime = Mage::helper('zab_timedcart')->getExpireDatetime(now());
$this->setExpireDatetime($expireDateTime);
return $this;
}
示例6: _addItemToQtyArray
/**
* Overwrite @method _addItemToQtyArray
*
* Adds stock item qty to $items (creates new entry or increments existing one)
* $items is array with following structure:
* array(
* $productId => array(
* 'qty' => $qty,
* 'item' => $stockItems|null
* )
* )
*
* @param Mage_Sales_Model_Quote_Item $quoteItem
* @param array &$items
*/
protected function _addItemToQtyArray($quoteItem, &$items)
{
$productId = $quoteItem->getProductId();
if (!$productId) {
return;
}
if (isset($items[$productId])) {
$items[$productId]['qty'] += $quoteItem->getTotalQty();
} else {
$stockItem = null;
if ($quoteItem->getProduct()) {
$stockItem = $quoteItem->getProduct()->getStockItem();
}
$items[$productId] = array('item' => $stockItem, 'qty' => $quoteItem->getTotalQty(), 'quote_item_id' => $quoteItem->getId(), 'creditmemo_item_id' => null);
}
}
示例7: handleUnavailableItem
/**
* Deal with the unavailable item. Mark the item as either out of stock
* or unavailable in the requested quantity. If the item has not already
* been added to cart, prevent it from being added.
*
* @param Mage_Sales_Model_Quote_Item
* @param int
* @return self
* @throws EbayEnterprise_Inventory_Exception_Quantity_Unavailable If item should not be added to the quote
*/
public function handleUnavailableItem(Mage_Sales_Model_Quote_Item $item, $quantityAvailable)
{
// Unavailable handler assumes that if an item is unavailable, it is
// a manage stock and non-backorderable item (non-manage stock and
// backorderable items will never be unavailable).
$itemIsOutOfStock = $quantityAvailable === 0;
// Items not already in the cart should not be added if unavailable.
// Items without an id have not yet been saved and can not have been
// added to the quote previously. Any item with an id, would have been
// saved when initially added to the cart previously.
if (!$item->getId()) {
$message = $itemIsOutOfStock ? EbayEnterprise_Inventory_Model_Quantity_Service::OUT_OF_STOCK_EXCEPTION_MESSAGE : EbayEnterprise_Inventory_Model_Quantity_Service::INSUFFICIENT_STOCK_EXCEPTION_MESSAGE;
throw Mage::exception('EbayEnterprise_Inventory_Exception_Quantity_Unavailable', $this->inventoryHelper->__($message, $item->getName(), $quantityAvailable));
}
return $itemIsOutOfStock ? $this->_addOutOutOfStockErrorInfo($item) : $this->_addInsufficientStockErrorInfoForItem($item, $quantityAvailable);
}
示例8: addItem
/**
* Adding new item to quote
*
* @param Mage_Sales_Model_Quote_Item $item
* @return Mage_Sales_Model_Quote
*/
function addItem(Mage_Sales_Model_Quote_Item $item)
{
// elite paint
if (isset($_POST['paint'])) {
if ('other' != $_POST['paint']) {
$item->setElitePaint($_POST['paint']);
} else {
$item->setElitePaintOther($_POST['vafPaintCustom']);
}
}
// elite paint
$item->setQuote($this);
if (!$item->getId()) {
$this->getItemsCollection()->addItem($item);
Mage::dispatchEvent('sales_quote_add_item', array('quote_item' => $item));
}
return $this;
}
示例9: updateAction
/**
* IFrame handler for submitted configuration for quote item
*
* @return Mage_Adminhtml_Customer_Cart_Product_Composite_CartController
*/
public function updateAction()
{
$updateResult = new Varien_Object();
try {
$this->_initData();
$buyRequest = new Varien_Object($this->getRequest()->getParams());
$this->_quote->updateItem($this->_quoteItem->getId(), $buyRequest);
$this->_quote->collectTotals()->save();
$updateResult->setOk(true);
} catch (Exception $e) {
$updateResult->setError(true);
$updateResult->setMessage($e->getMessage());
}
$updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname'));
Mage::getSingleton('Mage_Adminhtml_Model_Session')->setCompositeProductResult($updateResult);
$this->_redirect('*/catalog_product/showUpdateResult');
return $this;
}
示例10: _newLine
/**
* Makes a Line object from a product item object
*
* @param Varien_Object|Mage_Sales_Model_Quote_Item $item
* @return int|bool
*/
protected function _newLine($item)
{
if (!$item->getId()) {
$this->setCanSendRequest(false);
return $this;
}
$this->_addGwItemsAmount($item);
if ($this->isProductCalculated($item)) {
return false;
}
$product = $this->_getProductByProductId($this->_retrieveProductIdFromQuoteItem($item));
$taxClass = $this->_getTaxClassCodeByProduct($product);
$price = $item->getBaseRowTotal();
if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId())) {
$price = $item->getBaseRowTotal() - $item->getBaseDiscountAmount();
}
$lineNumber = count($this->_lines);
$line = new Line();
$line->setNo($lineNumber);
$line->setItemCode($this->_getCalculationHelper()->getItemCode($this->_getProductForItemCode($item), $item->getStoreId()));
$line->setDescription($item->getName());
$line->setQty($item->getTotalQty());
$line->setAmount($price);
$line->setDiscounted((double) $item->getDiscountAmount() && $this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId()));
if ($this->_getTaxDataHelper()->priceIncludesTax($item->getStoreId())) {
$line->setTaxIncluded(true);
}
if ($taxClass) {
$line->setTaxCode($taxClass);
}
$ref1Value = $this->_getRefValueByProductAndNumber($product, 1, $item->getStoreId());
if ($ref1Value) {
$line->setRef1($ref1Value);
}
$ref2Value = $this->_getRefValueByProductAndNumber($product, 2, $item->getStoreId());
if ($ref2Value) {
$line->setRef2($ref2Value);
}
$this->_lines[$lineNumber] = $line;
$this->_lineToLineId[$lineNumber] = $item->getId();
return $lineNumber;
}
示例11: _getMerchantPrivateItemDataXml
/**
* Convert quote item to private item XML
*
* @param Mage_Sales_Model_Quote_Item $item
* @return string
*/
protected function _getMerchantPrivateItemDataXml($item)
{
$xml = <<<EOT
<merchant-private-item-data>
<quote-item-id>{$item->getId()}</quote-item-id>
</merchant-private-item-data>
EOT;
return $xml;
}
示例12: deleteByQuoteItemAndDates
public function deleteByQuoteItemAndDates(Mage_Sales_Model_Quote_Item $QuoteItem, $start_date, $end_date)
{
$condition = "quote_item_id=" . intval($QuoteItem->getId()) . ' AND start_date="' . ITwebexperts_Payperrentals_Helper_Date::toDbDate($start_date) . '" AND end_date="' . ITwebexperts_Payperrentals_Helper_Date::toDbDate($end_date) . '"';
$this->_getWriteAdapter()->delete($this->getMainTable(), $condition);
return $this;
}
示例13: getConfigureButtonHtml
/**
* Generate configure button html
*
* @param Mage_Sales_Model_Quote_Item $item
* @return string
*/
public function getConfigureButtonHtml($item)
{
$product = $item->getProduct();
if ($product->canConfigure()) {
$class = '';
$addAttributes = sprintf('onclick="checkoutObj.showQuoteItemConfiguration(%s)"', $item->getId());
} else {
$class = 'disabled';
$addAttributes = 'disabled="disabled"';
}
return sprintf('<button type="button" class="scalable %s" %s><span><span><span>%s</span></span></span></button>', $class, $addAttributes, Mage::helper('sales')->__('Configure'));
}
示例14: _addGwItemsAmount
/**
* Adds giftwrapitems cost to request as item
*
* @param Mage_Sales_Model_Quote_Item $item
* @return int|bool
*/
protected function _addGwItemsAmount($item)
{
if (!$item->getGwId()) {
return false;
}
$lineNumber = $this->_getNewLineCode();
$storeId = $item->getQuote()->getStoreId();
//Add gift wrapping price(for individual items)
$gwItemsAmount = $item->getGwBasePrice() * $item->getQty();
$line = $this->_getNewDocumentRequestLineObject();
$line->setLineCode($lineNumber);
$gwItemsSku = $this->_getConfigHelper()->getGwItemsSku($storeId);
$line->setItemCode($gwItemsSku ? $gwItemsSku : self::DEFAULT_GW_ITEMS_SKU);
$line->setItemDescription(self::DEFAULT_GW_ITEMS_DESCRIPTION);
$line->setAvalaraGoodsAndServicesType($this->_getGiftTaxClassCode($storeId));
$line->setNumberOfItems($item->getQty());
$line->setlineAmount($gwItemsAmount);
$line->setDiscounted('false');
if ($this->_getTaxDataHelper()->priceIncludesTax($storeId)) {
$line->setTaxIncluded('true');
}
$this->_lines[$lineNumber] = $line;
$this->_setLinesToRequest();
$this->_lineToLineId[$lineNumber] = $this->_getConfigHelper()->getGwItemsSku($storeId);
$this->_productGiftPair[$lineNumber] = $item->getId();
return $lineNumber;
}
示例15: addActiveItemParentProduct
/**
* Add active parent product from item.
*
* @param Mage_Sales_Model_Quote_Item $item
* @return $this
*/
public function addActiveItemParentProduct($item)
{
if ($item && $item->getId() && $item->getParentItemId()) {
if ($item->getParentItem()->getProduct()->getTypeId() == 'configurable') {
// for price calculations to become accurate we need to reload the product,
// otherwise things like tier pricing won't be loaded on it and the calculations
// will ne dup being incorrect.
$this->_activeItemParentProducts[$item->getProduct()->getId()] = Mage::getModel('catalog/product')->load($item->getParentItem()->getProductId());
}
}
return $this;
}