本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例5: assignData
public function assignData($data)
{
if (!$data instanceof Varien_Object) {
$data = new Varien_Object($data);
}
$this->quote = $data->getQuote();
return $this;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}