本文整理汇总了PHP中Mage_Sales_Model_Quote_Item类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item类的具体用法?PHP Mage_Sales_Model_Quote_Item怎么用?PHP Mage_Sales_Model_Quote_Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Quote_Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemEditOptionsHtml
/**
* @param Mage_Sales_Model_Quote_Item $item
* @return string
*/
public function getItemEditOptionsHtml(Mage_Sales_Model_Quote_Item $item)
{
$product = $item->getProduct();
$optionsBlock = $this->getLayout()->createBlock('emjainteractive_advancedoptions/catalog_product_view_options', 'product.info.options.' . $item->getId())->addOptionRenderer('file', 'emjainteractive_advancedoptions/catalog_product_view_options_type_text', 'emjainteractive/advancedoptions/catalog/product/view/options/type/text.phtml')->addOptionRenderer('select', 'emjainteractive_advancedoptions/catalog_product_view_options_type_select', 'emjainteractive/advancedoptions/catalog/product/view/options/type/select.phtml')->addOptionRenderer('date', 'emjainteractive_advancedoptions/catalog_product_view_options_type_date', 'emjainteractive/advancedoptions/catalog/product/view/options/type/date.phtml')->addOptionRenderer('text', 'emjainteractive_advancedoptions/catalog_product_view_options_type_text', 'emjainteractive/advancedoptions/catalog/product/view/options/type/text.phtml')->setTemplate('catalog/product/view/options.phtml')->setProduct($product)->setQuoteItem($item);
$jsBlock = $this->getLayout()->createBlock('core/template', 'options_js' . $item->getId())->setTemplate('catalog/product/view/options/js.phtml');
return $jsBlock->toHtml() . $optionsBlock->toHtml();
}
示例2: _removeErrorsFromQuoteAndItem
/**
* Removes error statuses from quote and item, set by this observer
*
* @param Mage_Sales_Model_Quote_Item $item
* @param int $code
* @return Mage_CatalogInventory_Model_Observer
*/
protected function _removeErrorsFromQuoteAndItem($item, $code)
{
//if(ITwebexperts_Payperrentals_Helper_Data::isReservationType($item->getProduct()) && ($item->getProduct()->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_CONFIGURABLE || $item->getProduct()->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_BUNDLE || $item->getProduct()->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_GROUPED)){
// return $this;
//}
if ($item->getHasError()) {
$params = array('origin' => 'cataloginventory', 'code' => $code);
$item->removeErrorInfosByParams($params);
}
$quote = $item->getQuote();
$quoteItems = $quote->getItemsCollection();
$canRemoveErrorFromQuote = true;
foreach ($quoteItems as $quoteItem) {
if ($quoteItem->getItemId() == $item->getItemId()) {
continue;
}
$errorInfos = $quoteItem->getErrorInfos();
foreach ($errorInfos as $errorInfo) {
if ($errorInfo['code'] == $code) {
$canRemoveErrorFromQuote = false;
break;
}
}
if (!$canRemoveErrorFromQuote) {
break;
}
}
if ($quote->getHasError() && $canRemoveErrorFromQuote) {
$params = array('origin' => 'cataloginventory', 'code' => $code);
$quote->removeErrorInfosByParams(null, $params);
}
return $this;
}
示例3: compare
/**
* Compare item
*
* @param Mage_Sales_Model_Quote_Item $item
* @return bool
*/
public function compare($item)
{
if ($item->getOptionByCode('chili_document_id')) {
return false;
}
return parent::compare($item);
}
示例4: _removeErrorsFromQuoteAndItem
/**
* Removes error statuses from quote and item, set by this observer
*
* @param Mage_Sales_Model_Quote_Item $item
* @param string $origin
* @param int $code
* @return Jarlssen_CustomCartValidation_Model_Observer
*/
protected function _removeErrorsFromQuoteAndItem($item, $origin, $code)
{
if ($item->getHasError()) {
$params = array('origin' => $origin, 'code' => $code);
$item->removeErrorInfosByParams($params);
}
$quote = $item->getQuote();
$quoteItems = $quote->getItemsCollection();
$canRemoveErrorFromQuote = true;
foreach ($quoteItems as $quoteItem) {
if ($quoteItem->getItemId() == $item->getItemId()) {
continue;
}
$errorInfos = $quoteItem->getErrorInfos();
foreach ($errorInfos as $errorInfo) {
if ($errorInfo['code'] == $code) {
$canRemoveErrorFromQuote = false;
break;
}
}
if (!$canRemoveErrorFromQuote) {
break;
}
}
if ($quote->getHasError() && $canRemoveErrorFromQuote) {
$params = array('origin' => $origin, 'code' => $code);
$quote->removeErrorInfosByParams(null, $params);
}
return $this;
}
示例5: getMsrpHtml
/**
* Get html for MAP product enabled
*
* @param Mage_Sales_Model_Quote_Item $item
* @return string
*/
public function getMsrpHtml($item)
{
$product = $item->getProduct();
$block = $this->_preparePriceBlock($product);
$html = $block->setPriceElementIdPrefix('bundle-price-')->toHtml();
$product->setRealPriceHtml($html);
return $this->_getPriceContent($product);
}
示例6: getMsrpHtml
/**
* Get html for MAP product enabled
*
* @param Mage_Sales_Model_Quote_Item $item
* @return string
*/
public function getMsrpHtml($item)
{
$product = $item->getProduct();
$block = $this->_preparePriceBlock($product);
$html = $block->setDisplayMinimalPrice(true)->toHtml();
$product->setRealPriceHtml($html);
return $this->_getPriceContent($product);
}
示例7: getEddMessage
/**
* Get an estimated delivery message for a quote item.
*
* @param Mage_Sales_Model_Quote_Item
* @return string
*/
public function getEddMessage(Mage_Sales_Model_Quote_Item $item)
{
/** @var string $singularOrPluralItem */
$singularOrPluralItem = (int) $item->getQty() > 1 ? 's' : '';
/** @var EbayEnterprise_Inventory_Model_Details_Item | Varien_Object | null $eddItem */
$eddItem = $this->detailService->getDetailsForItem($item) ?: $this->inventoryHelper->getStreetDateForBackorderableItem($item);
return $eddItem ? $this->inventoryHelper->__($this->inventoryConfig->estimatedDeliveryTemplate, $singularOrPluralItem, $eddItem->getDeliveryWindowFromDate()->format('m/d/y'), $eddItem->getDeliveryWindowToDate()->format('m/d/y')) : '';
}
示例8: setParentItem
/**
* Set parent item
*
* @param Mage_Sales_Model_Quote_Item $parentItem
* @return Mage_Sales_Model_Quote_Item
*/
public function setParentItem($parentItem)
{
if ($parentItem) {
$this->_parentItem = $parentItem;
$parentItem->addChild($this);
}
return $this;
}
示例9: setUp
protected function setUp()
{
$this->_block = new Mage_Checkout_Block_Cart_Item_Renderer();
$item = new Mage_Sales_Model_Quote_Item();
$product = new Mage_Catalog_Model_Product();
$product->load(1);
$item->setProduct($product);
$this->_block->setItem($item);
}
示例10: quoteItemHasCustomTagOptions
public function quoteItemHasCustomTagOptions(Mage_Sales_Model_Quote_Item $quoteItem)
{
return array_reduce($quoteItem->getOptions(), function ($acc, Mage_Sales_Model_Quote_Item_Option $option) {
if ($acc || !preg_match('/^option_/', $option->getCode())) {
return $acc;
}
return !!Mage::getResourceModel('catalog/product_option_value_collection')->addFieldToFilter('option_type_id', $option->getValue())->addFieldToFilter('is_custom_tag', '1')->setPageSize(1)->load()->getSize();
}, false);
}
示例11: validate
/**
* Implementation of the validation logic
*
* @param Mage_Sales_Model_Quote_Item $item
* @return bool
*/
public function validate($item)
{
$multipleNumber = $this->_helper->getMultipleQtyNumber();
$qty = $item->getQty();
//For example 100 % 10
if ($qty % $multipleNumber != 0) {
return false;
}
return true;
}
示例12: importQuoteItem
public function importQuoteItem(Mage_Sales_Model_Quote_Item $quoteItem)
{
$this->_quote = $quoteItem->getQuote();
$this->setQuoteItem($quoteItem)->setQuoteItemId($quoteItem->getId())->setProductId($quoteItem->getProductId())->setProduct($quoteItem->getProduct())->setSku($quoteItem->getSku())->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;
}
示例13: validateStock
/**
* Validate stock of a quoteItem
*
* @param Mage_Sales_Model_Quote_Item $item
* @param float $priceInclTax
* @param float $priceExclTax
* @return ShopgateCartItem $result
*/
public function validateStock(Mage_Sales_Model_Quote_Item $item, $priceInclTax, $priceExclTax)
{
switch ($item->getProduct()->getTypeId()) {
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
$model = Mage::getModel('shopgate/shopgate_cart_validation_stock_bundle');
break;
default:
$model = Mage::getModel('shopgate/shopgate_cart_validation_stock_simple');
}
return $model->validateStock($item, $priceInclTax, $priceExclTax);
}
示例14: 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();
}
示例15: 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;
}