本文整理汇总了PHP中Mage_Sales_Model_Quote::hasRecurringItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::hasRecurringItems方法的具体用法?PHP Mage_Sales_Model_Quote::hasRecurringItems怎么用?PHP Mage_Sales_Model_Quote::hasRecurringItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::hasRecurringItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAvailable
/**
* Check whether payment method can be used
*
* TODO: payment method instance is not supposed to know about quote
*
* @param Mage_Sales_Model_Quote|null $quote
*
* @return bool
*/
public function isAvailable($quote = null)
{
$checkResult = new StdClass();
$isActive = (bool) (int) $this->getConfigData('active', $quote ? $quote->getStoreId() : null);
$checkResult->isAvailable = $isActive;
$checkResult->isDeniedInConfig = !$isActive;
// for future use in observers
Mage::dispatchEvent('payment_method_is_active', array('result' => $checkResult, 'method_instance' => $this, 'quote' => $quote));
// disable method if it cannot implement recurring profiles management and there are recurring items in quote
if ($checkResult->isAvailable) {
$implementsRecurring = $this->canManageRecurringProfiles();
// the $quote->hasRecurringItems() causes big performance impact, thus it has to be called last
if ($quote && !$implementsRecurring && $quote->hasRecurringItems()) {
$checkResult->isAvailable = false;
}
}
return $checkResult->isAvailable;
}
示例2: isApplicableToQuote
/**
* Check whether payment method is applicable to quote
* Purposed to allow use in controllers some logic that was implemented in blocks only before
*
* @param Mage_Sales_Model_Quote $quote
* @param int|null $checksBitMask
* @return bool
*/
public function isApplicableToQuote($quote, $checksBitMask)
{
if ($checksBitMask & self::CHECK_USE_FOR_COUNTRY) {
if (!$this->canUseForCountry($quote->getBillingAddress()->getCountry())) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_FOR_CURRENCY) {
if (!$this->canUseForCurrency($quote->getStore()->getBaseCurrencyCode())) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_CHECKOUT) {
if (!$this->canUseCheckout()) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_FOR_MULTISHIPPING) {
if (!$this->canUseForMultishipping()) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_INTERNAL) {
if (!$this->canUseInternal()) {
return false;
}
}
if ($checksBitMask & self::CHECK_ORDER_TOTAL_MIN_MAX) {
$total = $quote->getBaseGrandTotal();
$minTotal = $this->getConfigData('min_order_total');
$maxTotal = $this->getConfigData('max_order_total');
if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) {
return false;
}
}
if ($checksBitMask & self::CHECK_RECURRING_PROFILES) {
if (!$this->canManageRecurringProfiles() && $quote->hasRecurringItems()) {
return false;
}
}
if ($checksBitMask & self::CHECK_ZERO_TOTAL) {
$total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount();
if ($total < 0.0001 && $this->getCode() != 'free' && !($this->canManageRecurringProfiles() && $quote->hasRecurringItems())) {
return false;
}
}
return true;
}
示例3: isAvailable
/**
* Check whether payment method can be used
*
* TODO: payment method instance is not supposed to know about quote
*
* @param Mage_Sales_Model_Quote|null $quote
*
* @return bool
*/
public function isAvailable($quote = null)
{
$checkResult = new StdClass();
$isActive = (bool) (int) $this->getConfigData('active', $quote ? $quote->getStoreId() : null);
$shippingMethodRaw = $quote->getShippingAddress()->getShippingMethod();
$product = $this->_getHelper()->getDPDServiceCode($shippingMethodRaw);
if (!$isActive || !$quote || !$this->_getHelper()->isShippingMethodDpd($shippingMethodRaw) || !in_array($product, explode(',', $this->getConfigData('specificproducto', $quote->getStoreId()))) || is_null($this->getSurchage())) {
$isActive = false;
}
$checkResult->isAvailable = $isActive;
$checkResult->isDeniedInConfig = !$isActive;
// for future use in observers
Mage::dispatchEvent('payment_method_is_active', array('result' => $checkResult, 'method_instance' => $this, 'quote' => $quote));
// disable method if it cannot implement recurring profiles management and there are recurring items in quote
if ($checkResult->isAvailable) {
$implementsRecurring = $this->canManageRecurringProfiles();
// the $quote->hasRecurringItems() causes big performance impact, thus it has to be called last
if ($quote && !$implementsRecurring && $quote->hasRecurringItems()) {
$checkResult->isAvailable = false;
}
}
return $checkResult->isAvailable;
}