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


PHP Varien_Object::getQuote方法代码示例

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


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

示例1: validate

 /**
  * Validate if qoute customer is assigned to role segments
  *
  * @param Mage_Sales_Model_Quote_Address|Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $subscriptionId = $object->getQuote()->getSubscriptionId();
     $quoteCount = 1;
     if (!$subscriptionId) {
         $isSubscription = Mage::getSingleton('adyen_subscription/product_observer')->isQuoteAdyenSubscription($object->getQuote());
         if (!$isSubscription) {
             return false;
         }
     } else {
         $pastOrders = Mage::getResourceModel('adyen_subscription/subscription_quote_collection')->addFieldToFilter('order_id', array('notnull' => true))->addFieldToFilter('subscription_id', $subscriptionId);
         $quoteCount += $pastOrders->getSize();
     }
     return $this->validateAttribute($quoteCount);
 }
开发者ID:sandermangel,项目名称:adyen-magento-subscription,代码行数:21,代码来源:QuoteCount.php

示例2: validate

 /**
  * Validate Address Rule Condition
  *
  * @param Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $address = $object;
     if (!$address instanceof Mage_Sales_Model_Quote_Address) {
         if ($object->getQuote()->isVirtual()) {
             $address = $object->getQuote()->getBillingAddress();
         } else {
             $address = $object->getQuote()->getShippingAddress();
         }
     }
     if ('payment_method' == $this->getAttribute() && !$address->hasPaymentMethod()) {
         $address->setPaymentMethod($object->getQuote()->getPayment()->getMethod());
     }
     return parent::validate($address);
 }
开发者ID:rbrown,项目名称:magento-gifts,代码行数:21,代码来源:Address.php

示例3: validate

 /**
  * Validate Address Rule Condition
  *
  * @param Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $quote = $object;
     if (!$quote instanceof Mage_Sales_Model_Quote) {
         $quote = $object->getQuote();
     }
     $num = 0;
     if ($quote->getCustomerId()) {
         $resource = Mage::getSingleton('core/resource');
         $db = $resource->getConnection('core_read');
         $select = $db->select()->from(array('o' => $resource->getTableName('sales/order')), array())->where('o.customer_id = ?', $quote->getCustomerId())->where('o.status = ?', 'complete');
         if ('order_num' == $this->getAttribute()) {
             $select->from(null, array(new Zend_Db_Expr('COUNT(*)')));
         } elseif ('sales_amount' == $this->getAttribute()) {
             $select->from(null, array(new Zend_Db_Expr('SUM(o.base_grand_total)')));
         }
         //            elseif ('prods_qty' == $this->getAttribute()){
         //
         //                $select->joinInner(array('i'=>$resource->getTableName('sales/order_item')), 'o.entity_id=i.order_id', array(new Zend_Db_Expr('SUM(i.qty_ordered)')))
         //                (null, array(new Zend_Db_Expr('SUM(o.base_grand_total)')))
         //            }
         $num = $db->fetchOne($select);
     }
     return $this->validateAttribute($num);
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:31,代码来源:Orders.php

示例4: validate

 /**
  * validate
  *
  * @param Varien_Object $object Quote
  *
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     $all = $this->getAggregator() === 'all';
     $true = (bool) $this->getValue();
     $found = false;
     foreach ($object->getQuote()->getAllVisibleItems() as $item) {
         $found = $all;
         foreach ($this->getConditions() as $cond) {
             $validated = $cond->validate($item);
             if ($all && !$validated || !$all && $validated) {
                 $found = $validated;
                 break;
             }
         }
         if ($found && $true || !$true && $found) {
             break;
         }
     }
     if ($found && $true) {
         // found an item and we're looking for existing one
         return true;
     } elseif (!$found && !$true) {
         // not found and we're making sure it doesn't exist
         return true;
     }
     return false;
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:34,代码来源:Found.php

示例5: assignData

 public function assignData($data)
 {
     if (!$data instanceof Varien_Object) {
         $data = new Varien_Object($data);
     }
     $this->quote = $data->getQuote();
     return $this;
 }
开发者ID:simondole,项目名称:Plugin-Magento,代码行数:8,代码来源:Standard.php

示例6: validate

 public function validate(Varien_Object $object)
 {
     $quote = $object;
     if (!$quote instanceof Mage_Sales_Model_Quote) {
         $quote = $object->getQuote();
     }
     $num = Mage::getModel('amacart/history')->getRecoveredNumberByEmail($quote->getCustomerEmail(), '6month');
     return $this->validateAttribute($num);
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:9,代码来源:Carts6.php

示例7: validate

 /**
  * Validate if quote customer is assigned to role segments
  *
  * @param Mage_Sales_Model_Quote_Address|Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $isSubscription = Mage::getSingleton('adyen_subscription/product_observer')->isQuoteAdyenSubscription($object->getQuote());
     if (!$isSubscription) {
         return false;
     }
     foreach ($object->getQuote()->getAllVisibleItems() as $quoteItem) {
         $subscriptionId = $quoteItem->getData('_adyen_subscription');
         if (!$subscriptionId) {
             continue;
         }
         $validated = $this->validateAttribute($subscriptionId);
         if ($validated) {
             return true;
         }
     }
     return false;
 }
开发者ID:Adyen,项目名称:adyen-magento-subscription,代码行数:24,代码来源:ProductSubscription.php

示例8: validate

 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     $attr = $this->getAttribute();
     $total = 0;
     foreach ($object->getQuote()->getAllItems() as $item) {
         if (parent::validate($item)) {
             $total += $item->getData($attr);
         }
     }
     return $this->validateAttribute($total);
 }
开发者ID:rbrown,项目名称:magento-gifts,代码行数:20,代码来源:Subselect.php

示例9: validate

 public function validate(Varien_Object $object)
 {
     if ($object instanceof Rewardpoints_Model_Quote && !$object->getQuote()) {
         $object->setQuote($object);
     }
     $address = $object;
     if (!$address instanceof Mage_Sales_Model_Quote_Address) {
         if ($object->getQuote()->isVirtual()) {
             $address = $object->getQuote()->getBillingAddress();
         } else {
             $address = $object->getQuote()->getShippingAddress();
         }
     }
     $address->setBaseSubtotalIncTax($address->getBaseSubtotal() + $address->getBaseTaxAmount());
     return parent::validate($object);
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:16,代码来源:Address.php

示例10: validate

 /**
  * validate
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     // Fix a bug with the underlying combine condition check
     $value = $this->getValue();
     $this->setValue(true);
     $total = 0;
     foreach ($object->getQuote()->getAllVisibleItems() as $item) {
         if (Mage_SalesRule_Model_Rule_Condition_Product_Combine::validate($item)) {
             $total += $item->getData($this->getAttribute());
         }
     }
     // Fix a bug with the underlying combine condition check
     $this->setValue($value);
     return $this->validateAttribute($total);
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:24,代码来源:Subselect.php

示例11: validate

 public function validate(Varien_Object $object)
 {
     $quote = $object;
     if (!$quote instanceof Mage_Sales_Model_Quote) {
         $quote = $object->getQuote();
     }
     // order history conditions are valid for customers only, not for visitors.
     $id = $quote->getCustomerId();
     if (!$id) {
         return false;
     }
     $condArray = array();
     foreach ($this->getConditions() as $condObj) {
         $condArray[] = $condObj->validate($object);
     }
     $fieldName = $this->getAttributeElement()->getValue();
     $v = Mage::getSingleton('amrules/calculator')->getSingleTotalField($id, $fieldName, $condArray, $this->getAggregator());
     return $this->validateAttribute($v);
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:19,代码来源:Amasty_Rules_Model_Rule_Condition_Total.php

示例12: validate

 /**
  * Validate items total amount or total qty
  *
  * @param Varien_Object $object Quote
  * @return boolean
  */
 public function validate(Varien_Object $object)
 {
     if (!$this->getConditions()) {
         return false;
     }
     $attr = $this->getAttribute();
     $total = 0;
     foreach ($object->getQuote()->getAllItems() as $item) {
         // fix magento bug
         if ($item->getParentItemId()) {
             continue;
         }
         // for bundle we need to add a loop here
         // if we treat them as set of separate items
         if (@Amasty_Rules_Model_SalesRule_Rule_Condition_Product_Combine::validate($item)) {
             $total += $item->getData($attr);
         }
     }
     return $this->validateAttribute($total);
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:26,代码来源:Amasty_Rules_Model_SalesRule_Rule_Condition_Product_Subselect.php

示例13: validate

 /**
  * Validate Address Rule Condition
  *
  * @param Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $customer = $object;
     if (!$customer instanceof Mage_Customer_Model_Customer) {
         $customer = $object->getQuote()->getCustomer();
         $attr = $this->getAttribute();
         if ($attr != 'entity_id' && !$customer->getData($attr)) {
             $address = $object->getQuote()->getBillingAddress();
             $customer->setData($attr, $address->getData($attr));
         }
     }
     return parent::validate($customer);
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:19,代码来源:Customer.php

示例14: validate

 /**
  * Validate if qoute customer is assigned to role segments
  *
  * @param   Mage_Sales_Model_Quote_Address $object
  * @return  bool
  */
 public function validate(Varien_Object $object)
 {
     $customer = null;
     if ($object->getQuote()) {
         $customer = $object->getQuote()->getCustomer();
     }
     if (!$customer) {
         return false;
     }
     $segments = Mage::getSingleton('enterprise_customersegment/customer')->getCustomerSegmentIdsForWebsite($customer->getId(), $object->getQuote()->getStore()->getWebsite()->getId());
     return $this->validateAttribute($segments);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:18,代码来源:Segment.php

示例15: validate

 /**
  * Validate Address Rule Condition
  *
  * @param Varien_Object $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $customer = $object;
     if (!$customer instanceof Mage_Customer_Model_Customer) {
         $customer = $object->getQuote()->getCustomer();
         $attr = $this->getAttribute();
         if ($attr == 'membership_days') {
             $customer->setData($attr, Mage::helper('amrules')->getMembership($customer->getCreatedAt()));
         }
         if ($attr != 'entity_id' && !$customer->getData($attr)) {
             $address = $object->getQuote()->getBillingAddress();
             $customer->setData($attr, $address->getData($attr));
         }
     }
     return parent::validate($customer);
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:22,代码来源:Amasty_Rules_Model_Rule_Condition_Customer.php


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