本文整理汇总了PHP中Mage_Sales_Model_Quote::getItemsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getItemsCount方法的具体用法?PHP Mage_Sales_Model_Quote::getItemsCount怎么用?PHP Mage_Sales_Model_Quote::getItemsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getItemsCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeQuoteItems
private function initializeQuoteItems()
{
foreach ($this->proxyOrder->getItems() as $item) {
$this->clearQuoteItemsCache();
/** @var $quoteItemBuilder Ess_M2ePro_Model_Magento_Quote_Item */
$quoteItemBuilder = Mage::getModel('M2ePro/Magento_Quote_Item');
$quoteItemBuilder->init($this->quote, $item);
$product = $quoteItemBuilder->getProduct();
$request = $quoteItemBuilder->getRequest();
// ----------------------------
$productOriginalPrice = (double) $product->getPrice();
$price = $item->getBasePrice();
$product->setPrice($price);
$product->setSpecialPrice($price);
// ----------------------------
// see Mage_Sales_Model_Observer::substractQtyFromQuotes
$this->quote->setItemsCount($this->quote->getItemsCount() + 1);
$this->quote->setItemsQty((double) $this->quote->getItemsQty() + $request->getQty());
$result = $this->quote->addProduct($product, $request);
if (is_string($result)) {
throw new Exception($result);
}
$quoteItem = $this->quote->getItemByProduct($product);
if ($quoteItem !== false) {
$weight = $product->getTypeInstance()->getWeight();
if ($product->isConfigurable()) {
// hack: for child product weight was not load
$simpleProductId = $product->getCustomOption('simple_product')->getProductId();
$weight = Mage::getResourceModel('catalog/product')->getAttributeRawValue($simpleProductId, 'weight', 0);
}
$quoteItem->setStoreId($this->quote->getStoreId());
$quoteItem->setOriginalCustomPrice($item->getPrice());
$quoteItem->setOriginalPrice($productOriginalPrice);
$quoteItem->setBaseOriginalPrice($productOriginalPrice);
$quoteItem->setWeight($weight);
$quoteItem->setNoDiscount(1);
$giftMessageId = $quoteItemBuilder->getGiftMessageId();
if (!empty($giftMessageId)) {
$quoteItem->setGiftMessageId($giftMessageId);
}
$quoteItem->setAdditionalData($quoteItemBuilder->getAdditionalData($quoteItem));
}
}
}
示例2: initializeQuoteItems
/**
* Initialize quote items objects
*
* @throws Exception
*/
private function initializeQuoteItems()
{
foreach ($this->proxyOrder->getItems() as $item) {
$this->clearQuoteItemsCache();
/** @var $quoteItemBuilder Ess_M2ePro_Model_Magento_Quote_Item */
$quoteItemBuilder = Mage::getModel('M2ePro/Magento_Quote_Item');
$quoteItemBuilder->init($this->quote, $item);
$product = $quoteItemBuilder->getProduct();
$request = $quoteItemBuilder->getRequest();
// see Mage_Sales_Model_Observer::substractQtyFromQuotes
$this->quote->setItemsCount($this->quote->getItemsCount() + 1);
$this->quote->setItemsQty((double) $this->quote->getItemsQty() + $request->getQty());
$result = $this->quote->addProduct($product, $request);
if (is_string($result)) {
throw new Exception($result);
}
$quoteItem = $this->quote->getItemByProduct($product);
if ($quoteItem !== false) {
$quoteItem->setOriginalCustomPrice($item->getPrice());
$quoteItem->setNoDiscount(1);
$quoteItem->setGiftMessageId($quoteItemBuilder->getGiftMessageId());
$quoteItem->setAdditionalData($quoteItemBuilder->getAdditionalData($quoteItem));
}
}
}
示例3: isCCAndZeroAmountAuthAllowed
/**
* check if payment method is cc and zero amount authorization is enabled
*
* @param Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod
*
* @return bool
*/
public function isCCAndZeroAmountAuthAllowed(Netresearch_OPS_Model_Payment_Abstract $opsPaymentMethod, Mage_Sales_Model_Quote $quote)
{
$result = false;
$storeId = $quote->getStoreId();
if ($quote->getBaseGrandTotal() < 0.01 && $opsPaymentMethod instanceof Netresearch_OPS_Model_Payment_Cc && $opsPaymentMethod->isZeroAmountAuthorizationAllowed($storeId) && 0 < $quote->getItemsCount()) {
$result = true;
}
return $result;
}
示例4: initializeQuoteItems
/**
* Initialize quote items objects
*
* @throws Exception
*/
private function initializeQuoteItems()
{
foreach ($this->proxyOrder->getItems() as $item) {
/** @var $quoteItemBuilder Ess_M2ePro_Model_Magento_Quote_Item */
$quoteItemBuilder = Mage::getModel('M2ePro/Magento_Quote_Item');
$quoteItemBuilder->setQuoteBuilder($this)->setProxyItem($item);
$product = $quoteItemBuilder->getProduct();
$request = $quoteItemBuilder->getRequest();
$this->quote->setItemsCount($this->quote->getItemsCount() + 1);
$this->quote->setItemsQty((double) $this->quote->getItemsQty() + $request->getQty());
$result = $this->quote->addProduct($product, $request);
if (is_string($result)) {
throw new Exception($result);
}
$quoteItem = $this->quote->getItemByProduct($product);
if ($quoteItem !== false) {
$quoteItem->setOriginalCustomPrice($quoteItemBuilder->getChannelCurrencyPrice());
$quoteItem->setNoDiscount(1);
$quoteItem->setGiftMessageId($quoteItemBuilder->getGiftMessageId());
$quoteItem->setAdditionalData($quoteItemBuilder->getAdditionalData($quoteItem));
}
}
}
示例5: updateQuoteTotalQty
public function updateQuoteTotalQty(Mage_Sales_Model_Quote $quote)
{
$quote->setItemsCount(0);
$quote->setItemsQty(0);
$quote->setVirtualItemsQty(0);
foreach ($quote->getAllVisibleItems() as $item) {
if ($item->getParentItem()) {
continue;
}
$children = $item->getChildren();
if ($children && $item->isShipSeparately()) {
foreach ($children as $child) {
if ($child->getProduct()->getIsVirtual()) {
$quote->setVirtualItemsQty($quote->getVirtualItemsQty() + $child->getQty() * $item->getQty());
}
}
}
if ($item->getProduct()->getIsVirtual()) {
$quote->setVirtualItemsQty($quote->getVirtualItemsQty() + $item->getQty());
}
$quote->setItemsCount($quote->getItemsCount() + 1);
$quote->setItemsQty((double) $quote->getItemsQty() + $item->getQty());
}
}
示例6: _validateQuote
/**
* Determine if taxes can be collected for the quote.
*
* @param Mage_Sales_Model_Quote
* @return self
* @throws EbayEnterprise_Tax_Exception_Collector_InvalidQuote_Exception If the quote is not valid for making a tax request.
*/
protected function _validateQuote(Mage_Sales_Model_Quote $quote)
{
// At a minimum, the quote must have at least one item and a billing
// address with usable information. Currently, a spot check of address
// data *should* be useful enough to separate a complete address from
// an incomplete address.
$billingAddress = $quote->getBillingAddress();
if ($quote->getItemsCount() && $billingAddress->getFirstname() && $billingAddress->getLastname() && $billingAddress->getStreetFull() && $billingAddress->getCountryId()) {
return $this->_validateAddresses($quote->getAllAddresses());
}
throw Mage::exception('EbayEnterprise_Tax_Exception_Collector_InvalidQuote', 'Quote invalid for tax collection.');
}
示例7: canFetchDetails
/**
* Determine if there is enough data to send the request.
*
* @return bool
*/
protected function canFetchDetails(Mage_Sales_Model_Quote $quote)
{
return $quote->getItemsCount() && $this->hasUsableAddress($quote);
}