当前位置: 首页>>代码示例>>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;未经允许,请勿转载。