From b5a5fba309779218afc38b2454fc3ad31d5bba50 Mon Sep 17 00:00:00 2001 From: Magento Mirror Date: Sat, 17 Jan 2009 18:08:01 -0500 Subject: [PATCH] Import Magento Release 1.1.3 --- STATUS.txt | 62 +++++++++++++++- app/Mage.php | 2 +- .../Searches/Renderer/Searchquery.php | 2 +- .../System/Convert/Gui/Edit/Tab/Upload.php | 14 ++++ .../Sales/Order/CreditmemoController.php | 20 +++++- .../System/Convert/ProfileController.php | 10 ++- .../Catalog/Model/Product/Option/Value.php | 3 + .../Model/Product/Type/Configurable.php | 10 +++ .../Mage/CatalogInventory/Model/Observer.php | 6 +- .../Mage/Core/Controller/Varien/Action.php | 19 +++-- .../core/Mage/Install/Model/Installer/Db.php | 3 +- .../core/Mage/Paypal/Block/Express/Review.php | 19 ++++- app/code/core/Mage/Paypal/Model/Api/Nvp.php | 6 +- app/code/core/Mage/Paypal/Model/Express.php | 9 ++- .../core/Mage/Paypal/Model/Express/Review.php | 7 +- app/code/core/Mage/Paypal/Model/Standard.php | 18 +++-- .../Paypal/controllers/ExpressController.php | 10 ++- .../Mage/PaypalUk/Block/Express/Review.php | 19 ++++- app/code/core/Mage/PaypalUk/Model/Api/Pro.php | 6 +- app/code/core/Mage/PaypalUk/Model/Express.php | 6 +- .../Mage/PaypalUk/Model/Express/Review.php | 6 +- .../controllers/ExpressController.php | 8 ++- .../Mage/Sales/Model/Order/Invoice/Item.php | 12 +++- .../Mage/Sales/Model/Quote/Item/Abstract.php | 8 +-- .../system/convert/profile/upload.phtml | 9 +++ .../template/paypal/express/review.phtml | 72 +++++++++++-------- .../template/paypaluk/express/review.phtml | 71 ++++++++++-------- 27 files changed, 339 insertions(+), 98 deletions(-) diff --git a/STATUS.txt b/STATUS.txt index 28da868f11..d3cb9f99db 100644 --- a/STATUS.txt +++ b/STATUS.txt @@ -4,8 +4,10 @@ FIXED BUGS: #2222: Product Alerts thru Catalog Price Rules #4346: make tax_class_id attribute applicable only to simple, configurable, virtual by default + #4369: When translate-inline mode is set to yes Sales Report page shows XHTML code #4481: The logo image size displayed on PayPal checkout #4513: Msg that product was removed from compare list is not displyed in My Account view + #4528: Shipping quotes in shopping cart page #4637: txt change - admin forgot password #4651: Google Sitemap wil not generate #4703: Imported configurable products don't work @@ -13,7 +15,11 @@ FIXED BUGS: #4953: The 'Minimum order amount' should apply after the coupon is applied #5034: multiple store feature not working on the backend #5050: Product Browsing / list.phtml doesnt support transparency + #5076: Check for duplicate email only after "Place Order" clicked, payment goes through, and checkout does not end + #5105: Error while removing products from websites #5117 - removed type hinting from setGroup() + #5132: Grammatical error + #5133: Poor grammar #5173: Czech Republic - part of EU - have missing currency #5194: back links chaos in client dashboard #5202: Attribute Label doesn't change on the frontend @@ -62,6 +68,7 @@ FIXED BUGS: #5512: Order number shold be a link #5516: place order button kept disabled after error #5517: "About Us", "Customer Service" error 404 page + #5540: Customers addresses can't be edited in admin. #5570: Backoffice : create new order , problem with payment method under Windows #5583: Product prices don't import properly #5587: IE bug in decorateGeneric() @@ -85,15 +92,29 @@ FIXED BUGS: #5728: Unnecessary rows it the Admin -> Reports -> Products-> Low stock #5738: Unable to specify Special price to product for specific store view #5742: link clickable after guest checkout + #5750: Products with required fields Custom Options should be invisible in some cases #5754: 404 on both sides after trying to c #5755: Invalid image place on front + #5772: add en_NZ to etc/config.xml #5779: Broken view of long SKU in FF 2 #5784: Broken previewing of large picture at the front end + #5789: Store switch doesn't add SID parameter to url + #5790: Defect - if Custom Option is chossen - Related Products Up-sells Cross-sells + #5807: Need to have some validation for product.create API call #5812: invalid api path for both getspecialprice and setspecial price #5819: Bundle item are not showing at the front end (hasOptions attribute saving for bundles and configurable products) #5825: Autogenerated URL keys issue + #5833: Multistore: Call to a member function getStoreIds() #5839: form integrity in gift messages in multicheckout + #5850: app/code/core/Mage/Media/Model/File/Image.php - image conversion fails with upper case image extensions + #5851: saveAs in app/code/core/Mage/Media/Model/File/Image.php fails to report correct error #5856: Exception after in the shopping cart with 0.00 tax rate + #5873: Security Warning in Admin + #5875: Sitemap error + #5881: catalogindex_reindex_all cron job fails + #5882: Session of Admin User persists even after user is deleted + #5891: Cannot add Custom Options in Safari 3x + #5911: Can't add (inch) symbol Fixed dynamic SKU & weight, fixed SKU for products with custom options, multiselect options Fixed admin notifications URL Fixed cache management issues @@ -149,7 +170,33 @@ FIXED BUGS: Fixed base64 urls encoding Fixed shipping tracking numbers displaying Fixed shipping price displaying in admin order create form - + Fixed salesrule/address validation object + Fixed zip-codes validation + Fixed google checkout button url that broke xhtml + Fixed url rewrites for products in anchor category (for product not assigned to it directly) + Fixed date filter in abandoned cart report + Fixed order base_shipping_tax_amount & shipping_tax_amount saving + Fixed customer shopping cart not displaying child items in admin + Fixed click action in abandoned carts report + Fixed displaing select options in Safari + Fixed radio/checkboxes lables text wrapping + Fixed onepage checkout login form submit with keyboard Enter key + Fixed bundle price calculation on product view page + Fixed usaging URL rewrites for category view (pager, layered navigation) + Fixed creating shipment + Fixed parent items logic in payment methods + Fixed arguments for event in salesrule_validator_process + Fixed inventory checking for bundle products + Fixed updating tier prices with webservices API + Fixed google checkout xml tax section generation + Fixed deleting bundle options + Fixed configurable product weight calculation in shopping cart and checkout + Fixed displaying of pure virtual orders in admin + Fixed fatal error when Soap extension is not installed + Fixed wrong SOAP content type + Fixed errors in invoice/packingslip PDF print-out (added missing fonts, fixed overlapping columns and text wrapping, displaying of non-latin1 texts) + Fixed non-working store switcher + CHANGES: @@ -209,6 +256,19 @@ CHANGES: Moved tier prices to blocks Added clone price block for modern theme Design updates, themes cleanup + + Implemented duplicating custom options when duplicating a product + Added missing demo notice in modern theme + Added validation "_isUrlInternal" to check all referer, redirect and success urls + Added availability to reset query params for url generation + Added priority (sort order) to promo/quote/grid + Added event salesrule_validator_process + Added hiding long options on orders, invoices, etc on frontend + Set svn:ignore on downloader/pearlib/cache + Added N/A label in shipments for virtual products in bundle + + iPhone theme updated for 1.1 + Upgraded core/helper/string for binary-safe string operations NOTES: diff --git a/app/Mage.php b/app/Mage.php index 00be66d42a..66c5f21218 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -74,7 +74,7 @@ final class Mage { public static function getVersion() { - return '1.1.2'; + return '1.1.3'; } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php index 5aa9d97213..cacf5f2daa 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php @@ -31,7 +31,7 @@ public function render(Varien_Object $row) { $value = $row->getData($this->getColumn()->getIndex()); if (Mage::helper('core/string')->strlen($value) > 30) { - $value = '' . Mage::helper('core/string')->truncate($value, 30) . ''; + $value = '' . $this->htmlEscape(Mage::helper('core/string')->truncate($value, 30)) . ''; } else { $value = $this->htmlEscape($value); diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php index a8738c73fa..b0ee280d90 100755 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php @@ -34,5 +34,19 @@ public function __construct() $this->setTemplate('system/convert/profile/upload.phtml'); } + public function getPostMaxSize() + { + return ini_get('post_max_size'); + } + + public function getUploadMaxSize() + { + return ini_get('upload_max_filesize'); + } + + public function getDataMaxSize() + { + return min($this->getPostMaxSize(), $this->getUploadMaxSize()); + } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php index eaec6f9dcb..014161b35d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php @@ -125,8 +125,16 @@ protected function _initCreditmemo($update = false) $qty = min($orderItem->getQtyToRefund(), $invoiceItem->getQty()); } } + $item->setQty($qty); - $item->setBackToStock(isset($savedData[$orderItem->getId()]['back_to_stock'])); + + $children = $orderItem->getChildrenItems(); + if (!empty($children)) { + $item->setBackToStock(false); + } else { + $item->setBackToStock(isset($savedData[$orderItem->getId()]['back_to_stock'])); + } + $creditmemo->addItem($item); } } else { @@ -161,8 +169,16 @@ protected function _initCreditmemo($update = false) $qty = $orderItem->getQtyToRefund(); } } + $item->setQty($qty); - $item->setBackToStock(isset($savedData[$orderItem->getId()]['back_to_stock'])); + + $children = $orderItem->getChildrenItems(); + if (!empty($children)) { + $item->setBackToStock(false); + } else { + $item->setBackToStock(isset($savedData[$orderItem->getId()]['back_to_stock'])); + } + $creditmemo->addItem($item); } } diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php index 116093b141..2213ac49b3 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php @@ -169,10 +169,14 @@ public function saveAction() $this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id'=>$profile->getId()))); return; } + if ($this->getRequest()->getParam('continue')) { + $this->_redirect('*/*/edit', array('id'=>$profile->getId())); + } else { + $this->_redirect('*/*'); + } } - if ($this->getRequest()->getParam('continue')) { - $this->_redirect('*/*/edit', array('id'=>$profile->getId())); - } else { + else { + Mage::getSingleton('adminhtml/session')->addError($this->__('Invalid POST data (please check post_max_size and upload_max_filesize settings in you php.ini file)')); $this->_redirect('*/*'); } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Value.php b/app/code/core/Mage/Catalog/Model/Product/Option/Value.php index da764d9e53..00dc5c7c8e 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Value.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Value.php @@ -85,6 +85,9 @@ public function setProduct($product) public function getProduct() { + if (is_null($this->_product)) { + $this->_product = $this->getOption()->getProduct(); + } return $this->_product; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php index f5302c853e..bee3743896 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php @@ -389,6 +389,12 @@ public function prepareForCart(Varien_Object $buyRequest) $product->addCustomOption('attributes', serialize($attributes)); $product->addCustomOption('product_qty_'.$subProduct->getId(), 1, $subProduct); $product->addCustomOption('simple_product', $subProduct->getId(), $subProduct); + + $subProduct->setParentProductId($product->getId()) + ->setCartQty(1); + + $result[] = $subProduct; + return $result; } } @@ -410,6 +416,10 @@ public function getOrderOptions() $options['simple_name'] = $simpleOption->getProduct()->getName(); $options['simple_sku'] = $simpleOption->getProduct()->getSku(); } + + $options['product_calculations'] = self::CALCULATE_PARENT; + $options['shipment_type'] = self::SHIPMENT_TOGETHER; + return $options; } diff --git a/app/code/core/Mage/CatalogInventory/Model/Observer.php b/app/code/core/Mage/CatalogInventory/Model/Observer.php index 6f7abbd97d..1e820cc014 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Observer.php +++ b/app/code/core/Mage/CatalogInventory/Model/Observer.php @@ -292,9 +292,13 @@ public function createOrderItem($observer) /** * Before creating order item need subtract ordered qty from product stock */ - if (!$item->getId()) { + + $children = $item->getChildrenItems(); + + if (!$item->getId() && empty($children)) { Mage::getSingleton('cataloginventory/stock')->registerItemSale($item); } + return $this; } diff --git a/app/code/core/Mage/Core/Controller/Varien/Action.php b/app/code/core/Mage/Core/Controller/Varien/Action.php index 68be066370..2c5ec363ff 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Action.php +++ b/app/code/core/Mage/Core/Controller/Varien/Action.php @@ -565,13 +565,24 @@ protected function _getRefererUrl() return $refererUrl; } + /** + * Check url to be used as internal + * + * @param string $url + * @return bool + */ protected function _isUrlInternal($url) { - if (strpos($url, 'http') !== false - && strpos($url, Mage::app()->getStore()->getBaseUrl()) !== 0) { - return false; + if (strpos($url, 'http') !== false) { + /** + * Url must start from base secure or base unsecure url + */ + if ((strpos($url, Mage::app()->getStore()->getBaseUrl()) === 0) + || (strpos($url, Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true)) === 0)) { + return true; + } } - return true; + return false; } /** diff --git a/app/code/core/Mage/Install/Model/Installer/Db.php b/app/code/core/Mage/Install/Model/Installer/Db.php index 832e0ff2b9..03688eef22 100644 --- a/app/code/core/Mage/Install/Model/Installer/Db.php +++ b/app/code/core/Mage/Install/Model/Installer/Db.php @@ -53,9 +53,10 @@ public function checkDatabase($data) $result = $connection->query($connection->quoteInto('SHOW VARIABLES LIKE ?', 'version')); $row = $result->fetch(); $version = $row['Value']; + preg_match("([0-9.]+)",$version,$toCompare); $requiredVersion = (string)Mage::getSingleton('install/config')->getNode('check/mysql/version'); - if (version_compare($version, $requiredVersion) == -1) { + if (version_compare(isset($toCompare[0])?$toCompare[0]:$version, $requiredVersion) == -1) { Mage::throwException(Mage::helper('install')->__('Database server version does not match system requirements (required: %s, actual: %s)', $requiredVersion, $version)); } } diff --git a/app/code/core/Mage/Paypal/Block/Express/Review.php b/app/code/core/Mage/Paypal/Block/Express/Review.php index 1b488adeba..6b2aeb1af1 100644 --- a/app/code/core/Mage/Paypal/Block/Express/Review.php +++ b/app/code/core/Mage/Paypal/Block/Express/Review.php @@ -62,14 +62,14 @@ public function getShippingRates() #$this->getAddress()->collectShippingRates()->save(); $groups = $this->getAddress()->getGroupedAllShippingRates(); - if (!empty($groups)) { + /*if (!empty($groups)) { $ratesFilter = new Varien_Filter_Object_Grid(); $ratesFilter->addFilter(Mage::app()->getStore()->getPriceFilter(), 'price'); foreach ($groups as $code => $groupItems) { $groups[$code] = $ratesFilter->filter($groupItems); } - } + }*/ return $this->_rates = $groups; } return $this->_rates; @@ -92,4 +92,19 @@ public function setMethod($varName) { $this->_method=$varName; } + + public function getShippingPrice($price, $flag) + { + return $this->formatPrice($this->helper('tax')->getShippingPrice($price, $flag, $this->getAddress())); + } + + public function formatPrice($price) + { + return $this->getReview()->getQuote()->getStore()->convertPrice($price, true); + } + + public function isVirtual() + { + return $this->getReview()->getQuote()->getIsVirtual(); + } } \ No newline at end of file diff --git a/app/code/core/Mage/Paypal/Model/Api/Nvp.php b/app/code/core/Mage/Paypal/Model/Api/Nvp.php index a90b7f70cf..b8a82d5a3f 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Nvp.php +++ b/app/code/core/Mage/Paypal/Model/Api/Nvp.php @@ -231,7 +231,11 @@ public function callDoDirectPayment() { $p = $this->getPayment(); $a = $this->getBillingAddress(); - $s = $this->getShippingAddress(); + if ($this->getShippingAddress()) { + $s = $this->getShippingAddress(); + } else { + $s = $a; + } $nvpArr = array( 'PAYMENTACTION' => $this->getPaymentType(), diff --git a/app/code/core/Mage/Paypal/Model/Express.php b/app/code/core/Mage/Paypal/Model/Express.php index 08cb3c6f17..b54fa18049 100644 --- a/app/code/core/Mage/Paypal/Model/Express.php +++ b/app/code/core/Mage/Paypal/Model/Express.php @@ -181,7 +181,11 @@ public function shortcutSetExpressCheckout() public function markSetExpressCheckout() { - $address = $this->getQuote()->getShippingAddress(); + if ($this->getQuote()->isVirtual()) { + $address = $this->getQuote()->getBillingAddress(); + } else { + $address = $this->getQuote()->getShippingAddress(); + } $this->getApi() ->setPaymentType($this->getPaymentAction()) ->setAmount($address->getBaseGrandTotal()) @@ -191,7 +195,7 @@ public function markSetExpressCheckout() $this->catchError(); - $this->getSession()->setExpressCheckoutMethod('mark'); + $this->getSession()->setExpressCheckoutMethod('mark'); return $this; } @@ -307,6 +311,7 @@ public function capture(Varien_Object $payment, $amount) public function placeOrder(Varien_Object $payment) { $api = $this->getApi(); + $api->setAmount($payment->getOrder()->getBaseGrandTotal()) ->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode()); diff --git a/app/code/core/Mage/Paypal/Model/Express/Review.php b/app/code/core/Mage/Paypal/Model/Express/Review.php index 6aa77599ce..fd300d7d81 100644 --- a/app/code/core/Mage/Paypal/Model/Express/Review.php +++ b/app/code/core/Mage/Paypal/Model/Express/Review.php @@ -95,7 +95,12 @@ public function saveOrder() $order = Mage::getModel('sales/order'); /* @var $order Mage_Sales_Model_Order */ - $order = $convertQuote->addressToOrder($shipping); + if ($this->getQuote()->isVirtual()) { + $order = $convertQuote->addressToOrder($billing); + } else { + $order = $convertQuote->addressToOrder($shipping); + } + $order->setBillingAddress($convertQuote->addressToOrderAddress($billing)); $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping)); $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment())); diff --git a/app/code/core/Mage/Paypal/Model/Standard.php b/app/code/core/Mage/Paypal/Model/Standard.php index b59e183587..b0a47b474a 100644 --- a/app/code/core/Mage/Paypal/Model/Standard.php +++ b/app/code/core/Mage/Paypal/Model/Standard.php @@ -127,7 +127,13 @@ public function getOrderPlaceRedirectUrl() public function getStandardCheckoutFormFields() { - $a = $this->getQuote()->getShippingAddress(); + if ($this->getQuote()->getIsVirtual()) { + $a = $this->getQuote()->getBillingAddress(); + $b = $this->getQuote()->getShippingAddress(); + } else { + $a = $this->getQuote()->getShippingAddress(); + $b = $this->getQuote()->getBillingAddress(); + } //getQuoteCurrencyCode $currency_code = $this->getQuote()->getBaseCurrencyCode(); /* @@ -181,14 +187,16 @@ public function getStandardCheckoutFormFields() if ($transaciton_type=='O') { $businessName = Mage::getStoreConfig('paypal/wps/business_name'); $storeName = Mage::getStoreConfig('store/system/name'); - $amount = $a->getBaseSubtotal()-$a->getBaseDiscountAmount(); + $amount = ($a->getBaseSubtotal()+$b->getBaseSubtotal())-($a->getBaseDiscountAmount()+$b->getBaseDiscountAmount()); $sArr = array_merge($sArr, array( 'cmd' => '_ext-enter', 'redirect_cmd' => '_xclick', 'item_name' => $businessName ? $businessName : $storeName, 'amount' => sprintf('%.2f', $amount), )); - $tax = sprintf('%.2f', $this->getQuote()->getShippingAddress()->getBaseTaxAmount()); + $_shippingTax = $this->getQuote()->getShippingAddress()->getBaseTaxAmount(); + $_billingTax = $this->getQuote()->getBillingAddress()->getBaseTaxAmount(); + $tax = sprintf('%.2f', $_shippingTax + $_billingTax); if ($tax>0) { $sArr = array_merge($sArr, array( 'tax' => $tax @@ -226,16 +234,18 @@ public function getStandardCheckoutFormFields() $totalArr = $a->getTotals(); $shipping = sprintf('%.2f', $this->getQuote()->getShippingAddress()->getBaseShippingAmount()); - if ($shipping>0) { + if ($shipping>0 && !$this->getQuote()->getIsVirtual()) { if ($transaciton_type=='O') { $sArr = array_merge($sArr, array( 'shipping' => $shipping )); } else { + $shippingTax = $this->getQuote()->getShippingAddress()->getBaseShippingTaxAmount(); $sArr = array_merge($sArr, array( 'item_name_'.$i => $totalArr['shipping']->getTitle(), 'quantity_'.$i => 1, 'amount_'.$i => $shipping, + 'tax_'.$i => sprintf('%.2f',$shippingTax), )); $i++; } diff --git a/app/code/core/Mage/Paypal/controllers/ExpressController.php b/app/code/core/Mage/Paypal/controllers/ExpressController.php index da683b164c..ea6700619b 100644 --- a/app/code/core/Mage/Paypal/controllers/ExpressController.php +++ b/app/code/core/Mage/Paypal/controllers/ExpressController.php @@ -152,12 +152,13 @@ public function saveOrderAction() if (!$address->getShippingMethod()) { if ($shippingMethod = $this->getRequest()->getParam('shipping_method')) { $this->getReview()->saveShippingMethod($shippingMethod); - } else { + } else if (!$this->getReview()->getQuote()->getIsVirtual()) { $payPalSession->addError(Mage::helper('paypal')->__('Please select a valid shipping method')); $this->_redirect('paypal/express/review'); return; } } + $billing = $this->getReview()->getQuote()->getBillingAddress(); $shipping = $this->getReview()->getQuote()->getShippingAddress(); @@ -239,7 +240,12 @@ public function saveOrderAction() $order = Mage::getModel('sales/order'); /* @var $order Mage_Sales_Model_Order */ - $order = $convertQuote->addressToOrder($shipping); + if ($this->getReview()->getQuote()->isVirtual()) { + $order = $convertQuote->addressToOrder($billing); + } else { + $order = $convertQuote->addressToOrder($shipping); + } + $order->setBillingAddress($convertQuote->addressToOrderAddress($billing)); $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping)); $order->setPayment($convertQuote->paymentToOrderPayment($this->getReview()->getQuote()->getPayment())); diff --git a/app/code/core/Mage/PaypalUk/Block/Express/Review.php b/app/code/core/Mage/PaypalUk/Block/Express/Review.php index 1e38c348a3..b6f03ddc1b 100644 --- a/app/code/core/Mage/PaypalUk/Block/Express/Review.php +++ b/app/code/core/Mage/PaypalUk/Block/Express/Review.php @@ -62,14 +62,14 @@ public function getShippingRates() #$this->getAddress()->collectShippingRates()->save(); $groups = $this->getAddress()->getGroupedAllShippingRates(); - if (!empty($groups)) { + /*if (!empty($groups)) { $ratesFilter = new Varien_Filter_Object_Grid(); $ratesFilter->addFilter(Mage::app()->getStore()->getPriceFilter(), 'price'); foreach ($groups as $code => $groupItems) { $groups[$code] = $ratesFilter->filter($groupItems); } - } + }*/ return $this->_rates = $groups; } return $this->_rates; @@ -92,4 +92,19 @@ public function setMethod($varName) { $this->_method=$varName; } + + public function getShippingPrice($price, $flag) + { + return $this->formatPrice($this->helper('tax')->getShippingPrice($price, $flag, $this->getAddress())); + } + + public function formatPrice($price) + { + return $this->getReview()->getQuote()->getStore()->convertPrice($price, true); + } + + public function isVirtual() + { + return $this->getReview()->getQuote()->getIsVirtual(); + } } \ No newline at end of file diff --git a/app/code/core/Mage/PaypalUk/Model/Api/Pro.php b/app/code/core/Mage/PaypalUk/Model/Api/Pro.php index 0197f687d8..1d082f4e2e 100644 --- a/app/code/core/Mage/PaypalUk/Model/Api/Pro.php +++ b/app/code/core/Mage/PaypalUk/Model/Api/Pro.php @@ -82,7 +82,11 @@ public function callDoDirectPayment() { $p = $this->getPayment(); $a = $this->getBillingAddress(); - $s = $this->getShippingAddress(); + if ($this->getShippingAddress()) { + $s = $this->getShippingAddress(); + } else { + $s = $a; + } $proArr = array( 'TENDER' => self::TENDER_CC, diff --git a/app/code/core/Mage/PaypalUk/Model/Express.php b/app/code/core/Mage/PaypalUk/Model/Express.php index abcf3d2345..e735c60876 100644 --- a/app/code/core/Mage/PaypalUk/Model/Express.php +++ b/app/code/core/Mage/PaypalUk/Model/Express.php @@ -125,7 +125,11 @@ public function createFormBlock($name) */ public function markSetExpressCheckout() { - $address = $this->getQuote()->getShippingAddress(); + if ($this->getQuote()->isVirtual()) { + $address = $this->getQuote()->getBillingAddress(); + } else { + $address = $this->getQuote()->getShippingAddress(); + } $this->getApi() ->setTrxtype($this->getPaymentAction()) diff --git a/app/code/core/Mage/PaypalUk/Model/Express/Review.php b/app/code/core/Mage/PaypalUk/Model/Express/Review.php index 9cf318fe76..ae78855f31 100644 --- a/app/code/core/Mage/PaypalUk/Model/Express/Review.php +++ b/app/code/core/Mage/PaypalUk/Model/Express/Review.php @@ -96,7 +96,11 @@ public function saveOrder() $order = Mage::getModel('sales/order'); /* @var $order Mage_Sales_Model_Order */ - $order = $convertQuote->addressToOrder($shipping); + if ($this->getQuote()->isVirtual()) { + $order = $convertQuote->addressToOrder($billing); + } else { + $order = $convertQuote->addressToOrder($shipping); + } $order->setBillingAddress($convertQuote->addressToOrderAddress($billing)); $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping)); $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment())); diff --git a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php index 789dba8369..12314672ef 100644 --- a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php +++ b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php @@ -156,7 +156,7 @@ public function saveOrderAction() if (!$address->getShippingMethod()) { if ($shippingMethod = $this->getRequest()->getParam('shipping_method')) { $this->getReview()->saveShippingMethod($shippingMethod); - } else { + } else if (!$this->getReview()->getQuote()->getIsVirtual()) { $payPalSession->addError(Mage::helper('paypalUk')->__('Please select a valid shipping method')); $this->_redirect('paypaluk/express/review'); return; @@ -243,7 +243,11 @@ public function saveOrderAction() $order = Mage::getModel('sales/order'); /* @var $order Mage_Sales_Model_Order */ - $order = $convertQuote->addressToOrder($shipping); + if ($this->getReview()->getQuote()->isVirtual()) { + $order = $convertQuote->addressToOrder($billing); + } else { + $order = $convertQuote->addressToOrder($shipping); + } $order->setBillingAddress($convertQuote->addressToOrderAddress($billing)); $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping)); $order->setPayment($convertQuote->paymentToOrderPayment($this->getReview()->getQuote()->getPayment())); diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php index 414fc4219d..4667bbee82 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php @@ -125,10 +125,14 @@ public function register() { $orderItem = $this->getOrderItem(); $orderItem->setQtyInvoiced($orderItem->getQtyInvoiced()+$this->getQty()); + $orderItem->setTaxInvoiced($orderItem->getTaxInvoiced()+$this->getTaxAmount()); + $orderItem->setBaseTaxInvoiced($orderItem->getBaseTaxInvoiced()+$this->getBaseTaxAmount()); + $orderItem->setDiscountInvoiced($orderItem->getDiscountInvoiced()+$this->getDiscountAmount()); - $orderItem->setRowInvoiced($orderItem->getRowInvoiced()+$this->getRowTotal()); $orderItem->setBaseDiscountInvoiced($orderItem->getBaseDiscountInvoiced()+$this->getBaseDiscountAmount()); + + $orderItem->setRowInvoiced($orderItem->getRowInvoiced()+$this->getRowTotal()); $orderItem->setBaseRowInvoiced($orderItem->getBaseRowInvoiced()+$this->getBaseRowTotal()); return $this; } @@ -142,10 +146,14 @@ public function cancel() { $orderItem = $this->getOrderItem(); $orderItem->setQtyInvoiced($orderItem->getQtyInvoiced()-$this->getQty()); + $orderItem->setTaxInvoiced($orderItem->getTaxInvoiced()-$this->getTaxAmount()); + $orderItem->setBaseTaxInvoiced($orderItem->getBaseTaxInvoiced()-$this->getBaseTaxAmount()); + $orderItem->setDiscountInvoiced($orderItem->getDiscountInvoiced()-$this->getDiscountAmount()); - $orderItem->setRowInvoiced($orderItem->getRowInvoiced()-$this->getRowTotal()); $orderItem->setBaseDiscountInvoiced($orderItem->getBaseDiscountInvoiced()-$this->getBaseDiscountAmount()); + + $orderItem->setRowInvoiced($orderItem->getRowInvoiced()-$this->getRowTotal()); $orderItem->setBaseRowInvoiced($orderItem->getBaseRowInvoiced()-$this->getBaseRowTotal()); return $this; } diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php index 36467f4218..464c3ccaa3 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php @@ -325,7 +325,7 @@ public function getOriginalPrice() */ public function getTaxAmount() { - if ($this->getHasChildren() && $this->getProduct()->getPriceType() == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { + if ($this->getHasChildren() && $this->getProduct()->getPriceType() === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { $amount = 0; foreach ($this->getChildren() as $child) { $amount+= $child->getTaxAmount(); @@ -344,7 +344,7 @@ public function getTaxAmount() */ public function getPrice() { - if ($this->getHasChildren() && $this->getProduct()->getPriceType() == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { + if ($this->getHasChildren() && $this->getProduct()->getPriceType() === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { $price = $this->_getData('price'); /* foreach ($this->getChildren() as $child) { @@ -455,7 +455,7 @@ public function isChildrenCalculated() { $calculate = $this->getProduct()->getPriceType(); } - if ($calculate == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { + if ($calculate === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { return true; } return false; @@ -475,7 +475,7 @@ public function isShipSeparately() { $shipmentType = $this->getProduct()->getShipmentType(); } - if ($shipmentType == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) { + if ($shipmentType === Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) { return true; } return false; diff --git a/app/design/adminhtml/default/default/template/system/convert/profile/upload.phtml b/app/design/adminhtml/default/default/template/system/convert/profile/upload.phtml index 0ee80904a4..9409dd6353 100755 --- a/app/design/adminhtml/default/default/template/system/convert/profile/upload.phtml +++ b/app/design/adminhtml/default/default/template/system/convert/profile/upload.phtml @@ -1,4 +1,13 @@

Upload File

+
+ +
Upload File diff --git a/app/design/frontend/default/default/template/paypal/express/review.phtml b/app/design/frontend/default/default/template/paypal/express/review.phtml index b88c0c921c..7b3374d371 100644 --- a/app/design/frontend/default/default/template/paypal/express/review.phtml +++ b/app/design/frontend/default/default/template/paypal/express/review.phtml @@ -40,38 +40,48 @@

__('Shipping Method') ?>

- - getShippingRates())): ?> - __('Sorry, no quotes are available for this order at this time.') ?> + isVirtual()): ?> + __('No shipping method required.') ?> - -
- + getAddressShippingMethod()): ?> + + + $_rates): ?> + + + getErrorMessage()): ?> + + + + + + - - - -

- -
+ +

+ + + - @@ -117,7 +127,9 @@