本文整理汇总了PHP中Mage_Sales_Model_Quote::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getStore方法的具体用法?PHP Mage_Sales_Model_Quote::getStore怎么用?PHP Mage_Sales_Model_Quote::getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getStore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* Collect gift wrapping totals
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Enterprise_GiftWrapping_Model_Total_Quote_Giftwrapping
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
if ($address->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
return $this;
}
$this->_quote = $address->getQuote();
$this->_store = $this->_quote->getStore();
$quote = $this->_quote;
if ($quote->getIsMultiShipping()) {
$this->_quoteEntity = $address;
} else {
$this->_quoteEntity = $quote;
}
$this->_collectWrappingForItems($address)->_collectWrappingForQuote($address)->_collectPrintedCard($address);
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getGwItemsBasePrice() + $address->getGwBasePrice() + $address->getGwCardBasePrice());
$address->setGrandTotal($address->getGrandTotal() + $address->getGwItemsPrice() + $address->getGwPrice() + $address->getGwCardPrice());
if ($quote->getIsNewGiftWrappingCollecting()) {
$quote->setGwItemsBasePrice(0);
$quote->setGwItemsPrice(0);
$quote->setGwBasePrice(0);
$quote->setGwPrice(0);
$quote->setGwCardBasePrice(0);
$quote->setGwCardPrice(0);
$quote->setIsNewGiftWrappingCollecting(false);
}
$quote->setGwItemsBasePrice($address->getGwItemsBasePrice() + $quote->getGwItemsBasePrice());
$quote->setGwItemsPrice($address->getGwItemsPrice() + $quote->getGwItemsPrice());
$quote->setGwBasePrice($address->getGwBasePrice() + $quote->getGwBasePrice());
$quote->setGwPrice($address->getGwPrice() + $quote->getGwPrice());
$quote->setGwCardBasePrice($address->getGwCardBasePrice() + $quote->getGwCardBasePrice());
$quote->setGwCardPrice($address->getGwCardPrice() + $quote->getGwCardPrice());
return $this;
}
示例2: getProductTaxRate
private function getProductTaxRate()
{
/** @var $taxCalculator Mage_Tax_Model_Calculation */
$taxCalculator = Mage::getSingleton('tax/calculation');
$request = $taxCalculator->getRateRequest($this->quote->getShippingAddress(), $this->quote->getBillingAddress(), $this->quote->getCustomerTaxClassId(), $this->quote->getStore());
$request->setProductClassId($this->getProduct()->getTaxClassId());
return $taxCalculator->getRate($request);
}
示例3: callGetTaxForQuote
public function callGetTaxForQuote(Mage_Sales_Model_Quote $quote)
{
$request = $this->createTaxRequestFromQuoteAddress($quote->getShippingAddress());
$request = $this->prepareGetTaxRequest($request);
$errors = $this->validateTaxRequest($request);
if (count($errors)) {
return $errors;
}
return $this->call($quote->getStore(), '1.0/tax/get', $request);
}
示例4: initializeCurrency
private function initializeCurrency()
{
/** @var $currencyHelper Ess_M2ePro_Model_Currency */
$currencyHelper = Mage::getSingleton('M2ePro/Currency');
if ($currencyHelper->isConvertible($this->proxyOrder->getCurrency(), $this->quote->getStore())) {
$currentCurrency = Mage::getModel('directory/currency')->load($this->proxyOrder->getCurrency());
} else {
$currentCurrency = $this->quote->getStore()->getBaseCurrency();
}
$this->quote->getStore()->setData('current_currency', $currentCurrency);
}
示例5: needToSubtractShippingTax
private function needToSubtractShippingTax()
{
if (!$this->proxyOrder->isTaxModeChannel() && !$this->proxyOrder->isTaxModeMixed()) {
return false;
}
if (!$this->proxyOrder->isShippingPriceIncludesTax()) {
return false;
}
/** @var $storeConfigurator Ess_M2ePro_Model_Magento_Quote_Store_Configurator */
$storeConfigurator = Mage::getModel('M2ePro/Magento_Quote_Store_Configurator', $this);
$storeShippingTaxRate = $storeConfigurator->getStoreShippingTaxRate($this->quote->getStore());
return $this->proxyOrder->getTaxRate() != $storeShippingTaxRate;
}
示例6: checkCartMaxAmount
/**
* Check max amount on cart
*
* @param Mage_Sales_Model_Quote $quote
*/
public function checkCartMaxAmount($quote)
{
$quoteStore = $quote->getStore();
if ($this->isCartEnable($quoteStore)) {
$maxAmount = $this->getCartMaxAmount($quoteStore);
$grandTotal = $quote->getGrandTotal();
if ($grandTotal > $maxAmount) {
$formater = new Varien_Filter_Template();
$formater->setVariables(array('amount' => Mage::helper('core')->currency($maxAmount, true, false)));
$format = $this->getCartMessage($quoteStore);
// hold checkout
$quote->setHasError(true)->addMessage($formater->filter($format));
}
}
}
示例7: getRules
/**
* Return the correct rule set
*
* @param Mage_Sales_Model_Quote $quote
* @param bool $forceReload
*
* @return Mage_SalesRule_Model_Rule[]
*/
public function getRules(Mage_Sales_Model_Quote $quote, $forceReload = false)
{
$websiteId = intval($quote->getStore()->getWebsiteId());
$customerGroupId = intval($quote->getCustomerGroupId());
$couponCode = trim($quote->getCouponCode());
$key = $websiteId . '_' . $customerGroupId . '_' . $couponCode;
if ($forceReload) {
unset($this->rules[$key]);
}
if (!isset($this->rules[$key])) {
/** @var Mage_SalesRule_Model_Resource_Rule_Collection $rules */
$rules = Mage::getResourceModel('salesrule/rule_collection');
$rules->setValidationFilter($websiteId, $customerGroupId, $couponCode);
$this->rules[$key] = $rules->getItems();
}
return $this->rules[$key];
}
示例8: addCartProductsToXmlObj
/**
* Add product block to cart
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObject
* @param Mage_Sales_Model_Quote $quote
* @return null
*/
public function addCartProductsToXmlObj($xmlObject, $quote)
{
$productSmallImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/product_small');
$products = $xmlObject->addCustomChild('products');
/* @var $item Mage_Sales_Model_Quote_Item */
foreach ($this->getItems() as $item) {
$type = $item->getProductType();
$renderer = $this->getItemRenderer($type)->setItem($item);
/**
* General information
*/
$itemXml = $products->addCustomChild('item', null, array('entity_id' => $item->getProduct()->getId()));
$itemXml->addCustomChild('entity_type', $type);
$itemXml->addCustomChild('item_id', $item->getId());
$itemXml->addCustomChild('name', $xmlObject->escapeXml($renderer->getProductName()));
$itemXml->addCustomChild('code', 'cart[' . $item->getId() . '][qty]');
$itemXml->addCustomChild('qty', $renderer->getQty());
$icon = $renderer->getProductThumbnail()->resize($productSmallImageSize);
$iconXml = $itemXml->addChild('icon', $icon);
$iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
/**
* Price
*/
$pricesXmlObj = $itemXml->addCustomChild('price_list');
$exclPrice = $inclPrice = 0;
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
$exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount() + $item->getWeeeTaxDisposition();
} else {
$exclPrice = $item->getCalculationPrice();
}
}
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
$incl = $this->helper('checkout')->getPriceInclTax($item);
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
$inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
} else {
$inclPrice = $incl - $item->getWeeeTaxDisposition();
}
}
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
$paypalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getCalculationPrice());
$formattedExclPrice = $quote->getStore()->formatPrice($exclPrice, false);
$inclPrice = Mage::helper('xmlconnect')->formatPriceForXml($inclPrice);
$formattedInclPrice = $quote->getStore()->formatPrice($inclPrice, false);
$priceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'price'));
if ($this->helper('tax')->displayCartBothPrices()) {
$priceXmlObj->addCustomChild('price', $exclPrice, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $formattedExclPrice));
$priceXmlObj->addCustomChild('price', $inclPrice, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $formattedInclPrice));
} else {
if ($this->helper('tax')->displayCartPriceExclTax()) {
$priceXmlObj->addCustomChild('price', $exclPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $formattedExclPrice));
}
if ($this->helper('tax')->displayCartPriceInclTax()) {
$priceXmlObj->addCustomChild('price', $inclPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $formattedInclPrice));
}
}
/**
* Info for paypal MEP if it's enabled
*/
$appConfig = Mage::helper('xmlconnect')->getApplication()->loadConfiguration()->getRenderConf();
$isMepActive = $appConfig['paypal']['isActive'];
$paypalMepIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mep')->isAvailable(null);
if ($paypalMepIsAvailable && $isMepActive) {
$paypalPriceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'paypal'));
$paypalPriceXmlObj->addCustomChild('price', $paypalPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $quote->getStore()->formatPrice($paypalPrice, false)));
$paypalSubtotalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getRowTotal());
$paypalPriceXmlObj->addCustomChild('price', $paypalSubtotalPrice, array('id' => 'subtotal', 'label' => $this->__('Subtotal'), 'formatted_value' => $quote->getStore()->formatPrice($paypalSubtotalPrice, false)));
}
/**
* Subtotal
*/
$subtotalExclTax = $subtotalInclTax = 0;
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
$subtotalExclTax = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount() + $item->getWeeeTaxRowDisposition();
} else {
$subtotalExclTax = $item->getRowTotal();
}
}
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
$incl = $this->helper('checkout')->getSubtotalInclTax($item);
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
$subtotalInclTax = $incl + $item->getWeeeTaxAppliedRowAmount();
} else {
$subtotalInclTax = $incl - $item->getWeeeTaxRowDisposition();
}
}
$subtotalExclTax = Mage::helper('xmlconnect')->formatPriceForXml($subtotalExclTax);
$formattedSubtotalExcl = $quote->getStore()->formatPrice($subtotalExclTax, false);
$subtotalInclTax = Mage::helper('xmlconnect')->formatPriceForXml($subtotalInclTax);
$formattedSubtotalIncl = $quote->getStore()->formatPrice($subtotalInclTax, false);
$priceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'subtotal'));
//.........这里部分代码省略.........
示例9: getAddressGeoIP
/**
* Get GeoIp data by user ip address
* @param Mage_Sales_Model_Quote $quote
* @return array
*/
public function getAddressGeoIP(Mage_Sales_Model_Quote $quote)
{
$data = array();
$ipaddress = $_SERVER['REMOTE_ADDR'];
$geoip = false;
$enabled = Mage::getStoreConfig('onestepcheckout/general/enable_geoip', $quote->getStore());
$database = Mage::getBaseDir('base') . DS . Mage::getStoreConfig('onestepcheckout/general/geoip_database', $quote->getStore());
if (!$enabled || !file_exists($database) || !$ipaddress) {
return $data;
}
try {
if (!@(include_once 'Net/GeoIP.php')) {
Mage::throwException(Mage::helper('onestepcheckout')->__('Net/GeoIP pear package is not installed or inaccessible'));
} else {
require_once 'Net/GeoIP.php';
$geoip = Net_GeoIP::getInstance($database);
}
} catch (Exception $e) {
Mage::logException($e);
}
try {
// city database
if (is_object($geoip) && method_exists($geoip, 'lookupLocation')) {
$location = $geoip->lookupLocation($ipaddress);
$data['country_id'] = $location->countryCode;
$data['region_id'] = Mage::getModel('directory/region')->loadByCode($location->region, $location->countryCode)->getRegionId();
$data['city'] = $location->city ? utf8_encode($location->city) : '';
$data['postcode'] = $location->postalCode ? $location->postalCode : '';
// country database
} else {
if (is_object($geoip) && method_exists($geoip, 'lookupCountryCode')) {
$data['country_id'] = $geoip->lookupCountryCode($ipaddress);
//no database
} else {
Mage::throwException(Mage::helper('onestepcheckout')->__('Net/GeoIP database %s is not installed properly or is inaccessible', $database));
}
}
} catch (Exception $e) {
Mage::logException($e);
}
return $data;
}
示例10: 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;
}
示例11: callGetTaxForQuote
public function callGetTaxForQuote(Mage_Sales_Model_Quote $quote)
{
/** @var Aoe_AvaTax_Helper_Soap $helper */
$helper = Mage::helper('Aoe_AvaTax/Soap');
$address = $quote->getShippingAddress();
if ($address->validate() !== true) {
$resultArray = array('ResultCode' => 'Skip', 'Messages' => array(), 'TaxLines' => array());
return $resultArray;
}
$store = $quote->getStore();
$hideDiscountAmount = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $store);
$timestamp = $quote->getCreatedAt() ? Varien_Date::toTimestamp($quote->getCreatedAt()) : now();
$date = new Zend_Date($timestamp);
$request = new AvaTax\GetTaxRequest();
$request->setCompanyCode($this->limit($helper->getConfig('company_code', $store), 25));
$request->setDocType(AvaTax\DocumentType::$SalesOrder);
$request->setCommit(false);
$request->setDetailLevel(AvaTax\DetailLevel::$Tax);
$request->setDocDate($date->toString('yyyy-MM-dd'));
$request->setCustomerCode($helper->getCustomerDocCode($quote->getCustomer()) ?: $helper->getQuoteDocCode($quote));
$request->setCurrencyCode($this->limit($quote->getBaseCurrencyCode(), 3));
$request->setDiscount($hideDiscountAmount ? 0.0 : $store->roundPrice($address->getBaseDiscountAmount()));
if ($quote->getCustomerTaxvat()) {
$request->setBusinessIdentificationNo($this->limit($quote->getCustomerTaxvat(), 25));
}
$request->setOriginAddress($this->getOriginAddress($store));
$request->setDestinationAddress($this->getAddress($address));
$taxLines = array();
$itemPriceIncludesTax = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $store);
foreach ($this->getHelper()->getActionableQuoteAddressItems($address) as $k => $item) {
/** @var Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Quote_Address_Item $item */
$itemAmount = $store->roundPrice($itemPriceIncludesTax ? $item->getBaseRowTotalInclTax() : $item->getBaseRowTotal());
//$itemAmount = $store->roundPrice($item->getBaseRowTotal());
$itemAmount -= $store->roundPrice($item->getBaseDiscountAmount());
$taxLine = new AvaTax\Line();
$taxLine->setNo($this->limit($k, 50));
$taxLine->setItemCode($this->limit($item->getSku(), 50));
$taxLine->setQty(round($item->getQty(), 4));
$taxLine->setAmount($itemAmount);
$taxLine->setDescription($this->limit($item->getName(), 255));
$taxLine->setTaxCode($this->limit($helper->getProductTaxCode($item->getProduct()), 25));
$taxLine->setDiscounted($item->getBaseDiscountAmount() > 0.0);
$taxLine->setTaxIncluded($itemPriceIncludesTax);
$taxLine->setRef1($this->limit($helper->getQuoteItemRef1($item, $store), 250));
$taxLine->setRef2($this->limit($helper->getQuoteItemRef2($item, $store), 250));
$taxLines[] = $taxLine;
}
$shippingPriceIncludesTax = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX, $store);
$shippingAmount = $store->roundPrice($shippingPriceIncludesTax ? $address->getBaseShippingInclTax() : $address->getBaseShippingAmount());
//$shippingAmount = $store->roundPrice($address->getBaseShippingAmount());
$shippingAmount -= $store->roundPrice($address->getBaseShippingDiscountAmount());
$taxLine = new AvaTax\Line();
$taxLine->setNo('SHIPPING');
$taxLine->setItemCode('SHIPPING');
$taxLine->setQty(1);
$taxLine->setAmount($shippingAmount);
$taxLine->setDescription($this->limit("Shipping: " . $address->getShippingMethod(), 255));
$taxLine->setTaxCode($this->limit($helper->getShippingTaxCode($store), 25));
$taxLine->setDiscounted($address->getBaseShippingDiscountAmount() > 0.0);
$taxLine->setTaxIncluded($shippingPriceIncludesTax);
$taxLine->setRef1($this->limit($address->getShippingMethod(), 25));
$taxLines[] = $taxLine;
$request->setLines($taxLines);
Mage::dispatchEvent('aoe_avatax_soapapi_get_tax_for_quote_before', array('request' => $request, 'quote' => $quote));
// TODO: Handle giftwrapping
return $this->callGetTax($store, $request);
}
示例12: getCurrencyRate
/**
* Fetches the current store's currency or the one from the quote model.
* @param Mage_Sales_Model_Quote $quote [also accepts order model]
*/
public function getCurrencyRate($quote = null)
{
if ($quote->getStoreToQuoteRate() && $quote) {
$c = round($quote->getStoreToQuoteRate(), 4);
} else {
if ($quote) {
$store = $quote->getStore() ? $quote->getStore() : Mage::app()->getStore();
} else {
$store = Mage::app()->getStore();
}
$baseCurrency = $store->getBaseCurrency();
if ($quote) {
$quoteCurrency = $quote->hasForcedCurrency() ? $quote->getForcedCurrency() : $store->getCurrentCurrency();
} else {
$quoteCurrency = $store->getCurrentCurrency();
}
$c = $baseCurrency->getRate($quoteCurrency);
}
return $c;
}
示例13: __construct
/**
* set the quote information
* @param Mage_Sales_Model_Quote $quoteData
*/
public function __construct(Mage_Sales_Model_Quote $quoteData)
{
$customerModel = Mage::getModel('customer/customer');
$customerModel->load($quoteData->getCustomerId());
$this->id = $quoteData->getId();
$this->email = $quoteData->getCustomerEmail();
$this->store_name = $quoteData->getStore()->getName();
$created_at = new Zend_Date($quoteData->getCreatedAt(), Zend_Date::ISO_8601);
$this->created_date = $created_at->toString(Zend_Date::ISO_8601);
if ($quoteData->getShippingAddress()) {
$this->delivery_method = $quoteData->getShippingAddress()->getShippingDescription();
$this->delivery_total = $quoteData->getShippingAddress()->getShippingAmount();
}
$this->currency = $quoteData->getStoreCurrencyCode();
if ($payment = $quoteData->getPayment()) {
$this->payment = $payment->getMethod();
}
$this->couponCode = $quoteData->getCouponCode();
/**
* custom quote attributes
*/
$helper = Mage::helper('ddg');
$website = Mage::app()->getStore($quoteData->getStore())->getWebsite();
$customAttributes = $helper->getConfigSelectedCustomQuoteAttributes($website);
if ($customAttributes) {
$fields = Mage::getResourceModel('ddg_automation/quote')->getQuoteTableDescription();
foreach ($customAttributes as $customAttribute) {
if (isset($fields[$customAttribute])) {
$field = $fields[$customAttribute];
$value = $this->_getCustomAttributeValue($field, $quoteData);
if ($value) {
$this->_assignCustom($field, $value);
}
}
}
}
/**
* Billing address.
*/
if ($quoteData->getBillingAddress()) {
$billingData = $quoteData->getBillingAddress()->getData();
$this->billing_address = array('billing_address_1' => $this->_getStreet($billingData['street'], 1), 'billing_address_2' => $this->_getStreet($billingData['street'], 2), 'billing_city' => $billingData['city'], 'billing_region' => $billingData['region'], 'billing_country' => $billingData['country_id'], 'billing_postcode' => $billingData['postcode']);
}
/**
* Shipping address.
*/
if ($quoteData->getShippingAddress()) {
$shippingData = $quoteData->getShippingAddress()->getData();
$this->delivery_address = array('delivery_address_1' => $this->_getStreet($shippingData['street'], 1), 'delivery_address_2' => $this->_getStreet($shippingData['street'], 2), 'delivery_city' => $shippingData['city'], 'delivery_region' => $shippingData['region'], 'delivery_country' => $shippingData['country_id'], 'delivery_postcode' => $shippingData['postcode']);
}
/**
* Quote items.
* @var Mage_Sales_Model_Quote_Item $productItem
*/
foreach ($quoteData->getAllItems() as $productItem) {
$product = $productItem->getProduct();
if ($product) {
// category names
$categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name');
foreach ($categoryCollection as $cat) {
$categories = array();
$categories[] = $cat->getName();
$this->categories[]['Name'] = substr(implode(', ', $categories), 0, 244);
}
//get attribute set name
$attributeSetName = $this->_getAttributeSetName($product);
$this->products[] = array('name' => $productItem->getName(), 'sku' => $productItem->getSku(), 'qty' => (int) number_format($productItem->getData('qty'), 2), 'price' => (double) number_format($productItem->getPrice(), 2, '.', ''), 'attribute-set' => $attributeSetName);
} else {
// when no product information is available limit to this data
$this->products[] = array('name' => $productItem->getName(), 'sku' => $productItem->getSku(), 'qty' => (int) number_format($productItem->getData('qty'), 2), 'price' => (double) number_format($productItem->getPrice(), 2, '.', ''));
}
}
$this->quote_subtotal = (double) number_format($quoteData->getData('subtotal'), 2, '.', '');
$discountAmount = $quoteData->getData('subtotal') - $quoteData->getData('subtotal_with_discount');
$this->discount_amount = (double) number_format($discountAmount, 2, '.', '');
$this->quote_total = (double) number_format($quoteData->getData('grand_total'), 2, '.', '');
return true;
}
示例14: formatPrice
/**
* Format price base on store convert price method
*
* @param $price float
* @return string
*/
public function formatPrice($price)
{
return $this->_quote->getStore()->convertPrice($price, true);
}
示例15: _formatPrice
/**
* Format price base on store convert price method
*
* @param float $price
* @return string
*/
protected function _formatPrice($price)
{
return $this->_quote->getStore()->convertPrice($price, true);
}