本文整理汇总了PHP中Mage_Sales_Model_Quote类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote类的具体用法?PHP Mage_Sales_Model_Quote怎么用?PHP Mage_Sales_Model_Quote使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Quote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertBirthdate
/**
* add birthdate to params list, if it is available
*
* @param Mage_Sales_Model_Quote $quote Quote
* @return array Either empty or with birthdate
*/
public function convertBirthdate($quote)
{
if (is_null($quote->getCustomerDob())) {
return array();
}
return array('GEBURTSDATUM' => Mage::getModel('core/date')->date('d.m.Y', $quote->getCustomerDob()));
}
示例2: resetQuote
protected function resetQuote(Mage_Sales_Model_Quote $quote)
{
if (!$quote->getData('__applied_rules_reset__')) {
$quote->setAppliedRuleIds('');
$quote->setData('__applied_rules_reset__', true);
}
}
示例3: isAvailable
/**
* Check whether method is available
*
* @param Mage_Sales_Model_Quote|null $quote
* @return bool
*/
public function isAvailable($quote = null)
{
/* custom code written to round price here as roundPrice function was changed */
$_grand_price = Mage::app()->getStore()->roundPrice($quote->getGrandTotal());
$_grand_price = round($_grand_price, 2);
return parent::isAvailable($quote) && !empty($quote) && $_grand_price == 0;
}
示例4: setUp
protected function setUp()
{
parent::setUp();
$quote = new Mage_Sales_Model_Quote();
$quote->load('test01', 'reserved_order_id');
Mage::getSingleton('Mage_Checkout_Model_Session')->setQuoteId($quote->getId());
}
示例5: _addErrorMessage
/**
* Add error message if estimation has error
*
* @param Mage_Sales_Model_Quote $quote
* @return $this
*/
protected function _addErrorMessage($quote)
{
if ($quote->getData('estimate_tax_error')) {
$this->_getErrorsHelper()->addErrorMessage($quote);
}
return $this;
}
示例6: prepareCollection
/**
* Convert the resource model collection to an array
*
* @param Mage_Sales_Model_Quote $quote
*
* @return array
*/
public function prepareCollection(Mage_Sales_Model_Quote $quote)
{
// Store current state
$actionType = $this->getActionType();
$operation = $this->getOperation();
// Change state
$this->setActionType(self::ACTION_TYPE_COLLECTION);
$this->setOperation(self::OPERATION_RETRIEVE);
$data = [];
// Get store
$store = $quote->getStoreId();
// Get filter
$filter = $this->getFilter();
// Prepare methods
foreach (Mage::helper('payment')->getStoreMethods($store, $quote) as $method) {
/** @var $method Mage_Payment_Model_Method_Abstract */
if ($this->_canUseMethod($method, $quote) && $method->isApplicableToQuote($quote, Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL)) {
$method->setInfoInstance($quote->getPayment());
$data[] = $this->prepareMethod($method, $filter);
}
}
// Restore old state
$this->setActionType($actionType);
$this->setOperation($operation);
// Return prepared outbound data
return $data;
}
示例7: checkQuoteAmount
public function checkQuoteAmount(Mage_Sales_Model_Quote $quote, $amount)
{
if (!$quote->getHasError() && $amount >= self::MAXIMUM_AVAILABLE_NUMBER) {
$quote->setHasError(true);
$quote->addMessage($this->__('Some items have quantities exceeding allowed quantities. Please select a lower quantity to checkout.'));
}
return $this;
}
示例8: getOwnerParams
/**
* extraxcts the according Barclaycard owner* parameter
*
* @param Mage_Sales_Model_Quote $quote
* @param Mage_Customer_Model_Address_Abstract $billingAddress
*
* @return array
*/
public function getOwnerParams(Mage_Sales_Model_Quote $quote, Mage_Customer_Model_Address_Abstract $billingAddress)
{
$ownerParams = array();
if ($this->getConfig()->canSubmitExtraParameter($quote->getStoreId())) {
$ownerParams = array('OWNERADDRESS' => str_replace("\n", ' ', $billingAddress->getStreet(1)), 'OWNERTOWN' => $billingAddress->getCity(), 'OWNERZIP' => $billingAddress->getPostcode(), 'OWNERTELNO' => $billingAddress->getTelephone(), 'OWNERCTY' => $billingAddress->getCountry(), 'ECOM_BILLTO_POSTAL_POSTALCODE' => $billingAddress->getPostcode());
}
return $ownerParams;
}
示例9: validateAlias
/**
* Validates alias for in quote provided addresses
* @param Mage_Sales_Model_Quote $quote
* @param Varien_Object $payment
* @throws Mage_Core_Exception
*/
protected function validateAlias($quote, $payment)
{
$alias = $payment->getAdditionalInformation('alias');
if (0 < strlen(trim($alias)) && is_numeric($payment->getAdditionalInformation('cvc')) && false === Mage::helper('ops/alias')->isAliasValidForAddresses($quote->getCustomerId(), $alias, $quote->getBillingAddress(), $quote->getShippingAddress(), $quote->getStoreId())) {
$this->getOnepage()->getCheckout()->setGotoSection('payment');
Mage::throwException($this->getHelper()->__('Invalid payment information provided!'));
}
}
示例10: getAllConfigsByQuote
/**
* @api
*
* To be used in Form_Block, which has to display all wallet types
*
* @param Mage_Sales_Model_Quote $quote
* @return Payone_Core_Model_Config_Payment_Method_Interface
*/
public function getAllConfigsByQuote(Mage_Sales_Model_Quote $quote)
{
if (empty($this->matchingConfigs)) {
$configStore = $this->getConfigStore($quote->getStoreId());
$this->matchingConfigs = $configStore->getPayment()->getMethodsForQuote($this->methodType, $quote);
}
return $this->matchingConfigs;
}
示例11: getQuoteCurrency
/**
* returns the quote currency
*
* @param $quote
*
* @return string - the quotes currency
*/
public function getQuoteCurrency(Mage_Sales_Model_Quote $quote)
{
if ($quote->hasForcedCurrency()) {
return $quote->getForcedCurrency()->getCode();
} else {
return Mage::app()->getStore($quote->getStoreId())->getBaseCurrencyCode();
}
}
示例12: minimunOrderQty
/**
* Check if quote meets the minimun quantity
* of total items for a specific customer
*
* @todo Change to more meaningful name
*
* @param Mage_Sales_Model_Quote $quote
* @param Mage_Customer_Model_Customer $customer
* @return int|false
*/
public function minimunOrderQty(Mage_Sales_Model_Quote $quote, Mage_Customer_Model_Customer $customer)
{
$minQtyForCustomer = $this->getConfigValue($customer->getGroupId());
if ($quote->getItemsQty() < $minQtyForCustomer && $quote->getItemsQty() !== 0) {
return $minQtyForCustomer;
}
return false;
}
示例13: updateQuote
/**
* Update Quote Email Address if is guest and current email address assigned doesn't match new email
*
* @param Mage_Sales_Model_Quote $quote
*/
public function updateQuote(Mage_Sales_Model_Quote $quote)
{
$queue = Mage::getModel('bronto_emailcapture/queue');
$currentEmail = $queue->getCurrentEmail();
if (is_null($quote->getCustomerId()) && $queue->isValidEmail($currentEmail) && $quote->getCustomerEmail() !== $currentEmail) {
$quote->setCustomerEmail(Mage::getModel('bronto_emailcapture/queue')->getCurrentEmail())->save();
}
}
示例14: populuateQuote
/**
* Makes Quote available for Magento Core classes
*
* @param Mage_Sales_Model_Quote $quote
*/
public function populuateQuote(Mage_Sales_Model_Quote &$quote)
{
$quote->save();
$quote = Mage::getModel('sales/quote')->load($quote->getId());
Mage::getSingleton('checkout/cart')->setQuote($quote);
Mage::getSingleton('checkout/session')->setQuoteId($quote->getId());
Mage::getSingleton('checkout/type_onepage')->setQuote($quote);
}
示例15: checkQuoteAmount
/**
* Check quote amount
*
* @param Mage_Sales_Model_Quote $quote
* @param decimal $amount
* @return Mage_Sales_Helper_Data
*/
public function checkQuoteAmount(Mage_Sales_Model_Quote $quote, $amount)
{
if (!$quote->getHasError() && $amount >= self::MAXIMUM_AVAILABLE_NUMBER) {
$quote->setHasError(true);
$quote->addMessage($this->__('Items maximum quantity or price do not allow checkout.'));
}
return $this;
}