Version Notes
1.5.0.0.23.0 version of package
internal svn revision #3cd616975d5927903d4f34bde0d9e5e2e727e9ba
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Magento_Mobile |
| Version | 1.5.0.0.23.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.2.0.23.0 to 1.5.0.0.23.0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php +0 -20
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php +17 -17
- app/code/core/Mage/XmlConnect/Block/Cart.php +12 -12
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php +0 -29
- app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php +4 -4
- app/code/core/Mage/XmlConnect/Block/Cart/Items.php +11 -11
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Cart/Totals.php +4 -5
- app/code/core/Mage/XmlConnect/Block/Catalog.php +4 -4
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Giftcard.php +12 -11
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +20 -20
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +26 -26
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +10 -10
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php +3 -3
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php +237 -237
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php +6 -6
- app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php +48 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Configurable.php +2 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Grouped.php +2 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/Form.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/List.php +4 -4
- app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php +12 -12
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php +3 -3
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php +27 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php +9 -9
- app/code/core/Mage/XmlConnect/Block/Checkout/Pbridge/Result.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Configuration.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php +35 -0
- app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php +12 -12
- app/code/core/Mage/XmlConnect/Block/Customer/Form.php +1 -121
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php +6 -7
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php +0 -12
- app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php +10 -10
- app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php +7 -9
- app/code/core/Mage/XmlConnect/Block/Homebanners.php +4 -5
- app/code/core/Mage/XmlConnect/Block/Localization.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Review/Form.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Wishlist.php +15 -14
- app/code/core/Mage/XmlConnect/Controller/AdminAction.php +10 -3
- app/code/core/Mage/XmlConnect/Helper/AdminApplication.php +2 -2
- app/code/core/Mage/XmlConnect/Helper/Android.php +35 -86
- app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php +3 -3
- app/code/core/Mage/XmlConnect/Helper/Customer/Order.php +10 -10
- app/code/core/Mage/XmlConnect/Helper/Data.php +1 -2
- app/code/core/Mage/XmlConnect/Helper/Image.php +5 -2
- app/code/core/Mage/XmlConnect/Helper/Iphone.php +11 -226
- app/code/core/Mage/XmlConnect/Helper/Theme.php +2 -1
- app/code/core/Mage/XmlConnect/Model/AdminApplication.php +0 -40
- app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Category.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Application.php +7 -3
- app/code/core/Mage/XmlConnect/Model/ConfigData.php +5 -8
- app/code/core/Mage/XmlConnect/Model/Configuration.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Session.php +0 -137
- app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Type/Onepage.php +0 -465
- app/code/core/Mage/XmlConnect/Model/Corefix/Sales/Quote.php +0 -427
- app/code/core/Mage/XmlConnect/Model/ImageLimits.php +3 -8
- app/code/core/Mage/XmlConnect/Model/Images.php +29 -21
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php +21 -0
- app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php +2 -3
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Validator/Abstract.php +14 -15
- app/code/core/Mage/XmlConnect/Model/Simplexml/Message/Error.php +2 -3
- app/code/core/Mage/XmlConnect/controllers/Adminhtml/Connect/ConfigController.php +2 -2
- app/code/core/Mage/XmlConnect/controllers/Adminhtml/MobileController.php +2 -2
- app/code/core/Mage/XmlConnect/controllers/CartController.php +2 -2
- app/code/core/Mage/XmlConnect/controllers/CatalogController.php +20 -58
- app/code/core/Mage/XmlConnect/controllers/CheckoutController.php +0 -1
- app/code/core/Mage/XmlConnect/controllers/Paypal/MepController.php +4 -6
- app/code/core/Mage/XmlConnect/controllers/WishlistController.php +3 -1
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-data-upgrade-1.6.0.0-1.6.0.0.1.php +4 -5
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +1 -14
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/content.phtml +3 -3
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design.phtml +2 -2
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/autocomplete.phtml +3 -3
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview_android.phtml +14 -12
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview_ipad.phtml +14 -12
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview_iphone.phtml +14 -12
- app/design/adminhtml/default/default/template/xmlconnect/form/element/app_tabs_android.phtml +4 -4
- app/design/adminhtml/default/default/template/xmlconnect/form/element/app_tabs_ipad.phtml +4 -4
- app/design/adminhtml/default/default/template/xmlconnect/form/element/app_tabs_iphone.phtml +4 -4
- app/design/adminhtml/default/default/template/xmlconnect/mobile/notification_helper.phtml +6 -6
- app/design/adminhtml/default/default/template/xmlconnect/submission/app_icons_preview.phtml +0 -2
- package.xml +5 -5
app/code/core/Mage/XmlConnect/Block/Adminhtml/Admin/Application/Edit/Tab/Settings.php
CHANGED
|
@@ -59,7 +59,7 @@ class Mage_XmlConnect_Block_Adminhtml_Admin_Application_Edit_Tab_Settings
|
|
| 59 |
'title' => $this->__('Enable Admin Application'),
|
| 60 |
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
| 61 |
'required' => true,
|
| 62 |
-
'value' => Mage::getSingleton('xmlconnect/configuration')->isActiveAdminApp()
|
| 63 |
));
|
| 64 |
|
| 65 |
$this->setForm($form);
|
| 59 |
'title' => $this->__('Enable Admin Application'),
|
| 60 |
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
| 61 |
'required' => true,
|
| 62 |
+
'value' => (int)Mage::getSingleton('xmlconnect/configuration')->isActiveAdminApp()
|
| 63 |
));
|
| 64 |
|
| 65 |
$this->setForm($form);
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Config.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Adminhtml_Connect_Config extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render login form xml
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Adminhtml_Connect_Config extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render login form xml
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Simple xml object
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Simple xml object
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphInfo.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Time range filter options
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Time range filter options
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/TopSearchTerms.php
CHANGED
|
@@ -82,7 +82,7 @@ class Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
|
|
| 82 |
* Add last search terms info to xml object
|
| 83 |
*
|
| 84 |
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
|
| 85 |
-
* @return
|
| 86 |
*/
|
| 87 |
public function addTopSearchTermsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
|
| 88 |
{
|
| 82 |
* Add last search terms info to xml object
|
| 83 |
*
|
| 84 |
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
|
| 85 |
+
* @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
|
| 86 |
*/
|
| 87 |
public function addTopSearchTermsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
|
| 88 |
{
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Loginform.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Adminhtml_Connect_Loginform extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render login form xml
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Adminhtml_Connect_Loginform extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render login form xml
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Content.php
CHANGED
|
@@ -104,26 +104,6 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Content
|
|
| 104 |
return $this;
|
| 105 |
}
|
| 106 |
|
| 107 |
-
/**
|
| 108 |
-
* Retrieve add page button
|
| 109 |
-
*
|
| 110 |
-
* @return string
|
| 111 |
-
*/
|
| 112 |
-
public function getAddButtonHtml()
|
| 113 |
-
{
|
| 114 |
-
return $this->getChildHtml('add_button');
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
/**
|
| 118 |
-
* Retrieve delete page button
|
| 119 |
-
*
|
| 120 |
-
* @return string
|
| 121 |
-
*/
|
| 122 |
-
public function getDeleteButtonHtml()
|
| 123 |
-
{
|
| 124 |
-
return $this->getChildHtml('delete_button');
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
/**
|
| 128 |
* Prepare label for tab
|
| 129 |
*
|
| 104 |
return $this;
|
| 105 |
}
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
/**
|
| 108 |
* Prepare label for tab
|
| 109 |
*
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/Design/Images.php
CHANGED
|
@@ -168,7 +168,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Design_Images extends Mage
|
|
| 168 |
/**
|
| 169 |
* Retrieve image config object
|
| 170 |
*
|
| 171 |
-
* @return
|
| 172 |
*/
|
| 173 |
public function getConfig()
|
| 174 |
{
|
| 168 |
/**
|
| 169 |
* Retrieve image config object
|
| 170 |
*
|
| 171 |
+
* @return Varien_Object
|
| 172 |
*/
|
| 173 |
public function getConfig()
|
| 174 |
{
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Tab/Container/Submission.php
CHANGED
|
@@ -191,7 +191,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tab_Container_Submission
|
|
| 191 |
$fieldset->addField('conf/submit_text/contact_email', 'text', array(
|
| 192 |
'name' => 'conf[submit_text][email]',
|
| 193 |
'label' => $this->__('Contact Email'),
|
| 194 |
-
'class' => 'email',
|
| 195 |
'maxlength' => '40',
|
| 196 |
'value' => isset($formData['conf[submit_text][email]']) ? $formData['conf[submit_text][email]'] : null,
|
| 197 |
'note' => $this->__('Administrative contact for this app and for app submission issues.'),
|
|
@@ -270,54 +270,54 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Tab_Container_Submission
|
|
| 270 |
switch ($deviceType) {
|
| 271 |
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
|
| 272 |
$this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
|
| 273 |
-
$this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Required size:
|
| 274 |
|
| 275 |
$this->addImage($fieldset, 'conf/submit/loader_image', $this->__('Loader Splash Screen'),
|
| 276 |
-
$this->__('Image that appears on first screen while your app is loading. Required size:
|
| 277 |
|
| 278 |
$this->addImage($fieldset, 'conf/submit/loader_image_i4', $this->__('Loader Splash Screen <br />(iPhone 4 retina)'),
|
| 279 |
-
$this->__('Image that appears on first screen while your app is loading. Required size:
|
| 280 |
|
| 281 |
$this->addImage($fieldset, 'conf/submit/logo', $this->__('Custom App Icon'),
|
| 282 |
-
$this->__('Icon that will appear on the user
|
| 283 |
|
| 284 |
$this->addImage($fieldset, 'conf/submit/logo_i4', $this->__('Custom App Icon <br />(iPhone 4 retina)'),
|
| 285 |
-
$this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size:
|
| 286 |
|
| 287 |
$this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
|
| 288 |
-
$this->__('Store logo that is displayed on copyright page of app. Preferred size:
|
| 289 |
|
| 290 |
$this->addImage($fieldset, 'conf/submit/big_logo_i4', $this->__('Copyright Page Logo <br />(iPhone 4 retina)'),
|
| 291 |
-
$this->__('Store logo that is displayed on copyright page of app. Preferred size:
|
| 292 |
break;
|
| 293 |
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
|
| 294 |
$this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
|
| 295 |
-
$this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Required size:
|
| 296 |
|
| 297 |
$this->addImage($fieldset, 'conf/submit/ipad_loader_portrait_image', $this->__('Loader Splash Screen <br />(portrait mode)'),
|
| 298 |
-
$this->__('Image that appears on first screen while your app is loading. Required size:
|
| 299 |
|
| 300 |
$this->addImage($fieldset, 'conf/submit/ipad_loader_landscape_image', $this->__('Loader Splash Screen <br />(landscape mode)'),
|
| 301 |
-
$this->__('Image that appears on first screen while your app is loading. Required size:
|
| 302 |
|
| 303 |
$this->addImage($fieldset, 'conf/submit/ipad_logo', $this->__('Custom App Icon'),
|
| 304 |
-
$this->__('Icon that will appear on the user\'s device after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple). Recommended size:
|
| 305 |
|
| 306 |
$this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
|
| 307 |
-
$this->__('Store logo that is displayed on copyright page of app. Preferred size:
|
| 308 |
break;
|
| 309 |
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
|
| 310 |
$this->addImage($fieldset, 'conf/submit/icon', $this->__('High Resolution Application Icon'),
|
| 311 |
-
$this->__('The icon that appears in the Android Market. Recommended size:
|
| 312 |
|
| 313 |
$this->addImage($fieldset, 'conf/submit/android_loader_image', $this->__('Loader Splash Screen'),
|
| 314 |
-
$this->__('Image that appears on first screen while your app is loading. Required size:
|
| 315 |
|
| 316 |
$this->addImage($fieldset, 'conf/submit/android_logo', $this->__('Custom App Icon'),
|
| 317 |
-
$this->__('Icon that will appear on the user\'s device after they download your app. Recommended size:
|
| 318 |
|
| 319 |
$this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
|
| 320 |
-
$this->__('Store logo that is displayed on copyright page of app. Preferred size:
|
| 321 |
break;
|
| 322 |
}
|
| 323 |
|
| 191 |
$fieldset->addField('conf/submit_text/contact_email', 'text', array(
|
| 192 |
'name' => 'conf[submit_text][email]',
|
| 193 |
'label' => $this->__('Contact Email'),
|
| 194 |
+
'class' => 'validate-email email',
|
| 195 |
'maxlength' => '40',
|
| 196 |
'value' => isset($formData['conf[submit_text][email]']) ? $formData['conf[submit_text][email]'] : null,
|
| 197 |
'note' => $this->__('Administrative contact for this app and for app submission issues.'),
|
| 270 |
switch ($deviceType) {
|
| 271 |
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
|
| 272 |
$this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
|
| 273 |
+
$this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Required size: %spx x %spx.', 512, 512), '', true);
|
| 274 |
|
| 275 |
$this->addImage($fieldset, 'conf/submit/loader_image', $this->__('Loader Splash Screen'),
|
| 276 |
+
$this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 320, 460), '', true);
|
| 277 |
|
| 278 |
$this->addImage($fieldset, 'conf/submit/loader_image_i4', $this->__('Loader Splash Screen <br />(iPhone 4 retina)'),
|
| 279 |
+
$this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 640, 920), '', false);
|
| 280 |
|
| 281 |
$this->addImage($fieldset, 'conf/submit/logo', $this->__('Custom App Icon'),
|
| 282 |
+
$this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Recommended size: %spx x %spx at %s dpi.', 57, 57, 72), '', true);
|
| 283 |
|
| 284 |
$this->addImage($fieldset, 'conf/submit/logo_i4', $this->__('Custom App Icon <br />(iPhone 4 retina)'),
|
| 285 |
+
$this->__('Icon that will appear on the user\'s phone after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Recommended size: %spx x %spx.', 114, 114), '', false);
|
| 286 |
|
| 287 |
$this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
|
| 288 |
+
$this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 100, 100), '', true);
|
| 289 |
|
| 290 |
$this->addImage($fieldset, 'conf/submit/big_logo_i4', $this->__('Copyright Page Logo <br />(iPhone 4 retina)'),
|
| 291 |
+
$this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 200, 200), '', false);
|
| 292 |
break;
|
| 293 |
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
|
| 294 |
$this->addImage($fieldset, 'conf/submit/icon', $this->__('Large iTunes Icon'),
|
| 295 |
+
$this->__('Large icon that appears in the iTunes App Store. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Required size: %spx x %spx.', 512, 512), '', true);
|
| 296 |
|
| 297 |
$this->addImage($fieldset, 'conf/submit/ipad_loader_portrait_image', $this->__('Loader Splash Screen <br />(portrait mode)'),
|
| 298 |
+
$this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 768, 1024), '', true);
|
| 299 |
|
| 300 |
$this->addImage($fieldset, 'conf/submit/ipad_loader_landscape_image', $this->__('Loader Splash Screen <br />(landscape mode)'),
|
| 301 |
+
$this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 1024, 768), '', true);
|
| 302 |
|
| 303 |
$this->addImage($fieldset, 'conf/submit/ipad_logo', $this->__('Custom App Icon'),
|
| 304 |
+
$this->__('Icon that will appear on the user\'s device after they download your app. You do not need to apply a gradient or soft edges (this is done automatically by Apple).') . $this->__('Recommended size: %spx x %spx.', 72, 72), '', true);
|
| 305 |
|
| 306 |
$this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
|
| 307 |
+
$this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 100, 100), '', true);
|
| 308 |
break;
|
| 309 |
case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
|
| 310 |
$this->addImage($fieldset, 'conf/submit/icon', $this->__('High Resolution Application Icon'),
|
| 311 |
+
$this->__('The icon that appears in the Android Market.') . $this->__('Recommended size: %spx x %spx.', 512, 512) . $this->__('Maximum size: %s KB.', 1024), '', true);
|
| 312 |
|
| 313 |
$this->addImage($fieldset, 'conf/submit/android_loader_image', $this->__('Loader Splash Screen'),
|
| 314 |
+
$this->__('Image that appears on first screen while your app is loading.') . $this->__('Required size: %spx x %spx.', 320, 455), '', true);
|
| 315 |
|
| 316 |
$this->addImage($fieldset, 'conf/submit/android_logo', $this->__('Custom App Icon'),
|
| 317 |
+
$this->__('Icon that will appear on the user\'s device after they download your app.') . $this->__('Recommended size: %spx x %spx.', 48, 48), '', true);
|
| 318 |
|
| 319 |
$this->addImage($fieldset, 'conf/submit/big_logo', $this->__('Copyright Page Logo'),
|
| 320 |
+
$this->__('Store logo that is displayed on copyright page of app.') . $this->__('Preferred size: %spx x %spx.', 100, 100), '', true);
|
| 321 |
break;
|
| 322 |
}
|
| 323 |
|
app/code/core/Mage/XmlConnect/Block/Cart.php
CHANGED
|
@@ -84,13 +84,13 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
| 84 |
}
|
| 85 |
}
|
| 86 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 87 |
-
$
|
| 88 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 89 |
&& $item->getWeeeTaxAppliedAmount()
|
| 90 |
) {
|
| 91 |
-
$inclPrice = $
|
| 92 |
} else {
|
| 93 |
-
$inclPrice = $
|
| 94 |
}
|
| 95 |
}
|
| 96 |
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
|
@@ -150,13 +150,13 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
| 150 |
}
|
| 151 |
}
|
| 152 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 153 |
-
$
|
| 154 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 155 |
&& $item->getWeeeTaxAppliedAmount()
|
| 156 |
) {
|
| 157 |
-
$inclPrice = $
|
| 158 |
} else {
|
| 159 |
-
$inclPrice = $
|
| 160 |
}
|
| 161 |
}
|
| 162 |
|
|
@@ -189,14 +189,14 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
| 189 |
/**
|
| 190 |
* Options list
|
| 191 |
*/
|
| 192 |
-
$
|
| 193 |
-
if ($
|
| 194 |
$itemOptionsXml = $itemXml->addChild('options');
|
| 195 |
-
foreach ($
|
| 196 |
-
$
|
| 197 |
$optionXml = $itemOptionsXml->addChild('option');
|
| 198 |
-
$optionXml->addAttribute('label', $xmlObject->xmlAttribute($
|
| 199 |
-
$optionXml->addAttribute('text', $xmlObject->xmlAttribute($
|
| 200 |
}
|
| 201 |
}
|
| 202 |
|
| 84 |
}
|
| 85 |
}
|
| 86 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 87 |
+
$incl = $this->helper('checkout')->getPriceInclTax($item);
|
| 88 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 89 |
&& $item->getWeeeTaxAppliedAmount()
|
| 90 |
) {
|
| 91 |
+
$inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
|
| 92 |
} else {
|
| 93 |
+
$inclPrice = $incl - $item->getWeeeTaxDisposition();
|
| 94 |
}
|
| 95 |
}
|
| 96 |
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
| 150 |
}
|
| 151 |
}
|
| 152 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 153 |
+
$incl = $this->helper('checkout')->getSubtotalInclTax($item);
|
| 154 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 155 |
&& $item->getWeeeTaxAppliedAmount()
|
| 156 |
) {
|
| 157 |
+
$inclPrice = $incl + $item->getWeeeTaxAppliedRowAmount();
|
| 158 |
} else {
|
| 159 |
+
$inclPrice = $incl - $item->getWeeeTaxRowDisposition();
|
| 160 |
}
|
| 161 |
}
|
| 162 |
|
| 189 |
/**
|
| 190 |
* Options list
|
| 191 |
*/
|
| 192 |
+
$options = $renderer->getOptionList();
|
| 193 |
+
if ($options) {
|
| 194 |
$itemOptionsXml = $itemXml->addChild('options');
|
| 195 |
+
foreach ($options as $option) {
|
| 196 |
+
$formattedOptionValue = $renderer->getFormatedOptionValue($option);
|
| 197 |
$optionXml = $itemOptionsXml->addChild('option');
|
| 198 |
+
$optionXml->addAttribute('label', $xmlObject->xmlAttribute($option['label']));
|
| 199 |
+
$optionXml->addAttribute('text', $xmlObject->xmlAttribute($formattedOptionValue['value']));
|
| 200 |
}
|
| 201 |
}
|
| 202 |
|
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals.php
CHANGED
|
@@ -40,13 +40,6 @@ class Mage_XmlConnect_Block_Cart_CartTotals extends Mage_Checkout_Block_Cart_Tot
|
|
| 40 |
*/
|
| 41 |
protected $_defaultRenderer = 'xmlconnect/cart_cartTotals_default';
|
| 42 |
|
| 43 |
-
/**
|
| 44 |
-
* Cart xml object
|
| 45 |
-
*
|
| 46 |
-
* @var null|Mage_XmlConnect_Model_Simplexml_Element
|
| 47 |
-
*/
|
| 48 |
-
protected $_cartXmlObject;
|
| 49 |
-
|
| 50 |
/**
|
| 51 |
* Render cart totals xml
|
| 52 |
*
|
|
@@ -99,26 +92,4 @@ class Mage_XmlConnect_Block_Cart_CartTotals extends Mage_Checkout_Block_Cart_Tot
|
|
| 99 |
$block->setTotals($this->getTotals());
|
| 100 |
return $block;
|
| 101 |
}
|
| 102 |
-
|
| 103 |
-
/**
|
| 104 |
-
* Set cart xml object
|
| 105 |
-
*
|
| 106 |
-
* @param Mage_XmlConnect_Model_Simplexml_Element $cartXmlObject
|
| 107 |
-
* @return Mage_XmlConnect_Block_Cart_CartTotals
|
| 108 |
-
*/
|
| 109 |
-
public function setCartXmlObject($cartXmlObject)
|
| 110 |
-
{
|
| 111 |
-
$this->_cartXmlObject = $cartXmlObject;
|
| 112 |
-
return $this;
|
| 113 |
-
}
|
| 114 |
-
|
| 115 |
-
/**
|
| 116 |
-
* Get cart xml object
|
| 117 |
-
*
|
| 118 |
-
* @return Mage_XmlConnect_Model_Simplexml_Element|null
|
| 119 |
-
*/
|
| 120 |
-
public function getCartXmlObject()
|
| 121 |
-
{
|
| 122 |
-
return $this->_cartXmlObject;
|
| 123 |
-
}
|
| 124 |
}
|
| 40 |
*/
|
| 41 |
protected $_defaultRenderer = 'xmlconnect/cart_cartTotals_default';
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
/**
|
| 44 |
* Render cart totals xml
|
| 45 |
*
|
| 92 |
$block->setTotals($this->getTotals());
|
| 93 |
return $block;
|
| 94 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
}
|
app/code/core/Mage/XmlConnect/Block/Cart/CartTotals/Nodes/Giftcardaccount.php
CHANGED
|
@@ -45,16 +45,16 @@ class Mage_Xmlconnect_Block_Cart_CartTotals_Nodes_Giftcardaccount extends Mage_C
|
|
| 45 |
}
|
| 46 |
/** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
|
| 47 |
$cartXmlObject = $this->getCartObject();
|
| 48 |
-
$
|
| 49 |
-
if (!$
|
| 50 |
-
$
|
| 51 |
}
|
| 52 |
$code = $this->getTotal()->getCode();
|
| 53 |
|
| 54 |
/** @var $giftCardsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
| 55 |
$giftCardsXmlObj = $cartXmlObject->addCustomChild($code);
|
| 56 |
|
| 57 |
-
foreach ($
|
| 58 |
$giftCardValue = Mage::helper('xmlconnect')->formatPriceForXml($cardCode['a']);
|
| 59 |
$formattedValue = $this->getQuote()->getStore()->formatPrice($giftCardValue, false);
|
| 60 |
$giftCardsXmlObj->addCustomChild('item', '-' . $giftCardValue, array(
|
| 45 |
}
|
| 46 |
/** @var $cartXmlObject Mage_XmlConnect_Model_Simplexml_Element */
|
| 47 |
$cartXmlObject = $this->getCartObject();
|
| 48 |
+
$cards = $this->getTotal()->getGiftCards();
|
| 49 |
+
if (!$cards) {
|
| 50 |
+
$cards = $this->getQuoteGiftCards();
|
| 51 |
}
|
| 52 |
$code = $this->getTotal()->getCode();
|
| 53 |
|
| 54 |
/** @var $giftCardsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
| 55 |
$giftCardsXmlObj = $cartXmlObject->addCustomChild($code);
|
| 56 |
|
| 57 |
+
foreach ($cards as $cardCode) {
|
| 58 |
$giftCardValue = Mage::helper('xmlconnect')->formatPriceForXml($cardCode['a']);
|
| 59 |
$formattedValue = $this->getQuote()->getStore()->formatPrice($giftCardValue, false);
|
| 60 |
$giftCardsXmlObj->addCustomChild('item', '-' . $giftCardValue, array(
|
app/code/core/Mage/XmlConnect/Block/Cart/Items.php
CHANGED
|
@@ -77,13 +77,13 @@ class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
|
|
| 77 |
}
|
| 78 |
}
|
| 79 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 80 |
-
$
|
| 81 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 82 |
&& $item->getWeeeTaxAppliedAmount()
|
| 83 |
) {
|
| 84 |
-
$inclPrice = $
|
| 85 |
} else {
|
| 86 |
-
$inclPrice = $
|
| 87 |
}
|
| 88 |
}
|
| 89 |
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
|
@@ -162,13 +162,13 @@ class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
|
|
| 162 |
}
|
| 163 |
}
|
| 164 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 165 |
-
$
|
| 166 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 167 |
&& $item->getWeeeTaxAppliedAmount()
|
| 168 |
) {
|
| 169 |
-
$subtotalInclTax = $
|
| 170 |
} else {
|
| 171 |
-
$subtotalInclTax = $
|
| 172 |
}
|
| 173 |
}
|
| 174 |
|
|
@@ -212,14 +212,14 @@ class Mage_XmlConnect_Block_Cart_Items extends Mage_Checkout_Block_Cart_Abstract
|
|
| 212 |
/**
|
| 213 |
* Options list
|
| 214 |
*/
|
| 215 |
-
$
|
| 216 |
-
if ($
|
| 217 |
$itemOptionsXml = $itemXml->addCustomChild('options');
|
| 218 |
-
foreach ($
|
| 219 |
-
$
|
| 220 |
$itemOptionsXml->addCustomChild('option', null, array(
|
| 221 |
'label' => $xmlObject->xmlAttribute($_option['label']),
|
| 222 |
-
'text' => $xmlObject->xmlAttribute($
|
| 223 |
));
|
| 224 |
}
|
| 225 |
}
|
| 77 |
}
|
| 78 |
}
|
| 79 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 80 |
+
$incl = $this->helper('checkout')->getPriceInclTax($item);
|
| 81 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 82 |
&& $item->getWeeeTaxAppliedAmount()
|
| 83 |
) {
|
| 84 |
+
$inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
|
| 85 |
} else {
|
| 86 |
+
$inclPrice = $incl - $item->getWeeeTaxDisposition();
|
| 87 |
}
|
| 88 |
}
|
| 89 |
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
| 162 |
}
|
| 163 |
}
|
| 164 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 165 |
+
$incl = $this->helper('checkout')->getSubtotalInclTax($item);
|
| 166 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 167 |
&& $item->getWeeeTaxAppliedAmount()
|
| 168 |
) {
|
| 169 |
+
$subtotalInclTax = $incl + $item->getWeeeTaxAppliedRowAmount();
|
| 170 |
} else {
|
| 171 |
+
$subtotalInclTax = $incl - $item->getWeeeTaxRowDisposition();
|
| 172 |
}
|
| 173 |
}
|
| 174 |
|
| 212 |
/**
|
| 213 |
* Options list
|
| 214 |
*/
|
| 215 |
+
$options = $renderer->getOptionList();
|
| 216 |
+
if ($options) {
|
| 217 |
$itemOptionsXml = $itemXml->addCustomChild('options');
|
| 218 |
+
foreach ($options as $_option) {
|
| 219 |
+
$formattedOptionValue = $renderer->getFormatedOptionValue($_option);
|
| 220 |
$itemOptionsXml->addCustomChild('option', null, array(
|
| 221 |
'label' => $xmlObject->xmlAttribute($_option['label']),
|
| 222 |
+
'text' => $xmlObject->xmlAttribute($formattedOptionValue['value'])
|
| 223 |
));
|
| 224 |
}
|
| 225 |
}
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php
CHANGED
|
@@ -42,8 +42,8 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details extends Mage_Paypal_Block_E
|
|
| 42 |
public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
|
| 43 |
{
|
| 44 |
$itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
|
| 45 |
-
foreach ($this->getItems() as $
|
| 46 |
-
$this->getItemXml($
|
| 47 |
}
|
| 48 |
|
| 49 |
$reviewXmlObj->appendChild($this->getChild('totals')->setReturnObjectFlag(true)->_toHtml());
|
| 42 |
public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
|
| 43 |
{
|
| 44 |
$itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
|
| 45 |
+
foreach ($this->getItems() as $item) {
|
| 46 |
+
$this->getItemXml($item, $itemsXmlObj);
|
| 47 |
}
|
| 48 |
|
| 49 |
$reviewXmlObj->appendChild($this->getChild('totals')->setReturnObjectFlag(true)->_toHtml());
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/OrderDetails.php
CHANGED
|
@@ -42,8 +42,8 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_OrderDetails extends Mage_Paypal_Bl
|
|
| 42 |
public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
|
| 43 |
{
|
| 44 |
$itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
|
| 45 |
-
foreach ($this->getItems() as $
|
| 46 |
-
$this->getItemXml($
|
| 47 |
}
|
| 48 |
|
| 49 |
$this->getChild('totals')->setCartXmlObject($reviewXmlObj)->_toHtml();
|
| 42 |
public function addDetailsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj)
|
| 43 |
{
|
| 44 |
$itemsXmlObj = $reviewXmlObj->addChild('ordered_items');
|
| 45 |
+
foreach ($this->getItems() as $item) {
|
| 46 |
+
$this->getItemXml($item, $itemsXmlObj);
|
| 47 |
}
|
| 48 |
|
| 49 |
$this->getChild('totals')->setCartXmlObject($reviewXmlObj)->_toHtml();
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mep/Totals.php
CHANGED
|
@@ -43,7 +43,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mep_Totals extends Mage_Checkout_Block_C
|
|
| 43 |
/** @var $paypalCart Mage_Paypal_Model_Cart */
|
| 44 |
$paypalCart = Mage::getModel('paypal/cart', array($this->getQuote()));
|
| 45 |
/** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
| 46 |
-
$totalsXmlObj
|
| 47 |
foreach ($paypalCart->getTotals(true) as $code => $amount) {
|
| 48 |
$currencyAmount = $this->helper('core')->currency($amount, false, false);
|
| 49 |
$totalsXmlObj->addChild($code, sprintf('%01.2F', $currencyAmount));
|
| 43 |
/** @var $paypalCart Mage_Paypal_Model_Cart */
|
| 44 |
$paypalCart = Mage::getModel('paypal/cart', array($this->getQuote()));
|
| 45 |
/** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
| 46 |
+
$totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<cart_totals></cart_totals>');
|
| 47 |
foreach ($paypalCart->getTotals(true) as $code => $amount) {
|
| 48 |
$currencyAmount = $this->helper('core')->currency($amount, false, false);
|
| 49 |
$totalsXmlObj->addChild($code, sprintf('%01.2F', $currencyAmount));
|
app/code/core/Mage/XmlConnect/Block/Cart/Totals.php
CHANGED
|
@@ -90,7 +90,6 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
|
|
| 90 |
$this->_addTotalDataToXmlObj(
|
| 91 |
$totalsXmlObj, $code . '_excl_tax', $title, $grandTotalExlTax
|
| 92 |
);
|
| 93 |
-
|
| 94 |
$code = $code . '_incl_tax';
|
| 95 |
$title = $this->__('Grand Total (Incl. Tax)');
|
| 96 |
}
|
|
@@ -101,12 +100,12 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
|
|
| 101 |
}
|
| 102 |
continue 2;
|
| 103 |
case 'giftcardaccount':
|
| 104 |
-
$
|
| 105 |
-
if (!$
|
| 106 |
-
$
|
| 107 |
}
|
| 108 |
if ($renderer->getTotal()->getValue()) {
|
| 109 |
-
foreach ($
|
| 110 |
$title = $this->__('Gift Card (%s)', $cardCode['c']);
|
| 111 |
$value = $cardCode['c'];
|
| 112 |
$totalXmlObj = $totalsXmlObj->addChild($code);
|
| 90 |
$this->_addTotalDataToXmlObj(
|
| 91 |
$totalsXmlObj, $code . '_excl_tax', $title, $grandTotalExlTax
|
| 92 |
);
|
|
|
|
| 93 |
$code = $code . '_incl_tax';
|
| 94 |
$title = $this->__('Grand Total (Incl. Tax)');
|
| 95 |
}
|
| 100 |
}
|
| 101 |
continue 2;
|
| 102 |
case 'giftcardaccount':
|
| 103 |
+
$cards = $renderer->getTotal()->getGiftCards();
|
| 104 |
+
if (!$cards) {
|
| 105 |
+
$cards = $renderer->getQuoteGiftCards();
|
| 106 |
}
|
| 107 |
if ($renderer->getTotal()->getValue()) {
|
| 108 |
+
foreach ($cards as $cardCode) {
|
| 109 |
$title = $this->__('Gift Card (%s)', $cardCode['c']);
|
| 110 |
$value = $cardCode['c'];
|
| 111 |
$totalXmlObj = $totalsXmlObj->addChild($code);
|
app/code/core/Mage/XmlConnect/Block/Catalog.php
CHANGED
|
@@ -116,13 +116,13 @@ class Mage_XmlConnect_Block_Catalog extends Mage_Catalog_Block_Product_List_Tool
|
|
| 116 |
$sortOptions = array_merge(array('relevance' => $this->__('Relevance')), $sortOptions);
|
| 117 |
$this->setAvailableOrders($sortOptions)->setDefaultDirection('desc')->setSortBy('relevance');
|
| 118 |
|
| 119 |
-
foreach($this->getAvailableOrders() as $
|
| 120 |
$item = $ordersXmlObject->addChild('item');
|
| 121 |
-
if ($this->isOrderCurrent($
|
| 122 |
$item->addAttribute('isDefault', 1);
|
| 123 |
}
|
| 124 |
-
$item->addChild('code', $
|
| 125 |
-
$item->addChild('name', $ordersXmlObject->escapeXml($
|
| 126 |
}
|
| 127 |
return $ordersXmlObject;
|
| 128 |
}
|
| 116 |
$sortOptions = array_merge(array('relevance' => $this->__('Relevance')), $sortOptions);
|
| 117 |
$this->setAvailableOrders($sortOptions)->setDefaultDirection('desc')->setSortBy('relevance');
|
| 118 |
|
| 119 |
+
foreach($this->getAvailableOrders() as $key => $order) {
|
| 120 |
$item = $ordersXmlObject->addChild('item');
|
| 121 |
+
if ($this->isOrderCurrent($key)) {
|
| 122 |
$item->addAttribute('isDefault', 1);
|
| 123 |
}
|
| 124 |
+
$item->addChild('code', $key);
|
| 125 |
+
$item->addChild('name', $ordersXmlObject->escapeXml($order));
|
| 126 |
}
|
| 127 |
return $ordersXmlObject;
|
| 128 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/ItemPrice/Giftcard.php
CHANGED
|
@@ -66,30 +66,31 @@ class Mage_XmlConnect_Block_Catalog_Product_ItemPrice_Giftcard extends Mage_Bund
|
|
| 66 |
*
|
| 67 |
* @param Mage_Catalog_Model_Product $product
|
| 68 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
|
|
|
| 69 |
*/
|
| 70 |
-
public function collectProductPrices(
|
| 71 |
-
|
| 72 |
-
|
| 73 |
$this->setProduct($product);
|
| 74 |
|
| 75 |
if ($product->getCanShowPrice() !== false) {
|
| 76 |
$priceListXmlObj = $item->addCustomChild('price_list');
|
| 77 |
|
| 78 |
-
$
|
| 79 |
-
$
|
| 80 |
-
if ($
|
| 81 |
$pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
|
| 82 |
-
$pricesXmlObj->addCustomChild('price', $
|
| 83 |
'id' => 'regular',
|
| 84 |
'label' => $this->__('Regular'),
|
| 85 |
-
'formatted_value' => Mage::helper('core')->currency($
|
| 86 |
));
|
| 87 |
-
} elseif ($
|
| 88 |
$pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
|
| 89 |
-
$pricesXmlObj->addCustomChild('price', $
|
| 90 |
'id' => 'regular',
|
| 91 |
'label' => $this->__('From'),
|
| 92 |
-
'formatted_value' => Mage::helper('core')->currency($
|
| 93 |
));
|
| 94 |
}
|
| 95 |
}
|
| 66 |
*
|
| 67 |
* @param Mage_Catalog_Model_Product $product
|
| 68 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 69 |
+
* @return null
|
| 70 |
*/
|
| 71 |
+
public function collectProductPrices(Mage_Catalog_Model_Product $product,
|
| 72 |
+
Mage_XmlConnect_Model_Simplexml_Element $item)
|
| 73 |
+
{
|
| 74 |
$this->setProduct($product);
|
| 75 |
|
| 76 |
if ($product->getCanShowPrice() !== false) {
|
| 77 |
$priceListXmlObj = $item->addCustomChild('price_list');
|
| 78 |
|
| 79 |
+
$min = $this->getMinAmount();
|
| 80 |
+
$max = $this->getMaxAmount();
|
| 81 |
+
if ($min && $max && $min == $max) {
|
| 82 |
$pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
|
| 83 |
+
$pricesXmlObj->addCustomChild('price', $min, array(
|
| 84 |
'id' => 'regular',
|
| 85 |
'label' => $this->__('Regular'),
|
| 86 |
+
'formatted_value' => Mage::helper('core')->currency($min, true, false)
|
| 87 |
));
|
| 88 |
+
} elseif ($min && $min != 0) {
|
| 89 |
$pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
|
| 90 |
+
$pricesXmlObj->addCustomChild('price', $min, array(
|
| 91 |
'id' => 'regular',
|
| 92 |
'label' => $this->__('From'),
|
| 93 |
+
'formatted_value' => Mage::helper('core')->currency($min, true, false)
|
| 94 |
));
|
| 95 |
}
|
| 96 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php
CHANGED
|
@@ -64,7 +64,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options extends Mage_XmlConnect_Bloc
|
|
| 64 |
}
|
| 65 |
|
| 66 |
/**
|
| 67 |
-
* Create
|
| 68 |
*
|
| 69 |
* @param Mage_Catalog_Model_Product $product
|
| 70 |
* @return Mage_XmlConnect_Model_Simplexml_Element
|
|
@@ -189,7 +189,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options extends Mage_XmlConnect_Bloc
|
|
| 189 |
}
|
| 190 |
|
| 191 |
/**
|
| 192 |
-
* Create
|
| 193 |
*
|
| 194 |
* @param Mage_Catalog_Model_Product $product
|
| 195 |
* @return Mage_XmlConnect_Model_Simplexml_Element | false
|
| 64 |
}
|
| 65 |
|
| 66 |
/**
|
| 67 |
+
* Create produc custom options Mage_XmlConnect_Model_Simplexml_Element object
|
| 68 |
*
|
| 69 |
* @param Mage_Catalog_Model_Product $product
|
| 70 |
* @return Mage_XmlConnect_Model_Simplexml_Element
|
| 189 |
}
|
| 190 |
|
| 191 |
/**
|
| 192 |
+
* Create product custom options Mage_XmlConnect_Model_Simplexml_Element object
|
| 193 |
*
|
| 194 |
* @param Mage_Catalog_Model_Product $product
|
| 195 |
* @return Mage_XmlConnect_Model_Simplexml_Element | false
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php
CHANGED
|
@@ -66,9 +66,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
| 66 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
| 67 |
}
|
| 68 |
|
| 69 |
-
foreach ($bundleOptions as $
|
| 70 |
-
$selections = $
|
| 71 |
-
$optionId = $
|
| 72 |
if (empty($selections)) {
|
| 73 |
continue;
|
| 74 |
}
|
|
@@ -76,43 +76,43 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
| 76 |
$optionNode = $optionsXmlObj->addChild('option');
|
| 77 |
|
| 78 |
$type = parent::OPTION_TYPE_SELECT;
|
| 79 |
-
if ($
|
| 80 |
$type = parent::OPTION_TYPE_CHECKBOX;
|
| 81 |
}
|
| 82 |
-
$code = 'bundle_option[' . $
|
| 83 |
if ($type == parent::OPTION_TYPE_CHECKBOX) {
|
| 84 |
$code .= '[]';
|
| 85 |
}
|
| 86 |
$optionNode->addAttribute('code', $code);
|
| 87 |
$optionNode->addAttribute('type', $type);
|
| 88 |
-
$optionNode->addAttribute('label', $optionsXmlObj->escapeXml($
|
| 89 |
-
if ($
|
| 90 |
$optionNode->addAttribute('is_required', 1);
|
| 91 |
}
|
| 92 |
|
| 93 |
-
foreach ($selections as $
|
| 94 |
-
if (!$
|
| 95 |
continue;
|
| 96 |
}
|
| 97 |
-
$
|
| 98 |
if ($product->hasPreconfiguredValues()) {
|
| 99 |
-
$
|
| 100 |
}
|
| 101 |
-
if (null === $
|
| 102 |
-
$
|
| 103 |
}
|
| 104 |
|
| 105 |
$valueNode = $optionNode->addChild('value');
|
| 106 |
-
$valueNode->addAttribute('code', $
|
| 107 |
-
$valueNode->addAttribute('label', $optionsXmlObj->escapeXml($
|
| 108 |
-
if (!$
|
| 109 |
-
if ($
|
| 110 |
$valueNode->addAttribute('is_qty_editable', 1);
|
| 111 |
}
|
| 112 |
}
|
| 113 |
-
$valueNode->addAttribute('qty', $
|
| 114 |
|
| 115 |
-
$price = $product->getPriceModel()->getSelectionPreFinalPrice($product, $
|
| 116 |
$price = Mage::helper('xmlconnect')->formatPriceForXml($price);
|
| 117 |
if ((float)$price != 0.00) {
|
| 118 |
$valueNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml(
|
|
@@ -123,7 +123,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
| 123 |
|
| 124 |
if ($product->hasPreconfiguredValues()) {
|
| 125 |
$this->_setCartSelectedValue($valueNode, $type, $this->_getPreconfiguredOption(
|
| 126 |
-
$optionData, $optionId, $
|
| 127 |
));
|
| 128 |
}
|
| 129 |
}
|
| 66 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
| 67 |
}
|
| 68 |
|
| 69 |
+
foreach ($bundleOptions as $option) {
|
| 70 |
+
$selections = $option->getSelections();
|
| 71 |
+
$optionId = $option->getOptionId();
|
| 72 |
if (empty($selections)) {
|
| 73 |
continue;
|
| 74 |
}
|
| 76 |
$optionNode = $optionsXmlObj->addChild('option');
|
| 77 |
|
| 78 |
$type = parent::OPTION_TYPE_SELECT;
|
| 79 |
+
if ($option->isMultiSelection()) {
|
| 80 |
$type = parent::OPTION_TYPE_CHECKBOX;
|
| 81 |
}
|
| 82 |
+
$code = 'bundle_option[' . $option->getId() . ']';
|
| 83 |
if ($type == parent::OPTION_TYPE_CHECKBOX) {
|
| 84 |
$code .= '[]';
|
| 85 |
}
|
| 86 |
$optionNode->addAttribute('code', $code);
|
| 87 |
$optionNode->addAttribute('type', $type);
|
| 88 |
+
$optionNode->addAttribute('label', $optionsXmlObj->escapeXml($option->getTitle()));
|
| 89 |
+
if ($option->getRequired()) {
|
| 90 |
$optionNode->addAttribute('is_required', 1);
|
| 91 |
}
|
| 92 |
|
| 93 |
+
foreach ($selections as $selection) {
|
| 94 |
+
if (!$selection->isSaleable()) {
|
| 95 |
continue;
|
| 96 |
}
|
| 97 |
+
$qty = null;
|
| 98 |
if ($product->hasPreconfiguredValues()) {
|
| 99 |
+
$qty = $product->getPreconfiguredValues()->getData("bundle_option_qty/{$optionId}");
|
| 100 |
}
|
| 101 |
+
if (null === $qty) {
|
| 102 |
+
$qty = !($selection->getSelectionQty() * 1) ? '1' : $selection->getSelectionQty() * 1;
|
| 103 |
}
|
| 104 |
|
| 105 |
$valueNode = $optionNode->addChild('value');
|
| 106 |
+
$valueNode->addAttribute('code', $selection->getSelectionId());
|
| 107 |
+
$valueNode->addAttribute('label', $optionsXmlObj->escapeXml($selection->getName()));
|
| 108 |
+
if (!$option->isMultiSelection()) {
|
| 109 |
+
if ($selection->getSelectionCanChangeQty()) {
|
| 110 |
$valueNode->addAttribute('is_qty_editable', 1);
|
| 111 |
}
|
| 112 |
}
|
| 113 |
+
$valueNode->addAttribute('qty', $qty);
|
| 114 |
|
| 115 |
+
$price = $product->getPriceModel()->getSelectionPreFinalPrice($product, $selection);
|
| 116 |
$price = Mage::helper('xmlconnect')->formatPriceForXml($price);
|
| 117 |
if ((float)$price != 0.00) {
|
| 118 |
$valueNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml(
|
| 123 |
|
| 124 |
if ($product->hasPreconfiguredValues()) {
|
| 125 |
$this->_setCartSelectedValue($valueNode, $type, $this->_getPreconfiguredOption(
|
| 126 |
+
$optionData, $optionId, $selection->getSelectionId()
|
| 127 |
));
|
| 128 |
}
|
| 129 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php
CHANGED
|
@@ -57,28 +57,28 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
| 57 |
/**
|
| 58 |
* Configurable attributes
|
| 59 |
*/
|
| 60 |
-
$
|
| 61 |
-
if (!sizeof($
|
| 62 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
| 63 |
}
|
| 64 |
|
| 65 |
-
$
|
| 66 |
-
$
|
| 67 |
-
foreach ($
|
| 68 |
-
if ($
|
| 69 |
-
$
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 73 |
/**
|
| 74 |
* Allowed products options
|
| 75 |
*/
|
| 76 |
-
foreach ($
|
| 77 |
-
$
|
| 78 |
|
| 79 |
-
foreach ($
|
| 80 |
$productAttribute = $attribute->getProductAttribute();
|
| 81 |
-
$attributeValue = $
|
| 82 |
if (!isset($options[$productAttribute->getId()])) {
|
| 83 |
$options[$productAttribute->getId()] = array();
|
| 84 |
}
|
|
@@ -86,11 +86,11 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
| 86 |
if (!isset($options[$productAttribute->getId()][$attributeValue])) {
|
| 87 |
$options[$productAttribute->getId()][$attributeValue] = array();
|
| 88 |
}
|
| 89 |
-
$options[$productAttribute->getId()][$attributeValue][] = $
|
| 90 |
}
|
| 91 |
}
|
| 92 |
|
| 93 |
-
foreach ($
|
| 94 |
$productAttribute = $attribute->getProductAttribute();
|
| 95 |
$attributeId = $productAttribute->getId();
|
| 96 |
$info = array(
|
|
@@ -129,8 +129,8 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
| 129 |
|
| 130 |
$isFirst = true;
|
| 131 |
|
| 132 |
-
$
|
| 133 |
-
reset($
|
| 134 |
foreach ($attributes as $id => $attribute) {
|
| 135 |
$optionNode = $optionsXmlObj->addChild('option');
|
| 136 |
$optionNode->addAttribute('code', 'super_attribute[' . $id . ']');
|
|
@@ -146,8 +146,8 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
| 146 |
$valueNode->addAttribute('price', $option['price']);
|
| 147 |
$valueNode->addAttribute('formated_price', $option['formated_price']);
|
| 148 |
}
|
| 149 |
-
if (sizeof($
|
| 150 |
-
$this->_prepareRecursivelyRelatedValues($valueNode, $
|
| 151 |
}
|
| 152 |
if ($product->hasPreconfiguredValues()) {
|
| 153 |
$this->_setCartSelectedValue($valueNode, 'select', $this->_getPreconfiguredOption(
|
|
@@ -194,21 +194,21 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
| 194 |
$relatedNode->addAttribute('to', 'super_attribute[' . $attrId . ']');
|
| 195 |
}
|
| 196 |
|
| 197 |
-
$
|
| 198 |
-
$
|
| 199 |
-
$
|
| 200 |
if ((float)$option['price'] != 0.00) {
|
| 201 |
-
$
|
| 202 |
-
$
|
| 203 |
}
|
| 204 |
|
| 205 |
/**
|
| 206 |
* Recursive relation adding
|
| 207 |
*/
|
| 208 |
-
$
|
| 209 |
-
if (next($
|
| 210 |
-
reset($
|
| 211 |
-
$this->_prepareRecursivelyRelatedValues($
|
| 212 |
}
|
| 213 |
}
|
| 214 |
}
|
| 57 |
/**
|
| 58 |
* Configurable attributes
|
| 59 |
*/
|
| 60 |
+
$productAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
|
| 61 |
+
if (!sizeof($productAttributes)) {
|
| 62 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
| 63 |
}
|
| 64 |
|
| 65 |
+
$allowProducts = array();
|
| 66 |
+
$allProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
|
| 67 |
+
foreach ($allProducts as $productItem) {
|
| 68 |
+
if ($productItem->isSaleable()) {
|
| 69 |
+
$allowProducts[] = $productItem;
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 73 |
/**
|
| 74 |
* Allowed products options
|
| 75 |
*/
|
| 76 |
+
foreach ($allowProducts as $item) {
|
| 77 |
+
$productId = $item->getId();
|
| 78 |
|
| 79 |
+
foreach ($productAttributes as $attribute) {
|
| 80 |
$productAttribute = $attribute->getProductAttribute();
|
| 81 |
+
$attributeValue = $item->getData($productAttribute->getAttributeCode());
|
| 82 |
if (!isset($options[$productAttribute->getId()])) {
|
| 83 |
$options[$productAttribute->getId()] = array();
|
| 84 |
}
|
| 86 |
if (!isset($options[$productAttribute->getId()][$attributeValue])) {
|
| 87 |
$options[$productAttribute->getId()][$attributeValue] = array();
|
| 88 |
}
|
| 89 |
+
$options[$productAttribute->getId()][$attributeValue][] = $productId;
|
| 90 |
}
|
| 91 |
}
|
| 92 |
|
| 93 |
+
foreach ($productAttributes as $attribute) {
|
| 94 |
$productAttribute = $attribute->getProductAttribute();
|
| 95 |
$attributeId = $productAttribute->getId();
|
| 96 |
$info = array(
|
| 129 |
|
| 130 |
$isFirst = true;
|
| 131 |
|
| 132 |
+
$productAttributes = $attributes;
|
| 133 |
+
reset($productAttributes);
|
| 134 |
foreach ($attributes as $id => $attribute) {
|
| 135 |
$optionNode = $optionsXmlObj->addChild('option');
|
| 136 |
$optionNode->addAttribute('code', 'super_attribute[' . $id . ']');
|
| 146 |
$valueNode->addAttribute('price', $option['price']);
|
| 147 |
$valueNode->addAttribute('formated_price', $option['formated_price']);
|
| 148 |
}
|
| 149 |
+
if (sizeof($productAttributes) > 1) {
|
| 150 |
+
$this->_prepareRecursivelyRelatedValues($valueNode, $productAttributes, $option['products'], 1);
|
| 151 |
}
|
| 152 |
if ($product->hasPreconfiguredValues()) {
|
| 153 |
$this->_setCartSelectedValue($valueNode, 'select', $this->_getPreconfiguredOption(
|
| 194 |
$relatedNode->addAttribute('to', 'super_attribute[' . $attrId . ']');
|
| 195 |
}
|
| 196 |
|
| 197 |
+
$nodeValue = $relatedNode->addChild('value');
|
| 198 |
+
$nodeValue->addAttribute('code', $option['id']);
|
| 199 |
+
$nodeValue->addAttribute('label', $nodeValue->escapeXml($option['label']));
|
| 200 |
if ((float)$option['price'] != 0.00) {
|
| 201 |
+
$nodeValue->addAttribute('price', $option['price']);
|
| 202 |
+
$nodeValue->addAttribute('formated_price', $option['formated_price']);
|
| 203 |
}
|
| 204 |
|
| 205 |
/**
|
| 206 |
* Recursive relation adding
|
| 207 |
*/
|
| 208 |
+
$attrClone = $attributes;
|
| 209 |
+
if (next($attrClone) != false) {
|
| 210 |
+
reset($attrClone);
|
| 211 |
+
$this->_prepareRecursivelyRelatedValues($nodeValue, $attrClone, $intersect, $cycle + 1);
|
| 212 |
}
|
| 213 |
}
|
| 214 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php
CHANGED
|
@@ -55,30 +55,30 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Grouped extends Mage_XmlConn
|
|
| 55 |
/**
|
| 56 |
* Grouped (associated) products
|
| 57 |
*/
|
| 58 |
-
$
|
| 59 |
-
if (!sizeof($
|
| 60 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
| 61 |
}
|
| 62 |
|
| 63 |
-
foreach ($
|
| 64 |
-
if (!$
|
| 65 |
continue;
|
| 66 |
}
|
| 67 |
$optionNode = $optionsNode->addChild('option');
|
| 68 |
|
| 69 |
-
$optionNode->addAttribute('code', 'super_group[' . $
|
| 70 |
$optionNode->addAttribute('type', 'product');
|
| 71 |
-
$optionNode->addAttribute('label', $xmlModel->escapeXml($
|
| 72 |
$optionNode->addAttribute('is_qty_editable', 1);
|
| 73 |
-
$optionNode->addAttribute('qty', $
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Process product price
|
| 77 |
*/
|
| 78 |
-
if ($
|
| 79 |
-
$productPrice = $
|
| 80 |
} else {
|
| 81 |
-
$productPrice = $
|
| 82 |
}
|
| 83 |
|
| 84 |
if ($productPrice != 0) {
|
| 55 |
/**
|
| 56 |
* Grouped (associated) products
|
| 57 |
*/
|
| 58 |
+
$associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
| 59 |
+
if (!sizeof($associatedProducts)) {
|
| 60 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
| 61 |
}
|
| 62 |
|
| 63 |
+
foreach ($associatedProducts as $item) {
|
| 64 |
+
if (!$item->isSaleable()) {
|
| 65 |
continue;
|
| 66 |
}
|
| 67 |
$optionNode = $optionsNode->addChild('option');
|
| 68 |
|
| 69 |
+
$optionNode->addAttribute('code', 'super_group[' . $item->getId() . ']');
|
| 70 |
$optionNode->addAttribute('type', 'product');
|
| 71 |
+
$optionNode->addAttribute('label', $xmlModel->escapeXml($item->getName()));
|
| 72 |
$optionNode->addAttribute('is_qty_editable', 1);
|
| 73 |
+
$optionNode->addAttribute('qty', $item->getQty()*1);
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Process product price
|
| 77 |
*/
|
| 78 |
+
if ($item->getPrice() != $item->getFinalPrice()) {
|
| 79 |
+
$productPrice = $item->getFinalPrice();
|
| 80 |
} else {
|
| 81 |
+
$productPrice = $item->getPrice();
|
| 82 |
}
|
| 83 |
|
| 84 |
if ($productPrice != 0) {
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php
CHANGED
|
@@ -39,9 +39,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle extends Mage_Bundle_Blo
|
|
| 39 |
* @param Mage_Catalog_Model_Product $product
|
| 40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 41 |
*/
|
| 42 |
-
public function collectProductPrices(
|
| 43 |
-
|
| 44 |
-
|
| 45 |
$this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
|
| 46 |
|
| 47 |
$priceXmlObj = $item->addChild('price');
|
| 39 |
* @param Mage_Catalog_Model_Product $product
|
| 40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 41 |
*/
|
| 42 |
+
public function collectProductPrices(Mage_Catalog_Model_Product $product,
|
| 43 |
+
Mage_XmlConnect_Model_Simplexml_Element $item)
|
| 44 |
+
{
|
| 45 |
$this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
|
| 46 |
|
| 47 |
$priceXmlObj = $item->addChild('price');
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php
CHANGED
|
@@ -39,321 +39,321 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default extends Mage_Catalog_B
|
|
| 39 |
* @param Mage_Catalog_Model_Product $product
|
| 40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 41 |
*/
|
| 42 |
-
public function collectProductPrices(
|
| 43 |
-
|
| 44 |
-
|
| 45 |
$this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
|
| 46 |
|
| 47 |
$priceXmlObj = $item->addChild('price');
|
| 48 |
-
$
|
| 49 |
-
if (count($
|
| 50 |
$tierPricesTextArray = $item->escapeXml(implode(
|
| 51 |
-
PHP_EOL, $this->_getTierPricesTextArray($
|
| 52 |
));
|
| 53 |
$item->addCustomChild('price_tier', $tierPricesTextArray);
|
| 54 |
}
|
| 55 |
|
| 56 |
-
/** @var $
|
| 57 |
-
$
|
| 58 |
-
/** @var $
|
| 59 |
-
$
|
| 60 |
-
/** @var $
|
| 61 |
-
$
|
| 62 |
|
| 63 |
-
$
|
| 64 |
-
$
|
| 65 |
-
$
|
| 66 |
|
| 67 |
if (!$product->isGrouped()) {
|
| 68 |
-
$
|
| 69 |
-
if ($
|
| 70 |
-
$
|
| 71 |
-
$
|
| 72 |
}
|
| 73 |
|
| 74 |
-
$
|
| 75 |
-
$
|
| 76 |
-
$
|
| 77 |
-
$
|
| 78 |
-
$
|
| 79 |
-
if ($
|
| 80 |
-
if ($
|
| 81 |
/**
|
| 82 |
* Including
|
| 83 |
*/
|
| 84 |
-
if ($
|
| 85 |
$priceXmlObj->addAttribute(
|
| 86 |
-
'excluding_tax', $
|
| 87 |
);
|
| 88 |
$priceXmlObj->addAttribute(
|
| 89 |
-
'including_tax', $
|
| 90 |
);
|
| 91 |
-
} elseif ($
|
| 92 |
/**
|
| 93 |
* Including + Weee
|
| 94 |
*/
|
| 95 |
$priceXmlObj->addAttribute(
|
| 96 |
-
'excluding_tax', $
|
| 97 |
);
|
| 98 |
$priceXmlObj->addAttribute(
|
| 99 |
-
'including_tax', $
|
| 100 |
);
|
| 101 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 102 |
-
$
|
| 103 |
-
$weeeXmlObj->addAttribute('separator', $
|
| 104 |
-
foreach ($
|
| 105 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 106 |
$weeeItemXmlObj->addAttribute(
|
| 107 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 108 |
);
|
| 109 |
$weeeItemXmlObj->addAttribute(
|
| 110 |
-
'amount', $
|
| 111 |
);
|
| 112 |
}
|
| 113 |
-
} elseif ($
|
| 114 |
/**
|
| 115 |
* Including + Weee
|
| 116 |
*/
|
| 117 |
$priceXmlObj->addAttribute(
|
| 118 |
-
'excluding_tax', $
|
| 119 |
);
|
| 120 |
$priceXmlObj->addAttribute(
|
| 121 |
-
'including_tax', $
|
| 122 |
);
|
| 123 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 124 |
-
$
|
| 125 |
-
$weeeXmlObj->addAttribute('separator', $
|
| 126 |
-
foreach ($
|
| 127 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 128 |
$weeeItemXmlObj->addAttribute(
|
| 129 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 130 |
);
|
| 131 |
-
$weeeItemXmlObj->addAttribute('amount', $
|
| 132 |
-
$
|
| 133 |
));
|
| 134 |
}
|
| 135 |
-
} elseif ($
|
| 136 |
/**
|
| 137 |
* Excluding + Weee + Final
|
| 138 |
*/
|
| 139 |
-
$priceXmlObj->addAttribute('excluding_tax', $
|
| 140 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 141 |
-
foreach ($
|
| 142 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 143 |
$weeeItemXmlObj->addAttribute(
|
| 144 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 145 |
);
|
| 146 |
$weeeItemXmlObj->addAttribute(
|
| 147 |
-
'amount', $
|
| 148 |
);
|
| 149 |
}
|
| 150 |
-
$priceXmlObj->addAttribute('including_tax', $
|
| 151 |
-
$
|
| 152 |
));
|
| 153 |
} else {
|
| 154 |
-
$priceXmlObj->addAttribute('excluding_tax', $
|
| 155 |
$priceXmlObj->addAttribute(
|
| 156 |
-
'including_tax', $
|
| 157 |
);
|
| 158 |
}
|
| 159 |
/**
|
| 160 |
-
* if ($
|
| 161 |
*/
|
| 162 |
} else {
|
| 163 |
/**
|
| 164 |
* Including
|
| 165 |
*/
|
| 166 |
-
if ($
|
| 167 |
-
$priceXmlObj->addAttribute('regular', $
|
| 168 |
-
$
|
| 169 |
));
|
| 170 |
-
} elseif ($
|
| 171 |
/**
|
| 172 |
* Including + Weee
|
| 173 |
*/
|
| 174 |
-
$priceXmlObj->addAttribute('regular', $
|
| 175 |
-
$
|
| 176 |
));
|
| 177 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 178 |
-
$
|
| 179 |
-
$weeeXmlObj->addAttribute('separator', $
|
| 180 |
-
foreach ($
|
| 181 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 182 |
$weeeItemXmlObj->addAttribute(
|
| 183 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 184 |
);
|
| 185 |
$weeeItemXmlObj->addAttribute(
|
| 186 |
-
'amount', $
|
| 187 |
);
|
| 188 |
}
|
| 189 |
-
} elseif ($
|
| 190 |
/**
|
| 191 |
* Including + Weee
|
| 192 |
*/
|
| 193 |
-
$priceXmlObj->addAttribute('regular', $
|
| 194 |
-
$
|
| 195 |
));
|
| 196 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 197 |
-
$
|
| 198 |
-
$weeeXmlObj->addAttribute('separator', $
|
| 199 |
-
foreach ($
|
| 200 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 201 |
$weeeItemXmlObj->addAttribute(
|
| 202 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 203 |
);
|
| 204 |
-
$weeeItemXmlObj->addAttribute('amount', $
|
| 205 |
-
$
|
| 206 |
));
|
| 207 |
}
|
| 208 |
-
} elseif ($
|
| 209 |
/**
|
| 210 |
* Excluding + Weee + Final
|
| 211 |
*/
|
| 212 |
-
$priceXmlObj->addAttribute('regular', $
|
| 213 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 214 |
-
foreach ($
|
| 215 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 216 |
$weeeItemXmlObj->addAttribute(
|
| 217 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 218 |
);
|
| 219 |
$weeeItemXmlObj->addAttribute(
|
| 220 |
-
'amount', $
|
| 221 |
);
|
| 222 |
}
|
| 223 |
$priceXmlObj->addAttribute(
|
| 224 |
-
'including_tax', $
|
| 225 |
);
|
| 226 |
} else {
|
| 227 |
-
$priceXmlObj->addAttribute('regular', $
|
| 228 |
}
|
| 229 |
}
|
| 230 |
/**
|
| 231 |
-
* if ($
|
| 232 |
*/
|
| 233 |
} else {
|
| 234 |
-
$
|
| 235 |
/**
|
| 236 |
* Including
|
| 237 |
*/
|
| 238 |
-
if ($
|
| 239 |
-
$priceXmlObj->addAttribute('regular', $
|
| 240 |
-
$
|
| 241 |
));
|
| 242 |
-
if ($
|
| 243 |
-
$priceXmlObj->addAttribute('special_excluding_tax', $
|
| 244 |
-
$
|
| 245 |
));
|
| 246 |
-
$priceXmlObj->addAttribute('special_including_tax', $
|
| 247 |
-
$
|
| 248 |
));
|
| 249 |
} else {
|
| 250 |
-
$priceXmlObj->addAttribute('special', $
|
| 251 |
-
$
|
| 252 |
));
|
| 253 |
}
|
| 254 |
-
} elseif ($
|
| 255 |
/**
|
| 256 |
* Including + Weee
|
| 257 |
*/
|
| 258 |
-
$priceXmlObj->addAttribute('regular', $
|
| 259 |
-
$
|
| 260 |
));
|
| 261 |
-
$priceXmlObj->addAttribute('special_excluding_tax', $
|
| 262 |
-
$
|
| 263 |
));
|
| 264 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 265 |
-
$
|
| 266 |
-
$weeeXmlObj->addAttribute('separator', $
|
| 267 |
-
foreach ($
|
| 268 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 269 |
$weeeItemXmlObj->addAttribute(
|
| 270 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 271 |
);
|
| 272 |
-
$weeeItemXmlObj->addAttribute('amount', $
|
| 273 |
-
$
|
| 274 |
));
|
| 275 |
}
|
| 276 |
-
$priceXmlObj->addAttribute('special_including_tax', $
|
| 277 |
-
$
|
| 278 |
));
|
| 279 |
-
} elseif ($
|
| 280 |
/**
|
| 281 |
* Including + Weee
|
| 282 |
*/
|
| 283 |
-
$priceXmlObj->addAttribute('regular', $
|
| 284 |
-
$
|
| 285 |
));
|
| 286 |
-
$priceXmlObj->addAttribute('special_excluding_tax', $
|
| 287 |
-
$
|
| 288 |
));
|
| 289 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 290 |
-
$
|
| 291 |
-
$weeeXmlObj->addAttribute('separator', $
|
| 292 |
-
foreach ($
|
| 293 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 294 |
$weeeItemXmlObj->addAttribute(
|
| 295 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 296 |
);
|
| 297 |
-
$weeeItemXmlObj->addAttribute('amount', $
|
| 298 |
-
$
|
| 299 |
));
|
| 300 |
}
|
| 301 |
-
$priceXmlObj->addAttribute('special_including_tax', $
|
| 302 |
-
$
|
| 303 |
));
|
| 304 |
-
} elseif ($
|
| 305 |
/**
|
| 306 |
* Excluding + Weee + Final
|
| 307 |
*/
|
| 308 |
-
$priceXmlObj->addAttribute('regular', $
|
| 309 |
$priceXmlObj->addAttribute(
|
| 310 |
-
'special_excluding_tax', $
|
| 311 |
);
|
| 312 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 313 |
-
foreach ($
|
| 314 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 315 |
$weeeItemXmlObj->addAttribute(
|
| 316 |
-
'name', $weeeItemXmlObj->escapeXml($
|
| 317 |
);
|
| 318 |
-
$weeeItemXmlObj->addAttribute('amount', $
|
| 319 |
-
$
|
| 320 |
));
|
| 321 |
}
|
| 322 |
-
$priceXmlObj->addAttribute('special_including_tax', $
|
| 323 |
-
$
|
| 324 |
));
|
| 325 |
} else {
|
| 326 |
/**
|
| 327 |
* Excluding
|
| 328 |
*/
|
| 329 |
-
$priceXmlObj->addAttribute('regular', $
|
| 330 |
-
if ($
|
| 331 |
$priceXmlObj->addAttribute(
|
| 332 |
-
'special_excluding_tax', $
|
| 333 |
);
|
| 334 |
$priceXmlObj->addAttribute(
|
| 335 |
-
'special_including_tax', $
|
| 336 |
);
|
| 337 |
} else {
|
| 338 |
$priceXmlObj->addAttribute(
|
| 339 |
-
'special', $
|
| 340 |
);
|
| 341 |
}
|
| 342 |
}
|
| 343 |
}
|
| 344 |
|
| 345 |
-
if ($this->getDisplayMinimalPrice() && $
|
| 346 |
-
&& $
|
| 347 |
) {
|
| 348 |
-
$
|
| 349 |
|
| 350 |
-
if ($
|
| 351 |
-
$
|
| 352 |
}
|
| 353 |
|
| 354 |
if (!$this->getUseLinkForAsLowAs()) {
|
| 355 |
-
$priceXmlObj->addAttribute('as_low_as', $
|
| 356 |
-
$
|
| 357 |
));
|
| 358 |
}
|
| 359 |
}
|
|
@@ -361,23 +361,23 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default extends Mage_Catalog_B
|
|
| 361 |
* if (!$product->isGrouped()) {
|
| 362 |
*/
|
| 363 |
} else {
|
| 364 |
-
$
|
| 365 |
-
$
|
| 366 |
|
| 367 |
-
if ($this->getDisplayMinimalPrice() && $
|
| 368 |
-
if ($
|
| 369 |
-
$priceXmlObj->addAttribute('starting_at_excluding_tax', $
|
| 370 |
-
$
|
| 371 |
));
|
| 372 |
-
$priceXmlObj->addAttribute('starting_at_including_tax', $
|
| 373 |
-
$
|
| 374 |
));
|
| 375 |
} else {
|
| 376 |
-
$
|
| 377 |
-
if (!$
|
| 378 |
-
$
|
| 379 |
}
|
| 380 |
-
$priceXmlObj->addAttribute('starting_at', $
|
| 381 |
}
|
| 382 |
}
|
| 383 |
}
|
|
@@ -443,169 +443,169 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default extends Mage_Catalog_B
|
|
| 443 |
/**
|
| 444 |
* Get tier prices (formatted) as array of strings
|
| 445 |
*
|
| 446 |
-
* @param array $
|
| 447 |
-
* @param Mage_Catalog_Model_Product $
|
| 448 |
* @return array
|
| 449 |
*/
|
| 450 |
-
protected function _getTierPricesTextArray($
|
| 451 |
{
|
| 452 |
$pricesArray = array();
|
| 453 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
| 454 |
-
$
|
| 455 |
}
|
| 456 |
|
| 457 |
-
if ($
|
| 458 |
-
$
|
| 459 |
}
|
| 460 |
-
Mage::helper('weee')->processTierPrices($
|
| 461 |
|
| 462 |
-
foreach ($
|
| 463 |
$s = '';
|
| 464 |
if ($this->helper('tax')->displayBothPrices()) {
|
| 465 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
| 466 |
-
$s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $
|
| 467 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 468 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 469 |
-
if ($
|
| 470 |
-
$s .= ' (' . $this->__('%1$s incl tax.', $
|
| 471 |
$separator = ' + ';
|
| 472 |
-
foreach ($
|
| 473 |
-
$s .= $separator . $
|
| 474 |
-
$s .= Mage::helper('core')->currency($
|
| 475 |
}
|
| 476 |
$s .= ')';
|
| 477 |
}
|
| 478 |
$s .= ' ' . $this->__('each');
|
| 479 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 480 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 481 |
-
if ($
|
| 482 |
-
$s .= ' (' . $this->__('%1$s incl tax.', $
|
| 483 |
$separator = ' + ';
|
| 484 |
-
foreach ($
|
| 485 |
-
$s .= $separator . $
|
| 486 |
$s .= Mage::helper('core')->currency(
|
| 487 |
-
$
|
| 488 |
);
|
| 489 |
}
|
| 490 |
$s .= ')';
|
| 491 |
}
|
| 492 |
$s .= ' ' . $this->__('each');
|
| 493 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 494 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 495 |
-
if ($
|
| 496 |
$s .= ' (';
|
| 497 |
-
foreach ($
|
| 498 |
-
$s .= $
|
| 499 |
-
$s .= Mage::helper('core')->currency($
|
| 500 |
}
|
| 501 |
-
$s .= ' ' . $this->__('Total incl. Tax: %1$s', $
|
| 502 |
}
|
| 503 |
$s .= ' ' . $this->__('each');
|
| 504 |
} else {
|
| 505 |
-
$s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $
|
| 506 |
}
|
| 507 |
} else {
|
| 508 |
if ($this->helper('tax')->displayPriceIncludingTax()) {
|
| 509 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
| 510 |
-
$s .= $this->__('Buy %1$s for %2$s each', $
|
| 511 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 512 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 513 |
-
if ($
|
| 514 |
$s .= ' (';
|
| 515 |
$separator = '';
|
| 516 |
-
foreach ($
|
| 517 |
-
$s .= $separator . $
|
| 518 |
-
$s .= Mage::helper('core')->currency($
|
| 519 |
$separator = ' + ';
|
| 520 |
}
|
| 521 |
$s .= ')';
|
| 522 |
}
|
| 523 |
$s .= ' ' . $this->__('each');
|
| 524 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 525 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 526 |
-
if ($
|
| 527 |
$s .= ' (';
|
| 528 |
$separator = '';
|
| 529 |
-
foreach ($
|
| 530 |
-
$s .= $separator . $
|
| 531 |
$s .= Mage::helper('core')->currency(
|
| 532 |
-
$
|
| 533 |
);
|
| 534 |
$separator = ' + ';
|
| 535 |
}
|
| 536 |
$s .= ')';
|
| 537 |
}
|
| 538 |
$s .= ' ' . $this->__('each');
|
| 539 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 540 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 541 |
-
if ($
|
| 542 |
$s .= ' (';
|
| 543 |
-
foreach ($
|
| 544 |
-
$s .= $
|
| 545 |
-
$s .= Mage::helper('core')->currency($
|
| 546 |
}
|
| 547 |
-
$s .= ' ' . $this->__('Total incl. Tax: %1$s', $
|
| 548 |
}
|
| 549 |
$s .= ' ' . $this->__('each');
|
| 550 |
} else {
|
| 551 |
-
$s .= $this->__('Buy %1$s for %2$s each', $
|
| 552 |
}
|
| 553 |
} else {
|
| 554 |
-
if (Mage::helper('weee')->typeOfDisplay($
|
| 555 |
-
$s .= $this->__('Buy %1$s for %2$s each', $
|
| 556 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 557 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 558 |
-
if ($
|
| 559 |
$s .= ' (';
|
| 560 |
$separator = '';
|
| 561 |
-
foreach ($
|
| 562 |
-
$s .= $separator . $
|
| 563 |
-
$s .= Mage::helper('core')->currency($
|
| 564 |
$separator = ' + ';
|
| 565 |
}
|
| 566 |
$s .= ')';
|
| 567 |
}
|
| 568 |
$s .= ' ' . $this->__('each');
|
| 569 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 570 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 571 |
-
if ($
|
| 572 |
$s .= ' (';
|
| 573 |
$separator = '';
|
| 574 |
-
foreach ($
|
| 575 |
-
$s .= $separator . $
|
| 576 |
$s .= Mage::helper('core')->currency(
|
| 577 |
-
$
|
| 578 |
);
|
| 579 |
$separator = ' + ';
|
| 580 |
}
|
| 581 |
$s .= ')';
|
| 582 |
}
|
| 583 |
$s .= ' ' . $this->__('each');
|
| 584 |
-
} else if (Mage::helper('weee')->typeOfDisplay($
|
| 585 |
-
$s .= $this->__('Buy %1$s for %2$s', $
|
| 586 |
-
if ($
|
| 587 |
$s .= ' (';
|
| 588 |
-
foreach ($
|
| 589 |
-
$s .= $
|
| 590 |
-
$s .= Mage::helper('core')->currency($
|
| 591 |
}
|
| 592 |
-
$s .= ' ' . $this->__('Total incl. Tax: %1$s', $
|
| 593 |
}
|
| 594 |
$s .= ' ' . $this->__('each');
|
| 595 |
} else {
|
| 596 |
-
$s .= $this->__('Buy %1$s for %2$s each', $
|
| 597 |
}
|
| 598 |
}
|
| 599 |
}
|
| 600 |
-
if (!$
|
| 601 |
-
$condition1 = ($
|
| 602 |
-
&& $
|
| 603 |
|
| 604 |
-
$condition2 = ($
|
| 605 |
-
&& $
|
| 606 |
|
| 607 |
if ($condition1 || $condition2) {
|
| 608 |
-
$s .= ' ' . $this->__('and') . ' ' . $this->__('save') . ' ' . $
|
| 609 |
}
|
| 610 |
}
|
| 611 |
$pricesArray[] = $s;
|
| 39 |
* @param Mage_Catalog_Model_Product $product
|
| 40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 41 |
*/
|
| 42 |
+
public function collectProductPrices(Mage_Catalog_Model_Product $product,
|
| 43 |
+
Mage_XmlConnect_Model_Simplexml_Element $item)
|
| 44 |
+
{
|
| 45 |
$this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
|
| 46 |
|
| 47 |
$priceXmlObj = $item->addChild('price');
|
| 48 |
+
$tierPrices = $this->_getTierPrices($product);
|
| 49 |
+
if (count($tierPrices) > 0) {
|
| 50 |
$tierPricesTextArray = $item->escapeXml(implode(
|
| 51 |
+
PHP_EOL, $this->_getTierPricesTextArray($tierPrices, $product)
|
| 52 |
));
|
| 53 |
$item->addCustomChild('price_tier', $tierPricesTextArray);
|
| 54 |
}
|
| 55 |
|
| 56 |
+
/** @var $coreHelper Mage_Core_Helper_Data */
|
| 57 |
+
$coreHelper = $this->helper('core');
|
| 58 |
+
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
| 59 |
+
$weeeHelper = $this->helper('weee');
|
| 60 |
+
/** @var $taxHelper Mage_Tax_Helper_Data */
|
| 61 |
+
$taxHelper = $this->helper('tax');
|
| 62 |
|
| 63 |
+
$simplePricesTax = ($taxHelper->displayPriceIncludingTax() || $taxHelper->displayBothPrices());
|
| 64 |
+
$minimalPriceValue = $product->getMinimalPrice();
|
| 65 |
+
$minimalPrice = $taxHelper->getPrice($product, $minimalPriceValue, $simplePricesTax);
|
| 66 |
|
| 67 |
if (!$product->isGrouped()) {
|
| 68 |
+
$weeeTaxAmount = $weeeHelper->getAmountForDisplay($product);
|
| 69 |
+
if ($weeeHelper->typeOfDisplay($product, array(1, 2, 4))) {
|
| 70 |
+
$weeeTaxAmount = $weeeHelper->getAmount($product);
|
| 71 |
+
$weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForDisplay($product);
|
| 72 |
}
|
| 73 |
|
| 74 |
+
$price = $taxHelper->getPrice($product, $product->getPrice());
|
| 75 |
+
$regularPrice = $taxHelper->getPrice($product, $product->getPrice(), $simplePricesTax);
|
| 76 |
+
$finalPrice = $taxHelper->getPrice($product, $product->getFinalPrice());
|
| 77 |
+
$finalPriceInclTax = $taxHelper->getPrice($product, $product->getFinalPrice(), true);
|
| 78 |
+
$weeeHelper->getPriceDisplayType();
|
| 79 |
+
if ($finalPrice == $price) {
|
| 80 |
+
if ($taxHelper->displayBothPrices()) {
|
| 81 |
/**
|
| 82 |
* Including
|
| 83 |
*/
|
| 84 |
+
if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
|
| 85 |
$priceXmlObj->addAttribute(
|
| 86 |
+
'excluding_tax', $coreHelper->currency($price + $weeeTaxAmount, true, false)
|
| 87 |
);
|
| 88 |
$priceXmlObj->addAttribute(
|
| 89 |
+
'including_tax', $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)
|
| 90 |
);
|
| 91 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
|
| 92 |
/**
|
| 93 |
* Including + Weee
|
| 94 |
*/
|
| 95 |
$priceXmlObj->addAttribute(
|
| 96 |
+
'excluding_tax', $coreHelper->currency($price + $weeeTaxAmount, true, false)
|
| 97 |
);
|
| 98 |
$priceXmlObj->addAttribute(
|
| 99 |
+
'including_tax', $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)
|
| 100 |
);
|
| 101 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 102 |
+
$weeeSeparator = ' + ';
|
| 103 |
+
$weeeXmlObj->addAttribute('separator', $weeeSeparator);
|
| 104 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 105 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 106 |
$weeeItemXmlObj->addAttribute(
|
| 107 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 108 |
);
|
| 109 |
$weeeItemXmlObj->addAttribute(
|
| 110 |
+
'amount', $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
|
| 111 |
);
|
| 112 |
}
|
| 113 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
|
| 114 |
/**
|
| 115 |
* Including + Weee
|
| 116 |
*/
|
| 117 |
$priceXmlObj->addAttribute(
|
| 118 |
+
'excluding_tax', $coreHelper->currency($price + $weeeTaxAmount, true, false)
|
| 119 |
);
|
| 120 |
$priceXmlObj->addAttribute(
|
| 121 |
+
'including_tax', $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)
|
| 122 |
);
|
| 123 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 124 |
+
$weeeSeparator = ' + ';
|
| 125 |
+
$weeeXmlObj->addAttribute('separator', $weeeSeparator);
|
| 126 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 127 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 128 |
$weeeItemXmlObj->addAttribute(
|
| 129 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 130 |
);
|
| 131 |
+
$weeeItemXmlObj->addAttribute('amount', $coreHelper->currency(
|
| 132 |
+
$weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount(), true, false
|
| 133 |
));
|
| 134 |
}
|
| 135 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
|
| 136 |
/**
|
| 137 |
* Excluding + Weee + Final
|
| 138 |
*/
|
| 139 |
+
$priceXmlObj->addAttribute('excluding_tax', $coreHelper->currency($price, true, false));
|
| 140 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 141 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 142 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 143 |
$weeeItemXmlObj->addAttribute(
|
| 144 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 145 |
);
|
| 146 |
$weeeItemXmlObj->addAttribute(
|
| 147 |
+
'amount', $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
|
| 148 |
);
|
| 149 |
}
|
| 150 |
+
$priceXmlObj->addAttribute('including_tax', $coreHelper->currency(
|
| 151 |
+
$finalPriceInclTax + $weeeTaxAmount, true, false
|
| 152 |
));
|
| 153 |
} else {
|
| 154 |
+
$priceXmlObj->addAttribute('excluding_tax', $coreHelper->currency($price, true, false));
|
| 155 |
$priceXmlObj->addAttribute(
|
| 156 |
+
'including_tax', $coreHelper->currency($finalPriceInclTax, true, false)
|
| 157 |
);
|
| 158 |
}
|
| 159 |
/**
|
| 160 |
+
* if ($taxHelper->displayBothPrices()) {
|
| 161 |
*/
|
| 162 |
} else {
|
| 163 |
/**
|
| 164 |
* Including
|
| 165 |
*/
|
| 166 |
+
if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
|
| 167 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency(
|
| 168 |
+
$price + $weeeTaxAmount, true, false
|
| 169 |
));
|
| 170 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
|
| 171 |
/**
|
| 172 |
* Including + Weee
|
| 173 |
*/
|
| 174 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency(
|
| 175 |
+
$price + $weeeTaxAmount, true, false
|
| 176 |
));
|
| 177 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 178 |
+
$weeeSeparator = ' + ';
|
| 179 |
+
$weeeXmlObj->addAttribute('separator', $weeeSeparator);
|
| 180 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 181 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 182 |
$weeeItemXmlObj->addAttribute(
|
| 183 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 184 |
);
|
| 185 |
$weeeItemXmlObj->addAttribute(
|
| 186 |
+
'amount', $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
|
| 187 |
);
|
| 188 |
}
|
| 189 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
|
| 190 |
/**
|
| 191 |
* Including + Weee
|
| 192 |
*/
|
| 193 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency(
|
| 194 |
+
$price + $weeeTaxAmount, true, false
|
| 195 |
));
|
| 196 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 197 |
+
$weeeSeparator = ' + ';
|
| 198 |
+
$weeeXmlObj->addAttribute('separator', $weeeSeparator);
|
| 199 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 200 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 201 |
$weeeItemXmlObj->addAttribute(
|
| 202 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 203 |
);
|
| 204 |
+
$weeeItemXmlObj->addAttribute('amount', $coreHelper->currency(
|
| 205 |
+
$weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount(), true, false
|
| 206 |
));
|
| 207 |
}
|
| 208 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
|
| 209 |
/**
|
| 210 |
* Excluding + Weee + Final
|
| 211 |
*/
|
| 212 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency($price, true, false));
|
| 213 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 214 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 215 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 216 |
$weeeItemXmlObj->addAttribute(
|
| 217 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 218 |
);
|
| 219 |
$weeeItemXmlObj->addAttribute(
|
| 220 |
+
'amount', $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)
|
| 221 |
);
|
| 222 |
}
|
| 223 |
$priceXmlObj->addAttribute(
|
| 224 |
+
'including_tax', $coreHelper->currency($price + $weeeTaxAmount, true, false)
|
| 225 |
);
|
| 226 |
} else {
|
| 227 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency($price, true, false));
|
| 228 |
}
|
| 229 |
}
|
| 230 |
/**
|
| 231 |
+
* if ($finalPrice == $price) {
|
| 232 |
*/
|
| 233 |
} else {
|
| 234 |
+
$originalWeeeTaxAmount = $weeeHelper->getOriginalAmount($product);
|
| 235 |
/**
|
| 236 |
* Including
|
| 237 |
*/
|
| 238 |
+
if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
|
| 239 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency(
|
| 240 |
+
$regularPrice + $originalWeeeTaxAmount, true, false
|
| 241 |
));
|
| 242 |
+
if ($taxHelper->displayBothPrices()) {
|
| 243 |
+
$priceXmlObj->addAttribute('special_excluding_tax', $coreHelper->currency(
|
| 244 |
+
$finalPrice + $weeeTaxAmount, true, false
|
| 245 |
));
|
| 246 |
+
$priceXmlObj->addAttribute('special_including_tax', $coreHelper->currency(
|
| 247 |
+
$finalPriceInclTax + $weeeTaxAmount, true, false
|
| 248 |
));
|
| 249 |
} else {
|
| 250 |
+
$priceXmlObj->addAttribute('special', $coreHelper->currency(
|
| 251 |
+
$finalPrice + $weeeTaxAmount, true, false
|
| 252 |
));
|
| 253 |
}
|
| 254 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
|
| 255 |
/**
|
| 256 |
* Including + Weee
|
| 257 |
*/
|
| 258 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency(
|
| 259 |
+
$regularPrice + $originalWeeeTaxAmount, true, false
|
| 260 |
));
|
| 261 |
+
$priceXmlObj->addAttribute('special_excluding_tax', $coreHelper->currency(
|
| 262 |
+
$finalPrice + $weeeTaxAmount, true, false
|
| 263 |
));
|
| 264 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 265 |
+
$weeeSeparator = ' + ';
|
| 266 |
+
$weeeXmlObj->addAttribute('separator', $weeeSeparator);
|
| 267 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 268 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 269 |
$weeeItemXmlObj->addAttribute(
|
| 270 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 271 |
);
|
| 272 |
+
$weeeItemXmlObj->addAttribute('amount', $coreHelper->currency(
|
| 273 |
+
$weeeTaxAttribute->getAmount(), true, false
|
| 274 |
));
|
| 275 |
}
|
| 276 |
+
$priceXmlObj->addAttribute('special_including_tax', $coreHelper->currency(
|
| 277 |
+
$finalPriceInclTax + $weeeTaxAmount, true, false
|
| 278 |
));
|
| 279 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
|
| 280 |
/**
|
| 281 |
* Including + Weee
|
| 282 |
*/
|
| 283 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency(
|
| 284 |
+
$regularPrice + $originalWeeeTaxAmount, true, false
|
| 285 |
));
|
| 286 |
+
$priceXmlObj->addAttribute('special_excluding_tax', $coreHelper->currency(
|
| 287 |
+
$finalPrice + $weeeTaxAmount, true, false
|
| 288 |
));
|
| 289 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 290 |
+
$weeeSeparator = ' + ';
|
| 291 |
+
$weeeXmlObj->addAttribute('separator', $weeeSeparator);
|
| 292 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 293 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 294 |
$weeeItemXmlObj->addAttribute(
|
| 295 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 296 |
);
|
| 297 |
+
$weeeItemXmlObj->addAttribute('amount', $coreHelper->currency(
|
| 298 |
+
$weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount(), true, false
|
| 299 |
));
|
| 300 |
}
|
| 301 |
+
$priceXmlObj->addAttribute('special_including_tax', $coreHelper->currency(
|
| 302 |
+
$finalPriceInclTax + $weeeTaxAmount, true, false
|
| 303 |
));
|
| 304 |
+
} elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
|
| 305 |
/**
|
| 306 |
* Excluding + Weee + Final
|
| 307 |
*/
|
| 308 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency($regularPrice, true, false));
|
| 309 |
$priceXmlObj->addAttribute(
|
| 310 |
+
'special_excluding_tax', $coreHelper->currency($finalPrice, true, false)
|
| 311 |
);
|
| 312 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
| 313 |
+
foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
|
| 314 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
| 315 |
$weeeItemXmlObj->addAttribute(
|
| 316 |
+
'name', $weeeItemXmlObj->escapeXml($weeeTaxAttribute->getName())
|
| 317 |
);
|
| 318 |
+
$weeeItemXmlObj->addAttribute('amount', $coreHelper->currency(
|
| 319 |
+
$weeeTaxAttribute->getAmount(), true, false
|
| 320 |
));
|
| 321 |
}
|
| 322 |
+
$priceXmlObj->addAttribute('special_including_tax', $coreHelper->currency(
|
| 323 |
+
$finalPriceInclTax + $weeeTaxAmount, true, false
|
| 324 |
));
|
| 325 |
} else {
|
| 326 |
/**
|
| 327 |
* Excluding
|
| 328 |
*/
|
| 329 |
+
$priceXmlObj->addAttribute('regular', $coreHelper->currency($regularPrice, true, false));
|
| 330 |
+
if ($taxHelper->displayBothPrices()) {
|
| 331 |
$priceXmlObj->addAttribute(
|
| 332 |
+
'special_excluding_tax', $coreHelper->currency($finalPrice, true, false)
|
| 333 |
);
|
| 334 |
$priceXmlObj->addAttribute(
|
| 335 |
+
'special_including_tax', $coreHelper->currency($finalPriceInclTax, true, false)
|
| 336 |
);
|
| 337 |
} else {
|
| 338 |
$priceXmlObj->addAttribute(
|
| 339 |
+
'special', $coreHelper->currency($finalPrice, true, false)
|
| 340 |
);
|
| 341 |
}
|
| 342 |
}
|
| 343 |
}
|
| 344 |
|
| 345 |
+
if ($this->getDisplayMinimalPrice() && $minimalPriceValue
|
| 346 |
+
&& $minimalPriceValue < $product->getFinalPrice()
|
| 347 |
) {
|
| 348 |
+
$minimalPriceDisplayValue = $minimalPrice;
|
| 349 |
|
| 350 |
+
if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, array(0, 1, 4))) {
|
| 351 |
+
$minimalPriceDisplayValue = $minimalPrice + $weeeTaxAmount;
|
| 352 |
}
|
| 353 |
|
| 354 |
if (!$this->getUseLinkForAsLowAs()) {
|
| 355 |
+
$priceXmlObj->addAttribute('as_low_as', $coreHelper->currency(
|
| 356 |
+
$minimalPriceDisplayValue, true, false
|
| 357 |
));
|
| 358 |
}
|
| 359 |
}
|
| 361 |
* if (!$product->isGrouped()) {
|
| 362 |
*/
|
| 363 |
} else {
|
| 364 |
+
$exclTax = $taxHelper->getPrice($product, $minimalPriceValue, null);
|
| 365 |
+
$inclTax = $taxHelper->getPrice($product, $minimalPriceValue, true);
|
| 366 |
|
| 367 |
+
if ($this->getDisplayMinimalPrice() && $minimalPriceValue) {
|
| 368 |
+
if ($taxHelper->displayBothPrices()) {
|
| 369 |
+
$priceXmlObj->addAttribute('starting_at_excluding_tax', $coreHelper->currency(
|
| 370 |
+
$exclTax, true, false
|
| 371 |
));
|
| 372 |
+
$priceXmlObj->addAttribute('starting_at_including_tax', $coreHelper->currency(
|
| 373 |
+
$inclTax, true, false
|
| 374 |
));
|
| 375 |
} else {
|
| 376 |
+
$showPrice = $inclTax;
|
| 377 |
+
if (!$taxHelper->displayPriceIncludingTax()) {
|
| 378 |
+
$showPrice = $exclTax;
|
| 379 |
}
|
| 380 |
+
$priceXmlObj->addAttribute('starting_at', $coreHelper->currency($showPrice, true, false));
|
| 381 |
}
|
| 382 |
}
|
| 383 |
}
|
| 443 |
/**
|
| 444 |
* Get tier prices (formatted) as array of strings
|
| 445 |
*
|
| 446 |
+
* @param array $tierPrices
|
| 447 |
+
* @param Mage_Catalog_Model_Product $product
|
| 448 |
* @return array
|
| 449 |
*/
|
| 450 |
+
protected function _getTierPricesTextArray($tierPrices, $product)
|
| 451 |
{
|
| 452 |
$pricesArray = array();
|
| 453 |
+
if (Mage::helper('weee')->typeOfDisplay($product, array(1, 2, 4))) {
|
| 454 |
+
$weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($product);
|
| 455 |
}
|
| 456 |
|
| 457 |
+
if ($product->isGrouped()) {
|
| 458 |
+
$tierPrices = $this->getTierPrices($product);
|
| 459 |
}
|
| 460 |
+
Mage::helper('weee')->processTierPrices($product, $tierPrices);
|
| 461 |
|
| 462 |
+
foreach ($tierPrices as $price) {
|
| 463 |
$s = '';
|
| 464 |
if ($this->helper('tax')->displayBothPrices()) {
|
| 465 |
+
if (Mage::helper('weee')->typeOfDisplay($product, 0)) {
|
| 466 |
+
$s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $price['price_qty'], $price['formated_price_incl_weee_only'], $price['formated_price_incl_weee']);
|
| 467 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 1)) {
|
| 468 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
|
| 469 |
+
if ($weeeTaxAttributes) {
|
| 470 |
+
$s .= ' (' . $this->__('%1$s incl tax.', $price['formated_price_incl_weee']);
|
| 471 |
$separator = ' + ';
|
| 472 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 473 |
+
$s .= $separator . $attribute->getName() . ': ';
|
| 474 |
+
$s .= Mage::helper('core')->currency($attribute->getAmount());
|
| 475 |
}
|
| 476 |
$s .= ')';
|
| 477 |
}
|
| 478 |
$s .= ' ' . $this->__('each');
|
| 479 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 4)) {
|
| 480 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
|
| 481 |
+
if ($weeeTaxAttributes) {
|
| 482 |
+
$s .= ' (' . $this->__('%1$s incl tax.', $price['formated_price_incl_weee']);
|
| 483 |
$separator = ' + ';
|
| 484 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 485 |
+
$s .= $separator . $attribute->getName() . ': ';
|
| 486 |
$s .= Mage::helper('core')->currency(
|
| 487 |
+
$attribute->getAmount() + $attribute->getTaxAmount()
|
| 488 |
);
|
| 489 |
}
|
| 490 |
$s .= ')';
|
| 491 |
}
|
| 492 |
$s .= ' ' . $this->__('each');
|
| 493 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 2)) {
|
| 494 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price']);
|
| 495 |
+
if ($weeeTaxAttributes) {
|
| 496 |
$s .= ' (';
|
| 497 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 498 |
+
$s .= $attribute->getName() . ': ';
|
| 499 |
+
$s .= Mage::helper('core')->currency($attribute->getAmount());
|
| 500 |
}
|
| 501 |
+
$s .= ' ' . $this->__('Total incl. Tax: %1$s', $price['formated_price_incl_weee']) . ')';
|
| 502 |
}
|
| 503 |
$s .= ' ' . $this->__('each');
|
| 504 |
} else {
|
| 505 |
+
$s .= $this->__('Buy %1$s for %2$s (%3$s incl. tax) each', $price['price_qty'], $price['formated_price'], $price['formated_price_incl_tax']);
|
| 506 |
}
|
| 507 |
} else {
|
| 508 |
if ($this->helper('tax')->displayPriceIncludingTax()) {
|
| 509 |
+
if (Mage::helper('weee')->typeOfDisplay($product, 0)) {
|
| 510 |
+
$s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price_incl_weee']);
|
| 511 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 1)) {
|
| 512 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee']);
|
| 513 |
+
if ($weeeTaxAttributes) {
|
| 514 |
$s .= ' (';
|
| 515 |
$separator = '';
|
| 516 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 517 |
+
$s .= $separator . $attribute->getName() . ': ';
|
| 518 |
+
$s .= Mage::helper('core')->currency($attribute->getAmount());
|
| 519 |
$separator = ' + ';
|
| 520 |
}
|
| 521 |
$s .= ')';
|
| 522 |
}
|
| 523 |
$s .= ' ' . $this->__('each');
|
| 524 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 4)) {
|
| 525 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee']);
|
| 526 |
+
if ($weeeTaxAttributes) {
|
| 527 |
$s .= ' (';
|
| 528 |
$separator = '';
|
| 529 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 530 |
+
$s .= $separator . $attribute->getName() . ': ';
|
| 531 |
$s .= Mage::helper('core')->currency(
|
| 532 |
+
$attribute->getAmount() + $attribute->getTaxAmount()
|
| 533 |
);
|
| 534 |
$separator = ' + ';
|
| 535 |
}
|
| 536 |
$s .= ')';
|
| 537 |
}
|
| 538 |
$s .= ' ' . $this->__('each');
|
| 539 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 2)) {
|
| 540 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_tax']);
|
| 541 |
+
if ($weeeTaxAttributes) {
|
| 542 |
$s .= ' (';
|
| 543 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 544 |
+
$s .= $attribute->getName() . ': ';
|
| 545 |
+
$s .= Mage::helper('core')->currency($attribute->getAmount());
|
| 546 |
}
|
| 547 |
+
$s .= ' ' . $this->__('Total incl. Tax: %1$s', $price['formated_price_incl_weee']) . ')';
|
| 548 |
}
|
| 549 |
$s .= ' ' . $this->__('each');
|
| 550 |
} else {
|
| 551 |
+
$s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price_incl_tax']);
|
| 552 |
}
|
| 553 |
} else {
|
| 554 |
+
if (Mage::helper('weee')->typeOfDisplay($product, 0)) {
|
| 555 |
+
$s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price_incl_weee_only']);
|
| 556 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 1)) {
|
| 557 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
|
| 558 |
+
if ($weeeTaxAttributes) {
|
| 559 |
$s .= ' (';
|
| 560 |
$separator = '';
|
| 561 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 562 |
+
$s .= $separator . $attribute->getName() . ': ';
|
| 563 |
+
$s .= Mage::helper('core')->currency($attribute->getAmount());
|
| 564 |
$separator = ' + ';
|
| 565 |
}
|
| 566 |
$s .= ')';
|
| 567 |
}
|
| 568 |
$s .= ' ' . $this->__('each');
|
| 569 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 4)) {
|
| 570 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price_incl_weee_only']);
|
| 571 |
+
if ($weeeTaxAttributes) {
|
| 572 |
$s .= ' (';
|
| 573 |
$separator = '';
|
| 574 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 575 |
+
$s .= $separator . $attribute->getName() . ': ';
|
| 576 |
$s .= Mage::helper('core')->currency(
|
| 577 |
+
$attribute->getAmount() + $attribute->getTaxAmount()
|
| 578 |
);
|
| 579 |
$separator = ' + ';
|
| 580 |
}
|
| 581 |
$s .= ')';
|
| 582 |
}
|
| 583 |
$s .= ' ' . $this->__('each');
|
| 584 |
+
} else if (Mage::helper('weee')->typeOfDisplay($product, 2)) {
|
| 585 |
+
$s .= $this->__('Buy %1$s for %2$s', $price['price_qty'], $price['formated_price']);
|
| 586 |
+
if ($weeeTaxAttributes) {
|
| 587 |
$s .= ' (';
|
| 588 |
+
foreach ($weeeTaxAttributes as $attribute) {
|
| 589 |
+
$s .= $attribute->getName() . ': ';
|
| 590 |
+
$s .= Mage::helper('core')->currency($attribute->getAmount());
|
| 591 |
}
|
| 592 |
+
$s .= ' ' . $this->__('Total incl. Tax: %1$s', $price['formated_price_incl_weee_only']) . ')';
|
| 593 |
}
|
| 594 |
$s .= ' ' . $this->__('each');
|
| 595 |
} else {
|
| 596 |
+
$s .= $this->__('Buy %1$s for %2$s each', $price['price_qty'], $price['formated_price']);
|
| 597 |
}
|
| 598 |
}
|
| 599 |
}
|
| 600 |
+
if (!$product->isGrouped()) {
|
| 601 |
+
$condition1 = ($product->getPrice() == $product->getFinalPrice()
|
| 602 |
+
&& $product->getPrice() > $price['price']);
|
| 603 |
|
| 604 |
+
$condition2 = ($product->getPrice() != $product->getFinalPrice()
|
| 605 |
+
&& $product->getFinalPrice() > $price['price']);
|
| 606 |
|
| 607 |
if ($condition1 || $condition2) {
|
| 608 |
+
$s .= ' ' . $this->__('and') . ' ' . $this->__('save') . ' ' . $price['savePercent'] . '%';
|
| 609 |
}
|
| 610 |
}
|
| 611 |
$pricesArray[] = $s;
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php
CHANGED
|
@@ -75,15 +75,15 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Giftcard extends Mage_Bundle_B
|
|
| 75 |
if ($product->getCanShowPrice() !== false) {
|
| 76 |
$priceXmlObj = $item->addChild('price');
|
| 77 |
|
| 78 |
-
$
|
| 79 |
-
$
|
| 80 |
-
if ($
|
| 81 |
-
$priceXmlObj->addAttribute('regular', Mage::helper('core')->currency($
|
| 82 |
-
} else if ($
|
| 83 |
$priceXmlObj->addAttribute(
|
| 84 |
'regular',
|
| 85 |
Mage::helper('enterprise_giftcard')->__('From') . ': '
|
| 86 |
-
. Mage::helper('core')->currency($
|
| 87 |
);
|
| 88 |
}
|
| 89 |
}
|
| 75 |
if ($product->getCanShowPrice() !== false) {
|
| 76 |
$priceXmlObj = $item->addChild('price');
|
| 77 |
|
| 78 |
+
$min = $this->getMinAmount();
|
| 79 |
+
$max = $this->getMaxAmount();
|
| 80 |
+
if ($min && $max && $min == $max) {
|
| 81 |
+
$priceXmlObj->addAttribute('regular', Mage::helper('core')->currency($min, true, false));
|
| 82 |
+
} else if ($min && $min != 0) {
|
| 83 |
$priceXmlObj->addAttribute(
|
| 84 |
'regular',
|
| 85 |
Mage::helper('enterprise_giftcard')->__('From') . ': '
|
| 86 |
+
. Mage::helper('core')->currency($min, true, false)
|
| 87 |
);
|
| 88 |
}
|
| 89 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Checkout_Address_Form extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer address form xml
|
|
@@ -111,4 +111,51 @@ class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Templa
|
|
| 111 |
|
| 112 |
return $fromXmlObj->getXml();
|
| 113 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer address form xml
|
| 111 |
|
| 112 |
return $fromXmlObj->getXml();
|
| 113 |
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Retrieve regions by country
|
| 117 |
+
*
|
| 118 |
+
* @deprecated will delete in the next version
|
| 119 |
+
* @param string $countryId
|
| 120 |
+
* @return array
|
| 121 |
+
*/
|
| 122 |
+
protected function _getRegionOptions($countryId)
|
| 123 |
+
{
|
| 124 |
+
$cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . Mage::app()->getStore()->getId() . $countryId;
|
| 125 |
+
$cache = Mage::app()->loadCache($cacheKey);
|
| 126 |
+
if (Mage::app()->useCache('config') && $cache) {
|
| 127 |
+
$options = unserialize($cache);
|
| 128 |
+
} else {
|
| 129 |
+
$collection = Mage::getModel('directory/region')->getResourceCollection()->addCountryFilter($countryId)
|
| 130 |
+
->load();
|
| 131 |
+
$options = $collection->toOptionArray();
|
| 132 |
+
if (Mage::app()->useCache('config')) {
|
| 133 |
+
Mage::app()->saveCache(serialize($options), $cacheKey, array('config'));
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
return $options;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Retrieve countries
|
| 141 |
+
*
|
| 142 |
+
* @deprecated will delete in the next version
|
| 143 |
+
* @return array
|
| 144 |
+
*/
|
| 145 |
+
protected function _getCountryOptions()
|
| 146 |
+
{
|
| 147 |
+
$cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
| 148 |
+
$cache = Mage::app()->loadCache($cacheKey);
|
| 149 |
+
if (Mage::app()->useCache('config') && $cache) {
|
| 150 |
+
$options = unserialize($cache);
|
| 151 |
+
} else {
|
| 152 |
+
/** @var $collection Mage_Directory_Model_Mysql4_Country_Collection */
|
| 153 |
+
$collection = Mage::getModel('directory/country')->getResourceCollection()->loadByStore();
|
| 154 |
+
$options = $collection->toOptionArray(false);
|
| 155 |
+
if (Mage::app()->useCache('config')) {
|
| 156 |
+
Mage::app()->saveCache(serialize($options), $cacheKey, array('config'));
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
return $options;
|
| 160 |
+
}
|
| 161 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Configurable.php
CHANGED
|
@@ -44,7 +44,8 @@ class Mage_Xmlconnect_Block_Checkout_Cart_Item_Renderer_Configurable
|
|
| 44 |
$product = $this->getChildProduct();
|
| 45 |
if (!$product || !$product->getData('thumbnail')
|
| 46 |
|| ($product->getData('thumbnail') == 'no_selection')
|
| 47 |
-
|| (Mage::getStoreConfig(self::CONFIGURABLE_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)
|
|
|
|
| 48 |
$product = $this->getProduct();
|
| 49 |
}
|
| 50 |
return $this->helper('xmlconnect/catalog_product_image')->init($product, 'thumbnail');
|
| 44 |
$product = $this->getChildProduct();
|
| 45 |
if (!$product || !$product->getData('thumbnail')
|
| 46 |
|| ($product->getData('thumbnail') == 'no_selection')
|
| 47 |
+
|| (Mage::getStoreConfig(self::CONFIGURABLE_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)
|
| 48 |
+
) {
|
| 49 |
$product = $this->getProduct();
|
| 50 |
}
|
| 51 |
return $this->helper('xmlconnect/catalog_product_image')->init($product, 'thumbnail');
|
app/code/core/Mage/XmlConnect/Block/Checkout/Cart/Item/Renderer/Grouped.php
CHANGED
|
@@ -43,7 +43,8 @@ class Mage_Xmlconnect_Block_Checkout_Cart_Item_Renderer_Grouped extends Mage_Che
|
|
| 43 |
$product = $this->getProduct();
|
| 44 |
if (!$product->getData('thumbnail')
|
| 45 |
||($product->getData('thumbnail') == 'no_selection')
|
| 46 |
-
|| (Mage::getStoreConfig(self::GROUPED_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)
|
|
|
|
| 47 |
$product = $this->getGroupedProduct();
|
| 48 |
}
|
| 49 |
return $this->helper('xmlconnect/catalog_product_image')->init($product, 'thumbnail');
|
| 43 |
$product = $this->getProduct();
|
| 44 |
if (!$product->getData('thumbnail')
|
| 45 |
||($product->getData('thumbnail') == 'no_selection')
|
| 46 |
+
|| (Mage::getStoreConfig(self::GROUPED_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)
|
| 47 |
+
) {
|
| 48 |
$product = $this->getGroupedProduct();
|
| 49 |
}
|
| 50 |
return $this->helper('xmlconnect/catalog_product_image')->init($product, 'thumbnail');
|
app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Checkout_Onepage_Address extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Save address action
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Checkout_Onepage_Address extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Save address action
|
app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/Form.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Checkout_Onepage_Address_Form extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer address form
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Checkout_Onepage_Address_Form extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer address form
|
app/code/core/Mage/XmlConnect/Block/Checkout/Onepage/Address/List.php
CHANGED
|
@@ -43,15 +43,15 @@ class Mage_XmlConnect_Block_Checkout_Onepage_Address_List extends Mage_Checkout_
|
|
| 43 |
/** @var $listChild Mage_XmlConnect_Model_Simplexml_Element */
|
| 44 |
$listChild = $this->getXmlObj();
|
| 45 |
|
| 46 |
-
$
|
| 47 |
-
$
|
| 48 |
|
| 49 |
foreach ($this->getCustomer()->getAddresses() as $address) {
|
| 50 |
$childOptions = array();
|
| 51 |
-
if ($
|
| 52 |
$childOptions['default_billing'] = 1;
|
| 53 |
}
|
| 54 |
-
if ($
|
| 55 |
$childOptions['default_shipping'] = 1;
|
| 56 |
}
|
| 57 |
$addressItem = $listChild->addCustomChild('item', null, $childOptions);
|
| 43 |
/** @var $listChild Mage_XmlConnect_Model_Simplexml_Element */
|
| 44 |
$listChild = $this->getXmlObj();
|
| 45 |
|
| 46 |
+
$billingAddress = $this->getCustomer()->getPrimaryBillingAddress();
|
| 47 |
+
$shippingAddress = $this->getCustomer()->getPrimaryShippingAddress();
|
| 48 |
|
| 49 |
foreach ($this->getCustomer()->getAddresses() as $address) {
|
| 50 |
$childOptions = array();
|
| 51 |
+
if ($billingAddress && ($billingAddress->getEntityId() == $address->getEntityId())) {
|
| 52 |
$childOptions['default_billing'] = 1;
|
| 53 |
}
|
| 54 |
+
if ($shippingAddress && ($shippingAddress->getEntityId() == $address->getEntityId())) {
|
| 55 |
$childOptions['default_shipping'] = 1;
|
| 56 |
}
|
| 57 |
$addressItem = $listChild->addCustomChild('item', null, $childOptions);
|
app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php
CHANGED
|
@@ -78,12 +78,12 @@ class Mage_XmlConnect_Block_Checkout_Order_Review_Info extends Mage_Checkout_Blo
|
|
| 78 |
}
|
| 79 |
|
| 80 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 81 |
-
$
|
| 82 |
$typeOfDisplay = Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales');
|
| 83 |
if ($typeOfDisplay && $item->getWeeeTaxAppliedAmount()) {
|
| 84 |
-
$inclPrice = $
|
| 85 |
} else {
|
| 86 |
-
$inclPrice = $
|
| 87 |
}
|
| 88 |
}
|
| 89 |
|
|
@@ -127,13 +127,13 @@ class Mage_XmlConnect_Block_Checkout_Order_Review_Info extends Mage_Checkout_Blo
|
|
| 127 |
}
|
| 128 |
}
|
| 129 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 130 |
-
$
|
| 131 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 132 |
&& $item->getWeeeTaxAppliedAmount()
|
| 133 |
) {
|
| 134 |
-
$inclPrice = $
|
| 135 |
} else {
|
| 136 |
-
$inclPrice = $
|
| 137 |
}
|
| 138 |
}
|
| 139 |
|
|
@@ -166,15 +166,15 @@ class Mage_XmlConnect_Block_Checkout_Order_Review_Info extends Mage_Checkout_Blo
|
|
| 166 |
/**
|
| 167 |
* Options list
|
| 168 |
*/
|
| 169 |
-
$
|
| 170 |
-
if ($
|
| 171 |
$itemOptionsXml = $itemXml->addChild('options');
|
| 172 |
-
foreach ($
|
| 173 |
-
$
|
| 174 |
$optionXml = $itemOptionsXml->addChild('option');
|
| 175 |
-
$labelValue = $itemsXmlObj->escapeXml($
|
| 176 |
$optionXml->addAttribute('label', $labelValue);
|
| 177 |
-
$textValue = $itemsXmlObj->escapeXml($
|
| 178 |
$optionXml->addAttribute('text', $textValue);
|
| 179 |
}
|
| 180 |
}
|
| 78 |
}
|
| 79 |
|
| 80 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 81 |
+
$incl = $this->helper('checkout')->getPriceInclTax($item);
|
| 82 |
$typeOfDisplay = Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales');
|
| 83 |
if ($typeOfDisplay && $item->getWeeeTaxAppliedAmount()) {
|
| 84 |
+
$inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
|
| 85 |
} else {
|
| 86 |
+
$inclPrice = $incl - $item->getWeeeTaxDisposition();
|
| 87 |
}
|
| 88 |
}
|
| 89 |
|
| 127 |
}
|
| 128 |
}
|
| 129 |
if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
| 130 |
+
$incl = $this->helper('checkout')->getSubtotalInclTax($item);
|
| 131 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales')
|
| 132 |
&& $item->getWeeeTaxAppliedAmount()
|
| 133 |
) {
|
| 134 |
+
$inclPrice = $incl + $item->getWeeeTaxAppliedRowAmount();
|
| 135 |
} else {
|
| 136 |
+
$inclPrice = $incl - $item->getWeeeTaxRowDisposition();
|
| 137 |
}
|
| 138 |
}
|
| 139 |
|
| 166 |
/**
|
| 167 |
* Options list
|
| 168 |
*/
|
| 169 |
+
$options = $renderer->getOptionList();
|
| 170 |
+
if ($options) {
|
| 171 |
$itemOptionsXml = $itemXml->addChild('options');
|
| 172 |
+
foreach ($options as $option) {
|
| 173 |
+
$formattedOptionValue = $renderer->getFormatedOptionValue($option);
|
| 174 |
$optionXml = $itemOptionsXml->addChild('option');
|
| 175 |
+
$labelValue = $itemsXmlObj->escapeXml($option['label']);
|
| 176 |
$optionXml->addAttribute('label', $labelValue);
|
| 177 |
+
$textValue = $itemsXmlObj->escapeXml($formattedOptionValue['value']);
|
| 178 |
$optionXml->addAttribute('text', $textValue);
|
| 179 |
}
|
| 180 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php
CHANGED
|
@@ -80,8 +80,8 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Ccsave extends Mage_Payment_
|
|
| 80 |
|
| 81 |
$ccTypes = $helper->getArrayAsXmlItemValues($this->getCcAvailableTypes(), $this->getInfoData('cc_type'));
|
| 82 |
|
| 83 |
-
$
|
| 84 |
-
$ccMonths = $helper->getArrayAsXmlItemValues($
|
| 85 |
|
| 86 |
$ccYears = $helper->getArrayAsXmlItemValues($this->getCcYears(), $this->getInfoData('cc_exp_year'));
|
| 87 |
|
|
@@ -100,7 +100,7 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Ccsave extends Mage_Payment_
|
|
| 100 |
$solo = '';
|
| 101 |
if ($this->hasSsCardType()) {
|
| 102 |
$ssCcMonths = $helper->getArrayAsXmlItemValues(
|
| 103 |
-
$
|
| 104 |
);
|
| 105 |
$ssCcYears = $helper->getArrayAsXmlItemValues(
|
| 106 |
$this->getSsStartYears(), $this->getInfoData('cc_ss_start_year')
|
| 80 |
|
| 81 |
$ccTypes = $helper->getArrayAsXmlItemValues($this->getCcAvailableTypes(), $this->getInfoData('cc_type'));
|
| 82 |
|
| 83 |
+
$ccMonthArray = $this->getCcMonths();
|
| 84 |
+
$ccMonths = $helper->getArrayAsXmlItemValues($ccMonthArray, $this->getInfoData('cc_exp_month'));
|
| 85 |
|
| 86 |
$ccYears = $helper->getArrayAsXmlItemValues($this->getCcYears(), $this->getInfoData('cc_exp_year'));
|
| 87 |
|
| 100 |
$solo = '';
|
| 101 |
if ($this->hasSsCardType()) {
|
| 102 |
$ssCcMonths = $helper->getArrayAsXmlItemValues(
|
| 103 |
+
$ccMonthArray, $this->getInfoData('cc_ss_start_month')
|
| 104 |
);
|
| 105 |
$ssCcYears = $helper->getArrayAsXmlItemValues(
|
| 106 |
$this->getSsStartYears(), $this->getInfoData('cc_ss_start_year')
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php
CHANGED
|
@@ -44,8 +44,8 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Ccsave extends Mage_Pay
|
|
| 44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
| 45 |
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
| 46 |
|
| 47 |
-
if ($
|
| 48 |
-
foreach ($
|
| 49 |
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
| 50 |
'label' => $label
|
| 51 |
));
|
| 44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
| 45 |
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
| 46 |
|
| 47 |
+
if ($specificInfo = $this->getSpecificInformation()) {
|
| 48 |
+
foreach ($specificInfo as $label => $value) {
|
| 49 |
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
| 50 |
'label' => $label
|
| 51 |
));
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php
CHANGED
|
@@ -44,8 +44,8 @@ abstract class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Paypal_Abstrac
|
|
| 44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
| 45 |
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
| 46 |
|
| 47 |
-
if ($
|
| 48 |
-
foreach ($
|
| 49 |
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
| 50 |
'label' => $label
|
| 51 |
));
|
| 44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
| 45 |
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
| 46 |
|
| 47 |
+
if ($specificInfo = $this->getSpecificInformation()) {
|
| 48 |
+
foreach ($specificInfo as $label => $value) {
|
| 49 |
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
| 50 |
'label' => $label
|
| 51 |
));
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php
CHANGED
|
@@ -44,8 +44,8 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Pbridge_Verisign extend
|
|
| 44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
| 45 |
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
| 46 |
|
| 47 |
-
if ($
|
| 48 |
-
foreach ($
|
| 49 |
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
| 50 |
'label' => $label
|
| 51 |
));
|
| 44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
| 45 |
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
| 46 |
|
| 47 |
+
if ($specificInfo = $this->getSpecificInformation()) {
|
| 48 |
+
foreach ($specificInfo as $label => $value) {
|
| 49 |
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
| 50 |
'label' => $label
|
| 51 |
));
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php
CHANGED
|
@@ -76,7 +76,7 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_List extends Mage_Payment_Bl
|
|
| 76 |
*/
|
| 77 |
public function getQuote()
|
| 78 |
{
|
| 79 |
-
return Mage::getSingleton('
|
| 80 |
}
|
| 81 |
|
| 82 |
/**
|
|
@@ -372,4 +372,30 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_List extends Mage_Payment_Bl
|
|
| 372 |
}
|
| 373 |
return $this;
|
| 374 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
}
|
| 76 |
*/
|
| 77 |
public function getQuote()
|
| 78 |
{
|
| 79 |
+
return Mage::getSingleton('checkout/session')->getQuote();
|
| 80 |
}
|
| 81 |
|
| 82 |
/**
|
| 372 |
}
|
| 373 |
return $this;
|
| 374 |
}
|
| 375 |
+
|
| 376 |
+
/**
|
| 377 |
+
* Deprecated function adding Payment method to the xml
|
| 378 |
+
*
|
| 379 |
+
* @deprecated after 1.4.2.0
|
| 380 |
+
* @param Mage_Core_Block_Template $block
|
| 381 |
+
* @param Mage_XmlConnect_Model_Simplexml_Element $methodsXmlObj
|
| 382 |
+
* @param array $usedCodes
|
| 383 |
+
* @return bool
|
| 384 |
+
*/
|
| 385 |
+
protected function _addToXml($block, $methodsXmlObj, $usedCodes)
|
| 386 |
+
{
|
| 387 |
+
return false;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
/**
|
| 391 |
+
* Deprecated function check method status
|
| 392 |
+
*
|
| 393 |
+
* @deprecated after 1.4.2.0
|
| 394 |
+
* @param Mage_Payment_Model_Method_Abstract $method
|
| 395 |
+
* @return bool
|
| 396 |
+
*/
|
| 397 |
+
public function isAvailable($method)
|
| 398 |
+
{
|
| 399 |
+
return $method->isAvailable($this->getQuote());
|
| 400 |
+
}
|
| 401 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php
CHANGED
|
@@ -75,29 +75,29 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Paypal_Payflow extends Mage_
|
|
| 75 |
$formXmlObj->addAttribute('name', 'payment_form_' . $method->getCode());
|
| 76 |
$formXmlObj->addAttribute('method', 'post');
|
| 77 |
|
| 78 |
-
$
|
| 79 |
$ccTypes = '';
|
| 80 |
|
| 81 |
-
foreach ($this->getCcAvailableTypes() as $
|
| 82 |
-
if (!$
|
| 83 |
continue;
|
| 84 |
}
|
| 85 |
$ccTypes .= '
|
| 86 |
-
<item' . ($
|
| 87 |
<label>' . $_typeName . '</label>
|
| 88 |
-
<value>' . $
|
| 89 |
</item>';
|
| 90 |
}
|
| 91 |
|
| 92 |
$ccMonthes = '';
|
| 93 |
|
| 94 |
-
$
|
| 95 |
foreach ($this->getCcMonths() as $k => $v) {
|
| 96 |
if (!$k) {
|
| 97 |
continue;
|
| 98 |
}
|
| 99 |
$ccMonthes .= '
|
| 100 |
-
<item' . ($k == $
|
| 101 |
<label>' . $v . '</label>
|
| 102 |
<value>' . ($k ? $k : '') . '</value>
|
| 103 |
</item>';
|
|
@@ -105,13 +105,13 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Paypal_Payflow extends Mage_
|
|
| 105 |
|
| 106 |
$ccYears = '';
|
| 107 |
|
| 108 |
-
$
|
| 109 |
foreach ($this->getCcYears() as $k => $v) {
|
| 110 |
if (!$k) {
|
| 111 |
continue;
|
| 112 |
}
|
| 113 |
$ccYears .= '
|
| 114 |
-
<item' . ($k == $
|
| 115 |
<label>' . $v . '</label>
|
| 116 |
<value>' . ($k ? $k : '') . '</value>
|
| 117 |
</item>';
|
| 75 |
$formXmlObj->addAttribute('name', 'payment_form_' . $method->getCode());
|
| 76 |
$formXmlObj->addAttribute('method', 'post');
|
| 77 |
|
| 78 |
+
$ccType = $this->getInfoData('cc_type');
|
| 79 |
$ccTypes = '';
|
| 80 |
|
| 81 |
+
foreach ($this->getCcAvailableTypes() as $typeCode => $_typeName) {
|
| 82 |
+
if (!$typeCode) {
|
| 83 |
continue;
|
| 84 |
}
|
| 85 |
$ccTypes .= '
|
| 86 |
+
<item' . ($typeCode == $ccType ? ' selected="1"' : '') . '>
|
| 87 |
<label>' . $_typeName . '</label>
|
| 88 |
+
<value>' . $typeCode . '</value>
|
| 89 |
</item>';
|
| 90 |
}
|
| 91 |
|
| 92 |
$ccMonthes = '';
|
| 93 |
|
| 94 |
+
$ccExpMonth = $this->getInfoData('cc_exp_month');
|
| 95 |
foreach ($this->getCcMonths() as $k => $v) {
|
| 96 |
if (!$k) {
|
| 97 |
continue;
|
| 98 |
}
|
| 99 |
$ccMonthes .= '
|
| 100 |
+
<item' . ($k == $ccExpMonth ? ' selected="1"' : '') . '>
|
| 101 |
<label>' . $v . '</label>
|
| 102 |
<value>' . ($k ? $k : '') . '</value>
|
| 103 |
</item>';
|
| 105 |
|
| 106 |
$ccYears = '';
|
| 107 |
|
| 108 |
+
$ccExpYear = $this->getInfoData('cc_exp_year');
|
| 109 |
foreach ($this->getCcYears() as $k => $v) {
|
| 110 |
if (!$k) {
|
| 111 |
continue;
|
| 112 |
}
|
| 113 |
$ccYears .= '
|
| 114 |
+
<item' . ($k == $ccExpYear ? ' selected="1"' : '') . '>
|
| 115 |
<label>' . $v . '</label>
|
| 116 |
<value>' . ($k ? $k : '') . '</value>
|
| 117 |
</item>';
|
app/code/core/Mage/XmlConnect/Block/Checkout/Pbridge/Result.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Checkout_Pbridge_Result extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Return url for redirect with params of Payment Bridge incoming data
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Checkout_Pbridge_Result extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Return url for redirect with params of Payment Bridge incoming data
|
app/code/core/Mage/XmlConnect/Block/Configuration.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Configuration extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Current application model
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Configuration extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Current application model
|
app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php
CHANGED
|
@@ -323,6 +323,41 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
| 323 |
return $this;
|
| 324 |
}
|
| 325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
/**
|
| 327 |
* Get customer name widget block
|
| 328 |
*
|
| 323 |
return $this;
|
| 324 |
}
|
| 325 |
|
| 326 |
+
/**
|
| 327 |
+
* Add custom customer attributes
|
| 328 |
+
*
|
| 329 |
+
* @deprecated will delete in the next version
|
| 330 |
+
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $addressFieldset
|
| 331 |
+
* @return Mage_XmlConnect_Block_Customer_Address_Form
|
| 332 |
+
*/
|
| 333 |
+
protected function _addCustomAddressAttributes(
|
| 334 |
+
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $addressFieldset
|
| 335 |
+
) {
|
| 336 |
+
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
| 337 |
+
/** @var $addressAttrBlock Enterprise_Customer_Block_Form */
|
| 338 |
+
$addressAttrBlock = $this->getLayout()
|
| 339 |
+
->addBlock('enterprise_customer/form', 'customer_address_attr');
|
| 340 |
+
$addressAttrBlock->setFormCode('customer_address_edit');
|
| 341 |
+
$addressAttrBlock->setEntity($this->getAddress());
|
| 342 |
+
|
| 343 |
+
foreach ($this->_customerFiledRenderer as $type => $rendererBlock) {
|
| 344 |
+
$addressAttrBlock->addRenderer($type, $rendererBlock, 'customer/form/renderer/text.phtml');
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
if ($addressAttrBlock->hasUserDefinedAttributes()) {
|
| 348 |
+
foreach ($addressAttrBlock->getUserDefinedAttributes() as $attribute) {
|
| 349 |
+
$type = $attribute->getFrontendInput();
|
| 350 |
+
$block = $addressAttrBlock->getRenderer($type);
|
| 351 |
+
if ($block) {
|
| 352 |
+
$block->setAttributeObject($attribute)->setEntity($addressAttrBlock->getEntity())
|
| 353 |
+
->addFieldToXmlObj($addressFieldset);
|
| 354 |
+
}
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
return $this;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
/**
|
| 362 |
* Get customer name widget block
|
| 363 |
*
|
app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Customer_Address_List extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer address list xml
|
|
@@ -43,10 +43,10 @@ class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Templa
|
|
| 43 |
$addressXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<address></address>');
|
| 44 |
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 45 |
|
| 46 |
-
$
|
| 47 |
-
$
|
| 48 |
-
$billingAddress = $customer->getAddressById($
|
| 49 |
-
$shippingAddress = $customer->getAddressById($
|
| 50 |
|
| 51 |
if ($billingAddress && $billingAddress->getId()) {
|
| 52 |
$item = $addressXmlObj->addChild('item');
|
|
@@ -60,13 +60,13 @@ class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Templa
|
|
| 60 |
$item->addAttribute('default_shipping', 1);
|
| 61 |
$this->prepareAddressData($shippingAddress, $item);
|
| 62 |
}
|
| 63 |
-
$
|
| 64 |
-
if ($
|
| 65 |
-
foreach ($
|
| 66 |
$item = $addressXmlObj->addChild('item');
|
| 67 |
$item->addAttribute('label', $this->__('Additional Address'));
|
| 68 |
$item->addAttribute('additional', 1);
|
| 69 |
-
$this->prepareAddressData($
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
|
@@ -81,9 +81,9 @@ class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Templa
|
|
| 81 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 82 |
* @return array
|
| 83 |
*/
|
| 84 |
-
public function prepareAddressData(
|
| 85 |
-
|
| 86 |
-
|
| 87 |
if (!$address) {
|
| 88 |
return array();
|
| 89 |
}
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer address list xml
|
| 43 |
$addressXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<address></address>');
|
| 44 |
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 45 |
|
| 46 |
+
$billingAddssesId = $customer->getDefaultBilling();
|
| 47 |
+
$shippingAddssesId = $customer->getDefaultShipping();
|
| 48 |
+
$billingAddress = $customer->getAddressById($billingAddssesId);
|
| 49 |
+
$shippingAddress = $customer->getAddressById($shippingAddssesId);
|
| 50 |
|
| 51 |
if ($billingAddress && $billingAddress->getId()) {
|
| 52 |
$item = $addressXmlObj->addChild('item');
|
| 60 |
$item->addAttribute('default_shipping', 1);
|
| 61 |
$this->prepareAddressData($shippingAddress, $item);
|
| 62 |
}
|
| 63 |
+
$additionalAddresses = $customer->getAdditionalAddresses();
|
| 64 |
+
if ($additionalAddresses) {
|
| 65 |
+
foreach ($additionalAddresses as $address) {
|
| 66 |
$item = $addressXmlObj->addChild('item');
|
| 67 |
$item->addAttribute('label', $this->__('Additional Address'));
|
| 68 |
$item->addAttribute('additional', 1);
|
| 69 |
+
$this->prepareAddressData($address, $item);
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 81 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
| 82 |
* @return array
|
| 83 |
*/
|
| 84 |
+
public function prepareAddressData(Mage_Customer_Model_Address $address,
|
| 85 |
+
Mage_XmlConnect_Model_Simplexml_Element $item)
|
| 86 |
+
{
|
| 87 |
if (!$address) {
|
| 88 |
return array();
|
| 89 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Form.php
CHANGED
|
@@ -31,40 +31,8 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Customer_Form extends
|
| 35 |
{
|
| 36 |
-
/**
|
| 37 |
-
* Action type
|
| 38 |
-
*
|
| 39 |
-
* Action type false on registration page and true on account edit page
|
| 40 |
-
*
|
| 41 |
-
* @var bool
|
| 42 |
-
*/
|
| 43 |
-
protected $_isEditPage = false;
|
| 44 |
-
|
| 45 |
-
/**
|
| 46 |
-
* Checkout page
|
| 47 |
-
*
|
| 48 |
-
* True only for checkout registration page
|
| 49 |
-
*
|
| 50 |
-
* @var bool
|
| 51 |
-
*/
|
| 52 |
-
protected $_isCheckoutRegistrationPage = false;
|
| 53 |
-
|
| 54 |
-
/**
|
| 55 |
-
* Attributes block name
|
| 56 |
-
*
|
| 57 |
-
* @var string
|
| 58 |
-
*/
|
| 59 |
-
protected $_attributesBlockName = '';
|
| 60 |
-
|
| 61 |
-
/**
|
| 62 |
-
* Customer form code
|
| 63 |
-
*
|
| 64 |
-
* @var string
|
| 65 |
-
*/
|
| 66 |
-
protected $_customerFormCode = '';
|
| 67 |
-
|
| 68 |
/**
|
| 69 |
* Render customer form xml
|
| 70 |
*
|
|
@@ -228,92 +196,4 @@ class Mage_XmlConnect_Block_Customer_Form extends Mage_Core_Block_Template
|
|
| 228 |
}
|
| 229 |
return array();
|
| 230 |
}
|
| 231 |
-
|
| 232 |
-
/**
|
| 233 |
-
* Get action type
|
| 234 |
-
*
|
| 235 |
-
* @return boolean
|
| 236 |
-
*/
|
| 237 |
-
public function getIsEditPage()
|
| 238 |
-
{
|
| 239 |
-
return $this->_isEditPage;
|
| 240 |
-
}
|
| 241 |
-
|
| 242 |
-
/**
|
| 243 |
-
* Set action type
|
| 244 |
-
*
|
| 245 |
-
* @param boolean $actionType
|
| 246 |
-
* @return Mage_XmlConnect_Block_Customer_Form
|
| 247 |
-
*/
|
| 248 |
-
public function setIsEditPage($actionType)
|
| 249 |
-
{
|
| 250 |
-
$this->_isEditPage = $actionType;
|
| 251 |
-
return $this;
|
| 252 |
-
}
|
| 253 |
-
|
| 254 |
-
/**
|
| 255 |
-
* Set customer form code
|
| 256 |
-
*
|
| 257 |
-
* @param string $customerFormCode
|
| 258 |
-
* @return Mage_XmlConnect_Block_Customer_Form
|
| 259 |
-
*/
|
| 260 |
-
public function setCustomerFormCode($customerFormCode)
|
| 261 |
-
{
|
| 262 |
-
$this->_customerFormCode = $customerFormCode;
|
| 263 |
-
return $this;
|
| 264 |
-
}
|
| 265 |
-
|
| 266 |
-
/**
|
| 267 |
-
* Get customer form code
|
| 268 |
-
*
|
| 269 |
-
* @return string
|
| 270 |
-
*/
|
| 271 |
-
public function getCustomerFormCode()
|
| 272 |
-
{
|
| 273 |
-
return $this->_customerFormCode;
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
/**
|
| 277 |
-
* Set attributes block name
|
| 278 |
-
*
|
| 279 |
-
* @param string $attributesBlockName
|
| 280 |
-
* @return Mage_XmlConnect_Block_Customer_Form
|
| 281 |
-
*/
|
| 282 |
-
public function setAttributesBlockName($attributesBlockName)
|
| 283 |
-
{
|
| 284 |
-
$this->_attributesBlockName = $attributesBlockName;
|
| 285 |
-
return $this;
|
| 286 |
-
}
|
| 287 |
-
|
| 288 |
-
/**
|
| 289 |
-
* Get attributes block name
|
| 290 |
-
*
|
| 291 |
-
* @return string
|
| 292 |
-
*/
|
| 293 |
-
public function getAttributesBlockName()
|
| 294 |
-
{
|
| 295 |
-
return $this->_attributesBlockName;
|
| 296 |
-
}
|
| 297 |
-
|
| 298 |
-
/**
|
| 299 |
-
* Set is checkout page registration
|
| 300 |
-
*
|
| 301 |
-
* @param boolean $checkoutPageRegistration
|
| 302 |
-
* @return Mage_XmlConnect_Block_Customer_Form
|
| 303 |
-
*/
|
| 304 |
-
public function setIsCheckoutRegistrationPage($checkoutPageRegistration)
|
| 305 |
-
{
|
| 306 |
-
$this->_isCheckoutRegistrationPage = $checkoutPageRegistration;
|
| 307 |
-
return $this;
|
| 308 |
-
}
|
| 309 |
-
|
| 310 |
-
/**
|
| 311 |
-
* Get is checkout page registration
|
| 312 |
-
*
|
| 313 |
-
* @return boolean
|
| 314 |
-
*/
|
| 315 |
-
public function getIsCheckoutRegistrationPage()
|
| 316 |
-
{
|
| 317 |
-
return $this->_isCheckoutRegistrationPage;
|
| 318 |
-
}
|
| 319 |
}
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Customer_Form extends Mage_Core_Block_Abstract
|
| 35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
/**
|
| 37 |
* Render customer form xml
|
| 38 |
*
|
| 196 |
}
|
| 197 |
return array();
|
| 198 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php
CHANGED
|
@@ -49,7 +49,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle extends Mage_Bun
|
|
| 49 |
/** @var $parentItem Mage_Sales_Model_Order_Item */
|
| 50 |
$parentItem = $this->getItem();
|
| 51 |
$items = array_merge(array($parentItem), $parentItem->getChildrenItems());
|
| 52 |
-
$
|
| 53 |
|
| 54 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
| 55 |
$weeeHelper = $this->helper('weee');
|
|
@@ -96,9 +96,9 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle extends Mage_Bun
|
|
| 96 |
|
| 97 |
if ($isOption) {
|
| 98 |
$attributes = $this->getSelectionAttributes($item);
|
| 99 |
-
if ($
|
| 100 |
$objectXml->addAttribute('label', $objectXml->xmlAttribute($attributes['option_label']));
|
| 101 |
-
$
|
| 102 |
}
|
| 103 |
}
|
| 104 |
|
|
@@ -182,9 +182,8 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle extends Mage_Bun
|
|
| 182 |
{
|
| 183 |
/** @var $parentItem Mage_Sales_Model_Order_Item */
|
| 184 |
$parentItem = $this->getItem();
|
| 185 |
-
|
| 186 |
$items = array_merge(array($parentItem), $parentItem->getChildrenItems());
|
| 187 |
-
$
|
| 188 |
|
| 189 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
| 190 |
$weeeHelper = $this->helper('weee');
|
|
@@ -231,9 +230,9 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle extends Mage_Bun
|
|
| 231 |
|
| 232 |
if ($isOption) {
|
| 233 |
$attributes = $this->getSelectionAttributes($item);
|
| 234 |
-
if ($
|
| 235 |
$objectXml->addAttribute('label', $objectXml->xmlAttribute($attributes['option_label']));
|
| 236 |
-
$
|
| 237 |
}
|
| 238 |
}
|
| 239 |
|
| 49 |
/** @var $parentItem Mage_Sales_Model_Order_Item */
|
| 50 |
$parentItem = $this->getItem();
|
| 51 |
$items = array_merge(array($parentItem), $parentItem->getChildrenItems());
|
| 52 |
+
$prevOptionId = '';
|
| 53 |
|
| 54 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
| 55 |
$weeeHelper = $this->helper('weee');
|
| 96 |
|
| 97 |
if ($isOption) {
|
| 98 |
$attributes = $this->getSelectionAttributes($item);
|
| 99 |
+
if ($prevOptionId != $attributes['option_id']) {
|
| 100 |
$objectXml->addAttribute('label', $objectXml->xmlAttribute($attributes['option_label']));
|
| 101 |
+
$prevOptionId = $attributes['option_id'];
|
| 102 |
}
|
| 103 |
}
|
| 104 |
|
| 182 |
{
|
| 183 |
/** @var $parentItem Mage_Sales_Model_Order_Item */
|
| 184 |
$parentItem = $this->getItem();
|
|
|
|
| 185 |
$items = array_merge(array($parentItem), $parentItem->getChildrenItems());
|
| 186 |
+
$prevOptionId = '';
|
| 187 |
|
| 188 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
| 189 |
$weeeHelper = $this->helper('weee');
|
| 230 |
|
| 231 |
if ($isOption) {
|
| 232 |
$attributes = $this->getSelectionAttributes($item);
|
| 233 |
+
if ($prevOptionId != $attributes['option_id']) {
|
| 234 |
$objectXml->addAttribute('label', $objectXml->xmlAttribute($attributes['option_label']));
|
| 235 |
+
$prevOptionId = $attributes['option_id'];
|
| 236 |
}
|
| 237 |
}
|
| 238 |
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php
CHANGED
|
@@ -63,12 +63,6 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
| 63 |
|
| 64 |
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
| 65 |
|
| 66 |
-
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
|
| 67 |
-
if ($addtInfoBlock) {
|
| 68 |
-
// TODO: find how to set additional info block
|
| 69 |
-
// $addtInfoBlock->setItem($item)->toHtml();
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
$links = $this->getLinks();
|
| 73 |
if ($links) {
|
| 74 |
$linksXml = $itemXml->addCustomChild('links', null, array('label' => $this->getLinksTitle()));
|
|
@@ -147,12 +141,6 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
| 147 |
|
| 148 |
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
| 149 |
|
| 150 |
-
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
|
| 151 |
-
if ($addtInfoBlock) {
|
| 152 |
-
// TODO: find how to set additional info block
|
| 153 |
-
// $addtInfoBlock->setItem($item)->toHtml();
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
$links = $this->getLinks();
|
| 157 |
if ($links) {
|
| 158 |
$linksXml = $itemXml->addCustomChild('links', null, array('label' => $this->getLinksTitle()));
|
| 63 |
|
| 64 |
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
$links = $this->getLinks();
|
| 67 |
if ($links) {
|
| 68 |
$linksXml = $itemXml->addCustomChild('links', null, array('label' => $this->getLinksTitle()));
|
| 141 |
|
| 142 |
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
$links = $this->getLinks();
|
| 145 |
if ($links) {
|
| 146 |
$linksXml = $itemXml->addCustomChild('links', null, array('label' => $this->getLinksTitle()));
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Customer_Order_List extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Orders count limit
|
|
@@ -57,18 +57,18 @@ class Mage_XmlConnect_Block_Customer_Order_List extends Mage_Core_Block_Template
|
|
| 57 |
$orders->load();
|
| 58 |
|
| 59 |
if (sizeof($orders->getItems())) {
|
| 60 |
-
foreach ($orders as $
|
| 61 |
$item = $ordersXmlObj->addChild('item');
|
| 62 |
-
$item->addChild('entity_id', $
|
| 63 |
-
$item->addChild('number', $
|
| 64 |
-
$item->addChild('date', $this->formatDate($
|
| 65 |
-
if ($
|
| 66 |
-
$item->addChild('ship_to', $ordersXmlObj->escapeXml($
|
| 67 |
}
|
| 68 |
-
$item->addChild('total', $
|
| 69 |
-
$
|
| 70 |
));
|
| 71 |
-
$item->addChild('status', $
|
| 72 |
}
|
| 73 |
}
|
| 74 |
return $ordersXmlObj->asNiceXml();
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Customer_Order_List extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Orders count limit
|
| 57 |
$orders->load();
|
| 58 |
|
| 59 |
if (sizeof($orders->getItems())) {
|
| 60 |
+
foreach ($orders as $order) {
|
| 61 |
$item = $ordersXmlObj->addChild('item');
|
| 62 |
+
$item->addChild('entity_id', $order->getId());
|
| 63 |
+
$item->addChild('number', $order->getRealOrderId());
|
| 64 |
+
$item->addChild('date', $this->formatDate($order->getCreatedAtStoreDate()));
|
| 65 |
+
if ($order->getShippingAddress()) {
|
| 66 |
+
$item->addChild('ship_to', $ordersXmlObj->escapeXml($order->getShippingAddress()->getName()));
|
| 67 |
}
|
| 68 |
+
$item->addChild('total', $order->getOrderCurrency()->formatPrecision(
|
| 69 |
+
$order->getGrandTotal(), 2, array(), false, false
|
| 70 |
));
|
| 71 |
+
$item->addChild('status', $order->getStatusLabel());
|
| 72 |
}
|
| 73 |
}
|
| 74 |
return $ordersXmlObj->asNiceXml();
|
app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Customer_Storecredit extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer store credits xml
|
|
@@ -46,10 +46,8 @@ class Mage_XmlConnect_Block_Customer_Storecredit extends Mage_Core_Block_Templat
|
|
| 46 |
$accountBalance = $this->getLayout()
|
| 47 |
->addBlock('enterprise_customerbalance/account_balance', 'account_balance');
|
| 48 |
|
| 49 |
-
$customerBalanceHelper = Mage::helper('enterprise_customerbalance');
|
| 50 |
-
|
| 51 |
$xmlModel->addCustomChild('balance', null, array(
|
| 52 |
-
'label' => $
|
| 53 |
'value' => $accountBalance->getBalance(),
|
| 54 |
'formatted_value' => Mage::helper('core')->currency($accountBalance->getBalance(), true, false)
|
| 55 |
));
|
|
@@ -59,11 +57,11 @@ class Mage_XmlConnect_Block_Customer_Storecredit extends Mage_Core_Block_Templat
|
|
| 59 |
|
| 60 |
if ($accountHistory->canShow() && $accountHistory->getEvents() && count($accountHistory->getEvents())) {
|
| 61 |
$balanceHistory = $xmlModel->addCustomChild('balance_history', null, array(
|
| 62 |
-
'label' => $
|
| 63 |
-
'action_label' => $
|
| 64 |
-
'balance_change_label' => $
|
| 65 |
-
'balance_label' => $
|
| 66 |
-
'date_label' => $
|
| 67 |
));
|
| 68 |
|
| 69 |
foreach ($accountHistory->getEvents() as $event) {
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Customer_Storecredit extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render customer store credits xml
|
| 46 |
$accountBalance = $this->getLayout()
|
| 47 |
->addBlock('enterprise_customerbalance/account_balance', 'account_balance');
|
| 48 |
|
|
|
|
|
|
|
| 49 |
$xmlModel->addCustomChild('balance', null, array(
|
| 50 |
+
'label' => $this->__('Your current balance is:'),
|
| 51 |
'value' => $accountBalance->getBalance(),
|
| 52 |
'formatted_value' => Mage::helper('core')->currency($accountBalance->getBalance(), true, false)
|
| 53 |
));
|
| 57 |
|
| 58 |
if ($accountHistory->canShow() && $accountHistory->getEvents() && count($accountHistory->getEvents())) {
|
| 59 |
$balanceHistory = $xmlModel->addCustomChild('balance_history', null, array(
|
| 60 |
+
'label' => $this->__('Balance History'),
|
| 61 |
+
'action_label' => $this->__('Action'),
|
| 62 |
+
'balance_change_label' => $this->__('Balance Change'),
|
| 63 |
+
'balance_label' => $this->__('Balance'),
|
| 64 |
+
'date_label' => $this->__('Date')
|
| 65 |
));
|
| 66 |
|
| 67 |
foreach ($accountHistory->getEvents() as $event) {
|
app/code/core/Mage/XmlConnect/Block/Homebanners.php
CHANGED
|
@@ -31,14 +31,14 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Homebanners extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* List of images separated by device those have to be shown on home banners page
|
| 38 |
*
|
| 39 |
* @return array
|
| 40 |
*/
|
| 41 |
-
private function
|
| 42 |
{
|
| 43 |
return array(
|
| 44 |
Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID => array(
|
|
@@ -50,8 +50,7 @@ class Mage_XmlConnect_Block_Homebanners extends Mage_Core_Block_Template
|
|
| 50 |
Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD => array(
|
| 51 |
Mage_XmlConnect_Model_Device_Ipad::IMAGE_TYPE_LANDSCAPE_BANNER,
|
| 52 |
Mage_XmlConnect_Model_Device_Ipad::IMAGE_TYPE_PORTRAIT_BANNER,
|
| 53 |
-
|
| 54 |
-
);
|
| 55 |
}
|
| 56 |
|
| 57 |
/**
|
|
@@ -69,7 +68,7 @@ class Mage_XmlConnect_Block_Homebanners extends Mage_Core_Block_Template
|
|
| 69 |
/** @var $imagesModel Mage_XmlConnect_Model_Images */
|
| 70 |
$imagesModel = Mage::getModel('xmlconnect/images');
|
| 71 |
|
| 72 |
-
$bannerTypeCollection = $this->
|
| 73 |
$deviceType = $deviceHelper->getDeviceType();
|
| 74 |
foreach ($bannerTypeCollection[$deviceType] as $bannerType) {
|
| 75 |
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Homebanners extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* List of images separated by device those have to be shown on home banners page
|
| 38 |
*
|
| 39 |
* @return array
|
| 40 |
*/
|
| 41 |
+
private function getBannerTypeArray()
|
| 42 |
{
|
| 43 |
return array(
|
| 44 |
Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID => array(
|
| 50 |
Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD => array(
|
| 51 |
Mage_XmlConnect_Model_Device_Ipad::IMAGE_TYPE_LANDSCAPE_BANNER,
|
| 52 |
Mage_XmlConnect_Model_Device_Ipad::IMAGE_TYPE_PORTRAIT_BANNER,
|
| 53 |
+
));
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
/**
|
| 68 |
/** @var $imagesModel Mage_XmlConnect_Model_Images */
|
| 69 |
$imagesModel = Mage::getModel('xmlconnect/images');
|
| 70 |
|
| 71 |
+
$bannerTypeCollection = $this->getBannerTypeArray();
|
| 72 |
$deviceType = $deviceHelper->getDeviceType();
|
| 73 |
foreach ($bannerTypeCollection[$deviceType] as $bannerType) {
|
| 74 |
|
app/code/core/Mage/XmlConnect/Block/Localization.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Localization extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render home category list xml
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Localization extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Render home category list xml
|
app/code/core/Mage/XmlConnect/Block/Review/Form.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Block_Review_Form extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Collection of ratings
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Block_Review_Form extends Mage_Core_Block_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Collection of ratings
|
app/code/core/Mage/XmlConnect/Block/Wishlist.php
CHANGED
|
@@ -69,45 +69,46 @@ class Mage_XmlConnect_Block_Wishlist extends Mage_Wishlist_Block_Customer_Wishli
|
|
| 69 |
foreach ($this->getWishlistItems() as $item) {
|
| 70 |
/** @var $item Mage_Wishlist_Model_Item */
|
| 71 |
$itemXmlObj = $wishlistXmlObj->addChild('item');
|
|
|
|
| 72 |
$itemXmlObj->addChild('item_id', $item->getWishlistItemId());
|
| 73 |
$itemXmlObj->addChild('entity_id', $item->getProductId());
|
| 74 |
-
$itemXmlObj->addChild('entity_type_id', $item->getTypeId());
|
| 75 |
$itemXmlObj->addChild('name', $wishlistXmlObj->escapeXml($item->getName()));
|
| 76 |
-
$itemXmlObj->addChild('in_stock', (int)$item->getStockItem()->getIsInStock());
|
| 77 |
-
$itemXmlObj->addChild('is_salable', (int)$item->isSalable());
|
| 78 |
/**
|
| 79 |
* If product type is grouped than it has options as its grouped items
|
| 80 |
*/
|
| 81 |
-
if ($item->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE
|
| 82 |
-
|| $item->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
|
| 83 |
-
$item->setHasOptions(true);
|
| 84 |
}
|
| 85 |
-
$itemXmlObj->addChild('has_options', (int)$item->getHasOptions());
|
| 86 |
|
| 87 |
-
$icon = $categoryImageHelper->init($item, 'small_image')
|
| 88 |
->resize($productSmallImageSize);
|
| 89 |
|
| 90 |
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
| 91 |
$iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
|
| 92 |
|
| 93 |
-
$description = $wishlistXmlObj->escapeXml($item->
|
| 94 |
$itemXmlObj->addChild('description', $description);
|
| 95 |
|
| 96 |
$addedDate = $wishlistXmlObj->escapeXml($this->getFormatedDate($item->getAddedAt()));
|
| 97 |
$itemXmlObj->addChild('added_date', $addedDate);
|
| 98 |
|
| 99 |
if ($this->getChild('product_price')) {
|
| 100 |
-
$this->getChild('product_price')->setProduct($item)->setProductXmlObj($itemXmlObj)
|
| 101 |
->collectProductPrices();
|
| 102 |
}
|
| 103 |
|
| 104 |
-
if (!$item->getRatingSummary()) {
|
| 105 |
Mage::getModel('review/review')
|
| 106 |
-
->getEntitySummary($item, Mage::app()->getStore()->getId());
|
| 107 |
}
|
| 108 |
-
$ratingSummary = (int)$item->getRatingSummary()->getRatingSummary();
|
| 109 |
$itemXmlObj->addChild('rating_summary', round($ratingSummary / 10));
|
| 110 |
-
$itemXmlObj->addChild('reviews_count', $item->getRatingSummary()->getReviewsCount());
|
| 111 |
}
|
| 112 |
}
|
| 113 |
|
| 69 |
foreach ($this->getWishlistItems() as $item) {
|
| 70 |
/** @var $item Mage_Wishlist_Model_Item */
|
| 71 |
$itemXmlObj = $wishlistXmlObj->addChild('item');
|
| 72 |
+
|
| 73 |
$itemXmlObj->addChild('item_id', $item->getWishlistItemId());
|
| 74 |
$itemXmlObj->addChild('entity_id', $item->getProductId());
|
| 75 |
+
$itemXmlObj->addChild('entity_type_id', $item->getProduct()->getTypeId());
|
| 76 |
$itemXmlObj->addChild('name', $wishlistXmlObj->escapeXml($item->getName()));
|
| 77 |
+
$itemXmlObj->addChild('in_stock', (int)$item->getProduct()->getStockItem()->getIsInStock());
|
| 78 |
+
$itemXmlObj->addChild('is_salable', (int)$item->getProduct()->isSalable());
|
| 79 |
/**
|
| 80 |
* If product type is grouped than it has options as its grouped items
|
| 81 |
*/
|
| 82 |
+
if ($item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE
|
| 83 |
+
|| $item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
|
| 84 |
+
$item->getProduct()->setHasOptions(true);
|
| 85 |
}
|
| 86 |
+
$itemXmlObj->addChild('has_options', (int)$item->getProduct()->getHasOptions());
|
| 87 |
|
| 88 |
+
$icon = $categoryImageHelper->init($item->getProduct(), 'small_image')
|
| 89 |
->resize($productSmallImageSize);
|
| 90 |
|
| 91 |
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
| 92 |
$iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
|
| 93 |
|
| 94 |
+
$description = $wishlistXmlObj->escapeXml($item->getDescription());
|
| 95 |
$itemXmlObj->addChild('description', $description);
|
| 96 |
|
| 97 |
$addedDate = $wishlistXmlObj->escapeXml($this->getFormatedDate($item->getAddedAt()));
|
| 98 |
$itemXmlObj->addChild('added_date', $addedDate);
|
| 99 |
|
| 100 |
if ($this->getChild('product_price')) {
|
| 101 |
+
$this->getChild('product_price')->setProduct($item->getProduct())->setProductXmlObj($itemXmlObj)
|
| 102 |
->collectProductPrices();
|
| 103 |
}
|
| 104 |
|
| 105 |
+
if (!$item->getProduct()->getRatingSummary()) {
|
| 106 |
Mage::getModel('review/review')
|
| 107 |
+
->getEntitySummary($item->getProduct(), Mage::app()->getStore()->getId());
|
| 108 |
}
|
| 109 |
+
$ratingSummary = (int)$item->getProduct()->getRatingSummary()->getRatingSummary();
|
| 110 |
$itemXmlObj->addChild('rating_summary', round($ratingSummary / 10));
|
| 111 |
+
$itemXmlObj->addChild('reviews_count', $item->getProduct()->getRatingSummary()->getReviewsCount());
|
| 112 |
}
|
| 113 |
}
|
| 114 |
|
app/code/core/Mage/XmlConnect/Controller/AdminAction.php
CHANGED
|
@@ -33,6 +33,11 @@
|
|
| 33 |
*/
|
| 34 |
abstract class Mage_XmlConnect_Controller_AdminAction extends Mage_Adminhtml_Controller_Action
|
| 35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
/**
|
| 37 |
* Controller pre-dispatch method
|
| 38 |
*
|
|
@@ -46,7 +51,8 @@ abstract class Mage_XmlConnect_Controller_AdminAction extends Mage_Adminhtml_Con
|
|
| 46 |
->setPackageName((string)Mage::getConfig()->getNode('stores/admin/design/package/name'))
|
| 47 |
->setTheme((string)Mage::getConfig()->getNode('stores/admin/design/theme/default'));
|
| 48 |
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
|
| 49 |
-
|
|
|
|
| 50 |
Mage::getDesign()->setTheme($type, $value);
|
| 51 |
}
|
| 52 |
}
|
|
@@ -57,7 +63,8 @@ abstract class Mage_XmlConnect_Controller_AdminAction extends Mage_Adminhtml_Con
|
|
| 57 |
Mage_Core_Controller_Varien_Action::preDispatch();
|
| 58 |
|
| 59 |
if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied'
|
| 60 |
-
&& !$this->_isAllowed()
|
|
|
|
| 61 |
$this->_forward('denied');
|
| 62 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 63 |
return $this;
|
|
@@ -82,7 +89,7 @@ abstract class Mage_XmlConnect_Controller_AdminAction extends Mage_Adminhtml_Con
|
|
| 82 |
*/
|
| 83 |
public function _checkCookie()
|
| 84 |
{
|
| 85 |
-
$AdminDeviceCookie =
|
| 86 |
$currentDevice = isset($_COOKIE[$AdminDeviceCookie]) ? (string) $_COOKIE[$AdminDeviceCookie] : '';
|
| 87 |
if (!array_key_exists($currentDevice, Mage_XmlConnect_Helper_Data::getSupportedDevices())) {
|
| 88 |
$this->_message(
|
| 33 |
*/
|
| 34 |
abstract class Mage_XmlConnect_Controller_AdminAction extends Mage_Adminhtml_Controller_Action
|
| 35 |
{
|
| 36 |
+
/**
|
| 37 |
+
* Admin application device type cookie
|
| 38 |
+
*/
|
| 39 |
+
const DEVICE_TYPE_COOKIE_NAME = 'device_type';
|
| 40 |
+
|
| 41 |
/**
|
| 42 |
* Controller pre-dispatch method
|
| 43 |
*
|
| 51 |
->setPackageName((string)Mage::getConfig()->getNode('stores/admin/design/package/name'))
|
| 52 |
->setTheme((string)Mage::getConfig()->getNode('stores/admin/design/theme/default'));
|
| 53 |
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
|
| 54 |
+
$value = (string)Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
|
| 55 |
+
if ($value) {
|
| 56 |
Mage::getDesign()->setTheme($type, $value);
|
| 57 |
}
|
| 58 |
}
|
| 63 |
Mage_Core_Controller_Varien_Action::preDispatch();
|
| 64 |
|
| 65 |
if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied'
|
| 66 |
+
&& !$this->_isAllowed()
|
| 67 |
+
) {
|
| 68 |
$this->_forward('denied');
|
| 69 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 70 |
return $this;
|
| 89 |
*/
|
| 90 |
public function _checkCookie()
|
| 91 |
{
|
| 92 |
+
$AdminDeviceCookie = self::DEVICE_TYPE_COOKIE_NAME;
|
| 93 |
$currentDevice = isset($_COOKIE[$AdminDeviceCookie]) ? (string) $_COOKIE[$AdminDeviceCookie] : '';
|
| 94 |
if (!array_key_exists($currentDevice, Mage_XmlConnect_Helper_Data::getSupportedDevices())) {
|
| 95 |
$this->_message(
|
app/code/core/Mage/XmlConnect/Helper/AdminApplication.php
CHANGED
|
@@ -95,7 +95,7 @@ class Mage_XmlConnect_Helper_AdminApplication extends Mage_Core_Helper_Abstract
|
|
| 95 |
}
|
| 96 |
$storeIds = array_keys($params['store_list']);
|
| 97 |
foreach ($storeIds as $storeId) {
|
| 98 |
-
|
| 99 |
}
|
| 100 |
}
|
| 101 |
sort($this->_storeIdList);
|
|
@@ -123,7 +123,7 @@ class Mage_XmlConnect_Helper_AdminApplication extends Mage_Core_Helper_Abstract
|
|
| 123 |
}
|
| 124 |
$viewIds = array_keys($storeData['view_list']);
|
| 125 |
foreach ($viewIds as $viewId) {
|
| 126 |
-
|
| 127 |
}
|
| 128 |
}
|
| 129 |
}
|
| 95 |
}
|
| 96 |
$storeIds = array_keys($params['store_list']);
|
| 97 |
foreach ($storeIds as $storeId) {
|
| 98 |
+
$this->_storeIdList[] = $storeId;
|
| 99 |
}
|
| 100 |
}
|
| 101 |
sort($this->_storeIdList);
|
| 123 |
}
|
| 124 |
$viewIds = array_keys($storeData['view_list']);
|
| 125 |
foreach ($viewIds as $viewId) {
|
| 126 |
+
$this->_viewIdList[] = $viewId;
|
| 127 |
}
|
| 128 |
}
|
| 129 |
}
|
app/code/core/Mage/XmlConnect/Helper/Android.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Helper_Android extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Submission title length
|
|
@@ -43,6 +43,18 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 43 |
*/
|
| 44 |
const SUBMISSION_DESCRIPTION_LENGTH = 4000;
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
/**
|
| 47 |
* Tags identifier for title bar
|
| 48 |
*/
|
|
@@ -55,14 +67,26 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 55 |
|
| 56 |
/**
|
| 57 |
* Country renderer for submission
|
|
|
|
|
|
|
| 58 |
*/
|
| 59 |
const SUBMISSION_COUNTRY_RENDERER = 'androidmarket';
|
| 60 |
|
| 61 |
/**
|
| 62 |
* Country columns for submission
|
|
|
|
|
|
|
| 63 |
*/
|
| 64 |
const SUBMISSION_COUNTRY_COLUMNS = 2;
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
/**
|
| 67 |
* Submit images that are stored in "params" field of history table
|
| 68 |
*
|
|
@@ -71,14 +95,14 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 71 |
protected $_imageIds = array('icon', 'android_loader_image', 'android_logo', 'big_logo');
|
| 72 |
|
| 73 |
/**
|
| 74 |
-
* Country
|
| 75 |
*
|
| 76 |
-
* @var
|
| 77 |
*/
|
| 78 |
-
protected $
|
| 79 |
|
| 80 |
/**
|
| 81 |
-
* List of
|
| 82 |
*
|
| 83 |
* array(
|
| 84 |
* 'country name' => 'country id at directory model'
|
|
@@ -118,16 +142,6 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 118 |
'United States' => 'US',
|
| 119 |
);
|
| 120 |
|
| 121 |
-
/**
|
| 122 |
-
* Get submit images that are required for application submit
|
| 123 |
-
*
|
| 124 |
-
* @return array
|
| 125 |
-
*/
|
| 126 |
-
public function getSubmitImages()
|
| 127 |
-
{
|
| 128 |
-
return $this->_imageIds;
|
| 129 |
-
}
|
| 130 |
-
|
| 131 |
/**
|
| 132 |
* Default images list
|
| 133 |
*
|
|
@@ -140,13 +154,13 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 140 |
'count' => Mage_XmlConnect_Model_Device_Android::IMAGE_TYPE_ICON_COUNT,
|
| 141 |
'label' => $this->__('Logo in Header'),
|
| 142 |
'sortable' => false,
|
| 143 |
-
'sizeTip' => $this->__('Recommended size
|
| 144 |
),
|
| 145 |
Mage_XmlConnect_Model_Device_Android::IMAGE_TYPE_PORTRAIT_BANNER => array(
|
| 146 |
'count' => Mage_XmlConnect_Model_Device_Android::IMAGE_TYPE_BANNER_COUNT,
|
| 147 |
'label' => $this->__('Banners on Home Screen'),
|
| 148 |
'sortable' => true,
|
| 149 |
-
'sizeTip' => $this->__('Recommended size
|
| 150 |
));
|
| 151 |
}
|
| 152 |
|
|
@@ -492,22 +506,7 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 492 |
array(
|
| 493 |
'value' => 'STHeitiK-Light',
|
| 494 |
'label' => 'STHeitiK-Light',
|
| 495 |
-
|
| 496 |
-
);
|
| 497 |
-
}
|
| 498 |
-
|
| 499 |
-
/**
|
| 500 |
-
* List of allowed font sizes for Android application
|
| 501 |
-
*
|
| 502 |
-
* @return array
|
| 503 |
-
*/
|
| 504 |
-
public function getFontSizes()
|
| 505 |
-
{
|
| 506 |
-
$result = array();
|
| 507 |
-
for ($i = 6; $i < 32; $i++) {
|
| 508 |
-
$result[] = array('value' => $i, 'label' => $i . ' pt');
|
| 509 |
-
}
|
| 510 |
-
return $result;
|
| 511 |
}
|
| 512 |
|
| 513 |
/**
|
|
@@ -605,21 +604,6 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 605 |
return $errors;
|
| 606 |
}
|
| 607 |
|
| 608 |
-
/**
|
| 609 |
-
* Get renderer for submission country
|
| 610 |
-
*
|
| 611 |
-
* @return Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Androidmarket
|
| 612 |
-
*/
|
| 613 |
-
public function getCountryRenderer()
|
| 614 |
-
{
|
| 615 |
-
if (empty($this->_countryRenderer)) {
|
| 616 |
-
$renderer = 'xmlconnect/adminhtml_mobile_submission_renderer_country_'
|
| 617 |
-
. self::SUBMISSION_COUNTRY_RENDERER;
|
| 618 |
-
$this->_countryRenderer = Mage::app()->getLayout()->createBlock($renderer);
|
| 619 |
-
}
|
| 620 |
-
return $this->_countryRenderer;
|
| 621 |
-
}
|
| 622 |
-
|
| 623 |
/**
|
| 624 |
* Get label for submission country
|
| 625 |
*
|
|
@@ -630,16 +614,6 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 630 |
return Mage::helper('xmlconnect')->__('Locations');
|
| 631 |
}
|
| 632 |
|
| 633 |
-
/**
|
| 634 |
-
* Get columns for submission country
|
| 635 |
-
*
|
| 636 |
-
* @return int
|
| 637 |
-
*/
|
| 638 |
-
public function getCountryColumns()
|
| 639 |
-
{
|
| 640 |
-
return self::SUBMISSION_COUNTRY_COLUMNS;
|
| 641 |
-
}
|
| 642 |
-
|
| 643 |
/**
|
| 644 |
* Get placement of Country Names for submission country
|
| 645 |
*
|
|
@@ -657,12 +631,14 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 657 |
*/
|
| 658 |
public function getCountryClass()
|
| 659 |
{
|
| 660 |
-
return
|
| 661 |
}
|
| 662 |
|
| 663 |
/**
|
| 664 |
* Get list of countries that allowed by Magento Inc. for Android
|
| 665 |
*
|
|
|
|
|
|
|
| 666 |
* @return array
|
| 667 |
*/
|
| 668 |
public function getAndroidMarketCountriesArray()
|
|
@@ -719,31 +695,4 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
| 719 |
Mage::throwException(Mage::helper('xmlconnect')->__('Banner on Home Screen image missing.'));
|
| 720 |
}
|
| 721 |
}
|
| 722 |
-
|
| 723 |
-
/**
|
| 724 |
-
* Check the notifications are allowed for current type of application
|
| 725 |
-
*
|
| 726 |
-
* @return bool
|
| 727 |
-
*/
|
| 728 |
-
public function isNotificationsAllowed()
|
| 729 |
-
{
|
| 730 |
-
return true;
|
| 731 |
-
}
|
| 732 |
-
|
| 733 |
-
/**
|
| 734 |
-
* Get image count for image type
|
| 735 |
-
*
|
| 736 |
-
* @param string $imageType
|
| 737 |
-
* @return int
|
| 738 |
-
*/
|
| 739 |
-
public function getImageCount($imageType)
|
| 740 |
-
{
|
| 741 |
-
$imagesTypesList = $this->getImagesTypesList();
|
| 742 |
-
if (array_key_exists($imageType, $imagesTypesList)) {
|
| 743 |
-
$count = !empty($imagesTypesList[$imageType]['count']) ? $imagesTypesList[$imageType]['count'] : 0;
|
| 744 |
-
} else {
|
| 745 |
-
Mage::throwException(Mage::helper('xmlconnect')->__('Image type doesn\'t recognized: "%s".', $imageType));
|
| 746 |
-
}
|
| 747 |
-
return $count;
|
| 748 |
-
}
|
| 749 |
}
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Helper_Android extends Mage_XmlConnect_Helper_Device_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Submission title length
|
| 43 |
*/
|
| 44 |
const SUBMISSION_DESCRIPTION_LENGTH = 4000;
|
| 45 |
|
| 46 |
+
/**
|
| 47 |
+
* Android preview banner width
|
| 48 |
+
* @deprecated
|
| 49 |
+
*/
|
| 50 |
+
const PREVIEW_BANNER_WIDTH = 320;
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Android preview banner image height
|
| 54 |
+
* @deprecated
|
| 55 |
+
*/
|
| 56 |
+
const PREVIEW_BANNER_HEIGHT = 258;
|
| 57 |
+
|
| 58 |
/**
|
| 59 |
* Tags identifier for title bar
|
| 60 |
*/
|
| 67 |
|
| 68 |
/**
|
| 69 |
* Country renderer for submission
|
| 70 |
+
*
|
| 71 |
+
* @deprecated
|
| 72 |
*/
|
| 73 |
const SUBMISSION_COUNTRY_RENDERER = 'androidmarket';
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Country columns for submission
|
| 77 |
+
*
|
| 78 |
+
* @deprecated
|
| 79 |
*/
|
| 80 |
const SUBMISSION_COUNTRY_COLUMNS = 2;
|
| 81 |
|
| 82 |
+
/**
|
| 83 |
+
* Submission columns count
|
| 84 |
+
*
|
| 85 |
+
* @var int
|
| 86 |
+
*/
|
| 87 |
+
protected $_countryColumnsCount = 2;
|
| 88 |
+
|
| 89 |
+
|
| 90 |
/**
|
| 91 |
* Submit images that are stored in "params" field of history table
|
| 92 |
*
|
| 95 |
protected $_imageIds = array('icon', 'android_loader_image', 'android_logo', 'big_logo');
|
| 96 |
|
| 97 |
/**
|
| 98 |
+
* Country renderer block
|
| 99 |
*
|
| 100 |
+
* @var string
|
| 101 |
*/
|
| 102 |
+
protected $_countryRendererBlock = 'xmlconnect/adminhtml_mobile_submission_renderer_country_androidmarket';
|
| 103 |
|
| 104 |
/**
|
| 105 |
+
* List of countries that allowed in Androidmarket by Google
|
| 106 |
*
|
| 107 |
* array(
|
| 108 |
* 'country name' => 'country id at directory model'
|
| 142 |
'United States' => 'US',
|
| 143 |
);
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
/**
|
| 146 |
* Default images list
|
| 147 |
*
|
| 154 |
'count' => Mage_XmlConnect_Model_Device_Android::IMAGE_TYPE_ICON_COUNT,
|
| 155 |
'label' => $this->__('Logo in Header'),
|
| 156 |
'sortable' => false,
|
| 157 |
+
'sizeTip' => $this->__('Recommended size %spx x %spx.', 35, 35)
|
| 158 |
),
|
| 159 |
Mage_XmlConnect_Model_Device_Android::IMAGE_TYPE_PORTRAIT_BANNER => array(
|
| 160 |
'count' => Mage_XmlConnect_Model_Device_Android::IMAGE_TYPE_BANNER_COUNT,
|
| 161 |
'label' => $this->__('Banners on Home Screen'),
|
| 162 |
'sortable' => true,
|
| 163 |
+
'sizeTip' => $this->__('Recommended size %spx x %spx.', 320, 258) . $this->__('Note: Image size affects the performance of your app.') . $this->__('Keep your image size below %s KB for optimal performance.', 50)
|
| 164 |
));
|
| 165 |
}
|
| 166 |
|
| 506 |
array(
|
| 507 |
'value' => 'STHeitiK-Light',
|
| 508 |
'label' => 'STHeitiK-Light',
|
| 509 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 510 |
}
|
| 511 |
|
| 512 |
/**
|
| 604 |
return $errors;
|
| 605 |
}
|
| 606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 607 |
/**
|
| 608 |
* Get label for submission country
|
| 609 |
*
|
| 614 |
return Mage::helper('xmlconnect')->__('Locations');
|
| 615 |
}
|
| 616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 617 |
/**
|
| 618 |
* Get placement of Country Names for submission country
|
| 619 |
*
|
| 631 |
*/
|
| 632 |
public function getCountryClass()
|
| 633 |
{
|
| 634 |
+
return 'androidmarket';
|
| 635 |
}
|
| 636 |
|
| 637 |
/**
|
| 638 |
* Get list of countries that allowed by Magento Inc. for Android
|
| 639 |
*
|
| 640 |
+
* @deprecated
|
| 641 |
+
* @see $this->getAllowedCountriesArray()
|
| 642 |
* @return array
|
| 643 |
*/
|
| 644 |
public function getAndroidMarketCountriesArray()
|
| 695 |
Mage::throwException(Mage::helper('xmlconnect')->__('Banner on Home Screen image missing.'));
|
| 696 |
}
|
| 697 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 698 |
}
|
app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php
CHANGED
|
@@ -95,11 +95,11 @@ class Mage_XmlConnect_Helper_Customer_Form_Renderer extends Mage_Core_Helper_Abs
|
|
| 95 |
*
|
| 96 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Abstract $fieldset
|
| 97 |
* @param Mage_Core_Model_Layout $layout
|
| 98 |
-
* @return
|
| 99 |
*/
|
| 100 |
-
public function addCustomAttributes(Mage_XmlConnect_Model_Simplexml_Form_Abstract $fieldset, $layout)
|
|
|
|
| 101 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
| 102 |
-
|
| 103 |
$attrBlock = $layout->addBlock('enterprise_customer/form', $this->getAttributesBlockName());
|
| 104 |
$attrBlock->setFormCode($this->getFormCode());
|
| 105 |
$attrBlock->setEntity($this->getBlockEntity());
|
| 95 |
*
|
| 96 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Abstract $fieldset
|
| 97 |
* @param Mage_Core_Model_Layout $layout
|
| 98 |
+
* @return Mage_XmlConnect_Helper_Customer_Form_Renderer
|
| 99 |
*/
|
| 100 |
+
public function addCustomAttributes(Mage_XmlConnect_Model_Simplexml_Form_Abstract $fieldset, $layout)
|
| 101 |
+
{
|
| 102 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
|
|
|
| 103 |
$attrBlock = $layout->addBlock('enterprise_customer/form', $this->getAttributesBlockName());
|
| 104 |
$attrBlock->setFormCode($this->getFormCode());
|
| 105 |
$attrBlock->setEntity($this->getBlockEntity());
|
app/code/core/Mage/XmlConnect/Helper/Customer/Order.php
CHANGED
|
@@ -66,14 +66,14 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
| 66 |
*/
|
| 67 |
public function addPriceAndSubtotalToXml(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item,
|
| 68 |
Mage_XmlConnect_Model_Simplexml_Element $priceXml, Mage_XmlConnect_Model_Simplexml_Element $subtotalXml,
|
| 69 |
-
$isIncludeTax = false
|
| 70 |
-
|
| 71 |
$weeeParams = array();
|
| 72 |
|
| 73 |
$typesOfDisplay = $renderer->getTypesOfDisplay();
|
| 74 |
if ($isIncludeTax) {
|
| 75 |
$nodeName = self::INCLUDING_TAX_ID;
|
| 76 |
-
$nodeLabel = $
|
| 77 |
|
| 78 |
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
|
| 79 |
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
|
|
@@ -88,7 +88,7 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
| 88 |
$weeeParams['include'] = $inclPrice;
|
| 89 |
} else {
|
| 90 |
$nodeName = self::EXCLUDING_TAX_ID;
|
| 91 |
-
$nodeLabel = $
|
| 92 |
|
| 93 |
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
|
| 94 |
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount()
|
|
@@ -140,7 +140,7 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
| 140 |
$typesOfDisplay = $renderer->getTypesOfDisplay();
|
| 141 |
if ($isIncludeTax) {
|
| 142 |
$nodeId = self::INCLUDING_TAX_ID;
|
| 143 |
-
$nodeLabel = $
|
| 144 |
|
| 145 |
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
|
| 146 |
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
|
|
@@ -155,7 +155,7 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
| 155 |
$weeeParams['include'] = $inclPrice;
|
| 156 |
} else {
|
| 157 |
$nodeId = self::EXCLUDING_TAX_ID;
|
| 158 |
-
$nodeLabel = $
|
| 159 |
|
| 160 |
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
|
| 161 |
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount()
|
|
@@ -383,19 +383,19 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
| 383 |
) {
|
| 384 |
$qty = 1 * $item->getQtyOrdered();
|
| 385 |
if ($qty > 0) {
|
| 386 |
-
$quantityXml->addCustomChild('value', $qty, array('label' => $
|
| 387 |
}
|
| 388 |
$qty = 1 * $item->getQtyShipped();
|
| 389 |
if ($qty > 0) {
|
| 390 |
-
$quantityXml->addCustomChild('value', $qty, array('label' => $
|
| 391 |
}
|
| 392 |
$qty = 1 * $item->getQtyCanceled();
|
| 393 |
if ($qty > 0) {
|
| 394 |
-
$quantityXml->addCustomChild('value', $qty, array('label' => $
|
| 395 |
}
|
| 396 |
$qty = 1 * $item->getQtyRefunded();
|
| 397 |
if ($qty > 0) {
|
| 398 |
-
$quantityXml->addCustomChild('value', $qty, array('label' => $
|
| 399 |
}
|
| 400 |
}
|
| 401 |
|
| 66 |
*/
|
| 67 |
public function addPriceAndSubtotalToXml(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item,
|
| 68 |
Mage_XmlConnect_Model_Simplexml_Element $priceXml, Mage_XmlConnect_Model_Simplexml_Element $subtotalXml,
|
| 69 |
+
$isIncludeTax = false)
|
| 70 |
+
{
|
| 71 |
$weeeParams = array();
|
| 72 |
|
| 73 |
$typesOfDisplay = $renderer->getTypesOfDisplay();
|
| 74 |
if ($isIncludeTax) {
|
| 75 |
$nodeName = self::INCLUDING_TAX_ID;
|
| 76 |
+
$nodeLabel = $this->__('Incl. Tax');
|
| 77 |
|
| 78 |
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
|
| 79 |
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
|
| 88 |
$weeeParams['include'] = $inclPrice;
|
| 89 |
} else {
|
| 90 |
$nodeName = self::EXCLUDING_TAX_ID;
|
| 91 |
+
$nodeLabel = $this->__('Excl. Tax');
|
| 92 |
|
| 93 |
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
|
| 94 |
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount()
|
| 140 |
$typesOfDisplay = $renderer->getTypesOfDisplay();
|
| 141 |
if ($isIncludeTax) {
|
| 142 |
$nodeId = self::INCLUDING_TAX_ID;
|
| 143 |
+
$nodeLabel = $this->__('Incl. Tax');
|
| 144 |
|
| 145 |
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
|
| 146 |
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
|
| 155 |
$weeeParams['include'] = $inclPrice;
|
| 156 |
} else {
|
| 157 |
$nodeId = self::EXCLUDING_TAX_ID;
|
| 158 |
+
$nodeLabel = $this->__('Excl. Tax');
|
| 159 |
|
| 160 |
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
|
| 161 |
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount()
|
| 383 |
) {
|
| 384 |
$qty = 1 * $item->getQtyOrdered();
|
| 385 |
if ($qty > 0) {
|
| 386 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => $this->__('Ordered')));
|
| 387 |
}
|
| 388 |
$qty = 1 * $item->getQtyShipped();
|
| 389 |
if ($qty > 0) {
|
| 390 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => $this->__('Shipped')));
|
| 391 |
}
|
| 392 |
$qty = 1 * $item->getQtyCanceled();
|
| 393 |
if ($qty > 0) {
|
| 394 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => $this->__('Canceled')));
|
| 395 |
}
|
| 396 |
$qty = 1 * $item->getQtyRefunded();
|
| 397 |
if ($qty > 0) {
|
| 398 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => $this->__('Refunded')));
|
| 399 |
}
|
| 400 |
}
|
| 401 |
|
app/code/core/Mage/XmlConnect/Helper/Data.php
CHANGED
|
@@ -273,15 +273,14 @@ class Mage_XmlConnect_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 273 |
{
|
| 274 |
Varien_Profiler::start('TEST: ' . __METHOD__);
|
| 275 |
$deviceType = $this->getDeviceType();
|
|
|
|
| 276 |
switch ($deviceType) {
|
| 277 |
case self::DEVICE_TYPE_IPHONE:
|
| 278 |
case self::DEVICE_TYPE_IPAD:
|
| 279 |
$cacheKey = 'XMLCONNECT_COUNTRY_ITUNES_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
| 280 |
-
$deviceCountries = $this->getDeviceHelper()->getItunesCountriesArray();
|
| 281 |
break;
|
| 282 |
case self::DEVICE_TYPE_ANDROID:
|
| 283 |
$cacheKey = 'XMLCONNECT_COUNTRY_ANDROID_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
| 284 |
-
$deviceCountries = $this->getDeviceHelper()->getAndroidMarketCountriesArray();
|
| 285 |
break;
|
| 286 |
default:
|
| 287 |
Mage::throwException(
|
| 273 |
{
|
| 274 |
Varien_Profiler::start('TEST: ' . __METHOD__);
|
| 275 |
$deviceType = $this->getDeviceType();
|
| 276 |
+
$deviceCountries = $this->getDeviceHelper()->getAllowedCountriesArray();
|
| 277 |
switch ($deviceType) {
|
| 278 |
case self::DEVICE_TYPE_IPHONE:
|
| 279 |
case self::DEVICE_TYPE_IPAD:
|
| 280 |
$cacheKey = 'XMLCONNECT_COUNTRY_ITUNES_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
|
|
|
| 281 |
break;
|
| 282 |
case self::DEVICE_TYPE_ANDROID:
|
| 283 |
$cacheKey = 'XMLCONNECT_COUNTRY_ANDROID_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
|
|
|
| 284 |
break;
|
| 285 |
default:
|
| 286 |
Mage::throwException(
|
app/code/core/Mage/XmlConnect/Helper/Image.php
CHANGED
|
@@ -35,13 +35,15 @@ class Mage_XmlConnect_Helper_Image extends Mage_Core_Helper_Abstract
|
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Xml connect glue
|
| 38 |
-
*
|
|
|
|
| 39 |
*/
|
| 40 |
const XMLCONNECT_GLUE = Mage_XmlConnect_Model_ImageLimits::SCREEN_SIZE_UPDATE_TYPE_GLUE;
|
| 41 |
|
| 42 |
/**
|
| 43 |
* Image limits for content
|
| 44 |
*
|
|
|
|
| 45 |
* @var array|null
|
| 46 |
*/
|
| 47 |
protected $_content = null;
|
|
@@ -94,7 +96,8 @@ class Mage_XmlConnect_Helper_Image extends Mage_Core_Helper_Abstract
|
|
| 94 |
try {
|
| 95 |
$this->_forcedConvertPng($field);
|
| 96 |
|
| 97 |
-
$uploader
|
|
|
|
| 98 |
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
|
| 99 |
$uploader->setAllowRenameFiles(true);
|
| 100 |
$uploader->save($uploadDir);
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Xml connect glue
|
| 38 |
+
*
|
| 39 |
+
* @deprecated will delete in the next version
|
| 40 |
*/
|
| 41 |
const XMLCONNECT_GLUE = Mage_XmlConnect_Model_ImageLimits::SCREEN_SIZE_UPDATE_TYPE_GLUE;
|
| 42 |
|
| 43 |
/**
|
| 44 |
* Image limits for content
|
| 45 |
*
|
| 46 |
+
* @deprecated will delete in the next version
|
| 47 |
* @var array|null
|
| 48 |
*/
|
| 49 |
protected $_content = null;
|
| 96 |
try {
|
| 97 |
$this->_forcedConvertPng($field);
|
| 98 |
|
| 99 |
+
/** @var $uploader Mage_Core_Model_File_Uploader */
|
| 100 |
+
$uploader = Mage::getModel('core/file_uploader', $field);
|
| 101 |
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
|
| 102 |
$uploader->setAllowRenameFiles(true);
|
| 103 |
$uploader->save($uploadDir);
|
app/code/core/Mage/XmlConnect/Helper/Iphone.php
CHANGED
|
@@ -31,7 +31,7 @@
|
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
-
class Mage_XmlConnect_Helper_Iphone extends
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Submission title length
|
|
@@ -45,11 +45,14 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
| 45 |
|
| 46 |
/**
|
| 47 |
* Country renderer for submission page
|
|
|
|
|
|
|
| 48 |
*/
|
| 49 |
const SUBMISSION_COUNTRY_RENDERER = 'istore';
|
| 50 |
|
| 51 |
/**
|
| 52 |
* Country columns for submission page
|
|
|
|
| 53 |
*/
|
| 54 |
const SUBMISSION_COUNTRY_COLUMNS = 4;
|
| 55 |
|
|
@@ -62,125 +65,6 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
| 62 |
'icon', 'loader_image', 'loader_image_i4', 'logo', 'logo_i4', 'big_logo', 'big_logo_i4'
|
| 63 |
);
|
| 64 |
|
| 65 |
-
/**
|
| 66 |
-
* List of coutries that allowed in Ituens by Apple Store
|
| 67 |
-
*
|
| 68 |
-
* array(
|
| 69 |
-
* 'country name' => 'country id at directory model'
|
| 70 |
-
* )
|
| 71 |
-
*
|
| 72 |
-
* @var array
|
| 73 |
-
*/
|
| 74 |
-
protected $_allowedCountries = array(
|
| 75 |
-
'Argentina' => 'AR',
|
| 76 |
-
'Armenia' => 'AM',
|
| 77 |
-
'Australia' => 'AU',
|
| 78 |
-
'Austria' => 'AT',
|
| 79 |
-
'Belgium' => 'BE',
|
| 80 |
-
'Botswana' => 'BW',
|
| 81 |
-
'Brazil' => 'BR',
|
| 82 |
-
'Bulgaria' => 'BG',
|
| 83 |
-
'Canada' => 'CA',
|
| 84 |
-
'Chile' => 'CL',
|
| 85 |
-
'China' => 'CN',
|
| 86 |
-
'Colombia' => 'CO',
|
| 87 |
-
'Costa Rica' => 'CR',
|
| 88 |
-
'Croatia' => 'HR',
|
| 89 |
-
'Czech Republic' => 'CZ',
|
| 90 |
-
'Denmark' => 'DK',
|
| 91 |
-
'Dominican Republic' => 'DO',
|
| 92 |
-
'Ecuador' => 'EC',
|
| 93 |
-
'Egypt' => 'EG',
|
| 94 |
-
'El Salvador' => 'SV',
|
| 95 |
-
'Estonia' => 'EE',
|
| 96 |
-
'Finland' => 'FI',
|
| 97 |
-
'France' => 'FR',
|
| 98 |
-
'Germany' => 'DE',
|
| 99 |
-
'Greece' => 'GR',
|
| 100 |
-
'Guatemala' => 'GT',
|
| 101 |
-
'Honduras' => 'HN',
|
| 102 |
-
'Hong Kong SAR China' => 'HK',
|
| 103 |
-
'Hungary' => 'HU',
|
| 104 |
-
'India' => 'IN',
|
| 105 |
-
'Indonesia' => 'ID',
|
| 106 |
-
'Ireland' => 'IE',
|
| 107 |
-
'Israel' => 'IL',
|
| 108 |
-
'Italy' => 'IT',
|
| 109 |
-
'Jamaica' => 'JM',
|
| 110 |
-
'Japan' => 'JP',
|
| 111 |
-
'Jordan' => 'JO',
|
| 112 |
-
'Kazakstan' => 'KZ',
|
| 113 |
-
'Kenya' => 'KE',
|
| 114 |
-
'South Korea' => 'KR',
|
| 115 |
-
'Kuwait' => 'KW',
|
| 116 |
-
'Latvia' => 'LV',
|
| 117 |
-
'Lebanon' => 'LB',
|
| 118 |
-
'Lithuania' => 'LT',
|
| 119 |
-
'Luxembourg' => 'LU',
|
| 120 |
-
'Macau SAR China' => 'MO',
|
| 121 |
-
'Macedonia' => 'MK',
|
| 122 |
-
'Madagascar' => 'MG',
|
| 123 |
-
'Malaysia' => 'MY',
|
| 124 |
-
'Mali' => 'ML',
|
| 125 |
-
'Malta' => 'MT',
|
| 126 |
-
'Mauritius' => 'MU',
|
| 127 |
-
'Mexico' => 'MX',
|
| 128 |
-
'Moldova' => 'MD',
|
| 129 |
-
'Netherlands' => 'NL',
|
| 130 |
-
'New Zealand' => 'NZ',
|
| 131 |
-
'Nicaragua' => 'NI',
|
| 132 |
-
'Niger' => 'NE',
|
| 133 |
-
'Norway' => 'NO',
|
| 134 |
-
'Pakistan' => 'PK',
|
| 135 |
-
'Panama' => 'PA',
|
| 136 |
-
'Paraguay' => 'PY',
|
| 137 |
-
'Peru' => 'PE',
|
| 138 |
-
'Philippines' => 'PH',
|
| 139 |
-
'Poland' => 'PL',
|
| 140 |
-
'Portugal' => 'PT',
|
| 141 |
-
'Qatar' => 'QA',
|
| 142 |
-
'Romania' => 'RO',
|
| 143 |
-
'Russia' => 'RU',
|
| 144 |
-
'Saudi Arabia' => 'SA',
|
| 145 |
-
'Senegal' => 'SN',
|
| 146 |
-
'Singapore' => 'SG',
|
| 147 |
-
'Slovakia' => 'SK',
|
| 148 |
-
'Slovenia' => 'SI',
|
| 149 |
-
'South Africa' => 'ZA',
|
| 150 |
-
'Spain' => 'ES',
|
| 151 |
-
'Sri Lanka' => 'LK',
|
| 152 |
-
'Sweden' => 'SE',
|
| 153 |
-
'Switzerland' => 'CH',
|
| 154 |
-
'Taiwan' => 'TW',
|
| 155 |
-
'Thailand' => 'TH',
|
| 156 |
-
'Tunisia' => 'TN',
|
| 157 |
-
'Turkey' => 'TR',
|
| 158 |
-
'Uganda' => 'UG',
|
| 159 |
-
'United Arab Emirates' => 'AE',
|
| 160 |
-
'United Kingdom' => 'GB',
|
| 161 |
-
'United States' => 'US',
|
| 162 |
-
'Uruguay' => 'UY',
|
| 163 |
-
'Venezuela' => 'VE',
|
| 164 |
-
'Vietnam' => 'VN',
|
| 165 |
-
);
|
| 166 |
-
|
| 167 |
-
/**
|
| 168 |
-
* Country field renderer
|
| 169 |
-
*
|
| 170 |
-
* @var Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Istore
|
| 171 |
-
*/
|
| 172 |
-
protected $_countryRenderer = null;
|
| 173 |
-
|
| 174 |
-
/**
|
| 175 |
-
* Get submit images that are required for application submit
|
| 176 |
-
*
|
| 177 |
-
* @return array
|
| 178 |
-
*/
|
| 179 |
-
public function getSubmitImages()
|
| 180 |
-
{
|
| 181 |
-
return $this->_imageIds;
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
/**
|
| 185 |
* Get default application tabs
|
| 186 |
*
|
|
@@ -242,19 +126,19 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
| 242 |
'count' => Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_ICON_COUNT,
|
| 243 |
'label' => $this->__('Logo in Header'),
|
| 244 |
'sortable' => false,
|
| 245 |
-
'sizeTip' => $this->__('Recommended size
|
| 246 |
),
|
| 247 |
Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_PORTRAIT_BACKGROUND => array(
|
| 248 |
'count' => Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_BACKGROUND_COUNT,
|
| 249 |
'label' => $this->__('App Background'),
|
| 250 |
'sortable' => false,
|
| 251 |
-
'sizeTip' => $this->__('Recommended size
|
| 252 |
),
|
| 253 |
Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_PORTRAIT_BANNER => array(
|
| 254 |
'count' => Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_BANNER_COUNT,
|
| 255 |
'label' => $this->__('Banners on Home Screen'),
|
| 256 |
'sortable' => true,
|
| 257 |
-
'sizeTip' => $this->__('Recommended size
|
| 258 |
));
|
| 259 |
}
|
| 260 |
|
|
@@ -550,30 +434,15 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
| 550 |
array(
|
| 551 |
'value' => 'STHeitiK-Light',
|
| 552 |
'label' => 'STHeitiK-Light',
|
| 553 |
-
|
| 554 |
-
);
|
| 555 |
-
}
|
| 556 |
-
|
| 557 |
-
/**
|
| 558 |
-
* List of allowed font sizes for iPhone application
|
| 559 |
-
*
|
| 560 |
-
* @return array
|
| 561 |
-
*/
|
| 562 |
-
public function getFontSizes()
|
| 563 |
-
{
|
| 564 |
-
$result = array();
|
| 565 |
-
for ($i = 6; $i < 32; $i++) {
|
| 566 |
-
$result[] = array(
|
| 567 |
-
'value' => $i,
|
| 568 |
-
'label' => $i . ' pt',
|
| 569 |
-
);
|
| 570 |
-
}
|
| 571 |
-
return $result;
|
| 572 |
}
|
| 573 |
|
| 574 |
/**
|
| 575 |
* Get list of countries that allowed in Itunes by Apple Store for Iphone
|
|
|
|
| 576 |
*
|
|
|
|
|
|
|
| 577 |
* @return array
|
| 578 |
*/
|
| 579 |
public function getItunesCountriesArray()
|
|
@@ -681,61 +550,6 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
| 681 |
return $errors;
|
| 682 |
}
|
| 683 |
|
| 684 |
-
/**
|
| 685 |
-
* Get renderer for submission country
|
| 686 |
-
*
|
| 687 |
-
* @return Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Istore
|
| 688 |
-
*/
|
| 689 |
-
public function getCountryRenderer()
|
| 690 |
-
{
|
| 691 |
-
if (empty($this->_countryRenderer)) {
|
| 692 |
-
$renderer = 'xmlconnect/adminhtml_mobile_submission_renderer_country_'
|
| 693 |
-
. self::SUBMISSION_COUNTRY_RENDERER;
|
| 694 |
-
$this->_countryRenderer = Mage::app()->getLayout()->createBlock($renderer);
|
| 695 |
-
}
|
| 696 |
-
return $this->_countryRenderer;
|
| 697 |
-
}
|
| 698 |
-
|
| 699 |
-
/**
|
| 700 |
-
* Get label for submission country
|
| 701 |
-
*
|
| 702 |
-
* @return string
|
| 703 |
-
*/
|
| 704 |
-
public function getCountryLabel()
|
| 705 |
-
{
|
| 706 |
-
return Mage::helper('xmlconnect')->__('App Stores');
|
| 707 |
-
}
|
| 708 |
-
|
| 709 |
-
/**
|
| 710 |
-
* Get columns for submission country
|
| 711 |
-
*
|
| 712 |
-
* @return int
|
| 713 |
-
*/
|
| 714 |
-
public function getCountryColumns()
|
| 715 |
-
{
|
| 716 |
-
return self::SUBMISSION_COUNTRY_COLUMNS;
|
| 717 |
-
}
|
| 718 |
-
|
| 719 |
-
/**
|
| 720 |
-
* Get placement of Country Names for submission country
|
| 721 |
-
*
|
| 722 |
-
* @return bool
|
| 723 |
-
*/
|
| 724 |
-
public function isCountryNamePlaceLeft()
|
| 725 |
-
{
|
| 726 |
-
return true;
|
| 727 |
-
}
|
| 728 |
-
|
| 729 |
-
/**
|
| 730 |
-
* Get class name for submission country
|
| 731 |
-
*
|
| 732 |
-
* @return string
|
| 733 |
-
*/
|
| 734 |
-
public function getCountryClass()
|
| 735 |
-
{
|
| 736 |
-
return self::SUBMISSION_COUNTRY_RENDERER . ' stripy';
|
| 737 |
-
}
|
| 738 |
-
|
| 739 |
/**
|
| 740 |
* Check image fields
|
| 741 |
*
|
|
@@ -795,33 +609,4 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
| 795 |
Mage::throwException(Mage::helper('xmlconnect')->__('App Background image missing.'));
|
| 796 |
}
|
| 797 |
}
|
| 798 |
-
|
| 799 |
-
/**
|
| 800 |
-
* Check the notifications are allowed for current type of application
|
| 801 |
-
*
|
| 802 |
-
* @return bool
|
| 803 |
-
*/
|
| 804 |
-
public function isNotificationsAllowed()
|
| 805 |
-
{
|
| 806 |
-
return true;
|
| 807 |
-
}
|
| 808 |
-
|
| 809 |
-
/**
|
| 810 |
-
* Get image count for image type
|
| 811 |
-
*
|
| 812 |
-
* @param string $imageType
|
| 813 |
-
* @return int
|
| 814 |
-
*/
|
| 815 |
-
public function getImageCount($imageType)
|
| 816 |
-
{
|
| 817 |
-
$imagesTypesList = $this->getImagesTypesList();
|
| 818 |
-
if (array_key_exists($imageType, $imagesTypesList)) {
|
| 819 |
-
$count = !empty($imagesTypesList[$imageType]['count']) ? $imagesTypesList[$imageType]['count'] : 0;
|
| 820 |
-
} else {
|
| 821 |
-
Mage::throwException(
|
| 822 |
-
Mage::helper('xmlconnect')->__('Image type doesn\'t recognized: "%s".', $imageType)
|
| 823 |
-
);
|
| 824 |
-
}
|
| 825 |
-
return $count;
|
| 826 |
-
}
|
| 827 |
}
|
| 31 |
* @package Mage_XmlConnect
|
| 32 |
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
*/
|
| 34 |
+
class Mage_XmlConnect_Helper_Iphone extends Mage_XmlConnect_Helper_Device_Abstract
|
| 35 |
{
|
| 36 |
/**
|
| 37 |
* Submission title length
|
| 45 |
|
| 46 |
/**
|
| 47 |
* Country renderer for submission page
|
| 48 |
+
*
|
| 49 |
+
* @deprecated
|
| 50 |
*/
|
| 51 |
const SUBMISSION_COUNTRY_RENDERER = 'istore';
|
| 52 |
|
| 53 |
/**
|
| 54 |
* Country columns for submission page
|
| 55 |
+
* @deprecated
|
| 56 |
*/
|
| 57 |
const SUBMISSION_COUNTRY_COLUMNS = 4;
|
| 58 |
|
| 65 |
'icon', 'loader_image', 'loader_image_i4', 'logo', 'logo_i4', 'big_logo', 'big_logo_i4'
|
| 66 |
);
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
/**
|
| 69 |
* Get default application tabs
|
| 70 |
*
|
| 126 |
'count' => Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_ICON_COUNT,
|
| 127 |
'label' => $this->__('Logo in Header'),
|
| 128 |
'sortable' => false,
|
| 129 |
+
'sizeTip' => $this->__('Recommended size %spx x %spx.', 35, 35)
|
| 130 |
),
|
| 131 |
Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_PORTRAIT_BACKGROUND => array(
|
| 132 |
'count' => Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_BACKGROUND_COUNT,
|
| 133 |
'label' => $this->__('App Background'),
|
| 134 |
'sortable' => false,
|
| 135 |
+
'sizeTip' => $this->__('Recommended size %spx x %spx.', 320, 367) . $this->__('Note: Image size affects the performance of your app.') . $this->__('Keep your image size below %s KB for optimal performance.', 75)
|
| 136 |
),
|
| 137 |
Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_PORTRAIT_BANNER => array(
|
| 138 |
'count' => Mage_XmlConnect_Model_Device_Iphone::IMAGE_TYPE_BANNER_COUNT,
|
| 139 |
'label' => $this->__('Banners on Home Screen'),
|
| 140 |
'sortable' => true,
|
| 141 |
+
'sizeTip' => $this->__('Recommended size %spx x %spx.', 320, 230) . $this->__('Note: Image size affects the performance of your app.') . $this->__('Keep your image size below %s KB for optimal performance.', 50)
|
| 142 |
));
|
| 143 |
}
|
| 144 |
|
| 434 |
array(
|
| 435 |
'value' => 'STHeitiK-Light',
|
| 436 |
'label' => 'STHeitiK-Light',
|
| 437 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
}
|
| 439 |
|
| 440 |
/**
|
| 441 |
* Get list of countries that allowed in Itunes by Apple Store for Iphone
|
| 442 |
+
* (we get info from Iphone helper)
|
| 443 |
*
|
| 444 |
+
* @deprecated
|
| 445 |
+
* @see $this->getAllowedCountriesArray()
|
| 446 |
* @return array
|
| 447 |
*/
|
| 448 |
public function getItunesCountriesArray()
|
| 550 |
return $errors;
|
| 551 |
}
|
| 552 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 553 |
/**
|
| 554 |
* Check image fields
|
| 555 |
*
|
| 609 |
Mage::throwException(Mage::helper('xmlconnect')->__('App Background image missing.'));
|
| 610 |
}
|
| 611 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
}
|
app/code/core/Mage/XmlConnect/Helper/Theme.php
CHANGED
|
@@ -209,7 +209,8 @@ EOT;
|
|
| 209 |
protected function _checkDefaultThemes($fileList)
|
| 210 |
{
|
| 211 |
$cacheKey = 'MAGENTO_MOBILE_DEFAULT_THEMES_CACHE_KEY';
|
| 212 |
-
|
|
|
|
| 213 |
$defaultFiles = unserialize($cache);
|
| 214 |
} else {
|
| 215 |
$ioFile = new Varien_Io_File();
|
| 209 |
protected function _checkDefaultThemes($fileList)
|
| 210 |
{
|
| 211 |
$cacheKey = 'MAGENTO_MOBILE_DEFAULT_THEMES_CACHE_KEY';
|
| 212 |
+
$cache = Mage::app()->loadCache($cacheKey);
|
| 213 |
+
if (Mage::app()->useCache('config') && $cache) {
|
| 214 |
$defaultFiles = unserialize($cache);
|
| 215 |
} else {
|
| 216 |
$ioFile = new Varien_Io_File();
|
app/code/core/Mage/XmlConnect/Model/AdminApplication.php
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_XmlConnect
|
| 23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Admin Application model
|
| 29 |
-
*
|
| 30 |
-
* @category Mage
|
| 31 |
-
* @package Mage_Xmlconnect
|
| 32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
-
*/
|
| 34 |
-
class Mage_XmlConnect_Model_AdminApplication extends Mage_Core_Model_Abstract
|
| 35 |
-
{
|
| 36 |
-
/**
|
| 37 |
-
* Admin application device type cookie
|
| 38 |
-
*/
|
| 39 |
-
const DEVICE_TYPE_COOKIE_NAME = 'device_type';
|
| 40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Category.php
CHANGED
|
@@ -46,7 +46,7 @@ class Mage_XmlConnect_Model_Adminhtml_Search_Category extends Varien_Object
|
|
| 46 |
$this->setResults($arr);
|
| 47 |
return $this;
|
| 48 |
}
|
| 49 |
-
/** @var $collection
|
| 50 |
$collection = Mage::getResourceModel('xmlconnect/categorySearch_collection');
|
| 51 |
$collection->addAttributeToSelect('name')->addAttributeToSelect('description')
|
| 52 |
->addSearchFilter($this->getQuery())->setCurPage($this->getStart())->setPageSize($this->getLimit())->load();
|
| 46 |
$this->setResults($arr);
|
| 47 |
return $this;
|
| 48 |
}
|
| 49 |
+
/** @var $collection Mage_XmlConnect_Model_Mysql4_CategorySearch_Collection */
|
| 50 |
$collection = Mage::getResourceModel('xmlconnect/categorySearch_collection');
|
| 51 |
$collection->addAttributeToSelect('name')->addAttributeToSelect('description')
|
| 52 |
->addSearchFilter($this->getQuery())->setCurPage($this->getStart())->setPageSize($this->getLimit())->load();
|
app/code/core/Mage/XmlConnect/Model/Application.php
CHANGED
|
@@ -500,7 +500,11 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
| 500 |
/**
|
| 501 |
* Set flag is allowed guest checkout if quote contain downloadable product(s)
|
| 502 |
*/
|
| 503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
|
| 505 |
/**
|
| 506 |
* Is enabled Store credit functionality
|
|
@@ -577,11 +581,11 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
| 577 |
/**
|
| 578 |
* Check is allowed guest checkout if quote contain downloadable product(s)
|
| 579 |
*
|
| 580 |
-
* @return
|
| 581 |
*/
|
| 582 |
public function isGuestBuyDownloadableProduct()
|
| 583 |
{
|
| 584 |
-
return (
|
| 585 |
Mage_Downloadable_Model_Observer::XML_PATH_DISABLE_GUEST_CHECKOUT, $this->getStoreId()
|
| 586 |
);
|
| 587 |
}
|
| 500 |
/**
|
| 501 |
* Set flag is allowed guest checkout if quote contain downloadable product(s)
|
| 502 |
*/
|
| 503 |
+
if ($this->isGuestBuyDownloadableProduct()) {
|
| 504 |
+
$result['general']['isAllowedGuestCheckoutForDownloadableProducts'] = '0';
|
| 505 |
+
} else {
|
| 506 |
+
$result['general']['isAllowedGuestCheckoutForDownloadableProducts'] = '1';
|
| 507 |
+
}
|
| 508 |
|
| 509 |
/**
|
| 510 |
* Is enabled Store credit functionality
|
| 581 |
/**
|
| 582 |
* Check is allowed guest checkout if quote contain downloadable product(s)
|
| 583 |
*
|
| 584 |
+
* @return bool
|
| 585 |
*/
|
| 586 |
public function isGuestBuyDownloadableProduct()
|
| 587 |
{
|
| 588 |
+
return (bool)Mage::getStoreConfigFlag(
|
| 589 |
Mage_Downloadable_Model_Observer::XML_PATH_DISABLE_GUEST_CHECKOUT, $this->getStoreId()
|
| 590 |
);
|
| 591 |
}
|
app/code/core/Mage/XmlConnect/Model/ConfigData.php
CHANGED
|
@@ -292,17 +292,14 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
| 292 |
public function pagesUpgradeOldConfig($records)
|
| 293 |
{
|
| 294 |
$newConfig = array();
|
| 295 |
-
|
| 296 |
/** @var $applicationModel Mage_XmlConnect_Model_Application */
|
| 297 |
$applicationModel = Mage::getModel('xmlconnect/application');
|
| 298 |
-
|
| 299 |
$deprecatedFlag = Mage_XmlConnect_Model_Application::DEPRECATED_CONFIG_FLAG;
|
| 300 |
|
| 301 |
-
foreach ($records as $
|
| 302 |
-
|
| 303 |
/** @var $applicationModel Mage_XmlConnect_Model_Application */
|
| 304 |
-
$applicationModel->load($
|
| 305 |
-
$configData = $this->loadApplicationData($
|
| 306 |
|
| 307 |
foreach ($configData[$deprecatedFlag] as $deprecatedConfigKey => $deprecatedConfigValue) {
|
| 308 |
$pagesConfigPath = 'native/pages/';
|
|
@@ -311,7 +308,7 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
| 311 |
list($id, $type) = explode('/', $pagePath);
|
| 312 |
$newConfig[$id][$type] = $deprecatedConfigValue;
|
| 313 |
|
| 314 |
-
$this->deleteConfig($
|
| 315 |
}
|
| 316 |
}
|
| 317 |
|
|
@@ -322,7 +319,7 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
| 322 |
$path = 'staticpage/' . $id;
|
| 323 |
|
| 324 |
$this->getResource()->saveConfig(
|
| 325 |
-
$
|
| 326 |
);
|
| 327 |
}
|
| 328 |
}
|
| 292 |
public function pagesUpgradeOldConfig($records)
|
| 293 |
{
|
| 294 |
$newConfig = array();
|
|
|
|
| 295 |
/** @var $applicationModel Mage_XmlConnect_Model_Application */
|
| 296 |
$applicationModel = Mage::getModel('xmlconnect/application');
|
|
|
|
| 297 |
$deprecatedFlag = Mage_XmlConnect_Model_Application::DEPRECATED_CONFIG_FLAG;
|
| 298 |
|
| 299 |
+
foreach ($records as $applicationId) {
|
|
|
|
| 300 |
/** @var $applicationModel Mage_XmlConnect_Model_Application */
|
| 301 |
+
$applicationModel->load($applicationId);
|
| 302 |
+
$configData = $this->loadApplicationData($applicationId);
|
| 303 |
|
| 304 |
foreach ($configData[$deprecatedFlag] as $deprecatedConfigKey => $deprecatedConfigValue) {
|
| 305 |
$pagesConfigPath = 'native/pages/';
|
| 308 |
list($id, $type) = explode('/', $pagePath);
|
| 309 |
$newConfig[$id][$type] = $deprecatedConfigValue;
|
| 310 |
|
| 311 |
+
$this->deleteConfig($applicationId, $deprecatedFlag, $deprecatedConfigKey);
|
| 312 |
}
|
| 313 |
}
|
| 314 |
|
| 319 |
$path = 'staticpage/' . $id;
|
| 320 |
|
| 321 |
$this->getResource()->saveConfig(
|
| 322 |
+
$applicationId, Mage_XmlConnect_Model_Application::STATIC_PAGE_CATEGORY, $path, serialize($page)
|
| 323 |
);
|
| 324 |
}
|
| 325 |
}
|
app/code/core/Mage/XmlConnect/Model/Configuration.php
CHANGED
|
@@ -133,7 +133,7 @@ class Mage_XmlConnect_Model_Configuration extends Mage_Core_Model_Abstract
|
|
| 133 |
protected function _getConfigDataCollection()
|
| 134 |
{
|
| 135 |
if (null === $this->_configDataCollection) {
|
| 136 |
-
$this->_configDataCollection = Mage::getModel('core/
|
| 137 |
} else {
|
| 138 |
$this->_configDataCollection->clear()->getSelect()->reset();
|
| 139 |
}
|
| 133 |
protected function _getConfigDataCollection()
|
| 134 |
{
|
| 135 |
if (null === $this->_configDataCollection) {
|
| 136 |
+
$this->_configDataCollection = Mage::getModel('core/mysql4_config_data_collection');
|
| 137 |
} else {
|
| 138 |
$this->_configDataCollection->clear()->getSelect()->reset();
|
| 139 |
}
|
app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Session.php
DELETED
|
@@ -1,137 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_XmlConnect
|
| 23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Override the original Checkout session model
|
| 29 |
-
* The represented methods are overridden to fix Core bug:
|
| 30 |
-
* Order review - no data verifying in "Billing address" and "Shiping address" fields
|
| 31 |
-
*
|
| 32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
-
*/
|
| 34 |
-
class Mage_XmlConnect_Model_Corefix_Checkout_Session extends Mage_Checkout_Model_Session
|
| 35 |
-
{
|
| 36 |
-
/**
|
| 37 |
-
* Get checkout quote instance by current session
|
| 38 |
-
* Core fix
|
| 39 |
-
*
|
| 40 |
-
* @return Mage_XmlConnect_Model_Corefix_Sales_Quote
|
| 41 |
-
*/
|
| 42 |
-
public function getQuote()
|
| 43 |
-
{
|
| 44 |
-
if ($this->_quote === null) {
|
| 45 |
-
$quote = Mage::getModel('xmlconnect/corefix_sales_quote')
|
| 46 |
-
->setStoreId(Mage::app()->getStore()->getId());
|
| 47 |
-
|
| 48 |
-
/** @var $quote Mage_XmlConnect_Model_Corefix_Sales_Quote */
|
| 49 |
-
if ($this->getQuoteId()) {
|
| 50 |
-
$quote->loadActive($this->getQuoteId());
|
| 51 |
-
if ($quote->getId()) {
|
| 52 |
-
/**
|
| 53 |
-
* If current currency code of quote is not equal current currency code of store,
|
| 54 |
-
* need recalculate totals of quote. It is possible if customer use currency switcher or
|
| 55 |
-
* store switcher.
|
| 56 |
-
*/
|
| 57 |
-
if ($quote->getQuoteCurrencyCode() != Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
| 58 |
-
$quote->setStore(Mage::app()->getStore());
|
| 59 |
-
$quote->collectTotals()->save();
|
| 60 |
-
/**
|
| 61 |
-
* We mast to create new quote object, because collectTotals()
|
| 62 |
-
* can to create links with other objects.
|
| 63 |
-
*/
|
| 64 |
-
$quote = Mage::getModel('xmlconnect/corefix_sales_quote')
|
| 65 |
-
->setStoreId(Mage::app()->getStore()->getId());
|
| 66 |
-
$quote->load($this->getQuoteId());
|
| 67 |
-
}
|
| 68 |
-
} else {
|
| 69 |
-
$this->setQuoteId(null);
|
| 70 |
-
}
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
$customerSession = Mage::getSingleton('customer/session');
|
| 74 |
-
|
| 75 |
-
if (!$this->getQuoteId()) {
|
| 76 |
-
if ($customerSession->isLoggedIn()) {
|
| 77 |
-
$quote->loadByCustomer($customerSession->getCustomer());
|
| 78 |
-
$this->setQuoteId($quote->getId());
|
| 79 |
-
} else {
|
| 80 |
-
$quote->setIsCheckoutCart(true);
|
| 81 |
-
Mage::dispatchEvent('checkout_quote_init', array('quote' => $quote));
|
| 82 |
-
}
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
if ($this->getQuoteId()) {
|
| 86 |
-
if ($customerSession->isLoggedIn()) {
|
| 87 |
-
$quote->setCustomer($customerSession->getCustomer());
|
| 88 |
-
}
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
$quote->setStore(Mage::app()->getStore());
|
| 92 |
-
$this->_quote = $quote;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
if ($remoteAddr = Mage::helper('core/http')->getRemoteAddr()) {
|
| 96 |
-
$this->_quote->setRemoteIp($remoteAddr);
|
| 97 |
-
$xForwardIp = Mage::app()->getRequest()->getServer('HTTP_X_FORWARDED_FOR');
|
| 98 |
-
$this->_quote->setXForwardedFor($xForwardIp);
|
| 99 |
-
}
|
| 100 |
-
return $this->_quote;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
/**
|
| 104 |
-
* Load data for customer quote and merge with current quote
|
| 105 |
-
* Core fix
|
| 106 |
-
*
|
| 107 |
-
* @return Mage_XmlConnect_Model_Corefix_Checkout_Session
|
| 108 |
-
*/
|
| 109 |
-
public function loadCustomerQuote()
|
| 110 |
-
{
|
| 111 |
-
if (!Mage::getSingleton('customer/session')->getCustomerId()) {
|
| 112 |
-
return $this;
|
| 113 |
-
}
|
| 114 |
-
$customerQuote = Mage::getModel('xmlconnect/corefix_sales_quote')
|
| 115 |
-
->setStoreId(Mage::app()->getStore()->getId())
|
| 116 |
-
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomerId());
|
| 117 |
-
|
| 118 |
-
if ($customerQuote->getId() && $this->getQuoteId() != $customerQuote->getId()) {
|
| 119 |
-
if ($this->getQuoteId()) {
|
| 120 |
-
$customerQuote->merge($this->getQuote())
|
| 121 |
-
->collectTotals()
|
| 122 |
-
->save();
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
$this->setQuoteId($customerQuote->getId());
|
| 126 |
-
|
| 127 |
-
if ($this->_quote) {
|
| 128 |
-
$this->_quote->delete();
|
| 129 |
-
}
|
| 130 |
-
$this->_quote = $customerQuote;
|
| 131 |
-
} else {
|
| 132 |
-
$this->getQuote()->setCustomer(Mage::getSingleton('customer/session')->getCustomer())
|
| 133 |
-
->save();
|
| 134 |
-
}
|
| 135 |
-
return $this;
|
| 136 |
-
}
|
| 137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/core/Mage/XmlConnect/Model/Corefix/Checkout/Type/Onepage.php
DELETED
|
@@ -1,465 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_XmlConnect
|
| 23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Override the original One page checkout processing model
|
| 29 |
-
* The represented methods are overridden to fix Core bug:
|
| 30 |
-
* Order review - no data verifying in "Billing address" and "Shiping address" fields
|
| 31 |
-
*
|
| 32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
-
*/
|
| 34 |
-
class Mage_XmlConnect_Model_Corefix_Checkout_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
|
| 35 |
-
{
|
| 36 |
-
/**
|
| 37 |
-
* Class constructor
|
| 38 |
-
* Set customer already exists message
|
| 39 |
-
* Core fix
|
| 40 |
-
*/
|
| 41 |
-
public function __construct()
|
| 42 |
-
{
|
| 43 |
-
$this->_helper = Mage::helper('checkout');
|
| 44 |
-
$this->_customerEmailExistsMessage = $this->_helper->__('There is already a customer registered using this email address. Please login using this email address or enter a different email address to register your account.');
|
| 45 |
-
$this->_checkoutSession = Mage::getSingleton('xmlconnect/corefix_checkout_session');
|
| 46 |
-
$this->_customerSession = Mage::getSingleton('customer/session');
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
/**
|
| 50 |
-
* Save billing address information to quote
|
| 51 |
-
* This method is called by One Page Checkout JS (AJAX) while saving the billing information.
|
| 52 |
-
* Core fix
|
| 53 |
-
*
|
| 54 |
-
* @param array $data
|
| 55 |
-
* @param int $customerAddressId
|
| 56 |
-
* @return array
|
| 57 |
-
*/
|
| 58 |
-
public function saveBilling($data, $customerAddressId)
|
| 59 |
-
{
|
| 60 |
-
if (empty($data)) {
|
| 61 |
-
return array('error' => -1, 'message' => $this->_helper->__('Invalid data.'));
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
$address = $this->getQuote()->getBillingAddress();
|
| 65 |
-
/** @var $addressForm Mage_Customer_Model_Form */
|
| 66 |
-
$addressForm = Mage::getModel('customer/form');
|
| 67 |
-
$addressForm->setFormCode('customer_address_edit')
|
| 68 |
-
->setEntityType('customer_address')
|
| 69 |
-
->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
|
| 70 |
-
|
| 71 |
-
if (!empty($customerAddressId)) {
|
| 72 |
-
$customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
|
| 73 |
-
if ($customerAddress->getId()) {
|
| 74 |
-
if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
|
| 75 |
-
return array(
|
| 76 |
-
'error' => 1,
|
| 77 |
-
'message' => $this->_helper->__('Customer Address is not valid.')
|
| 78 |
-
);
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
$address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
|
| 82 |
-
$addressForm->setEntity($address);
|
| 83 |
-
$addressErrors = $addressForm->validateData($address->getData());
|
| 84 |
-
if ($addressErrors !== true) {
|
| 85 |
-
return array('error' => 1, 'message' => $addressErrors);
|
| 86 |
-
}
|
| 87 |
-
}
|
| 88 |
-
} else {
|
| 89 |
-
$addressForm->setEntity($address);
|
| 90 |
-
// emulate request object
|
| 91 |
-
$addressData = $addressForm->extractData($addressForm->prepareRequest($data));
|
| 92 |
-
$addressErrors = $addressForm->validateData($addressData);
|
| 93 |
-
if ($addressErrors !== true) {
|
| 94 |
-
return array('error' => 1, 'message' => $addressErrors);
|
| 95 |
-
}
|
| 96 |
-
$addressForm->compactData($addressData);
|
| 97 |
-
|
| 98 |
-
// Additional form data, not fetched by extractData (as it fetches only attributes)
|
| 99 |
-
$address->setSaveInAddressBook(empty($data['save_in_address_book']) ? 0 : 1);
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
// validate billing address
|
| 103 |
-
if (($validateRes = $address->validate()) !== true) {
|
| 104 |
-
return array('error' => 1, 'message' => $validateRes);
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
$address->implodeStreetAddress();
|
| 108 |
-
|
| 109 |
-
if (true !== ($result = $this->_validateCustomerData($data))) {
|
| 110 |
-
return $result;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
if (!$this->getQuote()->getCustomerId() && self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
|
| 114 |
-
if ($this->_customerEmailExists($address->getEmail(), Mage::app()->getWebsite()->getId())) {
|
| 115 |
-
return array('error' => 1, 'message' => $this->_customerEmailExistsMessage);
|
| 116 |
-
}
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
if (!$this->getQuote()->isVirtual()) {
|
| 120 |
-
/**
|
| 121 |
-
* Billing address using otions
|
| 122 |
-
*/
|
| 123 |
-
$usingCase = isset($data['use_for_shipping']) ? (int)$data['use_for_shipping'] : 0;
|
| 124 |
-
|
| 125 |
-
switch($usingCase) {
|
| 126 |
-
case 0:
|
| 127 |
-
$shipping = $this->getQuote()->getShippingAddress();
|
| 128 |
-
$shipping->setSameAsBilling(0);
|
| 129 |
-
break;
|
| 130 |
-
case 1:
|
| 131 |
-
$billing = clone $address;
|
| 132 |
-
$billing->unsAddressId()->unsAddressType();
|
| 133 |
-
$shipping = $this->getQuote()->getShippingAddress();
|
| 134 |
-
$shippingMethod = $shipping->getShippingMethod();
|
| 135 |
-
$shipping->addData($billing->getData())
|
| 136 |
-
->setSameAsBilling(1)
|
| 137 |
-
->setSaveInAddressBook(0)
|
| 138 |
-
->setShippingMethod($shippingMethod)
|
| 139 |
-
->setCollectShippingRates(true);
|
| 140 |
-
$this->getCheckout()->setStepData('shipping', 'complete', true);
|
| 141 |
-
break;
|
| 142 |
-
}
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
$this->getQuote()->collectTotals();
|
| 146 |
-
$this->getQuote()->save();
|
| 147 |
-
|
| 148 |
-
$this->getCheckout()
|
| 149 |
-
->setStepData('billing', 'allow', true)
|
| 150 |
-
->setStepData('billing', 'complete', true)
|
| 151 |
-
->setStepData('shipping', 'allow', true);
|
| 152 |
-
|
| 153 |
-
return array();
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
-
/**
|
| 157 |
-
* Validate customer data and set some its data for further usage in quote
|
| 158 |
-
* Will return either true or array with error messages
|
| 159 |
-
* Core fix
|
| 160 |
-
*
|
| 161 |
-
* @param array $data
|
| 162 |
-
* @return bool | array
|
| 163 |
-
*/
|
| 164 |
-
protected function _validateCustomerData(array $data)
|
| 165 |
-
{
|
| 166 |
-
/** @var $customerForm Mage_Customer_Model_Form */
|
| 167 |
-
$customerForm = Mage::getModel('customer/form');
|
| 168 |
-
$customerForm->setFormCode('checkout_register')
|
| 169 |
-
->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
|
| 170 |
-
|
| 171 |
-
$quote = $this->getQuote();
|
| 172 |
-
if ($quote->getCustomerId()) {
|
| 173 |
-
$customer = $quote->getCustomer();
|
| 174 |
-
$customerForm->setEntity($customer);
|
| 175 |
-
$customerData = $quote->getCustomer()->getData();
|
| 176 |
-
} else {
|
| 177 |
-
/** @var $customer Mage_Customer_Model_Customer */
|
| 178 |
-
$customer = Mage::getModel('customer/customer');
|
| 179 |
-
$customerForm->setEntity($customer);
|
| 180 |
-
$customerRequest = $customerForm->prepareRequest($data);
|
| 181 |
-
$customerData = $customerForm->extractData($customerRequest);
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
-
$customerErrors = $customerForm->validateData($customerData);
|
| 185 |
-
if ($customerErrors !== true) {
|
| 186 |
-
return array(
|
| 187 |
-
'error' => -1,
|
| 188 |
-
'message' => implode(', ', $customerErrors)
|
| 189 |
-
);
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
if ($quote->getCustomerId()) {
|
| 193 |
-
return true;
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
$customerForm->compactData($customerData);
|
| 197 |
-
|
| 198 |
-
if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
|
| 199 |
-
// set customer password
|
| 200 |
-
$customer->setPassword($customerRequest->getParam('customer_password'));
|
| 201 |
-
$customer->setConfirmation($customerRequest->getParam('confirm_password'));
|
| 202 |
-
} else {
|
| 203 |
-
// emulate customer password for quest
|
| 204 |
-
$password = $customer->generatePassword();
|
| 205 |
-
$customer->setPassword($password);
|
| 206 |
-
$customer->setConfirmation($password);
|
| 207 |
-
}
|
| 208 |
-
|
| 209 |
-
$result = $customer->validate();
|
| 210 |
-
if (true !== $result && is_array($result)) {
|
| 211 |
-
return array(
|
| 212 |
-
'error' => -1,
|
| 213 |
-
'message' => implode(', ', $result)
|
| 214 |
-
);
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
|
| 218 |
-
// save customer encrypted password in quote
|
| 219 |
-
$quote->setPasswordHash($customer->encryptPassword($customer->getPassword()));
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
// copy customer/guest email to address
|
| 223 |
-
$quote->getBillingAddress()->setEmail($customer->getEmail());
|
| 224 |
-
|
| 225 |
-
// copy customer data to quote
|
| 226 |
-
Mage::helper('core')->copyFieldset('customer_account', 'to_quote', $customer, $quote);
|
| 227 |
-
|
| 228 |
-
return true;
|
| 229 |
-
}
|
| 230 |
-
|
| 231 |
-
/**
|
| 232 |
-
* Save checkout shipping address
|
| 233 |
-
* Core fix
|
| 234 |
-
*
|
| 235 |
-
* @param array $data
|
| 236 |
-
* @param int $customerAddressId
|
| 237 |
-
* @return array
|
| 238 |
-
*/
|
| 239 |
-
public function saveShipping($data, $customerAddressId)
|
| 240 |
-
{
|
| 241 |
-
if (empty($data)) {
|
| 242 |
-
return array('error' => -1, 'message' => $this->_helper->__('Invalid data.'));
|
| 243 |
-
}
|
| 244 |
-
$address = $this->getQuote()->getShippingAddress();
|
| 245 |
-
|
| 246 |
-
/** @var $addressForm Mage_Customer_Model_Form */
|
| 247 |
-
$addressForm = Mage::getModel('customer/form');
|
| 248 |
-
$addressForm->setFormCode('customer_address_edit')
|
| 249 |
-
->setEntityType('customer_address')
|
| 250 |
-
->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
|
| 251 |
-
|
| 252 |
-
if (!empty($customerAddressId)) {
|
| 253 |
-
/** @var $customerAddress Mage_Customer_Model_Address */
|
| 254 |
-
$customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
|
| 255 |
-
if ($customerAddress->getId()) {
|
| 256 |
-
if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
|
| 257 |
-
return array(
|
| 258 |
-
'error' => 1,
|
| 259 |
-
'message' => $this->_helper->__('Customer Address is not valid.')
|
| 260 |
-
);
|
| 261 |
-
}
|
| 262 |
-
|
| 263 |
-
$address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
|
| 264 |
-
$addressForm->setEntity($address);
|
| 265 |
-
$addressErrors = $addressForm->validateData($address->getData());
|
| 266 |
-
if ($addressErrors !== true) {
|
| 267 |
-
return array('error' => 1, 'message' => $addressErrors);
|
| 268 |
-
}
|
| 269 |
-
}
|
| 270 |
-
} else {
|
| 271 |
-
$addressForm->setEntity($address);
|
| 272 |
-
// emulate request object
|
| 273 |
-
$addressData = $addressForm->extractData($addressForm->prepareRequest($data));
|
| 274 |
-
$addressErrors = $addressForm->validateData($addressData);
|
| 275 |
-
if ($addressErrors !== true) {
|
| 276 |
-
return array('error' => 1, 'message' => $addressErrors);
|
| 277 |
-
}
|
| 278 |
-
$addressForm->compactData($addressData);
|
| 279 |
-
|
| 280 |
-
// Additional form data, not fetched by extractData (as it fetches only attributes)
|
| 281 |
-
$address->setSaveInAddressBook(empty($data['save_in_address_book']) ? 0 : 1);
|
| 282 |
-
$address->setSameAsBilling(empty($data['same_as_billing']) ? 0 : 1);
|
| 283 |
-
}
|
| 284 |
-
|
| 285 |
-
$address->implodeStreetAddress();
|
| 286 |
-
$address->setCollectShippingRates(true);
|
| 287 |
-
|
| 288 |
-
if (($validateRes = $address->validate()) !== true) {
|
| 289 |
-
return array('error' => 1, 'message' => $validateRes);
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
$this->getQuote()->collectTotals()->save();
|
| 293 |
-
|
| 294 |
-
$this->getCheckout()
|
| 295 |
-
->setStepData('shipping', 'complete', true)
|
| 296 |
-
->setStepData('shipping_method', 'allow', true);
|
| 297 |
-
|
| 298 |
-
return array();
|
| 299 |
-
}
|
| 300 |
-
|
| 301 |
-
/**
|
| 302 |
-
* Specify quote payment method
|
| 303 |
-
* Core fix
|
| 304 |
-
*
|
| 305 |
-
* @param array $data
|
| 306 |
-
* @return array
|
| 307 |
-
*/
|
| 308 |
-
public function savePayment($data)
|
| 309 |
-
{
|
| 310 |
-
if (empty($data)) {
|
| 311 |
-
return array('error' => -1, 'message' => $this->_helper->__('Invalid data.'));
|
| 312 |
-
}
|
| 313 |
-
$quote = $this->getQuote();
|
| 314 |
-
if ($quote->isVirtual()) {
|
| 315 |
-
$quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 316 |
-
} else {
|
| 317 |
-
$quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
// shipping totals may be affected by payment method
|
| 321 |
-
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
| 322 |
-
$quote->getShippingAddress()->setCollectShippingRates(true);
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
$payment = $quote->getPayment();
|
| 326 |
-
$payment->importData($data);
|
| 327 |
-
|
| 328 |
-
$quote->save();
|
| 329 |
-
|
| 330 |
-
$this->getCheckout()
|
| 331 |
-
->setStepData('payment', 'complete', true)
|
| 332 |
-
->setStepData('review', 'allow', true);
|
| 333 |
-
|
| 334 |
-
return array();
|
| 335 |
-
}
|
| 336 |
-
|
| 337 |
-
/**
|
| 338 |
-
* Prepare quote for customer order submit
|
| 339 |
-
* Core fix
|
| 340 |
-
*
|
| 341 |
-
* @return void
|
| 342 |
-
*/
|
| 343 |
-
protected function _prepareCustomerQuote()
|
| 344 |
-
{
|
| 345 |
-
$quote = $this->getQuote();
|
| 346 |
-
$billing = $quote->getBillingAddress();
|
| 347 |
-
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
|
| 348 |
-
|
| 349 |
-
$customer = $this->getCustomerSession()->getCustomer();
|
| 350 |
-
if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
|
| 351 |
-
$customerBilling = $billing->exportCustomerAddress();
|
| 352 |
-
$customer->addAddress($customerBilling);
|
| 353 |
-
$billing->setCustomerAddress($customerBilling);
|
| 354 |
-
}
|
| 355 |
-
if ($shipping && !$shipping->getSameAsBilling()
|
| 356 |
-
&& (!$shipping->getCustomerId() || $shipping->getSaveInAddressBook())
|
| 357 |
-
) {
|
| 358 |
-
$customerShipping = $shipping->exportCustomerAddress();
|
| 359 |
-
$customer->addAddress($customerShipping);
|
| 360 |
-
$shipping->setCustomerAddress($customerShipping);
|
| 361 |
-
}
|
| 362 |
-
|
| 363 |
-
if (isset($customerBilling) && !$customer->getDefaultBilling()) {
|
| 364 |
-
$customerBilling->setIsDefaultBilling(true);
|
| 365 |
-
}
|
| 366 |
-
if ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) {
|
| 367 |
-
$customerShipping->setIsDefaultShipping(true);
|
| 368 |
-
} elseif (isset($customerBilling) && !$customer->getDefaultShipping()) {
|
| 369 |
-
$customerBilling->setIsDefaultShipping(true);
|
| 370 |
-
}
|
| 371 |
-
$quote->setCustomer($customer);
|
| 372 |
-
}
|
| 373 |
-
|
| 374 |
-
/**
|
| 375 |
-
* Create order based on checkout type. Create customer if necessary.
|
| 376 |
-
*
|
| 377 |
-
* @return Mage_XmlConnect_Model_Corefix_Checkout_Type_Onepage
|
| 378 |
-
*/
|
| 379 |
-
public function saveOrder()
|
| 380 |
-
{
|
| 381 |
-
$this->validate();
|
| 382 |
-
$isNewCustomer = false;
|
| 383 |
-
switch ($this->getCheckoutMethod()) {
|
| 384 |
-
case self::METHOD_GUEST:
|
| 385 |
-
$this->_prepareGuestQuote();
|
| 386 |
-
break;
|
| 387 |
-
case self::METHOD_REGISTER:
|
| 388 |
-
$this->_prepareNewCustomerQuote();
|
| 389 |
-
$isNewCustomer = true;
|
| 390 |
-
break;
|
| 391 |
-
default:
|
| 392 |
-
$this->_prepareCustomerQuote();
|
| 393 |
-
break;
|
| 394 |
-
}
|
| 395 |
-
|
| 396 |
-
/** @var $service Mage_Sales_Model_Service_Quote */
|
| 397 |
-
$service = Mage::getModel('sales/service_quote', $this->getQuote());
|
| 398 |
-
$service->submitAll();
|
| 399 |
-
|
| 400 |
-
if ($isNewCustomer) {
|
| 401 |
-
try {
|
| 402 |
-
$this->_involveNewCustomer();
|
| 403 |
-
} catch (Exception $e) {
|
| 404 |
-
Mage::logException($e);
|
| 405 |
-
}
|
| 406 |
-
}
|
| 407 |
-
|
| 408 |
-
$this->_checkoutSession->setLastQuoteId($this->getQuote()->getId())
|
| 409 |
-
->setLastSuccessQuoteId($this->getQuote()->getId())
|
| 410 |
-
->clearHelperData();
|
| 411 |
-
|
| 412 |
-
$order = $service->getOrder();
|
| 413 |
-
if ($order) {
|
| 414 |
-
Mage::dispatchEvent(
|
| 415 |
-
'checkout_type_onepage_save_order_after',
|
| 416 |
-
array('order' => $order, 'quote' => $this->getQuote())
|
| 417 |
-
);
|
| 418 |
-
|
| 419 |
-
/**
|
| 420 |
-
* a flag to set that there will be redirect to third party after confirmation
|
| 421 |
-
* eg: paypal standard ipn
|
| 422 |
-
*/
|
| 423 |
-
$redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
|
| 424 |
-
/**
|
| 425 |
-
* we only want to send to customer about new order when there is no redirect to third party
|
| 426 |
-
*/
|
| 427 |
-
if (!$redirectUrl) {
|
| 428 |
-
try {
|
| 429 |
-
$order->sendNewOrderEmail();
|
| 430 |
-
} catch (Exception $e) {
|
| 431 |
-
Mage::logException($e);
|
| 432 |
-
}
|
| 433 |
-
}
|
| 434 |
-
|
| 435 |
-
// add order information to the session
|
| 436 |
-
$this->_checkoutSession->setLastOrderId($order->getId())
|
| 437 |
-
->setRedirectUrl($redirectUrl)
|
| 438 |
-
->setLastRealOrderId($order->getIncrementId());
|
| 439 |
-
|
| 440 |
-
// as well a billing agreement can be created
|
| 441 |
-
$agreement = $order->getPayment()->getBillingAgreement();
|
| 442 |
-
if ($agreement) {
|
| 443 |
-
$this->_checkoutSession->setLastBillingAgreementId($agreement->getId());
|
| 444 |
-
}
|
| 445 |
-
}
|
| 446 |
-
|
| 447 |
-
// add recurring profiles information to the session
|
| 448 |
-
$profiles = $service->getRecurringPaymentProfiles();
|
| 449 |
-
if ($profiles) {
|
| 450 |
-
$ids = array();
|
| 451 |
-
foreach ($profiles as $profile) {
|
| 452 |
-
$ids[] = $profile->getId();
|
| 453 |
-
}
|
| 454 |
-
$this->_checkoutSession->setLastRecurringProfileIds($ids);
|
| 455 |
-
// TODO: send recurring profile emails
|
| 456 |
-
}
|
| 457 |
-
|
| 458 |
-
Mage::dispatchEvent(
|
| 459 |
-
'checkout_submit_all_after',
|
| 460 |
-
array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles)
|
| 461 |
-
);
|
| 462 |
-
|
| 463 |
-
return $this;
|
| 464 |
-
}
|
| 465 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/core/Mage/XmlConnect/Model/Corefix/Sales/Quote.php
DELETED
|
@@ -1,427 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_XmlConnect
|
| 23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Override the original Quote model
|
| 29 |
-
* The represented methods are overridden to fix Core bug:
|
| 30 |
-
* Order review - no data verifying in "Billing address" and "Shiping address" fields
|
| 31 |
-
*
|
| 32 |
-
* Supported events:
|
| 33 |
-
* sales_quote_load_after
|
| 34 |
-
* sales_quote_save_before
|
| 35 |
-
* sales_quote_save_after
|
| 36 |
-
* sales_quote_delete_before
|
| 37 |
-
* sales_quote_delete_after
|
| 38 |
-
*
|
| 39 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
| 40 |
-
*/
|
| 41 |
-
class Mage_XmlConnect_Model_Corefix_Sales_Quote extends Mage_Sales_Model_Quote
|
| 42 |
-
{
|
| 43 |
-
/**
|
| 44 |
-
* Loading quote by identifier
|
| 45 |
-
* Core fix
|
| 46 |
-
*
|
| 47 |
-
* @param int $quoteId
|
| 48 |
-
* @return Mage_XmlConnect_Model_Corefix_Sales_Quote
|
| 49 |
-
*/
|
| 50 |
-
public function loadByIdWithoutStore($quoteId)
|
| 51 |
-
{
|
| 52 |
-
$this->_getResource()->loadByIdWithoutStore($this, $quoteId);
|
| 53 |
-
$this->_afterLoad();
|
| 54 |
-
return $this;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
/**
|
| 58 |
-
* Assign customer model object data to quote
|
| 59 |
-
* Core fix
|
| 60 |
-
*
|
| 61 |
-
* @param Mage_Customer_Model_Customer $customer
|
| 62 |
-
* @return Mage_XmlConnect_Model_Corefix_Sales_Quote
|
| 63 |
-
*/
|
| 64 |
-
public function assignCustomer(Mage_Customer_Model_Customer $customer)
|
| 65 |
-
{
|
| 66 |
-
return $this->assignCustomerWithAddressChange($customer);
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
/**
|
| 70 |
-
* Assign customer model to quote with billing and shipping address change
|
| 71 |
-
* Core fix
|
| 72 |
-
*
|
| 73 |
-
* @param Mage_Customer_Model_Customer $customer
|
| 74 |
-
* @param Mage_Sales_Model_Quote_Address $billingAddress
|
| 75 |
-
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
| 76 |
-
* @return Mage_XmlConnect_Model_Corefix_Sales_Quote
|
| 77 |
-
*/
|
| 78 |
-
public function assignCustomerWithAddressChange(
|
| 79 |
-
Mage_Customer_Model_Customer $customer,
|
| 80 |
-
Mage_Sales_Model_Quote_Address $billingAddress = null,
|
| 81 |
-
Mage_Sales_Model_Quote_Address $shippingAddress = null
|
| 82 |
-
)
|
| 83 |
-
{
|
| 84 |
-
if ($customer->getId()) {
|
| 85 |
-
$this->setCustomer($customer);
|
| 86 |
-
|
| 87 |
-
if (!is_null($billingAddress)) {
|
| 88 |
-
$this->setBillingAddress($billingAddress);
|
| 89 |
-
} else {
|
| 90 |
-
$defaultBillingAddress = $customer->getDefaultBillingAddress();
|
| 91 |
-
if ($defaultBillingAddress && $defaultBillingAddress->getId()) {
|
| 92 |
-
$billingAddress = Mage::getModel('sales/quote_address')
|
| 93 |
-
->importCustomerAddress($defaultBillingAddress);
|
| 94 |
-
$this->setBillingAddress($billingAddress);
|
| 95 |
-
}
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
if (is_null($shippingAddress)) {
|
| 99 |
-
$defaultShippingAddress = $customer->getDefaultShippingAddress();
|
| 100 |
-
if ($defaultShippingAddress && $defaultShippingAddress->getId()) {
|
| 101 |
-
$shippingAddress = Mage::getModel('sales/quote_address')
|
| 102 |
-
->importCustomerAddress($defaultShippingAddress);
|
| 103 |
-
} else {
|
| 104 |
-
$shippingAddress = Mage::getModel('sales/quote_address');
|
| 105 |
-
}
|
| 106 |
-
}
|
| 107 |
-
$this->setShippingAddress($shippingAddress);
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
return $this;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
/**
|
| 114 |
-
* Retrieve customer group id
|
| 115 |
-
* Core fix
|
| 116 |
-
*
|
| 117 |
-
* @return int
|
| 118 |
-
*/
|
| 119 |
-
public function getCustomerGroupId()
|
| 120 |
-
{
|
| 121 |
-
if ($this->getCustomerId()) {
|
| 122 |
-
return ($this->getData('customer_group_id'))
|
| 123 |
-
? $this->getData('customer_group_id')
|
| 124 |
-
: $this->getCustomer()->getGroupId();
|
| 125 |
-
} else {
|
| 126 |
-
return Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;
|
| 127 |
-
}
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
/**
|
| 131 |
-
* Checking product exist in Quote
|
| 132 |
-
* Core fix
|
| 133 |
-
*
|
| 134 |
-
* @param int $productId
|
| 135 |
-
* @return bool
|
| 136 |
-
*/
|
| 137 |
-
public function hasProductId($productId)
|
| 138 |
-
{
|
| 139 |
-
foreach ($this->getAllItems() as $item) {
|
| 140 |
-
if ($item->getProductId() == $productId) {
|
| 141 |
-
return true;
|
| 142 |
-
}
|
| 143 |
-
}
|
| 144 |
-
return false;
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
/**
|
| 148 |
-
* Remove quote item by item identifier
|
| 149 |
-
* Core fix
|
| 150 |
-
*
|
| 151 |
-
* @param int $itemId
|
| 152 |
-
* @return Mage_XmlConnect_Model_Corefix_Sales_Quote
|
| 153 |
-
*/
|
| 154 |
-
public function removeItem($itemId)
|
| 155 |
-
{
|
| 156 |
-
$item = $this->getItemById($itemId);
|
| 157 |
-
if ($item) {
|
| 158 |
-
$item->setQuote($this);
|
| 159 |
-
/**
|
| 160 |
-
* If we remove item from quote - we can't use multishipping mode
|
| 161 |
-
*/
|
| 162 |
-
$this->setIsMultiShipping(false);
|
| 163 |
-
$item->isDeleted(true);
|
| 164 |
-
if ($item->getHasChildren()) {
|
| 165 |
-
foreach ($item->getChildren() as $child) {
|
| 166 |
-
$child->isDeleted(true);
|
| 167 |
-
}
|
| 168 |
-
}
|
| 169 |
-
Mage::dispatchEvent('sales_quote_remove_item', array('quote_item' => $item));
|
| 170 |
-
}
|
| 171 |
-
return $this;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
/**
|
| 175 |
-
* Advanced func to add product to quote - processing mode can be specified there.
|
| 176 |
-
* Returns error message if product type instance can't prepare product.
|
| 177 |
-
* Core fix
|
| 178 |
-
*
|
| 179 |
-
* @param Mage_Catalog_Model_Product $product
|
| 180 |
-
* @param null | float | Varien_Object $request
|
| 181 |
-
* @param null | string $processMode
|
| 182 |
-
* @throws Mage_Core_Exception
|
| 183 |
-
* @return Mage_Sales_Model_Quote_Item | string
|
| 184 |
-
*/
|
| 185 |
-
public function addProductAdvanced(Mage_Catalog_Model_Product $product, $request = null, $processMode = null)
|
| 186 |
-
{
|
| 187 |
-
if ($request === null) {
|
| 188 |
-
$request = 1;
|
| 189 |
-
}
|
| 190 |
-
if (is_numeric($request)) {
|
| 191 |
-
$request = new Varien_Object(array('qty' => $request));
|
| 192 |
-
}
|
| 193 |
-
if (!($request instanceof Varien_Object)) {
|
| 194 |
-
Mage::throwException(Mage::helper('sales')->__('Invalid request for adding product to quote.'));
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
$cartCandidates = $product->getTypeInstance(true)
|
| 198 |
-
->prepareForCartAdvanced($request, $product, $processMode);
|
| 199 |
-
|
| 200 |
-
/**
|
| 201 |
-
* Error message
|
| 202 |
-
*/
|
| 203 |
-
if (is_string($cartCandidates)) {
|
| 204 |
-
return $cartCandidates;
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
/**
|
| 208 |
-
* If prepare process return one object
|
| 209 |
-
*/
|
| 210 |
-
if (!is_array($cartCandidates)) {
|
| 211 |
-
$cartCandidates = array($cartCandidates);
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
$parentItem = null;
|
| 215 |
-
$errors = array();
|
| 216 |
-
$items = array();
|
| 217 |
-
foreach ($cartCandidates as $candidate) {
|
| 218 |
-
$item = $this->_addCatalogProduct($candidate, $candidate->getCartQty());
|
| 219 |
-
$items[] = $item;
|
| 220 |
-
|
| 221 |
-
/**
|
| 222 |
-
* As parent item we should always use the item of first added product
|
| 223 |
-
*/
|
| 224 |
-
if (!$parentItem) {
|
| 225 |
-
$parentItem = $item;
|
| 226 |
-
}
|
| 227 |
-
if ($parentItem && $candidate->getParentProductId() && !$item->getId()) {
|
| 228 |
-
$item->setParentItem($parentItem);
|
| 229 |
-
}
|
| 230 |
-
|
| 231 |
-
/**
|
| 232 |
-
* We specify qty after we know about parent (for stock)
|
| 233 |
-
*/
|
| 234 |
-
$item->addQty($candidate->getCartQty());
|
| 235 |
-
|
| 236 |
-
// collect errors instead of throwing first one
|
| 237 |
-
if ($item->getHasError()) {
|
| 238 |
-
$errors[] = $item->getMessage();
|
| 239 |
-
}
|
| 240 |
-
}
|
| 241 |
-
if (!empty($errors)) {
|
| 242 |
-
Mage::throwException(implode("\n", $errors));
|
| 243 |
-
}
|
| 244 |
-
|
| 245 |
-
Mage::dispatchEvent('sales_quote_product_add_after', array('items' => $items));
|
| 246 |
-
|
| 247 |
-
return $item;
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
/**
|
| 252 |
-
* Add product to quote
|
| 253 |
-
* return error message if product type instance can't prepare product
|
| 254 |
-
* Core fix
|
| 255 |
-
*
|
| 256 |
-
* @param mixed $product
|
| 257 |
-
* @param null | float | Varien_Object $request
|
| 258 |
-
* @return Mage_Sales_Model_Quote_Item | string
|
| 259 |
-
*/
|
| 260 |
-
public function addProduct(Mage_Catalog_Model_Product $product, $request = null)
|
| 261 |
-
{
|
| 262 |
-
return $this->addProductAdvanced($product, $request, Mage_Catalog_Model_Product_Type_Abstract::PROCESS_MODE_FULL);
|
| 263 |
-
}
|
| 264 |
-
|
| 265 |
-
/**
|
| 266 |
-
* Adding catalog product object data to quote
|
| 267 |
-
* Core fix
|
| 268 |
-
*
|
| 269 |
-
* @param Mage_Catalog_Model_Product $product
|
| 270 |
-
* @return Mage_Sales_Model_Quote_Item
|
| 271 |
-
*/
|
| 272 |
-
protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty = 1)
|
| 273 |
-
{
|
| 274 |
-
$newItem = false;
|
| 275 |
-
$item = $this->getItemByProduct($product);
|
| 276 |
-
if (!$item) {
|
| 277 |
-
$item = Mage::getModel('sales/quote_item');
|
| 278 |
-
$item->setQuote($this);
|
| 279 |
-
if (Mage::app()->getStore()->isAdmin()) {
|
| 280 |
-
$item->setStoreId($this->getStore()->getId());
|
| 281 |
-
} else {
|
| 282 |
-
$item->setStoreId(Mage::app()->getStore()->getId());
|
| 283 |
-
}
|
| 284 |
-
$newItem = true;
|
| 285 |
-
}
|
| 286 |
-
|
| 287 |
-
/**
|
| 288 |
-
* We can't modify existing child items
|
| 289 |
-
*/
|
| 290 |
-
if ($item->getId() && $product->getParentProductId()) {
|
| 291 |
-
return $item;
|
| 292 |
-
}
|
| 293 |
-
|
| 294 |
-
$item->setOptions($product->getCustomOptions())
|
| 295 |
-
->setProduct($product);
|
| 296 |
-
|
| 297 |
-
// Add only item that is not in quote already (there can be other new or already saved item
|
| 298 |
-
if ($newItem) {
|
| 299 |
-
$this->addItem($item);
|
| 300 |
-
}
|
| 301 |
-
|
| 302 |
-
return $item;
|
| 303 |
-
}
|
| 304 |
-
|
| 305 |
-
/**
|
| 306 |
-
* Updates quote item with new configuration
|
| 307 |
-
*
|
| 308 |
-
* $params sets how current item configuration must be taken into account and additional options.
|
| 309 |
-
* It's passed to Mage_Catalog_Helper_Product->addParamsToBuyRequest() to compose resulting buyRequest.
|
| 310 |
-
*
|
| 311 |
-
* Basically it can hold
|
| 312 |
-
* - 'current_config', Varien_Object or array - current buyRequest that configures product in this item,
|
| 313 |
-
* used to restore currently attached files
|
| 314 |
-
* - 'files_prefix': string[a-z0-9_] - prefix that was added at frontend to names of file options (file inputs), so they won't
|
| 315 |
-
* intersect with other submitted options
|
| 316 |
-
*
|
| 317 |
-
* For more options see Mage_Catalog_Helper_Product->addParamsToBuyRequest()
|
| 318 |
-
*
|
| 319 |
-
* Core fix
|
| 320 |
-
*
|
| 321 |
-
* @param int $itemId
|
| 322 |
-
* @param Varien_Object $buyRequest
|
| 323 |
-
* @param null | array | Varien_Object $params
|
| 324 |
-
* @throws Mage_Core_Exception
|
| 325 |
-
* @return Mage_Sales_Model_Quote_Item
|
| 326 |
-
*
|
| 327 |
-
* @see Mage_Catalog_Helper_Product::addParamsToBuyRequest()
|
| 328 |
-
*/
|
| 329 |
-
public function updateItem($itemId, $buyRequest, $params = null)
|
| 330 |
-
{
|
| 331 |
-
$item = $this->getItemById($itemId);
|
| 332 |
-
if (!$item) {
|
| 333 |
-
Mage::throwException(Mage::helper('sales')->__('Wrong quote item id to update configuration.'));
|
| 334 |
-
}
|
| 335 |
-
$productId = $item->getProduct()->getId();
|
| 336 |
-
|
| 337 |
-
//We need to create new clear product instance with same $productId
|
| 338 |
-
//to set new option values from $buyRequest
|
| 339 |
-
$product = Mage::getModel('catalog/product')
|
| 340 |
-
->setStoreId($this->getStore()->getId())
|
| 341 |
-
->load($productId);
|
| 342 |
-
|
| 343 |
-
if (!$params) {
|
| 344 |
-
$params = new Varien_Object();
|
| 345 |
-
} elseif (is_array($params)) {
|
| 346 |
-
$params = new Varien_Object($params);
|
| 347 |
-
}
|
| 348 |
-
$params->setCurrentConfig($item->getBuyRequest());
|
| 349 |
-
$buyRequest = Mage::helper('catalog/product')->addParamsToBuyRequest($buyRequest, $params);
|
| 350 |
-
|
| 351 |
-
$resultItem = $this->addProduct($product, $buyRequest);
|
| 352 |
-
|
| 353 |
-
if (is_string($resultItem)) {
|
| 354 |
-
Mage::throwException($resultItem);
|
| 355 |
-
}
|
| 356 |
-
|
| 357 |
-
if ($resultItem->getParentItem()) {
|
| 358 |
-
$resultItem = $resultItem->getParentItem();
|
| 359 |
-
}
|
| 360 |
-
|
| 361 |
-
if ($resultItem->getId() != $itemId) {
|
| 362 |
-
/**
|
| 363 |
-
* Product configuration didn't stick to original quote item
|
| 364 |
-
* It either has same configuration as some other quote item's product or completely new configuration
|
| 365 |
-
*/
|
| 366 |
-
$this->removeItem($itemId);
|
| 367 |
-
|
| 368 |
-
$items = $this->getAllItems();
|
| 369 |
-
foreach ($items as $item) {
|
| 370 |
-
if (($item->getProductId() == $productId) && ($item->getId() != $resultItem->getId())) {
|
| 371 |
-
if ($resultItem->compare($item)) {
|
| 372 |
-
// Product configuration is same as in other quote item
|
| 373 |
-
$resultItem->setQty($resultItem->getQty() + $item->getQty());
|
| 374 |
-
$this->removeItem($item->getId());
|
| 375 |
-
break;
|
| 376 |
-
}
|
| 377 |
-
}
|
| 378 |
-
}
|
| 379 |
-
} else {
|
| 380 |
-
$resultItem->setQty($buyRequest->getQty());
|
| 381 |
-
}
|
| 382 |
-
|
| 383 |
-
return $resultItem;
|
| 384 |
-
}
|
| 385 |
-
|
| 386 |
-
/**
|
| 387 |
-
* Retrieve quote item by product id
|
| 388 |
-
* Core fix
|
| 389 |
-
*
|
| 390 |
-
* @param Mage_Catalog_Model_Product $product
|
| 391 |
-
* @return Mage_Sales_Model_Quote_Item | false
|
| 392 |
-
*/
|
| 393 |
-
public function getItemByProduct($product)
|
| 394 |
-
{
|
| 395 |
-
foreach ($this->getAllItems() as $item) {
|
| 396 |
-
if ($item->representProduct($product)) {
|
| 397 |
-
return $item;
|
| 398 |
-
}
|
| 399 |
-
}
|
| 400 |
-
return false;
|
| 401 |
-
}
|
| 402 |
-
|
| 403 |
-
/**
|
| 404 |
-
* Check quote for virtual product only
|
| 405 |
-
* Core fix
|
| 406 |
-
*
|
| 407 |
-
* @return bool
|
| 408 |
-
*/
|
| 409 |
-
public function isVirtual()
|
| 410 |
-
{
|
| 411 |
-
$isVirtual = true;
|
| 412 |
-
$countItems = 0;
|
| 413 |
-
foreach ($this->getItemsCollection() as $_item) {
|
| 414 |
-
/** @var $_item Mage_Sales_Model_Quote_Item */
|
| 415 |
-
if ($_item->isDeleted() || $_item->getParentItemId()) {
|
| 416 |
-
continue;
|
| 417 |
-
}
|
| 418 |
-
$countItems ++;
|
| 419 |
-
if (!$_item->getProduct()->getIsVirtual()) {
|
| 420 |
-
$isVirtual = false;
|
| 421 |
-
break;
|
| 422 |
-
}
|
| 423 |
-
}
|
| 424 |
-
return $countItems == 0 ? false : $isVirtual;
|
| 425 |
-
}
|
| 426 |
-
|
| 427 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/core/Mage/XmlConnect/Model/ImageLimits.php
CHANGED
|
@@ -204,21 +204,16 @@ class Mage_XmlConnect_Model_ImageLimits extends Mage_Core_Model_Abstract
|
|
| 204 |
|
| 205 |
if ($this->_screenSize && $this->_screenSize != $defaultScreenSize) {
|
| 206 |
if (!$this->getSizeModel()) {
|
| 207 |
-
|
| 208 |
-
|
|
|
|
| 209 |
$this->setSizeModel($sizeModel);
|
| 210 |
-
} catch (Mage_Core_Exception $e) {
|
| 211 |
-
Mage::throwException($e->getMessage());
|
| 212 |
-
Mage::logException($e);
|
| 213 |
-
} catch (Exception $e) {
|
| 214 |
-
// if image limits update not found, continue calculation based on default screen size
|
| 215 |
}
|
| 216 |
}
|
| 217 |
$this->_calculateImageLimits()->_afterCalculate();
|
| 218 |
} else {
|
| 219 |
$this->_setScreenSize($defaultScreenSize)->_setDefaultSizeModel();
|
| 220 |
}
|
| 221 |
-
|
| 222 |
return $this;
|
| 223 |
}
|
| 224 |
|
| 204 |
|
| 205 |
if ($this->_screenSize && $this->_screenSize != $defaultScreenSize) {
|
| 206 |
if (!$this->getSizeModel()) {
|
| 207 |
+
$modelClass = Mage::getConfig()->getModelClassName('xmlconnect/imageLimits_' . $this->_screenSize);
|
| 208 |
+
if (class_exists($modelClass, false) || mageFindClassFile($modelClass)) {
|
| 209 |
+
$sizeModel = Mage::getModel('xmlconnect/imageLimits_' . $this->_screenSize, $this->_updateType);
|
| 210 |
$this->setSizeModel($sizeModel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
}
|
| 213 |
$this->_calculateImageLimits()->_afterCalculate();
|
| 214 |
} else {
|
| 215 |
$this->_setScreenSize($defaultScreenSize)->_setDefaultSizeModel();
|
| 216 |
}
|
|
|
|
| 217 |
return $this;
|
| 218 |
}
|
| 219 |
|
app/code/core/Mage/XmlConnect/Model/Images.php
CHANGED
|
@@ -76,9 +76,10 @@ class Mage_XmlConnect_Model_Images extends Mage_Core_Model_Abstract
|
|
| 76 |
* Remove all image files
|
| 77 |
*
|
| 78 |
* @param string $imageFile
|
|
|
|
| 79 |
* @return Mage_XmlConnect_Model_Images
|
| 80 |
*/
|
| 81 |
-
protected function _deleteImageFiles($imageFile)
|
| 82 |
{
|
| 83 |
$convertedImageFile = $this->_convertFileExtensionToPng($imageFile);
|
| 84 |
$ioAdapter = new Varien_Io_File();
|
|
@@ -89,10 +90,12 @@ class Mage_XmlConnect_Model_Images extends Mage_Core_Model_Abstract
|
|
| 89 |
if (!is_dir($baseImageDir . DS . $item)) {
|
| 90 |
continue;
|
| 91 |
}
|
| 92 |
-
$ioAdapter->rm($baseImageDir . DS . $item . DS . $convertedImageFile);
|
| 93 |
}
|
| 94 |
}
|
| 95 |
-
$
|
|
|
|
|
|
|
| 96 |
return $this;
|
| 97 |
}
|
| 98 |
|
|
@@ -440,23 +443,28 @@ class Mage_XmlConnect_Model_Images extends Mage_Core_Model_Abstract
|
|
| 440 |
$configModel = $applicationModel->getConfigModel();
|
| 441 |
$deprecatedFlag = Mage_XmlConnect_Model_Application::DEPRECATED_CONFIG_FLAG;
|
| 442 |
|
| 443 |
-
foreach ($records as $
|
| 444 |
-
// Add icon to image table
|
| 445 |
-
$iconFile = basename($rows['value']);
|
| 446 |
-
$this->saveImage(
|
| 447 |
-
$rows['application_id'], $iconFile, Mage_XmlConnect_Model_Device_Abstract::IMAGE_TYPE_ICON, 1
|
| 448 |
-
);
|
| 449 |
-
|
| 450 |
-
// delete old icon record from config_data table
|
| 451 |
-
$configModel->deleteConfig($rows['application_id'], $deprecatedFlag, 'native/navigationBar/icon');
|
| 452 |
-
|
| 453 |
-
// delete all icon files from file system
|
| 454 |
-
$this->_deleteImageFiles($iconFile);
|
| 455 |
-
|
| 456 |
/** @var $applicationModel Mage_XmlConnect_Model_Application */
|
| 457 |
-
$applicationModel->load($
|
| 458 |
$configPathList = $oldConfigPathByDeviceType[$applicationModel->getType()];
|
| 459 |
-
$configData = $configModel->loadApplicationData($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
$i = 0;
|
| 461 |
// old config path prefix native/body/
|
| 462 |
$configPrefix = 'native/body/';
|
|
@@ -466,13 +474,13 @@ class Mage_XmlConnect_Model_Images extends Mage_Core_Model_Abstract
|
|
| 466 |
}
|
| 467 |
$fileName = basename($configData[$deprecatedFlag][$configPrefix . $configPath]);
|
| 468 |
// add new record to image table
|
| 469 |
-
$this->saveImage($
|
| 470 |
|
| 471 |
// delete all image files from file system
|
| 472 |
-
$this->_deleteImageFiles($fileName);
|
| 473 |
|
| 474 |
// remove old record from config_data table
|
| 475 |
-
$configModel->deleteConfig($
|
| 476 |
}
|
| 477 |
}
|
| 478 |
return $this;
|
| 76 |
* Remove all image files
|
| 77 |
*
|
| 78 |
* @param string $imageFile
|
| 79 |
+
* @param bool $deleteOriginal
|
| 80 |
* @return Mage_XmlConnect_Model_Images
|
| 81 |
*/
|
| 82 |
+
protected function _deleteImageFiles($imageFile, $deleteOriginal = true)
|
| 83 |
{
|
| 84 |
$convertedImageFile = $this->_convertFileExtensionToPng($imageFile);
|
| 85 |
$ioAdapter = new Varien_Io_File();
|
| 90 |
if (!is_dir($baseImageDir . DS . $item)) {
|
| 91 |
continue;
|
| 92 |
}
|
| 93 |
+
$ioAdapter->rm($baseImageDir . DS . $item . DS . basename($convertedImageFile));
|
| 94 |
}
|
| 95 |
}
|
| 96 |
+
if ($deleteOriginal) {
|
| 97 |
+
$ioAdapter->rm(self::getBasePath() . DS . basename($imageFile));
|
| 98 |
+
}
|
| 99 |
return $this;
|
| 100 |
}
|
| 101 |
|
| 443 |
$configModel = $applicationModel->getConfigModel();
|
| 444 |
$deprecatedFlag = Mage_XmlConnect_Model_Application::DEPRECATED_CONFIG_FLAG;
|
| 445 |
|
| 446 |
+
foreach ($records as $application_id) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
/** @var $applicationModel Mage_XmlConnect_Model_Application */
|
| 448 |
+
$applicationModel->load($application_id);
|
| 449 |
$configPathList = $oldConfigPathByDeviceType[$applicationModel->getType()];
|
| 450 |
+
$configData = $configModel->loadApplicationData($application_id);
|
| 451 |
+
|
| 452 |
+
// old icon config path
|
| 453 |
+
$iconConfigPath = 'native/navigationBar/icon';
|
| 454 |
+
if (!empty($configData[$deprecatedFlag][$iconConfigPath])) {
|
| 455 |
+
// Add icon to image table
|
| 456 |
+
$iconFile = basename($configData[$deprecatedFlag][$iconConfigPath]);
|
| 457 |
+
$this->saveImage(
|
| 458 |
+
$application_id, $iconFile, Mage_XmlConnect_Model_Device_Abstract::IMAGE_TYPE_ICON, 1
|
| 459 |
+
);
|
| 460 |
+
|
| 461 |
+
// delete old icon record from config_data table
|
| 462 |
+
$configModel->deleteConfig($application_id, $deprecatedFlag, $iconConfigPath);
|
| 463 |
+
|
| 464 |
+
// delete all icon files from file system
|
| 465 |
+
$this->_deleteImageFiles($iconFile, false);
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
$i = 0;
|
| 469 |
// old config path prefix native/body/
|
| 470 |
$configPrefix = 'native/body/';
|
| 474 |
}
|
| 475 |
$fileName = basename($configData[$deprecatedFlag][$configPrefix . $configPath]);
|
| 476 |
// add new record to image table
|
| 477 |
+
$this->saveImage($application_id, $fileName, $imageType, ++$i);
|
| 478 |
|
| 479 |
// delete all image files from file system
|
| 480 |
+
$this->_deleteImageFiles($fileName, false);
|
| 481 |
|
| 482 |
// remove old record from config_data table
|
| 483 |
+
$configModel->deleteConfig($application_id, $deprecatedFlag, $configPrefix . $configPath);
|
| 484 |
}
|
| 485 |
}
|
| 486 |
return $this;
|
app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php
CHANGED
|
@@ -45,6 +45,27 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl extends Mage_Paypal_Model
|
|
| 45 |
*/
|
| 46 |
protected $_code = self::MECL_METHOD_CODE;
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
/**
|
| 49 |
* Check whether payment method can be used
|
| 50 |
*
|
| 45 |
*/
|
| 46 |
protected $_code = self::MECL_METHOD_CODE;
|
| 47 |
|
| 48 |
+
/**
|
| 49 |
+
* Can use method for a frontend checkout
|
| 50 |
+
*
|
| 51 |
+
* @var bool
|
| 52 |
+
*/
|
| 53 |
+
protected $_canUseCheckout = false;
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Can method be used for multishipping checkout type
|
| 57 |
+
*
|
| 58 |
+
* @var bool
|
| 59 |
+
*/
|
| 60 |
+
protected $_canUseForMultishipping = false;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Can method manage recurring profiles
|
| 64 |
+
*
|
| 65 |
+
* @var bool
|
| 66 |
+
*/
|
| 67 |
+
protected $_canManageRecurringProfiles = false;
|
| 68 |
+
|
| 69 |
/**
|
| 70 |
* Check whether payment method can be used
|
| 71 |
*
|
app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php
CHANGED
|
@@ -74,11 +74,10 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
| 74 |
*
|
| 75 |
* @throws Mage_Core_Exception
|
| 76 |
* @param array $params
|
| 77 |
-
* @return void
|
| 78 |
*/
|
| 79 |
public function __construct($params = array())
|
| 80 |
{
|
| 81 |
-
$this->_checkoutSession = Mage::getSingleton('
|
| 82 |
if (isset($params['quote']) && $params['quote'] instanceof Mage_Sales_Model_Quote) {
|
| 83 |
$this->_quote = $params['quote'];
|
| 84 |
} else {
|
|
@@ -115,7 +114,7 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
| 115 |
$this->_quote->assignCustomer($customer);
|
| 116 |
}
|
| 117 |
if (!Mage::getSingleton('customer/session')->isLoggedIn()
|
| 118 |
-
&& Mage::getSingleton('
|
| 119 |
) {
|
| 120 |
$this->_prepareGuestQuote();
|
| 121 |
}
|
| 74 |
*
|
| 75 |
* @throws Mage_Core_Exception
|
| 76 |
* @param array $params
|
|
|
|
| 77 |
*/
|
| 78 |
public function __construct($params = array())
|
| 79 |
{
|
| 80 |
+
$this->_checkoutSession = Mage::getSingleton('checkout/session');
|
| 81 |
if (isset($params['quote']) && $params['quote'] instanceof Mage_Sales_Model_Quote) {
|
| 82 |
$this->_quote = $params['quote'];
|
| 83 |
} else {
|
| 114 |
$this->_quote->assignCustomer($customer);
|
| 115 |
}
|
| 116 |
if (!Mage::getSingleton('customer/session')->isLoggedIn()
|
| 117 |
+
&& Mage::getSingleton('checkout/session')->getQuote()->isAllowedGuestCheckout()
|
| 118 |
) {
|
| 119 |
$this->_prepareGuestQuote();
|
| 120 |
}
|
app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Validator/Abstract.php
CHANGED
|
@@ -71,22 +71,21 @@ class Mage_XmlConnect_Model_Simplexml_Form_Element_Validator_Abstract
|
|
| 71 |
*/
|
| 72 |
protected function _setDefaultValidatorTypeMessages()
|
| 73 |
{
|
| 74 |
-
$helper = Mage::helper('xmlconnect');
|
| 75 |
$this->_validatorTypeMessages = array(
|
| 76 |
-
'min_length' =>
|
| 77 |
-
'max_length' =>
|
| 78 |
-
'alphanumeric' =>
|
| 79 |
-
'email' =>
|
| 80 |
-
'required' =>
|
| 81 |
-
'required_select' =>
|
| 82 |
-
'numeric' =>
|
| 83 |
-
'alpha' =>
|
| 84 |
-
'url' =>
|
| 85 |
-
'date' =>
|
| 86 |
-
'max_file_size' =>
|
| 87 |
-
'file_extensions' =>
|
| 88 |
-
'max_image_width' =>
|
| 89 |
-
'max_image_height' =>
|
| 90 |
);
|
| 91 |
return $this;
|
| 92 |
}
|
| 71 |
*/
|
| 72 |
protected function _setDefaultValidatorTypeMessages()
|
| 73 |
{
|
|
|
|
| 74 |
$this->_validatorTypeMessages = array(
|
| 75 |
+
'min_length' => Mage::helper('xmlconnect')->__('Text length does not satisfy specified min text range.'),
|
| 76 |
+
'max_length' => Mage::helper('xmlconnect')->__('Text length does not satisfy specified max text range.'),
|
| 77 |
+
'alphanumeric' => Mage::helper('xmlconnect')->__('Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'),
|
| 78 |
+
'email' => Mage::helper('xmlconnect')->__('Please enter a valid email address. For example johndoe@domain.com.'),
|
| 79 |
+
'required' => Mage::helper('xmlconnect')->__('This is a required field.'),
|
| 80 |
+
'required_select' => Mage::helper('xmlconnect')->__('Please select an option.'),
|
| 81 |
+
'numeric' => Mage::helper('xmlconnect')->__('Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.'),
|
| 82 |
+
'alpha' => Mage::helper('xmlconnect')->__('Please use letters only (a-z or A-Z) in this field.'),
|
| 83 |
+
'url' => Mage::helper('xmlconnect')->__('Please enter a valid URL. Protocol is required (http://, https:// or ftp://)'),
|
| 84 |
+
'date' => Mage::helper('xmlconnect')->__('Please enter a valid date.'),
|
| 85 |
+
'max_file_size' => Mage::helper('xmlconnect')->__('\'%s\' exceeds the allowed file size: %d (bytes)', $this->getFieldLabel(), $this->getValue()),
|
| 86 |
+
'file_extensions' => Mage::helper('xmlconnect')->__('\'%s\' is not a valid file extension. Allowed extensions: %s', $this->getFieldLabel(), $this->getValue()),
|
| 87 |
+
'max_image_width' => Mage::helper('xmlconnect')->__('\'%s\' width exceeds allowed value of %d px', $this->getFieldLabel(), $this->getValue()),
|
| 88 |
+
'max_image_height' => Mage::helper('xmlconnect')->__('\'%s\' height exceeds allowed value of %d px', $this->getFieldLabel(), $this->getValue())
|
| 89 |
);
|
| 90 |
return $this;
|
| 91 |
}
|
app/code/core/Mage/XmlConnect/Model/Simplexml/Message/Error.php
CHANGED
|
@@ -85,10 +85,9 @@ class Mage_XmlConnect_Model_Simplexml_Message_Error extends Mage_XmlConnect_Mode
|
|
| 85 |
*/
|
| 86 |
protected function _getCustomMessageList()
|
| 87 |
{
|
| 88 |
-
$helper = Mage::helper('xmlconnect');
|
| 89 |
return array(
|
| 90 |
-
self::ERROR_CLIENT_SP_SESSION_EXPIRED =>
|
| 91 |
-
self::ERROR_USER_SP_ACCESS_FORBIDDEN =>
|
| 92 |
);
|
| 93 |
}
|
| 94 |
|
| 85 |
*/
|
| 86 |
protected function _getCustomMessageList()
|
| 87 |
{
|
|
|
|
| 88 |
return array(
|
| 89 |
+
self::ERROR_CLIENT_SP_SESSION_EXPIRED => Mage::helper('xmlconnect')->__('User session is expired'),
|
| 90 |
+
self::ERROR_USER_SP_ACCESS_FORBIDDEN => Mage::helper('xmlconnect')->__('Access forbidden')
|
| 91 |
);
|
| 92 |
}
|
| 93 |
|
app/code/core/Mage/XmlConnect/controllers/Adminhtml/Connect/ConfigController.php
CHANGED
|
@@ -87,8 +87,8 @@ class Mage_XmlConnect_Adminhtml_Connect_ConfigController extends Mage_XmlConnect
|
|
| 87 |
{
|
| 88 |
$cookieToSetArray = array(
|
| 89 |
array(
|
| 90 |
-
'cookieName' =>
|
| 91 |
-
'paramName' =>
|
| 92 |
),
|
| 93 |
array(
|
| 94 |
'cookieName' => Mage_XmlConnect_Model_Application::APP_SCREEN_SIZE_NAME,
|
| 87 |
{
|
| 88 |
$cookieToSetArray = array(
|
| 89 |
array(
|
| 90 |
+
'cookieName' => self::DEVICE_TYPE_COOKIE_NAME,
|
| 91 |
+
'paramName' => self::DEVICE_TYPE_COOKIE_NAME,
|
| 92 |
),
|
| 93 |
array(
|
| 94 |
'cookieName' => Mage_XmlConnect_Model_Application::APP_SCREEN_SIZE_NAME,
|
app/code/core/Mage/XmlConnect/controllers/Adminhtml/MobileController.php
CHANGED
|
@@ -1390,8 +1390,8 @@ class Mage_XmlConnect_Adminhtml_MobileController extends Mage_Adminhtml_Controll
|
|
| 1390 |
}
|
| 1391 |
$imageModel->validateAndSetSubmitData($data)->checkType()->checkApplication();
|
| 1392 |
|
| 1393 |
-
/** @var $uploader
|
| 1394 |
-
$uploader = Mage::getModel('
|
| 1395 |
$uploader->setAllowRenameFiles(true)->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
|
| 1396 |
$result = $uploader->save(Mage_XmlConnect_Model_Images::getBasePath(), $newFileName);
|
| 1397 |
$result['thumbnail'] = Mage::getModel('xmlconnect/images')->getCustomSizeImageUrl(
|
| 1390 |
}
|
| 1391 |
$imageModel->validateAndSetSubmitData($data)->checkType()->checkApplication();
|
| 1392 |
|
| 1393 |
+
/** @var $uploader Mage_Core_Model_File_Uploader */
|
| 1394 |
+
$uploader = Mage::getModel('core/file_uploader', $imageModel->getImageType());
|
| 1395 |
$uploader->setAllowRenameFiles(true)->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
|
| 1396 |
$result = $uploader->save(Mage_XmlConnect_Model_Images::getBasePath(), $newFileName);
|
| 1397 |
$result['thumbnail'] = Mage::getModel('xmlconnect/images')->getCustomSizeImageUrl(
|
app/code/core/Mage/XmlConnect/controllers/CartController.php
CHANGED
|
@@ -456,7 +456,7 @@ class Mage_XmlConnect_CartController extends Mage_XmlConnect_Controller_Action
|
|
| 456 |
*/
|
| 457 |
protected function _getSession()
|
| 458 |
{
|
| 459 |
-
return Mage::getSingleton('
|
| 460 |
}
|
| 461 |
|
| 462 |
/**
|
|
@@ -575,7 +575,7 @@ class Mage_XmlConnect_CartController extends Mage_XmlConnect_Controller_Action
|
|
| 575 |
*/
|
| 576 |
public function updateItemOptionsAction()
|
| 577 |
{
|
| 578 |
-
$cart
|
| 579 |
$id = (int) $this->getRequest()->getParam('id');
|
| 580 |
$params = $this->getRequest()->getParams();
|
| 581 |
|
| 456 |
*/
|
| 457 |
protected function _getSession()
|
| 458 |
{
|
| 459 |
+
return Mage::getSingleton('checkout/session');
|
| 460 |
}
|
| 461 |
|
| 462 |
/**
|
| 575 |
*/
|
| 576 |
public function updateItemOptionsAction()
|
| 577 |
{
|
| 578 |
+
$cart = $this->_getCart();
|
| 579 |
$id = (int) $this->getRequest()->getParam('id');
|
| 580 |
$params = $this->getRequest()->getParams();
|
| 581 |
|
app/code/core/Mage/XmlConnect/controllers/CatalogController.php
CHANGED
|
@@ -103,7 +103,16 @@ class Mage_XmlConnect_CatalogController extends Mage_XmlConnect_Controller_Actio
|
|
| 103 |
return;
|
| 104 |
}
|
| 105 |
try {
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
$this->loadLayout(false);
|
| 108 |
$this->getLayout()->getBlock('xmlconnect.catalog.product')->setProduct($product);
|
| 109 |
$this->renderLayout();
|
|
@@ -124,7 +133,16 @@ class Mage_XmlConnect_CatalogController extends Mage_XmlConnect_Controller_Actio
|
|
| 124 |
public function productViewAction()
|
| 125 |
{
|
| 126 |
try {
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
$this->loadLayout(false);
|
| 129 |
$this->getLayout()->getBlock('xmlconnect.catalog.product')->setProduct($product);
|
| 130 |
$this->renderLayout();
|
|
@@ -454,60 +472,4 @@ class Mage_XmlConnect_CatalogController extends Mage_XmlConnect_Controller_Actio
|
|
| 454 |
}
|
| 455 |
return $this;
|
| 456 |
}
|
| 457 |
-
|
| 458 |
-
/**
|
| 459 |
-
* Initialize requested product object
|
| 460 |
-
*
|
| 461 |
-
* @return Mage_Catalog_Model_Product
|
| 462 |
-
*/
|
| 463 |
-
protected function _initProduct()
|
| 464 |
-
{
|
| 465 |
-
Mage::dispatchEvent('catalog_controller_product_init_before', array('controller_action' => $this));
|
| 466 |
-
$categoryId = (int) $this->getRequest()->getParam('category', false);
|
| 467 |
-
$productId = (int) $this->getRequest()->getParam('id');
|
| 468 |
-
|
| 469 |
-
if (!$productId) {
|
| 470 |
-
return false;
|
| 471 |
-
}
|
| 472 |
-
|
| 473 |
-
$product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($productId);
|
| 474 |
-
|
| 475 |
-
if (!Mage::helper('catalog/product')->canShow($product)) {
|
| 476 |
-
return false;
|
| 477 |
-
}
|
| 478 |
-
|
| 479 |
-
if (!in_array(Mage::app()->getStore()->getWebsiteId(), $product->getWebsiteIds())) {
|
| 480 |
-
return false;
|
| 481 |
-
}
|
| 482 |
-
|
| 483 |
-
$category = null;
|
| 484 |
-
if ($categoryId) {
|
| 485 |
-
$category = Mage::getModel('catalog/category')->load($categoryId);
|
| 486 |
-
$product->setCategory($category);
|
| 487 |
-
Mage::register('current_category', $category);
|
| 488 |
-
} elseif (Mage::getSingleton('catalog/session')->getLastVisitedCategoryId()) {
|
| 489 |
-
$categoryId = Mage::getSingleton('catalog/session')->getLastVisitedCategoryId();
|
| 490 |
-
if ($product->canBeShowInCategory($categoryId)) {
|
| 491 |
-
$category = Mage::getModel('catalog/category')->load($categoryId);
|
| 492 |
-
$product->setCategory($category);
|
| 493 |
-
Mage::register('current_category', $category);
|
| 494 |
-
}
|
| 495 |
-
}
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
Mage::register('current_product', $product);
|
| 499 |
-
Mage::register('product', $product);
|
| 500 |
-
|
| 501 |
-
try {
|
| 502 |
-
Mage::dispatchEvent('catalog_controller_product_init', array('product' => $product));
|
| 503 |
-
Mage::dispatchEvent(
|
| 504 |
-
'catalog_controller_product_init_after', array('product' => $product, 'controller_action' => $this)
|
| 505 |
-
);
|
| 506 |
-
} catch (Mage_Core_Exception $e) {
|
| 507 |
-
Mage::logException($e);
|
| 508 |
-
return false;
|
| 509 |
-
}
|
| 510 |
-
|
| 511 |
-
return $product;
|
| 512 |
-
}
|
| 513 |
}
|
| 103 |
return;
|
| 104 |
}
|
| 105 |
try {
|
| 106 |
+
// Prepare data
|
| 107 |
+
/** @var $productHelper Mage_Catalog_Helper_Product */
|
| 108 |
+
$productHelper = Mage::helper('catalog/product');
|
| 109 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
| 110 |
+
$params = new Varien_Object();
|
| 111 |
+
$params->setCategoryId(false);
|
| 112 |
+
|
| 113 |
+
// Standard algorithm to prepare and render product view page
|
| 114 |
+
$product = $productHelper->initProduct($productId, $this, $params);
|
| 115 |
+
|
| 116 |
$this->loadLayout(false);
|
| 117 |
$this->getLayout()->getBlock('xmlconnect.catalog.product')->setProduct($product);
|
| 118 |
$this->renderLayout();
|
| 133 |
public function productViewAction()
|
| 134 |
{
|
| 135 |
try {
|
| 136 |
+
// Prepare data
|
| 137 |
+
/** @var $productHelper Mage_Catalog_Helper_Product */
|
| 138 |
+
$productHelper = Mage::helper('catalog/product');
|
| 139 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
| 140 |
+
$params = new Varien_Object();
|
| 141 |
+
$params->setCategoryId(false);
|
| 142 |
+
|
| 143 |
+
// Standard algorithm to prepare and render product view page
|
| 144 |
+
$product = $productHelper->initProduct($productId, $this, $params);
|
| 145 |
+
|
| 146 |
$this->loadLayout(false);
|
| 147 |
$this->getLayout()->getBlock('xmlconnect.catalog.product')->setProduct($product);
|
| 148 |
$this->renderLayout();
|
| 472 |
}
|
| 473 |
return $this;
|
| 474 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
}
|
app/code/core/Mage/XmlConnect/controllers/CheckoutController.php
CHANGED
|
@@ -369,7 +369,6 @@ class Mage_XmlConnect_CheckoutController extends Mage_XmlConnect_Controller_Acti
|
|
| 369 |
'request' => $this->getRequest(),
|
| 370 |
'quote' => $this->getOnepage()->getQuote()
|
| 371 |
));
|
| 372 |
-
$this->getOnepage()->getQuote()->collectTotals()->save();
|
| 373 |
$this->_message(implode('. ', $result['message']), self::MESSAGE_STATUS_ERROR);
|
| 374 |
}
|
| 375 |
}
|
| 369 |
'request' => $this->getRequest(),
|
| 370 |
'quote' => $this->getOnepage()->getQuote()
|
| 371 |
));
|
|
|
|
| 372 |
$this->_message(implode('. ', $result['message']), self::MESSAGE_STATUS_ERROR);
|
| 373 |
}
|
| 374 |
}
|
app/code/core/Mage/XmlConnect/controllers/Paypal/MepController.php
CHANGED
|
@@ -56,7 +56,7 @@ class Mage_XmlConnect_Paypal_MepController extends Mage_XmlConnect_Controller_Ac
|
|
| 56 |
{
|
| 57 |
parent::preDispatch();
|
| 58 |
if (!Mage::getSingleton('customer/session')->isLoggedIn()
|
| 59 |
-
&& !Mage::getSingleton('
|
| 60 |
) {
|
| 61 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 62 |
$this->_message(
|
|
@@ -179,10 +179,6 @@ class Mage_XmlConnect_Paypal_MepController extends Mage_XmlConnect_Controller_Ac
|
|
| 179 |
$data = $this->getRequest()->getPost('shipping_method', '');
|
| 180 |
$this->_getQuote()->getShippingAddress()->setShippingMethod($data)->setCollectShippingRates(true)->save();
|
| 181 |
|
| 182 |
-
if (isset($data['region'])) {
|
| 183 |
-
$data['region_id'] = $data['region'];
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
$result = $this->_checkout->saveShippingMethod($data);
|
| 187 |
|
| 188 |
if (!isset($result['error'])) {
|
|
@@ -280,6 +276,7 @@ class Mage_XmlConnect_Paypal_MepController extends Mage_XmlConnect_Controller_Ac
|
|
| 280 |
$text .= $this->__('Your order # is: %s. ', $orderId);
|
| 281 |
$text .= $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.');
|
| 282 |
$message->addChild('text', $text);
|
|
|
|
| 283 |
$message->addChild('order_id', $orderId);
|
| 284 |
$this->getResponse()->setBody($message->asNiceXml());
|
| 285 |
return;
|
|
@@ -299,6 +296,7 @@ class Mage_XmlConnect_Paypal_MepController extends Mage_XmlConnect_Controller_Ac
|
|
| 299 |
*/
|
| 300 |
protected function _initCheckout()
|
| 301 |
{
|
|
|
|
| 302 |
$quote = $this->_getQuote();
|
| 303 |
if (!$quote->hasItems() || $quote->getHasError()) {
|
| 304 |
Mage::throwException($this->__('Unable to initialize MEP Checkout.'));
|
|
@@ -319,7 +317,7 @@ class Mage_XmlConnect_Paypal_MepController extends Mage_XmlConnect_Controller_Ac
|
|
| 319 |
*/
|
| 320 |
protected function _getCheckoutSession()
|
| 321 |
{
|
| 322 |
-
return Mage::getSingleton('
|
| 323 |
}
|
| 324 |
|
| 325 |
/**
|
| 56 |
{
|
| 57 |
parent::preDispatch();
|
| 58 |
if (!Mage::getSingleton('customer/session')->isLoggedIn()
|
| 59 |
+
&& !Mage::getSingleton('checkout/session')->getQuote()->isAllowedGuestCheckout()
|
| 60 |
) {
|
| 61 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 62 |
$this->_message(
|
| 179 |
$data = $this->getRequest()->getPost('shipping_method', '');
|
| 180 |
$this->_getQuote()->getShippingAddress()->setShippingMethod($data)->setCollectShippingRates(true)->save();
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
$result = $this->_checkout->saveShippingMethod($data);
|
| 183 |
|
| 184 |
if (!isset($result['error'])) {
|
| 276 |
$text .= $this->__('Your order # is: %s. ', $orderId);
|
| 277 |
$text .= $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.');
|
| 278 |
$message->addChild('text', $text);
|
| 279 |
+
|
| 280 |
$message->addChild('order_id', $orderId);
|
| 281 |
$this->getResponse()->setBody($message->asNiceXml());
|
| 282 |
return;
|
| 296 |
*/
|
| 297 |
protected function _initCheckout()
|
| 298 |
{
|
| 299 |
+
|
| 300 |
$quote = $this->_getQuote();
|
| 301 |
if (!$quote->hasItems() || $quote->getHasError()) {
|
| 302 |
Mage::throwException($this->__('Unable to initialize MEP Checkout.'));
|
| 317 |
*/
|
| 318 |
protected function _getCheckoutSession()
|
| 319 |
{
|
| 320 |
+
return Mage::getSingleton('checkout/session');
|
| 321 |
}
|
| 322 |
|
| 323 |
/**
|
app/code/core/Mage/XmlConnect/controllers/WishlistController.php
CHANGED
|
@@ -151,7 +151,8 @@ class Mage_XmlConnect_WishlistController extends Mage_XmlConnect_Controller_Acti
|
|
| 151 |
}
|
| 152 |
|
| 153 |
try {
|
| 154 |
-
$
|
|
|
|
| 155 |
if (strlen(trim((string)$request->getParam('description')))) {
|
| 156 |
$result->setDescription($request->getParam('description'))->save();
|
| 157 |
}
|
|
@@ -172,6 +173,7 @@ class Mage_XmlConnect_WishlistController extends Mage_XmlConnect_Controller_Acti
|
|
| 172 |
} catch (Mage_Core_Exception $e) {
|
| 173 |
$this->_message($e->getMessage(), self::MESSAGE_STATUS_ERROR);
|
| 174 |
} catch (Exception $e) {
|
|
|
|
| 175 |
$this->_message(
|
| 176 |
$this->__('An error occurred while adding item to wishlist.'), self::MESSAGE_STATUS_ERROR
|
| 177 |
);
|
| 151 |
}
|
| 152 |
|
| 153 |
try {
|
| 154 |
+
$buyRequest = new Varien_Object($this->getRequest()->getParams());
|
| 155 |
+
$result = $wishlist->addNewItem($product, $buyRequest);
|
| 156 |
if (strlen(trim((string)$request->getParam('description')))) {
|
| 157 |
$result->setDescription($request->getParam('description'))->save();
|
| 158 |
}
|
| 173 |
} catch (Mage_Core_Exception $e) {
|
| 174 |
$this->_message($e->getMessage(), self::MESSAGE_STATUS_ERROR);
|
| 175 |
} catch (Exception $e) {
|
| 176 |
+
Mage::logException($e);
|
| 177 |
$this->_message(
|
| 178 |
$this->__('An error occurred while adding item to wishlist.'), self::MESSAGE_STATUS_ERROR
|
| 179 |
);
|
app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-data-upgrade-1.6.0.0-1.6.0.0.1.php
CHANGED
|
@@ -39,12 +39,11 @@ $installer = $this;
|
|
| 39 |
|
| 40 |
/** @var $configModel Mage_XmlConnect_Model_Application */
|
| 41 |
$configModel = Mage::getModel('xmlconnect/configData');
|
| 42 |
-
$select = $configModel->getResource()->getReadConnection()->select()->from(
|
| 43 |
-
|
| 44 |
-
))->where('category=?', Mage_XmlConnect_Model_Application::DEPRECATED_CONFIG_FLAG)
|
| 45 |
-
->where('path=?', 'native/navigationBar/icon');
|
| 46 |
|
| 47 |
-
$result = $configModel->getResource()->getReadConnection()->
|
| 48 |
|
| 49 |
if (count($result)) {
|
| 50 |
Mage::getModel('xmlconnect/images')->dataUpgradeOldConfig($result);
|
| 39 |
|
| 40 |
/** @var $configModel Mage_XmlConnect_Model_Application */
|
| 41 |
$configModel = Mage::getModel('xmlconnect/configData');
|
| 42 |
+
$select = $configModel->getResource()->getReadConnection()->select()->from(
|
| 43 |
+
$configTableName, array('application_id')
|
| 44 |
+
)->group('application_id')->where('category=?', Mage_XmlConnect_Model_Application::DEPRECATED_CONFIG_FLAG);
|
|
|
|
| 45 |
|
| 46 |
+
$result = $configModel->getResource()->getReadConnection()->fetchCol($select);
|
| 47 |
|
| 48 |
if (count($result)) {
|
| 49 |
Mage::getModel('xmlconnect/images')->dataUpgradeOldConfig($result);
|
app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php
CHANGED
|
@@ -354,11 +354,6 @@ $installer->run("ALTER TABLE `{$queueTableName}` DROP `app_code`;");
|
|
| 354 |
*/
|
| 355 |
$installer->run("ALTER TABLE `{$appTableName}` ADD UNIQUE `UNQ_XMLCONNECT_APPLICATION_CODE` (`code`)");
|
| 356 |
|
| 357 |
-
$installer->run("
|
| 358 |
-
ALTER TABLE `{$configTableName}`
|
| 359 |
-
ADD UNIQUE `UNQ_XMLCONNECT_CONFIG` (`application_id`,`category`,`path`)
|
| 360 |
-
");
|
| 361 |
-
|
| 362 |
$installer->run("
|
| 363 |
ALTER TABLE `{$configTableName}`
|
| 364 |
ADD UNIQUE `UNQ_XMLCONNECT_CONFIG_DATA_APPLICATION_ID_CATEGORY_PATH` (`application_id`,`category`,`path`)
|
|
@@ -372,20 +367,12 @@ ALTER TABLE `{$appTableName}`
|
|
| 372 |
ON UPDATE SET NULL
|
| 373 |
");
|
| 374 |
|
| 375 |
-
$installer->run("
|
| 376 |
-
ALTER TABLE `{$configTableName}`
|
| 377 |
-
ADD CONSTRAINT `FK_APPLICATION_ID` FOREIGN KEY (`application_id`)
|
| 378 |
-
REFERENCES `{$appTableName}` (`application_id`)
|
| 379 |
-
ON DELETE CASCADE
|
| 380 |
-
ON UPDATE CASCADE
|
| 381 |
-
");
|
| 382 |
-
|
| 383 |
$installer->run("
|
| 384 |
ALTER TABLE `{$configTableName}`
|
| 385 |
ADD CONSTRAINT `FK_31EE36D814216200D7C0723145AC510E` FOREIGN KEY (`application_id`)
|
| 386 |
REFERENCES `{$appTableName}` (`application_id`)
|
| 387 |
ON DELETE CASCADE
|
| 388 |
-
ON UPDATE CASCADE
|
| 389 |
");
|
| 390 |
|
| 391 |
$installer->run("
|
| 354 |
*/
|
| 355 |
$installer->run("ALTER TABLE `{$appTableName}` ADD UNIQUE `UNQ_XMLCONNECT_APPLICATION_CODE` (`code`)");
|
| 356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
$installer->run("
|
| 358 |
ALTER TABLE `{$configTableName}`
|
| 359 |
ADD UNIQUE `UNQ_XMLCONNECT_CONFIG_DATA_APPLICATION_ID_CATEGORY_PATH` (`application_id`,`category`,`path`)
|
| 367 |
ON UPDATE SET NULL
|
| 368 |
");
|
| 369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
$installer->run("
|
| 371 |
ALTER TABLE `{$configTableName}`
|
| 372 |
ADD CONSTRAINT `FK_31EE36D814216200D7C0723145AC510E` FOREIGN KEY (`application_id`)
|
| 373 |
REFERENCES `{$appTableName}` (`application_id`)
|
| 374 |
ON DELETE CASCADE
|
| 375 |
+
ON UPDATE CASCADE;
|
| 376 |
");
|
| 377 |
|
| 378 |
$installer->run("
|
app/design/adminhtml/default/default/template/xmlconnect/edit/tab/content.phtml
CHANGED
|
@@ -40,7 +40,7 @@
|
|
| 40 |
<tr class="headings">
|
| 41 |
<th><?php echo $this->__('Label') ?></th>
|
| 42 |
<th><?php echo $this->__('Get Content from CMS Page') ?></th>
|
| 43 |
-
<th><?php echo $this->
|
| 44 |
</tr>
|
| 45 |
</thead>
|
| 46 |
<tbody id='content_pages'>
|
|
@@ -71,7 +71,7 @@
|
|
| 71 |
'</span>' +
|
| 72 |
'</td>' +
|
| 73 |
'<td class="label">' +
|
| 74 |
-
'<?php echo $this->
|
| 75 |
'</td>' +
|
| 76 |
'</tr>';
|
| 77 |
|
|
@@ -90,7 +90,7 @@
|
|
| 90 |
'</span>' +
|
| 91 |
'</td>' +
|
| 92 |
'<td class="label">' +
|
| 93 |
-
'<?php echo $this->
|
| 94 |
'</td>' +
|
| 95 |
'</tr>';
|
| 96 |
|
| 40 |
<tr class="headings">
|
| 41 |
<th><?php echo $this->__('Label') ?></th>
|
| 42 |
<th><?php echo $this->__('Get Content from CMS Page') ?></th>
|
| 43 |
+
<th><?php echo $this->getChildHtml('add_button') ?></th>
|
| 44 |
</tr>
|
| 45 |
</thead>
|
| 46 |
<tbody id='content_pages'>
|
| 71 |
'</span>' +
|
| 72 |
'</td>' +
|
| 73 |
'<td class="label">' +
|
| 74 |
+
'<?php echo $this->getChildHtml('delete_button') ?>' +
|
| 75 |
'</td>' +
|
| 76 |
'</tr>';
|
| 77 |
|
| 90 |
'</span>' +
|
| 91 |
'</td>' +
|
| 92 |
'<td class="label">' +
|
| 93 |
+
'<?php echo $this->getChildHtml('delete_button') ?>' +
|
| 94 |
'</td>' +
|
| 95 |
'</tr>';
|
| 96 |
|
app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design.phtml
CHANGED
|
@@ -30,7 +30,7 @@ var imageTemplate = '<input type="hidden" name="{{file_field}}[image][{{id}}][im
|
|
| 30 |
'<div class="banner-image">'+
|
| 31 |
'<div class="row">'+
|
| 32 |
'<div id="{{file_field}}_{{id}}_file" class="uploader">'+
|
| 33 |
-
'<div id="{{file_field}}_{{id}}_file-old" class="file-row-info"><div id="{{file_field}}_preview_{{id}}" style="background:url(
|
| 34 |
'<div id="{{file_field}}_{{id}}_file-new" class="file-row-info new-file"></div>'+
|
| 35 |
'<div class="buttons">'+
|
| 36 |
'<div id="{{file_field}}_{{id}}_file-install-flash" style="display:none">'+
|
|
@@ -300,7 +300,7 @@ var uploaderTemplate = '<div class="no-display" id="[[idName]]-template">' +
|
|
| 300 |
'{{percent}}% {{uploaded}} / {{total}}' +
|
| 301 |
'</div>';
|
| 302 |
|
| 303 |
-
var fileListTemplate = '<div style="background:url(
|
| 304 |
'<span class="file-info">' +
|
| 305 |
'<span class="file-info-name">{{name}}</span>' + ' ' +
|
| 306 |
'<span class="file-info-size">({{size}})</span>' +
|
| 30 |
'<div class="banner-image">'+
|
| 31 |
'<div class="row">'+
|
| 32 |
'<div id="{{file_field}}_{{id}}_file" class="uploader">'+
|
| 33 |
+
'<div id="{{file_field}}_{{id}}_file-old" class="file-row-info"><div id="{{file_field}}_preview_{{id}}" style="background:url({{thumbnail}}) no-repeat center;" class="image-placeholder"></div></div>'+
|
| 34 |
'<div id="{{file_field}}_{{id}}_file-new" class="file-row-info new-file"></div>'+
|
| 35 |
'<div class="buttons">'+
|
| 36 |
'<div id="{{file_field}}_{{id}}_file-install-flash" style="display:none">'+
|
| 300 |
'{{percent}}% {{uploaded}} / {{total}}' +
|
| 301 |
'</div>';
|
| 302 |
|
| 303 |
+
var fileListTemplate = '<div style="background:url({{file}}) no-repeat center;" class="image-placeholder"></div>' +
|
| 304 |
'<span class="file-info">' +
|
| 305 |
'<span class="file-info-name">{{name}}</span>' + ' ' +
|
| 306 |
'<span class="file-info-size">({{size}})</span>' +
|
app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/autocomplete.phtml
CHANGED
|
@@ -32,11 +32,11 @@
|
|
| 32 |
<img src="<?php echo Mage::getSingleton('catalog/product_media_config')->getMediaUrl($item['image']); ?>" width="45" height="45" alt="" />
|
| 33 |
</div>
|
| 34 |
<?php endif; ?>
|
| 35 |
-
<input type="hidden" name="<?php echo $item['id']; ?>" value="<?php echo $this->
|
| 36 |
-
<strong><?php echo $this->__('%s id:', $item['label']) . ' ' . $item['item_id']; ?></strong>
|
| 37 |
<p><?php echo $this->escapeHtml($item['name']) ?></p>
|
| 38 |
<span class="informal"><?php echo $this->escapeHtml($item['description']) ?></span>
|
| 39 |
-
<span class="informal"><a onclick="event.stopPropagation();" href="<?php echo $item['url'] ?>" target="_blank"
|
| 40 |
</li>
|
| 41 |
<?php endforeach ?>
|
| 42 |
</ul>
|
| 32 |
<img src="<?php echo Mage::getSingleton('catalog/product_media_config')->getMediaUrl($item['image']); ?>" width="45" height="45" alt="" />
|
| 33 |
</div>
|
| 34 |
<?php endif; ?>
|
| 35 |
+
<input type="hidden" name="<?php echo $item['id']; ?>" value="<?php echo $this->escapeHtml($item['name']) ?>">
|
| 36 |
+
<strong><?php echo $this->escapeHtml($this->__('%s id:', $item['label']) . ' ' . $item['item_id']); ?></strong>
|
| 37 |
<p><?php echo $this->escapeHtml($item['name']) ?></p>
|
| 38 |
<span class="informal"><?php echo $this->escapeHtml($item['description']) ?></span>
|
| 39 |
+
<span class="informal"><a onclick="event.stopPropagation();" href="<?php echo $item['url'] ?>" target="_blank"/><?php echo $this->__('Edit') ?></a></span>
|
| 40 |
</li>
|
| 41 |
<?php endforeach ?>
|
| 42 |
</ul>
|
app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview_android.phtml
CHANGED
|
@@ -93,17 +93,19 @@ document.observe("dom:loaded", function() {
|
|
| 93 |
});
|
| 94 |
|
| 95 |
tabsDesignSectionPreviewClicked = false;
|
| 96 |
-
|
| 97 |
-
$("mobile_app_tabs_design_section")
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
</script>
|
| 93 |
});
|
| 94 |
|
| 95 |
tabsDesignSectionPreviewClicked = false;
|
| 96 |
+
Event.observe(document, 'dom:loaded', function() {
|
| 97 |
+
if ($("mobile_app_tabs_design_section")) {
|
| 98 |
+
$("mobile_app_tabs_design_section").observe('click', function() {
|
| 99 |
+
if (!tabsDesignSectionPreviewClicked) {
|
| 100 |
+
setTimeout("updatePreview()", 200);
|
| 101 |
+
tabsDesignSectionPreviewClicked = true;
|
| 102 |
+
}
|
| 103 |
+
});
|
| 104 |
+
} else {
|
| 105 |
+
// 1 is correct value - tells that you don't need to load app data
|
| 106 |
+
mmPreviewPagePrefix = 'submission_action/1/';
|
| 107 |
+
updatePreview();
|
| 108 |
+
}
|
| 109 |
+
});
|
| 110 |
|
| 111 |
</script>
|
app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview_ipad.phtml
CHANGED
|
@@ -151,17 +151,19 @@ document.observe("dom:loaded", function() {
|
|
| 151 |
});
|
| 152 |
|
| 153 |
tabsDesignSectionPreviewClicked = false;
|
| 154 |
-
|
| 155 |
-
$("mobile_app_tabs_design_section")
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
| 166 |
|
| 167 |
</script>
|
| 151 |
});
|
| 152 |
|
| 153 |
tabsDesignSectionPreviewClicked = false;
|
| 154 |
+
Event.observe(document, 'dom:loaded', function() {
|
| 155 |
+
if ($("mobile_app_tabs_design_section")) {
|
| 156 |
+
$("mobile_app_tabs_design_section").observe('click', function() {
|
| 157 |
+
if (!tabsDesignSectionPreviewClicked) {
|
| 158 |
+
setTimeout("updatePreview()", 200);
|
| 159 |
+
tabsDesignSectionPreviewClicked = true;
|
| 160 |
+
}
|
| 161 |
+
});
|
| 162 |
+
} else {
|
| 163 |
+
// 1 is correct value - tells that you don't need to load app data
|
| 164 |
+
mmPreviewPagePrefix = 'submission_action/1/';
|
| 165 |
+
updatePreview();
|
| 166 |
+
}
|
| 167 |
+
});
|
| 168 |
|
| 169 |
</script>
|
app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview_iphone.phtml
CHANGED
|
@@ -95,17 +95,19 @@ document.observe("dom:loaded", function() {
|
|
| 95 |
});
|
| 96 |
|
| 97 |
tabsDesignSectionPreviewClicked = false;
|
| 98 |
-
|
| 99 |
-
$("mobile_app_tabs_design_section")
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
|
| 111 |
</script>
|
| 95 |
});
|
| 96 |
|
| 97 |
tabsDesignSectionPreviewClicked = false;
|
| 98 |
+
Event.observe(document, 'dom:loaded', function() {
|
| 99 |
+
if ($("mobile_app_tabs_design_section")) {
|
| 100 |
+
$("mobile_app_tabs_design_section").observe('click', function() {
|
| 101 |
+
if (!tabsDesignSectionPreviewClicked) {
|
| 102 |
+
setTimeout("updatePreview()", 200);
|
| 103 |
+
tabsDesignSectionPreviewClicked = true;
|
| 104 |
+
}
|
| 105 |
+
});
|
| 106 |
+
} else {
|
| 107 |
+
// 1 is correct value - tells that you don't need to load app data
|
| 108 |
+
mmPreviewPagePrefix = 'submission_action/1/';
|
| 109 |
+
updatePreview();
|
| 110 |
+
}
|
| 111 |
+
});
|
| 112 |
|
| 113 |
</script>
|
app/design/adminhtml/default/default/template/xmlconnect/form/element/app_tabs_android.phtml
CHANGED
|
@@ -152,6 +152,10 @@ function XmlconnectTabUpdate() {
|
|
| 152 |
document.getElementById('<?php echo htmlspecialchars($this->getName()); ?>').value = Object.toJSON({"enabledTabs": enabledTabs, "disabledTabs": disabledTabs})
|
| 153 |
}
|
| 154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
function XmlconnectUpdateEnabled() {
|
| 156 |
enabledTabs = [];
|
| 157 |
for(i=0; i<firstTabItems.length; i++) {
|
|
@@ -328,7 +332,3 @@ function XmlconnectTabDisable(tabNumber, panelNamber) {
|
|
| 328 |
</table>
|
| 329 |
|
| 330 |
</td></tr>
|
| 331 |
-
|
| 332 |
-
<script type="text/javascript">
|
| 333 |
-
XmlconnectTabUpdate();
|
| 334 |
-
</script>
|
| 152 |
document.getElementById('<?php echo htmlspecialchars($this->getName()); ?>').value = Object.toJSON({"enabledTabs": enabledTabs, "disabledTabs": disabledTabs})
|
| 153 |
}
|
| 154 |
|
| 155 |
+
document.observe("dom:loaded", function() {
|
| 156 |
+
XmlconnectTabUpdate();
|
| 157 |
+
});
|
| 158 |
+
|
| 159 |
function XmlconnectUpdateEnabled() {
|
| 160 |
enabledTabs = [];
|
| 161 |
for(i=0; i<firstTabItems.length; i++) {
|
| 332 |
</table>
|
| 333 |
|
| 334 |
</td></tr>
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/xmlconnect/form/element/app_tabs_ipad.phtml
CHANGED
|
@@ -105,6 +105,10 @@ function XmlconnectTabUpdate() {
|
|
| 105 |
document.getElementById('<?php echo htmlspecialchars($this->getName()); ?>').value = Object.toJSON({"enabledTabs": enabledTabs, "disabledTabs": disabledTabs})
|
| 106 |
}
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
function XmlconnectTabEnable(disabledTabNumber) {
|
| 109 |
enabledTabs.push(disabledTabs.splice(disabledTabNumber, 1).shift());
|
| 110 |
XmlconnectTabUpdate();
|
|
@@ -212,7 +216,3 @@ function XmlconnectTabDisable(tabNumber) {
|
|
| 212 |
</table>
|
| 213 |
|
| 214 |
</td></tr>
|
| 215 |
-
|
| 216 |
-
<script type="text/javascript">
|
| 217 |
-
XmlconnectTabUpdate();
|
| 218 |
-
</script>
|
| 105 |
document.getElementById('<?php echo htmlspecialchars($this->getName()); ?>').value = Object.toJSON({"enabledTabs": enabledTabs, "disabledTabs": disabledTabs})
|
| 106 |
}
|
| 107 |
|
| 108 |
+
document.observe("dom:loaded", function() {
|
| 109 |
+
XmlconnectTabUpdate();
|
| 110 |
+
});
|
| 111 |
+
|
| 112 |
function XmlconnectTabEnable(disabledTabNumber) {
|
| 113 |
enabledTabs.push(disabledTabs.splice(disabledTabNumber, 1).shift());
|
| 114 |
XmlconnectTabUpdate();
|
| 216 |
</table>
|
| 217 |
|
| 218 |
</td></tr>
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/xmlconnect/form/element/app_tabs_iphone.phtml
CHANGED
|
@@ -111,6 +111,10 @@ function XmlconnectTabUpdate() {
|
|
| 111 |
document.getElementById('<?php echo htmlspecialchars($this->getName()); ?>').value = Object.toJSON({"enabledTabs": enabledTabs, "disabledTabs": disabledTabs})
|
| 112 |
}
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
function XmlconnectTabMove(tab1, tab2) {
|
| 115 |
directionLeft = tab1 > tab2;
|
| 116 |
if (enabledTabs[tab1] && (enabledTabs[tab1].action == moreActionText)) {
|
|
@@ -328,7 +332,3 @@ function fetchMore() {
|
|
| 328 |
</table>
|
| 329 |
|
| 330 |
</td></tr>
|
| 331 |
-
|
| 332 |
-
<script type="text/javascript">
|
| 333 |
-
XmlconnectTabUpdate();
|
| 334 |
-
</script>
|
| 111 |
document.getElementById('<?php echo htmlspecialchars($this->getName()); ?>').value = Object.toJSON({"enabledTabs": enabledTabs, "disabledTabs": disabledTabs})
|
| 112 |
}
|
| 113 |
|
| 114 |
+
document.observe("dom:loaded", function() {
|
| 115 |
+
XmlconnectTabUpdate();
|
| 116 |
+
});
|
| 117 |
+
|
| 118 |
function XmlconnectTabMove(tab1, tab2) {
|
| 119 |
directionLeft = tab1 > tab2;
|
| 120 |
if (enabledTabs[tab1] && (enabledTabs[tab1].action == moreActionText)) {
|
| 332 |
</table>
|
| 333 |
|
| 334 |
</td></tr>
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/xmlconnect/mobile/notification_helper.phtml
CHANGED
|
@@ -4,10 +4,10 @@
|
|
| 4 |
*
|
| 5 |
* NOTICE OF LICENSE
|
| 6 |
*
|
| 7 |
-
* This source file is subject to the
|
| 8 |
-
* that is bundled with this package in the file
|
| 9 |
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/
|
| 11 |
* If you did not receive a copy of the license and are unable to
|
| 12 |
* obtain it through the world-wide-web, please send an email
|
| 13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
|
@@ -18,10 +18,10 @@
|
|
| 18 |
* versions in the future. If you wish to customize Magento for your
|
| 19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
*
|
| 21 |
-
* @category
|
| 22 |
-
* @package
|
| 23 |
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/
|
| 25 |
*/
|
| 26 |
?>
|
| 27 |
<div class="notification-global notification-global-notice">
|
| 4 |
*
|
| 5 |
* NOTICE OF LICENSE
|
| 6 |
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
* If you did not receive a copy of the license and are unable to
|
| 12 |
* obtain it through the world-wide-web, please send an email
|
| 13 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 18 |
* versions in the future. If you wish to customize Magento for your
|
| 19 |
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
*/
|
| 26 |
?>
|
| 27 |
<div class="notification-global notification-global-notice">
|
app/design/adminhtml/default/default/template/xmlconnect/submission/app_icons_preview.phtml
CHANGED
|
@@ -27,8 +27,6 @@
|
|
| 27 |
|
| 28 |
<script type="text/javascript">
|
| 29 |
// <