当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Object::getQty方法代码示例

本文整理汇总了PHP中Varien_Object::getQty方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getQty方法的具体用法?PHP Varien_Object::getQty怎么用?PHP Varien_Object::getQty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Object的用法示例。


在下文中一共展示了Varien_Object::getQty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: inventoryPush

 /**
  * Update stock data of multiple products at once
  *
  * @param array $itemData
  * @return array
  */
 public function inventoryPush($itemData)
 {
     if (isset($itemData['records'])) {
         $itemData = $itemData['records'];
     }
     $response = array();
     $response['records'] = array();
     $orderItemsCollection = Mage::getResourceModel('retailops_api/api')->getRetailopsReadyOrderItems();
     $orderItems = $this->filterOrderItems($orderItemsCollection);
     $productIds = $this->getProductIds($itemData);
     foreach ($itemData as $item) {
         try {
             $itemObj = new Varien_Object($item);
             Mage::dispatchEvent('retailops_inventory_push_record', array('record' => $itemObj));
             $result = array();
             $result['sku'] = $itemObj->getSku();
             $itemObj->setQty($itemObj->getQuantity());
             // api update accepts qty not quantity parameter
             $qty = $itemObj->getQty();
             if (isset($orderItems[$itemObj->getSku()])) {
                 $qty = $itemObj->getQty() - $orderItems[$itemObj->getSku()];
             }
             $itemObj->setQty($qty);
             Mage::dispatchEvent('retailops_inventory_push_record_qty_processed', array('record' => $itemObj));
             $this->update($productIds[$itemObj->getSku()], $itemObj->getData());
             $result['status'] = RetailOps_Api_Helper_Data::API_STATUS_SUCCESS;
         } catch (Mage_Core_Exception $e) {
             $result['status'] = RetailOps_Api_Helper_Data::API_STATUS_FAIL;
             $result['error'] = array('code' => $e->getCode(), 'message' => $e->getMessage());
         }
         $response['records'][] = $result;
     }
     return $response;
 }
开发者ID:ksawh,项目名称:retailops_magento,代码行数:40,代码来源:Api.php

示例2: _getValue

 public function _getValue(Varien_Object $row)
 {
     if ($row->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
         $value = '<span id="qty_label_' . $row->getId() . '" data-id="' . $row->getId() . '">' . (int) $row->getQty() . '</span>';
         $value .= '<input type="text" id="qty_value_' . $row->getId() . '" name="qty_value[' . $row->getId() . ']" data-id="' . $row->getId() . '" value="' . (int) $row->getQty() . '" style="width: 100px;margin-right: 2px;display:none">';
         $value .= '<button id="qty_button_' . $row->getId() . '" data-id="' . $row->getId() . '" onclick="vcUpdateInfor(' . $row->getId() . ',\'qty\')" style="display:none"><span><span>Update</span></span></button>';
         $value .= '<img id="qty_waiting_' . $row->getId() . '" src="' . $this->getSkinUrl('vc_easyupdateproductinfor/images/ajax-loader.gif') . '" class="v-middle" style="display:none" />';
     } else {
         $value = number_format($row->getQty(), 0);
     }
     return $value;
 }
开发者ID:hoadaithieu,项目名称:mage-easyupdatedproductinfor,代码行数:12,代码来源:Qty.php

示例3: getBuyRequest

 /**
  * Added for Magento <= 1.4 compatibility
  * @return Varien_Object
  */
 public function getBuyRequest()
 {
     $option = $this->getOptionByCode('info_buyRequest');
     $buyRequest = new Varien_Object($option ? unserialize($option->getValue()) : null);
     // Overwrite standard buy request qty, because item qty could have changed since adding to quote
     $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($this->getQty() * 1);
     return $buyRequest;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:12,代码来源:Item.php

示例4: prepareForCartAdvanced

 public function prepareForCartAdvanced(Varien_Object $buyRequest, $product = null, $processMode = null)
 {
     if ($product) {
         $qty = $buyRequest->getQty();
         $product->getFinalPrice($qty, $product);
     }
     return parent::prepareForCartAdvanced($buyRequest, $product, $processMode);
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:8,代码来源:Product.php

示例5: render

 public function render(Varien_Object $row)
 {
     $manage_stock = Mage::getStoreConfig("cataloginventory/item_options/manage_stock");
     if (!in_array($row->getTypeId(), array('simple', 'virtual', 'downloadable'))) {
         return Mage::helper('advancedinventory')->__("-");
     }
     if ($row->getManageStock() || $row->getUse_config_manage_stock() && $manage_stock) {
         if ($row->getMultistock_enabled()) {
             $html = (int) $row->getQty();
         } else {
             $html = "<input class = 'keydown inventory_input' type = 'text' value = '" . (int) $row->getQty() . "' />";
         }
         $enabled = $row->getMultistock_enabled() ? 'enabled' : 'disabled';
         return "<span class = 'GlobalQty' id = 'GlobalQty_" . $row->getId() . "' multistock = '" . $enabled . "'>" . $html . "</span>";
     } else {
         return Mage::helper('advancedinventory')->__("X");
     }
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:18,代码来源:GlobalQty.php

示例6: render

 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $_row)
 {
     if (ITwebexperts_Payperrentals_Helper_Data::isReservationType($_row->getId())) {
         $data = intval(ITwebexperts_Payperrentals_Helper_Data::getAttributeCodeForId($_row->getId(), 'payperrentals_quantity'));
     } else {
         $data = intval($_row->getQty());
     }
     return $data;
 }
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:15,代码来源:Qty.php

示例7: validate

 /**
  * Validate Product Rule Condition
  *
  * @param Varien_Object $object
  *
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     /** @var Mage_Catalog_Model_Product $product */
     $product = $object->getProduct();
     if (!$product instanceof Mage_Catalog_Model_Product) {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
     return parent::validate($product);
 }
开发者ID:okite11,项目名称:frames21,代码行数:17,代码来源:Product.php

示例8: validate

 /**
  * Validate Product Rule Condition
  *
  * @param Varien_Object $object
  *
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $product = false;
     if ($object->getProduct() instanceof Mage_Catalog_Model_Product && $object->getData($this->getAttribute()) !== null) {
         $product = $object->getProduct();
     } else {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
     return parent::validate($product);
 }
开发者ID:rbrown,项目名称:magento-gifts,代码行数:18,代码来源:Product.php

示例9: validate

 /**
  * Validate Product Rule Condition
  *
  * @param Varien_Object $object
  *
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     /** @var Mage_Catalog_Model_Product $product */
     $product = $object->getProduct();
     if (!$product instanceof Mage_Catalog_Model_Product) {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
     $valid = parent::validate($product);
     if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
         $children = $object->getChildren();
         $valid = $children && $this->validate($children[0]);
     }
     return $valid;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:22,代码来源:Product.php

示例10: validate

 /**
  * Validate Product Rule Condition
  *
  * @param Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $op = $this->getOperator();
     $product = false;
     if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
         $product = $object->getProduct();
     } else {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
     if (!$product->getData($this->getAttribute()) && ($op != '==' || $op != '!=') && $this->getAttribute() != 'category_ids') {
         return false;
     }
     return parent::validate($product);
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:21,代码来源:Product.php

示例11: estimate

 public function estimate()
 {
     $product = $this->getProduct();
     $addToCartInfo = (array) $product->getAddToCartInfo();
     $addressInfo = (array) $this->getAddressInfo();
     if (!$product instanceof Mage_Catalog_Model_Product || !$product->getId()) {
         Mage::throwException(Mage::helper('webdevlopers_productpageshipping')->__('Please specify a valid product'));
     }
     if (!isset($addressInfo['country_id'])) {
         Mage::throwException(Mage::helper('webdevlopers_productpageshipping')->__('Please specify a country'));
     }
     if (empty($addressInfo['cart'])) {
         $this->resetQuote();
     }
     $shippingAddress = $this->getQuote()->getShippingAddress();
     $shippingAddress->setCountryId($addressInfo['country_id']);
     if (isset($addressInfo['region_id'])) {
         $shippingAddress->setRegionId($addressInfo['region_id']);
     }
     if (isset($addressInfo['postcode'])) {
         $shippingAddress->setPostcode($addressInfo['postcode']);
     }
     if (isset($addressInfo['region'])) {
         $shippingAddress->setRegion($addressInfo['region']);
     }
     if (isset($addressInfo['city'])) {
         $shippingAddress->setCity($addressInfo['city']);
     }
     $shippingAddress->setCollectShippingRates(true);
     if (isset($addressInfo['coupon_code'])) {
         $this->getQuote()->setCouponCode($addressInfo['coupon_code']);
     }
     $request = new Varien_Object($addToCartInfo);
     if ($product->getStockItem()) {
         $minimumQty = $product->getStockItem()->getMinSaleQty();
         if ($minimumQty > 0 && $request->getQty() < $minimumQty) {
             $request->setQty($minimumQty);
         }
     }
     $result = $this->getQuote()->addProduct($product, $request);
     if (is_string($result)) {
         Mage::throwException($result);
     }
     Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
     $this->getQuote()->collectTotals();
     $this->_result = $shippingAddress->getGroupedAllShippingRates();
     return $this;
 }
开发者ID:shakhawat4g,项目名称:MagentoExtensions,代码行数:48,代码来源:Estimate.php

示例12: getBuyRequest

 /**
  * Use our own method to get buyRequest
  * @param Mage_Sales_Model_Quote_Item $salesItem
  * @return Varien_Object
  *
  */
 public function getBuyRequest($salesItem, $option = false)
 {
     if ($option) {
         $option = $salesItem->getOptionByCode('info_buyRequest');
         $buyRequest = new Varien_Object($option && $option->getValue() ? unserialize($option->getValue()) : null);
         $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($salesItem->getQty() * 1);
         return $buyRequest;
     }
     $option = $salesItem->getProductOptionByCode('info_buyRequest');
     if (!$option) {
         $option = array();
     }
     $buyRequest = new Varien_Object($option);
     $buyRequest->setQty($salesItem->getQtyOrdered() * 1);
     return $buyRequest;
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:22,代码来源:AW_Collpur_Helper_Data.php

示例13: giftingItemToGiftingPayload

 /**
  * Trasfer data from an "item" with gifting options to a Gifting payload.
  * The "item" may be a quote item or quote address, as either may have
  * gift options data, retrievable in the same way.
  *
  * @param Varien_Object
  * @param IGfiting
  * @return IGifting
  */
 public function giftingItemToGiftingPayload(Varien_Object $giftItem, IGifting $giftingPayload)
 {
     $giftPricing = $giftingPayload->getEmptyGiftPriceGroup();
     $giftWrap = Mage::getModel('enterprise_giftwrapping/wrapping')->load($giftItem->getGwId());
     if ($giftWrap->getId()) {
         // For quote items (which will have a quantity), gift wrapping price
         // on the item will be the price for a single item to be wrapped,
         // total will be for cost for all items to be wrapped (qty * amount).
         // For addresses (which will have no quantity), gift wrapping price
         // on the address will be the price for wrapping all items for that
         // address, so total is just amount (1 * amount).
         $giftQty = $giftItem->getQty() ?: 1;
         // Add pricing data for gift wrapping - does not include discounts
         // as Magento does not support applying discounts to gift wrapping
         // out-of-the-box.
         $giftPricing->setUnitPrice($giftWrap->getBasePrice())->setAmount($giftItem->getGwPrice() * $giftQty)->setTaxClass($giftWrap->getEb2cTaxClass());
         $giftingPayload->setGiftItemId($giftWrap->getEb2cSku())->setGiftDescription($giftWrap->getDesign())->setGiftPricing($giftPricing);
     }
     return $giftingPayload;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:29,代码来源:Payload.php

示例14: validate

 /**
  * Validate Product Rule Condition
  *
  * @param Varien_Object $object
  *
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     /** @var Mage_Catalog_Model_Product $product */
     $product = $object->getProduct();
     if (!$product instanceof Mage_Catalog_Model_Product) {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
     // Allows attributes to take custom option SKU into consideration
     if ($this->getAttribute() === self::QUOTE_ITEM_SKU) {
         $product->setData($this->getAttribute(), $object->getSku());
         $valid = Mage_Rule_Model_Condition_Product_Abstract::validate($product);
     } else {
         $valid = parent::validate($object);
     }
     if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
         $children = $object->getChildren();
         $valid = $children && $this->validate($children[0]);
     }
     return $valid;
 }
开发者ID:outeredge,项目名称:edge-magento-module-customoptionpromotion,代码行数:28,代码来源:Product.php

示例15: render

 public function render(Varien_Object $row)
 {
     if (in_array($row->getTypeId(), array('simple', 'virtual', 'downloadable'))) {
         $localQty = Mage::getModel('advancedinventory/advancedinventory')->getLocalGlobalStockByProductId($row->getId());
         $diff = $row->getQty() - $localQty->getTotalQuantityInStock();
         if (!$localQty->getManageLocalStock()) {
             $html = "<span id='stock_difference_" . $row->getId() . "' style=''>-</span>";
         } else {
             if ($diff == 0) {
                 $html = "<span  style='color:green'> == </span>";
             } elseif ($diff > 0) {
                 $html = "<span  style='color:red'><b style='font-size:16px;'>> </b>  (+ " . $diff . ")</span>";
             } else {
                 $html = "<span  style='color:orange; '><b style='font-size:16px;'>< </b>  (" . $diff . ")</span>";
             }
         }
         return $html;
     } else {
         return "-";
     }
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:21,代码来源:Stockdiff.php


注:本文中的Varien_Object::getQty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。