當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Object::getProduct方法代碼示例

本文整理匯總了PHP中Varien_Object::getProduct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Object::getProduct方法的具體用法?PHP Varien_Object::getProduct怎麽用?PHP Varien_Object::getProduct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Varien_Object的用法示例。


在下文中一共展示了Varien_Object::getProduct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validate

 public function validate(Varien_Object $object)
 {
     // for optimization if we no conditions
     if (!$this->getConditions()) {
         return true;
     }
     $origProduct = null;
     if ($object->getHasChildren() && $object->getProductType() == 'configurable') {
         //remember original product
         $origProduct = $object->getProduct();
         $origSku = $object->getSku();
         foreach ($object->getChildren() as $child) {
             // only one itereation.
             $categoryIds = array_merge($child->getProduct()->getCategoryIds(), $origProduct->getCategoryIds());
             $categoryIds = array_unique($categoryIds);
             $object->setProduct($child->getProduct());
             $object->setSku($child->getSku());
             $object->getProduct()->setCategoryIds($categoryIds);
         }
     }
     $result = @Mage_Rule_Model_Condition_Combine::validate($object);
     if ($origProduct) {
         // restore original product
         $object->setProduct($origProduct);
         $object->setSku($origSku);
     }
     return $result;
 }
開發者ID:xiaoguizhidao,項目名稱:blingjewelry-prod,代碼行數:28,代碼來源:Combine.php

示例2: getItemHtml

 public function getItemHtml(Varien_Object $item)
 {
     if ($item instanceof Unirgy_DropshipSplit_Model_Cart_Vendor || $item->getQuoteItem() instanceof Unirgy_DropshipSplit_Model_Cart_Vendor) {
         $qItem = !$item instanceof Unirgy_DropshipSplit_Model_Cart_Vendor || $item->getProduct() && !$item->getProduct()->getId() ? $item->getQuoteItem() : $item;
         $blockName = "vendor_{$qItem->getVendor()->getId()}_{$qItem->getPart()}_" . self::$_blockIter++;
         return $this->getLayout()->createBlock('udsplit/multishipping_vendor', $blockName)->addData($qItem->getData())->setQuote($qItem->getQuote1())->toHtml();
     }
     return parent::getItemHtml($item);
 }
開發者ID:xiaoguizhidao,項目名稱:magento,代碼行數:9,代碼來源:Overview.php

示例3: 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

示例4: 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) {
         $product = $object->getProduct();
     } else {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $product->setQuoteItemSku($object->getSku());
     //$newObject = new Varien_Object();
     $object->setProduct($product);
     return parent::validate($object);
 }
開發者ID:xiaoguizhidao,項目名稱:blingjewelry-prod,代碼行數:19,代碼來源:Product.php

示例5: 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

示例6: validate

 public function validate(Varien_Object $object)
 {
     if ($vendorId = $this->getRule()->getData('vendor_id')) {
         $product = false;
         if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
             $product = $object->getProduct();
             if (!$product || !$product->getData('sm_product_vendor_id')) {
                 $product = Mage::getModel('catalog/product')->load($object->getProductId());
             }
             if ($product->getData('sm_product_vendor_id') != $vendorId) {
                 return false;
             }
         }
     }
     return parent::validate($object);
 }
開發者ID:shashankkanungo,項目名稱:magento,代碼行數:16,代碼來源:Combine.php

示例7: _prepareData

 /**
  * @param null|Varien_Object $dataObject
  * @return Xcom_Xfabric_Model_Message_Request
  */
 public function _prepareData(Varien_Object $dataObject = null)
 {
     $avroDataObject = Mage::getModel('xcom_chronicle/message_webstore_offer', array('product' => $dataObject->getProduct(), 'store_id' => $dataObject->getStoreId()));
     $data = array('offer' => $avroDataObject->toArray());
     $this->setMessageData($data);
     return parent::_prepareData($dataObject);
 }
開發者ID:ridhoq,項目名稱:mxpi-twitter,代碼行數:11,代碼來源:Outbound.php

示例8: banProductPageCache

 /**
  * Ban a specific product page from the cache
  *
  * Events:
  *     catalog_product_save_commit_after
  *
  * @param  Varien_Object $eventObject
  * @return null
  */
 public function banProductPageCache($eventObject)
 {
     if (Mage::helper('turpentine/varnish')->getVarnishEnabled()) {
         $banHelper = Mage::helper('turpentine/ban');
         /** @var Mage_Catalog_Model_Product $product */
         $product = $eventObject->getProduct();
         /** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection */
         $parentProductsCollection = $banHelper->getRelatedProductsCollection($product);
         // if not possible to get collection
         if (!$parentProductsCollection) {
             return;
         }
         // ban product and related products
         $urlPattern = $banHelper->getProductBanRegex($parentProductsCollection);
         $result = $this->_getVarnishAdmin()->flushUrl($urlPattern);
         Mage::dispatchEvent('turpentine_ban_product_cache', $result);
         $cronHelper = Mage::helper('turpentine/cron');
         if ($this->_checkResult($result) && $cronHelper->getCrawlerEnabled()) {
             $cronHelper->addProductToCrawlerQueue($product);
             foreach ($banHelper->getParentProducts($product) as $parentProduct) {
                 $cronHelper->addProductToCrawlerQueue($parentProduct);
             }
         }
         // ban related categories
         $productIds = array_merge(array($product->getId()), $parentProductsCollection->getAllIds());
         $categoryRelationCollection = Mage::getResourceModel('turpentine/catalog_category_product_collection')->filterAllByProductIds($productIds);
         $categoryIds = $categoryRelationCollection->getAllCategoryIds();
         $categoryCollection = Mage::getResourceModel('catalog/category_collection')->addAttributeToSelect('url_key')->addIdFilter($categoryIds);
         foreach ($categoryCollection as $category) {
             $this->banCategoryCache(new Varien_Object(array('category' => $category)));
         }
     }
 }
開發者ID:rickbakker,項目名稱:magento-turpentine,代碼行數:42,代碼來源:Ban.php

示例9: _prepareData

 /**
  * @param null|Varien_Object $dataObject
  * @return Xcom_Xfabric_Model_Message_Request
  */
 public function _prepareData(Varien_Object $dataObject = null)
 {
     $avroDataObject = Mage::getModel('xcom_chronicle/message_product', $dataObject->getProduct());
     $data = array('products' => array($avroDataObject->toArray()));
     $this->setMessageData($data);
     return parent::_prepareData($dataObject);
 }
開發者ID:ridhoq,項目名稱:mxpi-twitter,代碼行數:11,代碼來源:Outbound.php

示例10: validate

 /**
  * @param Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     // check product type
     if ($this->getAttribute() == 'product_type') {
         if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
             $product = $object->getProduct();
         } else {
             $product = Mage::getModel('catalog/product')->load($object->getProductId());
         }
         if ($product->getTypeId() == $this->getValue()) {
             return true;
         } else {
             return false;
         }
     }
     return parent::validate($object);
 }
開發者ID:cabrerabywaters,項目名稱:magentoSunshine,代碼行數:21,代碼來源:Product.php

示例11: 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

示例12: render

 /**
  * Render price for last ordered item
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     // Show base price of product - the real price will be shown when user will configure product (if needed)
     $priceInitial = $row->getProduct()->getPrice() * 1;
     $priceInitial = floatval($priceInitial) * $this->_getRate($row);
     $priceInitial = sprintf("%f", $priceInitial);
     $currencyCode = $this->_getCurrencyCode($row);
     if ($currencyCode) {
         $priceInitial = Mage::app()->getLocale()->currency($currencyCode)->toCurrency($priceInitial);
     }
     return $priceInitial;
 }
開發者ID:QiuLihua83,項目名稱:magento-enterprise-1.13.1.0,代碼行數:18,代碼來源:Price.php

示例13: 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) {
         $product = $object->getProduct();
     } else {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     if (Mage::getStoreConfig('amrules/general/options_values')) {
         $options = $product->getTypeInstance(true)->getOrderOptions($product);
         $values = '';
         if (isset($options['options'])) {
             foreach ($options['options'] as $option) {
                 $values .= '|' . $option['value'];
             }
         }
         $product->setQuoteItemValue($values);
     }
     $product->setQuoteItemSku($object->getSku());
     $object->setProduct($product);
     return parent::validate($object);
 }
開發者ID:ankita-parashar,項目名稱:magento,代碼行數:28,代碼來源:Amasty_Rules_Model_SalesRule_Rule_Condition_Product.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());
     $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

示例15: _toLinkHtml

 /**
  * Render single action as link html
  *
  * @param  array $action
  * @param  Varien_Object $row
  * @return string
  */
 protected function _toLinkHtml($action, Varien_Object $row)
 {
     $product = $row->getProduct();
     if (isset($action['process']) && $action['process'] == 'configurable') {
         if ($product->canConfigure()) {
             $style = '';
             $onClick = sprintf('onclick="return %s.configureItem(%s)"', $action['control_object'], $row->getId());
         } else {
             $style = 'style="color: #CCC;"';
             $onClick = '';
         }
         return sprintf('<a href="%s" %s %s>%s</a>', $action['url'], $style, $onClick, $action['caption']);
     } else {
         return parent::_toLinkHtml($action, $row);
     }
 }
開發者ID:SalesOneGit,項目名稱:s1_magento,代碼行數:23,代碼來源:Multiaction.php


注:本文中的Varien_Object::getProduct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。