Version Notes
1.6.0.0.22.1 version of package internal svn revision #121425
Download this release
Release Info
Developer | Magento Core Team |
Extension | Magento_Mobile |
Version | 1.6.0.0.22.1 |
Comparing to | |
See all releases |
Code changes from version 1.5.0.0.22.1 to 1.6.0.0.22.1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php +1 -3
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Content.php +2 -9
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Tabitems.php +2 -7
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Androidmarket.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Istore.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php +3 -4
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Application.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Msgtitle.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Pushtitle.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Status.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Template.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php +5 -13
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php +2 -2
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php +5 -4
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Name.php +48 -0
- app/code/core/Mage/XmlConnect/Block/Cart.php +2 -1
- app/code/core/Mage/XmlConnect/Block/Cart/Crosssell.php +2 -4
- app/code/core/Mage/XmlConnect/Block/Cart/Info.php +3 -12
- app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php +18 -34
- app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php +8 -7
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php +3 -7
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php +17 -51
- app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php +10 -31
- app/code/core/Mage/XmlConnect/Block/Cart/Totals.php +2 -9
- app/code/core/Mage/XmlConnect/Block/Catalog/Category.php +4 -9
- app/code/core/Mage/XmlConnect/Block/Catalog/Product.php +4 -9
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php +3 -6
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php +3 -9
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/List.php +3 -6
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +7 -18
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +1 -6
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +2 -12
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php +43 -90
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +4 -10
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Simple.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Virtual.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php +36 -55
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php +124 -335
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php +5 -11
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Related.php +13 -20
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review/List.php +5 -9
- app/code/core/Mage/XmlConnect/Block/Catalog/Search.php +6 -5
- app/code/core/Mage/XmlConnect/Block/Checkout/Address/Billing.php +3 -1
- app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php +60 -82
- app/code/core/Mage/XmlConnect/Block/Checkout/Agreements.php +1 -0
- app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Checkmo.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Authorizenet.php +8 -20
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php +4 -11
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Checkmo.php +7 -16
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Free.php +1 -4
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php +4 -9
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php +5 -11
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Purchaseorder.php +5 -13
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php +19 -41
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Purchaseorder.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Configuration.php +2 -8
- app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php +46 -75
- app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php +7 -10
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Boolean.php +4 -14
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Date.php +20 -33
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/File.php +11 -18
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Image.php +5 -10
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Multiline.php +5 -16
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Select.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Text.php +7 -24
- app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Textarea.php +1 -2
- app/code/core/Mage/XmlConnect/Block/Customer/GiftcardCheck.php +4 -18
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Details.php +11 -25
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php +26 -49
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Default.php +13 -34
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php +13 -35
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Giftcard.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Grouped.php +2 -4
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Items.php +2 -3
- app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php +10 -23
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals.php +5 -12
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance.php +2 -5
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance/Refunded.php +2 -5
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Giftcards.php +3 -8
- app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Tax.php +4 -13
- app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php +26 -58
- app/code/core/Mage/XmlConnect/Block/Home.php +0 -2
- app/code/core/Mage/XmlConnect/Block/Review/Form.php +23 -46
- app/code/core/Mage/XmlConnect/Controller/Action.php +6 -9
- app/code/core/Mage/XmlConnect/Helper/Android.php +4 -9
- app/code/core/Mage/XmlConnect/Helper/Catalog/Category/Image.php +1 -0
- app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php +1 -2
- app/code/core/Mage/XmlConnect/Helper/Customer/Order.php +47 -100
- app/code/core/Mage/XmlConnect/Helper/Data.php +63 -43
- app/code/core/Mage/XmlConnect/Helper/Image.php +4 -10
- app/code/core/Mage/XmlConnect/Helper/Ipad.php +6 -15
- app/code/core/Mage/XmlConnect/Helper/Iphone.php +10 -30
- app/code/core/Mage/XmlConnect/Helper/Theme.php +3 -7
- app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Baseurl.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Application.php +25 -57
- app/code/core/Mage/XmlConnect/Model/Catalog/Category/Image.php +13 -28
- app/code/core/Mage/XmlConnect/Model/ConfigData.php +3 -9
- app/code/core/Mage/XmlConnect/Model/History.php +4 -4
- app/code/core/Mage/XmlConnect/Model/Input/Filter/MaliciousCode.php +0 -100
- app/code/core/Mage/XmlConnect/Model/Mysql4/Application.php +2 -94
- app/code/core/Mage/XmlConnect/Model/Mysql4/Application/Collection.php +9 -10
- app/code/core/Mage/XmlConnect/Model/Mysql4/Cms/Page/Collection.php +4 -31
- app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData.php +1 -72
- app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData/Collection.php +1 -141
- app/code/core/Mage/XmlConnect/Model/Mysql4/Filter/Collection.php +2 -67
- app/code/core/Mage/XmlConnect/Model/Mysql4/History.php +9 -57
- app/code/core/Mage/XmlConnect/Model/Mysql4/History/Collection.php +4 -36
- app/code/core/Mage/XmlConnect/Model/Mysql4/Queue.php +9 -10
- app/code/core/Mage/XmlConnect/Model/Mysql4/Queue/Collection.php +1 -67
- app/code/core/Mage/XmlConnect/Model/Mysql4/Setup.php +10 -2
- app/code/core/Mage/XmlConnect/Model/Mysql4/Template.php +9 -10
- app/code/core/Mage/XmlConnect/Model/Mysql4/Template/Collection.php +1 -36
- app/code/core/Mage/XmlConnect/Model/Observer.php +4 -7
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Config.php +2 -6
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php +16 -9
- app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mep.php +1 -2
- app/code/core/Mage/XmlConnect/Model/Paypal/Mecl/Checkout.php +1 -2
- app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php +9 -18
- app/code/core/Mage/XmlConnect/Model/Preview/Abstract.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Queue.php +9 -15
- app/code/core/Mage/XmlConnect/Model/Resource/Application.php +121 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Application/Collection.php +45 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Cms/Page/Collection.php +62 -0
- app/code/core/Mage/XmlConnect/Model/Resource/ConfigData.php +102 -0
- app/code/core/Mage/XmlConnect/Model/Resource/ConfigData/Collection.php +173 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Filter/Collection.php +101 -0
- app/code/core/Mage/XmlConnect/Model/Resource/History.php +90 -0
- app/code/core/Mage/XmlConnect/Model/Resource/History/Collection.php +67 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Queue.php +45 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Queue/Collection.php +113 -0
- app/code/core/Mage/XmlConnect/{Block/Checkout/Shipping/Method/Avaliable.php → Model/Resource/Setup.php} +2 -5
- app/code/core/Mage/XmlConnect/Model/Resource/Template.php +45 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Template/Collection.php +72 -0
- app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php +2 -9
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form.php +16 -28
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Abstract.php +9 -14
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Abstract.php +3 -15
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/CountryListSelect.php +28 -65
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Fieldset.php +16 -23
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Multiline.php +3 -4
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Multiselect.php +3 -4
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/Validator/Abstract.php +17 -23
- app/code/core/Mage/XmlConnect/Model/Template.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Theme.php +5 -13
- app/code/core/Mage/XmlConnect/controllers/Adminhtml/MobileController.php +86 -124
- app/code/core/Mage/XmlConnect/controllers/CartController.php +23 -42
- app/code/core/Mage/XmlConnect/controllers/CatalogController.php +13 -23
- app/code/core/Mage/XmlConnect/controllers/CheckoutController.php +25 -19
- app/code/core/Mage/XmlConnect/controllers/CmsController.php +2 -2
- app/code/core/Mage/XmlConnect/controllers/ConfigurationController.php +11 -25
- app/code/core/Mage/XmlConnect/controllers/CustomerController.php +40 -85
- app/code/core/Mage/XmlConnect/controllers/IndexController.php +1 -1
- app/code/core/Mage/XmlConnect/controllers/Paypal/MeclController.php +37 -95
- app/code/core/Mage/XmlConnect/controllers/Paypal/MepController.php +20 -50
- app/code/core/Mage/XmlConnect/controllers/PbridgeController.php +2 -2
- app/code/core/Mage/XmlConnect/controllers/ReviewController.php +17 -38
- app/code/core/Mage/XmlConnect/controllers/WishlistController.php +18 -32
- app/code/core/Mage/XmlConnect/etc/config.xml +8 -6
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/install-1.6.0.0.php +279 -0
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.4.0.13-1.4.0.14.php +44 -23
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.4.0.9-1.4.0.10.php +1 -6
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +501 -0
- media/xmlconnect/system/ok.gif +0 -0
- package.xml +6 -7
- skin/adminhtml/default/default/images/xmlconnect/mobile_preview/android/bg_content.jpg +0 -0
- skin/adminhtml/default/default/images/xmlconnect/mobile_preview/android/bg_home_content.jpg +0 -0
- skin/adminhtml/default/default/images/xmlconnect/mobile_preview/android/logo_big.png +0 -0
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit.php
CHANGED
@@ -128,7 +128,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit
|
|
128 |
}
|
129 |
|
130 |
if (isset($app) && $app->getId()) {
|
131 |
-
return $this->__('Edit App "%s"', $this->
|
132 |
} else {
|
133 |
return $this->__('New App');
|
134 |
}
|
128 |
}
|
129 |
|
130 |
if (isset($app) && $app->getId()) {
|
131 |
+
return $this->__('Edit App "%s"', $this->escapeHtml($app->getName()));
|
132 |
} else {
|
133 |
return $this->__('New App');
|
134 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Form/Element/Country.php
CHANGED
@@ -127,9 +127,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Country
|
|
127 |
$html .= PHP_EOL . '</tr>' . PHP_EOL;
|
128 |
}
|
129 |
|
130 |
-
$html .= '</table>'
|
131 |
-
. PHP_EOL
|
132 |
-
. $this->getAfterElementHtml();
|
133 |
|
134 |
return $html;
|
135 |
}
|
127 |
$html .= PHP_EOL . '</tr>' . PHP_EOL;
|
128 |
}
|
129 |
|
130 |
+
$html .= '</table>' . PHP_EOL . $this->getAfterElementHtml();
|
|
|
|
|
131 |
|
132 |
return $html;
|
133 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Content.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Content
|
35 |
-
extends Mage_Adminhtml_Block_Template
|
36 |
{
|
37 |
/**
|
38 |
* Set path to template used for generating block's output.
|
@@ -43,13 +42,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Content
|
|
43 |
public function setTemplate($templateType)
|
44 |
{
|
45 |
$deviceType = Mage::helper('xmlconnect')->getDeviceType();
|
46 |
-
parent::setTemplate(
|
47 |
-
'xmlconnect/edit/tab/design/preview/'
|
48 |
-
. $templateType
|
49 |
-
. '_'
|
50 |
-
. $deviceType
|
51 |
-
. '.phtml'
|
52 |
-
);
|
53 |
return $this;
|
54 |
}
|
55 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Content extends Mage_Adminhtml_Block_Template
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Set path to template used for generating block's output.
|
42 |
public function setTemplate($templateType)
|
43 |
{
|
44 |
$deviceType = Mage::helper('xmlconnect')->getDeviceType();
|
45 |
+
parent::setTemplate('xmlconnect/edit/tab/design/preview/' . $templateType . '_' . $deviceType . '.phtml');
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
return $this;
|
47 |
}
|
48 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Preview/Tabitems.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Tabitems
|
35 |
-
extends Mage_Adminhtml_Block_Template
|
36 |
{
|
37 |
/**
|
38 |
* Set preview tab items template
|
@@ -42,11 +41,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Tabitems
|
|
42 |
parent::__construct();
|
43 |
|
44 |
$deviceType = Mage::helper('xmlconnect')->getDeviceType();
|
45 |
-
$this->setTemplate(
|
46 |
-
'xmlconnect/edit/tab/design/preview/tab_items_'
|
47 |
-
. $deviceType
|
48 |
-
. '.phtml'
|
49 |
-
);
|
50 |
}
|
51 |
|
52 |
/**
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Adminhtml_Mobile_Preview_Tabitems extends Mage_Adminhtml_Block_Template
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Set preview tab items template
|
41 |
parent::__construct();
|
42 |
|
43 |
$deviceType = Mage::helper('xmlconnect')->getDeviceType();
|
44 |
+
$this->setTemplate('xmlconnect/edit/tab/design/preview/tab_items_' . $deviceType . '.phtml');
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
/**
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission.php
CHANGED
@@ -114,7 +114,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission
|
|
114 |
{
|
115 |
$app = Mage::helper('xmlconnect')->getApplication();
|
116 |
if ($app && $app->getId()) {
|
117 |
-
return $this->__('Submit App "%s"', $this->
|
118 |
}
|
119 |
return '';
|
120 |
}
|
114 |
{
|
115 |
$app = Mage::helper('xmlconnect')->getApplication();
|
116 |
if ($app && $app->getId()) {
|
117 |
+
return $this->__('Submit App "%s"', $this->escapeHtml($app->getName()));
|
118 |
}
|
119 |
return '';
|
120 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Androidmarket.php
CHANGED
@@ -38,7 +38,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Android
|
|
38 |
/**
|
39 |
* Override setting the template
|
40 |
*
|
41 |
-
* @return
|
42 |
*/
|
43 |
protected function _construct()
|
44 |
{
|
38 |
/**
|
39 |
* Override setting the template
|
40 |
*
|
41 |
+
* @return null
|
42 |
*/
|
43 |
protected function _construct()
|
44 |
{
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Submission/Renderer/Country/Istore.php
CHANGED
@@ -38,7 +38,7 @@ class Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Renderer_Country_Istore
|
|
38 |
/**
|
39 |
* Override setting the template
|
40 |
*
|
41 |
-
* @return
|
42 |
*/
|
43 |
protected function _construct()
|
44 |
{
|
38 |
/**
|
39 |
* Override setting the template
|
40 |
*
|
41 |
+
* @return null
|
42 |
*/
|
43 |
protected function _construct()
|
44 |
{
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Edit.php
CHANGED
@@ -80,7 +80,7 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Edit
|
|
80 |
{
|
81 |
$message = Mage::registry('current_message');
|
82 |
if ($message && $message->getId()) {
|
83 |
-
return $this->__('Edit AirMail Message Queue #%s', $this->
|
84 |
} else {
|
85 |
return $this->__('New AirMail Message Queue');
|
86 |
}
|
80 |
{
|
81 |
$message = Mage::registry('current_message');
|
82 |
if ($message && $message->getId()) {
|
83 |
+
return $this->__('Edit AirMail Message Queue #%s', $this->escapeHtml($message->getId()));
|
84 |
} else {
|
85 |
return $this->__('New AirMail Message Queue');
|
86 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php
CHANGED
@@ -33,7 +33,6 @@
|
|
33 |
*/
|
34 |
class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
35 |
{
|
36 |
-
|
37 |
/**
|
38 |
* Setting grid_id, sort order and sort direction
|
39 |
*/
|
@@ -70,10 +69,10 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Wi
|
|
70 |
*/
|
71 |
protected function _prepareColumns()
|
72 |
{
|
73 |
-
$this->addColumn('
|
74 |
'header' => $this->__('ID'),
|
75 |
'align' => 'center',
|
76 |
-
'index' => 'main_table.
|
77 |
'width' => '40px',
|
78 |
'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_id'
|
79 |
));
|
@@ -89,7 +88,7 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Wi
|
|
89 |
$this->addColumn('app_code', array(
|
90 |
'header' => $this->__('Application Name'),
|
91 |
'align' => 'left',
|
92 |
-
'index' => '
|
93 |
'type' => 'options',
|
94 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
95 |
'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_application'
|
33 |
*/
|
34 |
class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
35 |
{
|
|
|
36 |
/**
|
37 |
* Setting grid_id, sort order and sort direction
|
38 |
*/
|
69 |
*/
|
70 |
protected function _prepareColumns()
|
71 |
{
|
72 |
+
$this->addColumn('queue_id', array(
|
73 |
'header' => $this->__('ID'),
|
74 |
'align' => 'center',
|
75 |
+
'index' => 'main_table.queue_id',
|
76 |
'width' => '40px',
|
77 |
'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_id'
|
78 |
));
|
88 |
$this->addColumn('app_code', array(
|
89 |
'header' => $this->__('Application Name'),
|
90 |
'align' => 'left',
|
91 |
+
'index' => 'app.code',
|
92 |
'type' => 'options',
|
93 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
94 |
'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_application'
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Application.php
CHANGED
@@ -42,7 +42,7 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Application
|
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
-
$str = $this->
|
46 |
if ($str == '') {
|
47 |
$str = ' --- ';
|
48 |
}
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
+
$str = $this->escapeHtml($row->getAppName());
|
46 |
if ($str == '') {
|
47 |
$str = ' --- ';
|
48 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Msgtitle.php
CHANGED
@@ -46,6 +46,6 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Msgtitle
|
|
46 |
if (strlen($msgTitle) > 50) {
|
47 |
$msgTitle = substr($msgTitle, 0, 50) . '...';
|
48 |
}
|
49 |
-
return $this->
|
50 |
}
|
51 |
}
|
46 |
if (strlen($msgTitle) > 50) {
|
47 |
$msgTitle = substr($msgTitle, 0, 50) . '...';
|
48 |
}
|
49 |
+
return $this->escapeHtml($msgTitle);
|
50 |
}
|
51 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Pushtitle.php
CHANGED
@@ -42,6 +42,6 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Pushtitle
|
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
-
return $this->
|
46 |
}
|
47 |
}
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
+
return $this->escapeHtml($row->getPushTitle());
|
46 |
}
|
47 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Status.php
CHANGED
@@ -64,6 +64,6 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Status
|
|
64 |
$str = $this->__('Undefined');
|
65 |
}
|
66 |
|
67 |
-
return $this->
|
68 |
}
|
69 |
}
|
64 |
$str = $this->__('Undefined');
|
65 |
}
|
66 |
|
67 |
+
return $this->escapeHtml($str);
|
68 |
}
|
69 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid/Renderer/Template.php
CHANGED
@@ -42,7 +42,7 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid_Renderer_Template
|
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
-
$str = $this->
|
46 |
if ($str == '') {
|
47 |
$str .= '---';
|
48 |
}
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
+
$str = $this->escapeHtml($row->getTplName());
|
46 |
if ($str == '') {
|
47 |
$str .= '---';
|
48 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Adminhtml_Template_Edit
|
35 |
-
extends Mage_Adminhtml_Block_Widget_Form_Container
|
36 |
{
|
37 |
/**
|
38 |
* Constructor
|
@@ -44,16 +43,9 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit
|
|
44 |
$this->_blockGroup = 'xmlconnect';
|
45 |
parent::__construct();
|
46 |
|
47 |
-
$this->_updateButton(
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'deleteConfirm(\''
|
51 |
-
. $this->__('Warning: All related AirMail messages will be deleted!')
|
52 |
-
. PHP_EOL
|
53 |
-
. $this->__('Are you sure you want to do this?')
|
54 |
-
.'\', \''
|
55 |
-
. $this->getDeleteUrl()
|
56 |
-
. '\')'
|
57 |
);
|
58 |
$this->_updateButton('save', 'label', $this->__('Save'));
|
59 |
$this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
|
@@ -79,7 +71,7 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit
|
|
79 |
{
|
80 |
$template = Mage::registry('current_template');
|
81 |
if ($template && $template->getId()) {
|
82 |
-
return $this->__('Edit Template "%s"', $this->
|
83 |
} else {
|
84 |
return $this->__('New Template');
|
85 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Adminhtml_Template_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Constructor
|
43 |
$this->_blockGroup = 'xmlconnect';
|
44 |
parent::__construct();
|
45 |
|
46 |
+
$this->_updateButton('delete', 'onclick', 'deleteConfirm(\''
|
47 |
+
. $this->__('Warning: All related AirMail messages will be deleted!') . PHP_EOL
|
48 |
+
. $this->__('Are you sure you want to do this?') .'\', \'' . $this->getDeleteUrl() . '\')'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
);
|
50 |
$this->_updateButton('save', 'label', $this->__('Save'));
|
51 |
$this->_updateButton('save', 'onclick', 'if (editForm.submit()) {disableElements(\'save\')}');
|
71 |
{
|
72 |
$template = Mage::registry('current_template');
|
73 |
if ($template && $template->getId()) {
|
74 |
+
return $this->__('Edit Template "%s"', $this->escapeHtml($template->getName()));
|
75 |
} else {
|
76 |
return $this->__('New Template');
|
77 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Edit/Form.php
CHANGED
@@ -94,8 +94,8 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Edit_Form
|
|
94 |
));
|
95 |
}
|
96 |
|
97 |
-
$fieldset->addField('
|
98 |
-
'name' => '
|
99 |
'label' => $this->__('Application'),
|
100 |
'title' => $this->__('Application'),
|
101 |
'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false,
|
94 |
));
|
95 |
}
|
96 |
|
97 |
+
$fieldset->addField('application_id', 'select', array(
|
98 |
+
'name' => 'application_id',
|
99 |
'label' => $this->__('Application'),
|
100 |
'title' => $this->__('Application'),
|
101 |
'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false,
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php
CHANGED
@@ -64,17 +64,18 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block
|
|
64 |
*/
|
65 |
protected function _prepareColumns()
|
66 |
{
|
67 |
-
$this->addColumn('
|
68 |
'header' => $this->__('ID'),
|
69 |
'align' => 'center',
|
70 |
-
'index' => '
|
71 |
'width' => '40px'
|
72 |
));
|
73 |
|
74 |
$this->addColumn('name', array(
|
75 |
'header' => $this->__('Template Name'),
|
76 |
'align' => 'left',
|
77 |
-
'index' => 'name',
|
|
|
78 |
'escape' => true
|
79 |
));
|
80 |
|
@@ -94,7 +95,7 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block
|
|
94 |
|
95 |
$this->addColumn('app_code', array(
|
96 |
'header' => $this->__('Application'),
|
97 |
-
'index' => '
|
98 |
'type' => 'options',
|
99 |
'align' => 'left',
|
100 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
64 |
*/
|
65 |
protected function _prepareColumns()
|
66 |
{
|
67 |
+
$this->addColumn('template_id', array(
|
68 |
'header' => $this->__('ID'),
|
69 |
'align' => 'center',
|
70 |
+
'index' => 'template_id',
|
71 |
'width' => '40px'
|
72 |
));
|
73 |
|
74 |
$this->addColumn('name', array(
|
75 |
'header' => $this->__('Template Name'),
|
76 |
'align' => 'left',
|
77 |
+
'index' => 'main_table.name',
|
78 |
+
'renderer' => 'xmlconnect/adminhtml_template_grid_renderer_name',
|
79 |
'escape' => true
|
80 |
));
|
81 |
|
95 |
|
96 |
$this->addColumn('app_code', array(
|
97 |
'header' => $this->__('Application'),
|
98 |
+
'index' => 'app.code',
|
99 |
'type' => 'options',
|
100 |
'align' => 'left',
|
101 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php
CHANGED
@@ -42,7 +42,7 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid_Renderer_Application
|
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
-
$str = $this->
|
46 |
if ($str == '') {
|
47 |
$str = ' --- ';
|
48 |
}
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
+
$str = $this->escapeHtml($row->getAppName());
|
46 |
if ($str == '') {
|
47 |
$str = ' --- ';
|
48 |
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Name.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Adminhtml airmail queue grid block action item renderer
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Block_Adminhtml_Template_Grid_Renderer_Name
|
35 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Render grid row
|
39 |
+
*
|
40 |
+
* @param Varien_Object $row
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public function render(Varien_Object $row)
|
44 |
+
{
|
45 |
+
$str = $this->escapeHtml($row->getName());
|
46 |
+
return $str;
|
47 |
+
}
|
48 |
+
}
|
app/code/core/Mage/XmlConnect/Block/Cart.php
CHANGED
@@ -91,7 +91,7 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
91 |
) {
|
92 |
$inclPrice = $_incl + $item->getWeeeTaxAppliedAmount();
|
93 |
} else {
|
94 |
-
|
95 |
}
|
96 |
}
|
97 |
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
@@ -124,6 +124,7 @@ class Mage_XmlConnect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
124 |
* Info for paypal MEP if it's enabled
|
125 |
*/
|
126 |
$appConfig = Mage::helper('xmlconnect')->getApplication()->loadConfiguration()->getRenderConf();
|
|
|
127 |
$isMepActive = $appConfig['paypal']['isActive'];
|
128 |
|
129 |
$paypalMepIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mep')->isAvailable(null);
|
91 |
) {
|
92 |
$inclPrice = $_incl + $item->getWeeeTaxAppliedAmount();
|
93 |
} else {
|
94 |
+
$inclPrice = $_incl - $item->getWeeeTaxDisposition();
|
95 |
}
|
96 |
}
|
97 |
$exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
|
124 |
* Info for paypal MEP if it's enabled
|
125 |
*/
|
126 |
$appConfig = Mage::helper('xmlconnect')->getApplication()->loadConfiguration()->getRenderConf();
|
127 |
+
|
128 |
$isMepActive = $appConfig['paypal']['isActive'];
|
129 |
|
130 |
$paypalMepIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mep')->isAvailable(null);
|
app/code/core/Mage/XmlConnect/Block/Cart/Crosssell.php
CHANGED
@@ -83,14 +83,12 @@ class Mage_XmlConnect_Block_Cart_Crosssell extends Mage_Checkout_Block_Cart_Cros
|
|
83 |
}
|
84 |
|
85 |
if ($this->getChild('product_price')) {
|
86 |
-
$this->getChild('product_price')->setProduct($product)
|
87 |
-
->setProductXmlObj($itemXmlObj)
|
88 |
->collectProductPrices();
|
89 |
}
|
90 |
|
91 |
if (!$product->getRatingSummary()) {
|
92 |
-
Mage::getModel('review/review')
|
93 |
-
->getEntitySummary($product, Mage::app()->getStore()->getId());
|
94 |
}
|
95 |
|
96 |
$itemXmlObj->addChild('rating_summary', round((int)$product->getRatingSummary()->getRatingSummary() / 10));
|
83 |
}
|
84 |
|
85 |
if ($this->getChild('product_price')) {
|
86 |
+
$this->getChild('product_price')->setProduct($product)->setProductXmlObj($itemXmlObj)
|
|
|
87 |
->collectProductPrices();
|
88 |
}
|
89 |
|
90 |
if (!$product->getRatingSummary()) {
|
91 |
+
Mage::getModel('review/review')->getEntitySummary($product, Mage::app()->getStore()->getId());
|
|
|
92 |
}
|
93 |
|
94 |
$itemXmlObj->addChild('rating_summary', round((int)$product->getRatingSummary()->getRatingSummary() / 10));
|
app/code/core/Mage/XmlConnect/Block/Cart/Info.php
CHANGED
@@ -45,20 +45,11 @@ class Mage_XmlConnect_Block_Cart_Info extends Mage_XmlConnect_Block_Cart
|
|
45 |
/** @var $xmlObject Mage_XmlConnect_Model_Simplexml_Element */
|
46 |
$xmlObject = Mage::getModel('xmlconnect/simplexml_element', '<cart></cart>');
|
47 |
|
48 |
-
$xmlObject->addChild(
|
49 |
-
'is_virtual',
|
50 |
-
(int)$this->helper('checkout/cart')->getIsVirtualQuote()
|
51 |
-
);
|
52 |
|
53 |
-
$xmlObject->addChild(
|
54 |
-
'summary_qty',
|
55 |
-
(int)$this->helper('checkout/cart')->getSummaryCount()
|
56 |
-
);
|
57 |
|
58 |
-
$xmlObject->addChild(
|
59 |
-
'virtual_qty',
|
60 |
-
(int)$quote->getItemVirtualQty()
|
61 |
-
);
|
62 |
|
63 |
if (strlen($quote->getCouponCode())) {
|
64 |
$xmlObject->addChild('has_coupon_code', 1);
|
45 |
/** @var $xmlObject Mage_XmlConnect_Model_Simplexml_Element */
|
46 |
$xmlObject = Mage::getModel('xmlconnect/simplexml_element', '<cart></cart>');
|
47 |
|
48 |
+
$xmlObject->addChild('is_virtual', (int)$this->helper('checkout/cart')->getIsVirtualQuote());
|
|
|
|
|
|
|
49 |
|
50 |
+
$xmlObject->addChild('summary_qty', (int)$this->helper('checkout/cart')->getSummaryCount());
|
|
|
|
|
|
|
51 |
|
52 |
+
$xmlObject->addChild('virtual_qty', (int)$quote->getItemVirtualQty());
|
|
|
|
|
|
|
53 |
|
54 |
if (strlen($quote->getCouponCode())) {
|
55 |
$xmlObject->addChild('has_coupon_code', 1);
|
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer.php
CHANGED
@@ -42,7 +42,7 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
42 |
{
|
43 |
$_item = $this->getItem();
|
44 |
$productXmlObj = $reviewXmlObj->addCustomChild('item');
|
45 |
-
$productXmlObj->addCustomChild('name', $this->
|
46 |
|
47 |
if ($_options = $this->getOptionList()) {
|
48 |
$optionsXmlObj = $productXmlObj->addChild('options');
|
@@ -55,14 +55,10 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
55 |
$value = null;
|
56 |
}
|
57 |
|
58 |
-
$optionsXmlObj->addCustomChild(
|
59 |
-
'
|
60 |
-
$value
|
61 |
-
|
62 |
-
'label' => $this->htmlEscape($_option['label']),
|
63 |
-
'value' => $_formattedOptionValue['value']
|
64 |
-
)
|
65 |
-
);
|
66 |
}
|
67 |
}
|
68 |
|
@@ -87,15 +83,14 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
87 |
|
88 |
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
89 |
if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
|
90 |
-
&& $_item->getWeeeTaxAppliedAmount()
|
91 |
-
|
92 |
-
|
93 |
+ $_item->getWeeeTaxRowDisposition();
|
94 |
} else {
|
95 |
$exclPrice = $_item->getRowTotal();
|
96 |
}
|
97 |
$exclPrice = $this->_formatPrice($exclPrice);
|
98 |
-
|
99 |
$subtotalXmlObj->addAttribute('excluding_tax', $subtotalXmlObj->escapeXml($exclPrice));
|
100 |
}
|
101 |
|
@@ -212,45 +207,34 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_
|
|
212 |
$amount = $tax['amount'];
|
213 |
}
|
214 |
|
215 |
-
$weeeXmlObj->addCustomChild(
|
216 |
-
'
|
217 |
-
|
218 |
-
|
219 |
-
'name' => $tax['title'],
|
220 |
-
'amount' => $this->_formatPrice($amount)
|
221 |
-
)
|
222 |
-
);
|
223 |
}
|
224 |
} elseif ($_item->getWeeeTaxAppliedAmount()
|
225 |
&& ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales'))
|
226 |
) {
|
227 |
foreach (Mage::helper('weee')->getApplied($_item) as $tax) {
|
228 |
-
|
229 |
if ($subtotalFlag) {
|
230 |
$amount = $tax['row_amount_incl_tax'];
|
231 |
} else {
|
232 |
$amount = $tax['amount_incl_tax'];
|
233 |
}
|
234 |
|
235 |
-
$weeeXmlObj->addCustomChild(
|
236 |
-
'
|
237 |
-
|
238 |
-
|
239 |
-
'name' => $tax['title'],
|
240 |
-
'amount' => $this->_formatPrice($amount)
|
241 |
-
)
|
242 |
-
);
|
243 |
}
|
244 |
}
|
245 |
|
246 |
if ($typeOfDisplay2 && $_item->getWeeeTaxAppliedAmount()) {
|
247 |
if ($subtotalFlag) {
|
248 |
-
$totalExcl = $_item->getRowTotal()
|
249 |
-
+ $_item->getWeeeTaxAppliedRowAmount()
|
250 |
+ $_item->getWeeeTaxRowDisposition();
|
251 |
} else {
|
252 |
-
$totalExcl = $_item->getCalculationPrice()
|
253 |
-
+ $_item->getWeeeTaxAppliedAmount()
|
254 |
+ $_item->getWeeeTaxDisposition();
|
255 |
}
|
256 |
|
42 |
{
|
43 |
$_item = $this->getItem();
|
44 |
$productXmlObj = $reviewXmlObj->addCustomChild('item');
|
45 |
+
$productXmlObj->addCustomChild('name', $this->escapeHtml($this->getProductName()));
|
46 |
|
47 |
if ($_options = $this->getOptionList()) {
|
48 |
$optionsXmlObj = $productXmlObj->addChild('options');
|
55 |
$value = null;
|
56 |
}
|
57 |
|
58 |
+
$optionsXmlObj->addCustomChild('option', $value, array(
|
59 |
+
'label' => $this->escapeHtml($_option['label']),
|
60 |
+
'value' => $_formattedOptionValue['value']
|
61 |
+
));
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
}
|
64 |
|
83 |
|
84 |
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
85 |
if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')
|
86 |
+
&& $_item->getWeeeTaxAppliedAmount()
|
87 |
+
) {
|
88 |
+
$exclPrice = $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount()
|
89 |
+ $_item->getWeeeTaxRowDisposition();
|
90 |
} else {
|
91 |
$exclPrice = $_item->getRowTotal();
|
92 |
}
|
93 |
$exclPrice = $this->_formatPrice($exclPrice);
|
|
|
94 |
$subtotalXmlObj->addAttribute('excluding_tax', $subtotalXmlObj->escapeXml($exclPrice));
|
95 |
}
|
96 |
|
207 |
$amount = $tax['amount'];
|
208 |
}
|
209 |
|
210 |
+
$weeeXmlObj->addCustomChild('item', null, array(
|
211 |
+
'name' => $tax['title'],
|
212 |
+
'amount' => $this->_formatPrice($amount)
|
213 |
+
));
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
} elseif ($_item->getWeeeTaxAppliedAmount()
|
216 |
&& ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales'))
|
217 |
) {
|
218 |
foreach (Mage::helper('weee')->getApplied($_item) as $tax) {
|
|
|
219 |
if ($subtotalFlag) {
|
220 |
$amount = $tax['row_amount_incl_tax'];
|
221 |
} else {
|
222 |
$amount = $tax['amount_incl_tax'];
|
223 |
}
|
224 |
|
225 |
+
$weeeXmlObj->addCustomChild('item', null, array(
|
226 |
+
'name' => $tax['title'],
|
227 |
+
'amount' => $this->_formatPrice($amount)
|
228 |
+
));
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
}
|
231 |
|
232 |
if ($typeOfDisplay2 && $_item->getWeeeTaxAppliedAmount()) {
|
233 |
if ($subtotalFlag) {
|
234 |
+
$totalExcl = $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount()
|
|
|
235 |
+ $_item->getWeeeTaxRowDisposition();
|
236 |
} else {
|
237 |
+
$totalExcl = $_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount()
|
|
|
238 |
+ $_item->getWeeeTaxDisposition();
|
239 |
}
|
240 |
|
app/code/core/Mage/XmlConnect/Block/Cart/Item/Renderer/Configurable.php
CHANGED
@@ -32,8 +32,8 @@
|
|
32 |
*/
|
33 |
class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConnect_Block_Cart_Item_Renderer
|
34 |
{
|
35 |
-
const CONFIGURABLE_PRODUCT_IMAGE= 'checkout/cart/configurable_product_image';
|
36 |
-
const USE_PARENT_IMAGE
|
37 |
|
38 |
/**
|
39 |
* Get item configurable product
|
@@ -42,7 +42,8 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConn
|
|
42 |
*/
|
43 |
public function getConfigurableProduct()
|
44 |
{
|
45 |
-
|
|
|
46 |
return $option->getProduct();
|
47 |
}
|
48 |
return $this->getProduct();
|
@@ -55,7 +56,8 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConn
|
|
55 |
*/
|
56 |
public function getChildProduct()
|
57 |
{
|
58 |
-
|
|
|
59 |
return $option->getProduct();
|
60 |
}
|
61 |
return $this->getProduct();
|
@@ -72,7 +74,7 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConn
|
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
-
* Get list of all
|
76 |
*
|
77 |
* @return array
|
78 |
*/
|
@@ -80,7 +82,6 @@ class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConn
|
|
80 |
{
|
81 |
/* @var $helper Mage_Catalog_Helper_Product_Configuration */
|
82 |
$helper = Mage::helper('catalog/product_configuration');
|
83 |
-
|
84 |
-
return $options;
|
85 |
}
|
86 |
}
|
32 |
*/
|
33 |
class Mage_XmlConnect_Block_Cart_Item_Renderer_Configurable extends Mage_XmlConnect_Block_Cart_Item_Renderer
|
34 |
{
|
35 |
+
const CONFIGURABLE_PRODUCT_IMAGE = 'checkout/cart/configurable_product_image';
|
36 |
+
const USE_PARENT_IMAGE = 'parent';
|
37 |
|
38 |
/**
|
39 |
* Get item configurable product
|
42 |
*/
|
43 |
public function getConfigurableProduct()
|
44 |
{
|
45 |
+
$option = $this->getItem()->getOptionByCode('product_type');
|
46 |
+
if ($option) {
|
47 |
return $option->getProduct();
|
48 |
}
|
49 |
return $this->getProduct();
|
56 |
*/
|
57 |
public function getChildProduct()
|
58 |
{
|
59 |
+
$option = $this->getItem()->getOptionByCode('simple_product');
|
60 |
+
if ($option) {
|
61 |
return $option->getProduct();
|
62 |
}
|
63 |
return $this->getProduct();
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
+
* Get list of all options for product
|
78 |
*
|
79 |
* @return array
|
80 |
*/
|
82 |
{
|
83 |
/* @var $helper Mage_Catalog_Helper_Product_Configuration */
|
84 |
$helper = Mage::helper('catalog/product_configuration');
|
85 |
+
return $helper->getConfigurableOptions($this->getItem());
|
|
|
86 |
}
|
87 |
}
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Details.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_Xmlconnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details
|
35 |
-
extends Mage_Paypal_Block_Express_Review_Details
|
36 |
{
|
37 |
/**
|
38 |
* Add cart details to XML object
|
@@ -47,9 +46,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details
|
|
47 |
$this->getItemXml($_item, $itemsXmlObj);
|
48 |
}
|
49 |
|
50 |
-
$reviewXmlObj->appendChild(
|
51 |
-
$this->getChild('totals')->setReturnObjectFlag(true)->_toHtml()
|
52 |
-
);
|
53 |
|
54 |
return $reviewXmlObj;
|
55 |
}
|
@@ -66,8 +63,7 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details
|
|
66 |
Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
|
67 |
)
|
68 |
{
|
69 |
-
$renderer = $this->getItemRenderer($item->getProductType())
|
70 |
-
->setItem($item)->setQuote($this->getQuote());
|
71 |
return $renderer->addProductToXmlObj($reviewXmlObj);
|
72 |
}
|
73 |
|
31 |
* @package Mage_Xmlconnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Details extends Mage_Paypal_Block_Express_Review_Details
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add cart details to XML object
|
46 |
$this->getItemXml($_item, $itemsXmlObj);
|
47 |
}
|
48 |
|
49 |
+
$reviewXmlObj->appendChild($this->getChild('totals')->setReturnObjectFlag(true)->_toHtml());
|
|
|
|
|
50 |
|
51 |
return $reviewXmlObj;
|
52 |
}
|
63 |
Mage_XmlConnect_Model_Simplexml_Element $reviewXmlObj
|
64 |
)
|
65 |
{
|
66 |
+
$renderer = $this->getItemRenderer($item->getProductType())->setItem($item)->setQuote($this->getQuote());
|
|
|
67 |
return $renderer->addProductToXmlObj($reviewXmlObj);
|
68 |
}
|
69 |
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Review.php
CHANGED
@@ -41,88 +41,54 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Ex
|
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
/** @var $reviewXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
-
$reviewXmlObj = Mage::getModel(
|
45 |
-
'xmlconnect/simplexml_element',
|
46 |
-
'<mecl_cart_details></mecl_cart_details>'
|
47 |
-
);
|
48 |
|
49 |
if ($this->getPaypalMessages()) {
|
50 |
-
$reviewXmlObj->addChild(
|
51 |
-
'paypal_message',
|
52 |
-
implode(PHP_EOL, $this->getPaypalMessages())
|
53 |
-
);
|
54 |
}
|
55 |
|
56 |
if ($this->getShippingAddress()) {
|
57 |
$reviewXmlObj->addCustomChild(
|
58 |
'shipping_address',
|
59 |
-
|
60 |
array('label' => $this->__('Shipping Address'))
|
61 |
);
|
62 |
}
|
63 |
|
64 |
if ($this->_quote->isVirtual()) {
|
65 |
-
$reviewXmlObj->addCustomChild(
|
66 |
-
'
|
67 |
-
|
68 |
-
array(
|
69 |
-
'label' => $this->__('No shipping method required.')
|
70 |
-
)
|
71 |
-
);
|
72 |
} elseif ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
|
73 |
if ($groups = $this->getShippingRateGroups()) {
|
74 |
$currentRate = $this->getCurrentShippingRate();
|
75 |
foreach ($groups as $code => $rates) {
|
76 |
foreach ($rates as $rate) {
|
77 |
if ($currentRate === $rate) {
|
78 |
-
$reviewXmlObj->addCustomChild(
|
79 |
-
'
|
80 |
-
|
81 |
-
|
82 |
-
'rate' => strip_tags($this->renderShippingRateOption($rate)),
|
83 |
-
'label' => $this->getCarrierName($code)
|
84 |
-
)
|
85 |
-
);
|
86 |
break(2);
|
87 |
}
|
88 |
}
|
89 |
}
|
90 |
}
|
91 |
}
|
92 |
-
$reviewXmlObj->addCustomChild(
|
93 |
-
'
|
94 |
-
|
95 |
-
array(
|
96 |
-
'label' => $this->__('Payment Method')
|
97 |
-
)
|
98 |
-
);
|
99 |
|
100 |
$reviewXmlObj->addCustomChild(
|
101 |
'billing_address',
|
102 |
-
|
103 |
array(
|
104 |
-
'label'
|
105 |
-
'payer_email'
|
106 |
-
|
107 |
-
);
|
108 |
|
109 |
$this->getChild('details')->addDetailsToXmlObj($reviewXmlObj);
|
110 |
|
111 |
return $reviewXmlObj->asNiceXml();
|
112 |
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Get text output for specified address
|
116 |
-
*
|
117 |
-
* @param $address
|
118 |
-
* @return string
|
119 |
-
*/
|
120 |
-
public function renderAddress($address)
|
121 |
-
{
|
122 |
-
return preg_replace(
|
123 |
-
array('@\r@', '@\n+@'),
|
124 |
-
array('', PHP_EOL),
|
125 |
-
$address->getFormated(false)
|
126 |
-
);
|
127 |
-
}
|
128 |
}
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
/** @var $reviewXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
+
$reviewXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<mecl_cart_details></mecl_cart_details>');
|
|
|
|
|
|
|
45 |
|
46 |
if ($this->getPaypalMessages()) {
|
47 |
+
$reviewXmlObj->addChild('paypal_message', implode(PHP_EOL, $this->getPaypalMessages()));
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
if ($this->getShippingAddress()) {
|
51 |
$reviewXmlObj->addCustomChild(
|
52 |
'shipping_address',
|
53 |
+
Mage::helper('xmlconnect')->trimLineBreaks($this->getShippingAddress()->format('text')),
|
54 |
array('label' => $this->__('Shipping Address'))
|
55 |
);
|
56 |
}
|
57 |
|
58 |
if ($this->_quote->isVirtual()) {
|
59 |
+
$reviewXmlObj->addCustomChild('shipping_method', null, array(
|
60 |
+
'label' => $this->__('No shipping method required.')
|
61 |
+
));
|
|
|
|
|
|
|
|
|
62 |
} elseif ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
|
63 |
if ($groups = $this->getShippingRateGroups()) {
|
64 |
$currentRate = $this->getCurrentShippingRate();
|
65 |
foreach ($groups as $code => $rates) {
|
66 |
foreach ($rates as $rate) {
|
67 |
if ($currentRate === $rate) {
|
68 |
+
$reviewXmlObj->addCustomChild('shipping_method', null, array(
|
69 |
+
'rate' => strip_tags($this->renderShippingRateOption($rate)),
|
70 |
+
'label' => $this->getCarrierName($code)
|
71 |
+
));
|
|
|
|
|
|
|
|
|
72 |
break(2);
|
73 |
}
|
74 |
}
|
75 |
}
|
76 |
}
|
77 |
}
|
78 |
+
$reviewXmlObj->addCustomChild('payment_method', $this->escapeHtml($this->getPaymentMethodTitle()), array(
|
79 |
+
'label' => $this->__('Payment Method')
|
80 |
+
));
|
|
|
|
|
|
|
|
|
81 |
|
82 |
$reviewXmlObj->addCustomChild(
|
83 |
'billing_address',
|
84 |
+
Mage::helper('xmlconnect')->trimLineBreaks($this->getBillingAddress()->format('text')),
|
85 |
array(
|
86 |
+
'label' => $this->__('Billing Address'),
|
87 |
+
'payer_email' => $this->__('Payer Email: %s', $this->getBillingAddress()->getEmail())
|
88 |
+
));
|
|
|
89 |
|
90 |
$this->getChild('details')->addDetailsToXmlObj($reviewXmlObj);
|
91 |
|
92 |
return $reviewXmlObj->asNiceXml();
|
93 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php
CHANGED
@@ -50,9 +50,9 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
|
|
50 |
$methodListXmlObj->addAttribute('label', $this->__('Shipping Method'));
|
51 |
|
52 |
if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
|
53 |
-
|
|
|
54 |
$currentRate = $this->getCurrentShippingRate();
|
55 |
-
|
56 |
foreach ($groups as $code => $rates) {
|
57 |
$rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj, $code);
|
58 |
foreach ($rates as $rate) {
|
@@ -63,36 +63,20 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
|
|
63 |
if ($currentRate === $rate) {
|
64 |
$rateAttributes += array('selected' => 1);
|
65 |
}
|
66 |
-
$rateXmlObj->addCustomChild(
|
67 |
-
'rate',
|
68 |
-
null,
|
69 |
-
$rateAttributes
|
70 |
-
);
|
71 |
}
|
72 |
}
|
73 |
} else {
|
74 |
-
$message = $this->_quote->isVirtual()
|
75 |
-
? $this->__('No shipping method required.')
|
76 |
: $this->__('Sorry, no quotes are available for this order at this time.');
|
77 |
-
$methodListXmlObj->addCustomChild(
|
78 |
-
'method',
|
79 |
-
null,
|
80 |
-
array(
|
81 |
-
'label' => $message
|
82 |
-
)
|
83 |
-
);
|
84 |
}
|
85 |
} else {
|
86 |
$rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj);
|
87 |
-
|
88 |
-
|
89 |
-
'
|
90 |
-
|
91 |
-
array(
|
92 |
-
'label' => $this->renderShippingRateOption($this->getCurrentShippingRate()),
|
93 |
-
'selected' => 1
|
94 |
-
)
|
95 |
-
);
|
96 |
}
|
97 |
|
98 |
return $methodListXmlObj->asNiceXml();
|
@@ -108,11 +92,6 @@ class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
|
|
108 |
protected function _addRatesToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $methodListXmlObj, $code = '')
|
109 |
{
|
110 |
$attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
|
111 |
-
return $methodListXmlObj->addCustomChild(
|
112 |
-
'method',
|
113 |
-
null,
|
114 |
-
$attributes
|
115 |
-
)
|
116 |
-
->addCustomChild('rates');
|
117 |
}
|
118 |
}
|
50 |
$methodListXmlObj->addAttribute('label', $this->__('Shipping Method'));
|
51 |
|
52 |
if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
|
53 |
+
$groups = $this->getShippingRateGroups();
|
54 |
+
if ($groups) {
|
55 |
$currentRate = $this->getCurrentShippingRate();
|
|
|
56 |
foreach ($groups as $code => $rates) {
|
57 |
$rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj, $code);
|
58 |
foreach ($rates as $rate) {
|
63 |
if ($currentRate === $rate) {
|
64 |
$rateAttributes += array('selected' => 1);
|
65 |
}
|
66 |
+
$rateXmlObj->addCustomChild('rate', null, $rateAttributes);
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
} else {
|
70 |
+
$message = $this->_quote->isVirtual() ? $this->__('No shipping method required.')
|
|
|
71 |
: $this->__('Sorry, no quotes are available for this order at this time.');
|
72 |
+
$methodListXmlObj->addCustomChild('method', null, array('label' => $message));
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
} else {
|
75 |
$rateXmlObj = $this->_addRatesToXmlObj($methodListXmlObj);
|
76 |
+
$rateXmlObj->addCustomChild('rate', null, array(
|
77 |
+
'label' => $this->renderShippingRateOption($this->getCurrentShippingRate()),
|
78 |
+
'selected' => 1
|
79 |
+
));
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
return $methodListXmlObj->asNiceXml();
|
92 |
protected function _addRatesToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $methodListXmlObj, $code = '')
|
93 |
{
|
94 |
$attributes = $code ? array('label' => $this->getCarrierName($code)) : array();
|
95 |
+
return $methodListXmlObj->addCustomChild('method', null, $attributes)->addCustomChild('rates');
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
}
|
app/code/core/Mage/XmlConnect/Block/Cart/Totals.php
CHANGED
@@ -42,7 +42,6 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
|
|
42 |
{
|
43 |
/** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
$totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<totals></totals>');
|
45 |
-
// $taxConfig = Mage::getSingleton('tax/config');
|
46 |
|
47 |
foreach ($this->getQuote()->getTotals() as $total) {
|
48 |
$code = $total->getCode();
|
@@ -74,10 +73,7 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
|
|
74 |
if ($renderer->displayBoth()) {
|
75 |
$title = $renderer->getExcludeTaxLabel();
|
76 |
$this->_addTotalDataToXmlObj(
|
77 |
-
$totalsXmlObj,
|
78 |
-
$code . '_excl_tax',
|
79 |
-
$title,
|
80 |
-
$renderer->getShippingExcludeTax()
|
81 |
);
|
82 |
|
83 |
$code = $code . '_incl_tax';
|
@@ -95,10 +91,7 @@ class Mage_XmlConnect_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals
|
|
95 |
if ($displayBoth) {
|
96 |
$title = $this->__('Grand Total (Excl. Tax)');
|
97 |
$this->_addTotalDataToXmlObj(
|
98 |
-
$totalsXmlObj,
|
99 |
-
$code . '_excl_tax',
|
100 |
-
$title,
|
101 |
-
$grandTotalExlTax
|
102 |
);
|
103 |
$code = $code . '_incl_tax';
|
104 |
$title = $this->__('Grand Total (Incl. Tax)');
|
42 |
{
|
43 |
/** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
$totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<totals></totals>');
|
|
|
45 |
|
46 |
foreach ($this->getQuote()->getTotals() as $total) {
|
47 |
$code = $total->getCode();
|
73 |
if ($renderer->displayBoth()) {
|
74 |
$title = $renderer->getExcludeTaxLabel();
|
75 |
$this->_addTotalDataToXmlObj(
|
76 |
+
$totalsXmlObj, $code . '_excl_tax', $title, $renderer->getShippingExcludeTax()
|
|
|
|
|
|
|
77 |
);
|
78 |
|
79 |
$code = $code . '_incl_tax';
|
91 |
if ($displayBoth) {
|
92 |
$title = $this->__('Grand Total (Excl. Tax)');
|
93 |
$this->_addTotalDataToXmlObj(
|
94 |
+
$totalsXmlObj, $code . '_excl_tax', $title, $grandTotalExlTax
|
|
|
|
|
|
|
95 |
);
|
96 |
$code = $code . '_incl_tax';
|
97 |
$title = $this->__('Grand Total (Incl. Tax)');
|
app/code/core/Mage/XmlConnect/Block/Catalog/Category.php
CHANGED
@@ -55,16 +55,14 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
|
|
55 |
$productListBlock = $this->getChild('product_list');
|
56 |
if ($productListBlock && $categoryModel->getLevel() > 1) {
|
57 |
$layer = Mage::getSingleton('catalog/layer');
|
58 |
-
$productsXmlObj = $productListBlock->setCategory($categoryModel)
|
59 |
-
->setLayer($layer)
|
60 |
->getProductsXmlObject();
|
61 |
$hasMoreProductItems = (int)$productListBlock->getHasProductItems();
|
62 |
}
|
63 |
|
64 |
$infoBlock = $this->getChild('category_info');
|
65 |
if ($infoBlock) {
|
66 |
-
$categoryInfoXmlObj = $infoBlock->setCategory($categoryModel)
|
67 |
-
->getCategoryInfoXmlObject();
|
68 |
$categoryInfoXmlObj->addChild('has_more_items', $hasMoreProductItems);
|
69 |
$categoryXmlObj->appendChild($categoryInfoXmlObj);
|
70 |
}
|
@@ -86,11 +84,8 @@ class Mage_XmlConnect_Block_Catalog_Category extends Mage_XmlConnect_Block_Catal
|
|
86 |
if (!is_null($categoryId)) {
|
87 |
$itemXmlObj->addChild('parent_id', $item->getParentId());
|
88 |
}
|
89 |
-
$icon = Mage::helper('xmlconnect/catalog_category_image')
|
90 |
-
->
|
91 |
-
->resize(
|
92 |
-
Mage::helper('xmlconnect/image')->getImageSizeForContent('category')
|
93 |
-
);
|
94 |
|
95 |
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
96 |
|
55 |
$productListBlock = $this->getChild('product_list');
|
56 |
if ($productListBlock && $categoryModel->getLevel() > 1) {
|
57 |
$layer = Mage::getSingleton('catalog/layer');
|
58 |
+
$productsXmlObj = $productListBlock->setCategory($categoryModel)->setLayer($layer)
|
|
|
59 |
->getProductsXmlObject();
|
60 |
$hasMoreProductItems = (int)$productListBlock->getHasProductItems();
|
61 |
}
|
62 |
|
63 |
$infoBlock = $this->getChild('category_info');
|
64 |
if ($infoBlock) {
|
65 |
+
$categoryInfoXmlObj = $infoBlock->setCategory($categoryModel)->getCategoryInfoXmlObject();
|
|
|
66 |
$categoryInfoXmlObj->addChild('has_more_items', $hasMoreProductItems);
|
67 |
$categoryXmlObj->appendChild($categoryInfoXmlObj);
|
68 |
}
|
84 |
if (!is_null($categoryId)) {
|
85 |
$itemXmlObj->addChild('parent_id', $item->getParentId());
|
86 |
}
|
87 |
+
$icon = Mage::helper('xmlconnect/catalog_category_image')->initialize($item, 'thumbnail')
|
88 |
+
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('category'));
|
|
|
|
|
|
|
89 |
|
90 |
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
91 |
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product.php
CHANGED
@@ -95,14 +95,8 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
|
|
95 |
Mage::getModel('review/review')->getEntitySummary($product, Mage::app()->getStore()->getId());
|
96 |
}
|
97 |
|
98 |
-
$item->addChild(
|
99 |
-
|
100 |
-
round((int)$product->getRatingSummary()->getRatingSummary() / 10)
|
101 |
-
);
|
102 |
-
$item->addChild(
|
103 |
-
'reviews_count',
|
104 |
-
$product->getRatingSummary()->getReviewsCount()
|
105 |
-
);
|
106 |
|
107 |
if ($this->getChild('product_price')) {
|
108 |
$this->getChild('product_price')->setProduct($product)->setProductXmlObj($item)
|
@@ -158,7 +152,8 @@ class Mage_XmlConnect_Block_Catalog_Product extends Mage_XmlConnect_Block_Catalo
|
|
158 |
}
|
159 |
}
|
160 |
|
161 |
-
$productOptions = $this->getChild('xmlconnect.catalog.product.options')
|
|
|
162 |
if ($productOptions instanceof Mage_XmlConnect_Model_Simplexml_Element) {
|
163 |
$productXmlObj->appendChild($productOptions);
|
164 |
}
|
95 |
Mage::getModel('review/review')->getEntitySummary($product, Mage::app()->getStore()->getId());
|
96 |
}
|
97 |
|
98 |
+
$item->addChild('rating_summary', round((int)$product->getRatingSummary()->getRatingSummary() / 10));
|
99 |
+
$item->addChild('reviews_count', $product->getRatingSummary()->getReviewsCount());
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
if ($this->getChild('product_price')) {
|
102 |
$this->getChild('product_price')->setProduct($product)->setProductXmlObj($item)
|
152 |
}
|
153 |
}
|
154 |
|
155 |
+
$productOptions = $this->getChild('xmlconnect.catalog.product.options')
|
156 |
+
->getProductOptionsXmlObject($product);
|
157 |
if ($productOptions instanceof Mage_XmlConnect_Model_Simplexml_Element) {
|
158 |
$productXmlObj->appendChild($productOptions);
|
159 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Attributes.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Attributes
|
35 |
-
extends Mage_Catalog_Block_Product_View_Attributes
|
36 |
{
|
37 |
/**
|
38 |
* Add additional information (attributes) to current product xml object
|
@@ -41,10 +40,8 @@ class Mage_XmlConnect_Block_Catalog_Product_Attributes
|
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $productXmlObject
|
42 |
*/
|
43 |
public function addAdditionalData(
|
44 |
-
Mage_Catalog_Model_Product $product,
|
45 |
-
|
46 |
-
)
|
47 |
-
{
|
48 |
if ($product && $productXmlObject && $product->getId()) {
|
49 |
$this->_product = $product;
|
50 |
$additionalData = $this->getAdditionalData();
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Attributes extends Mage_Catalog_Block_Product_View_Attributes
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add additional information (attributes) to current product xml object
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $productXmlObject
|
41 |
*/
|
42 |
public function addAdditionalData(
|
43 |
+
Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $productXmlObject
|
44 |
+
) {
|
|
|
|
|
45 |
if ($product && $productXmlObject && $product->getId()) {
|
46 |
$this->_product = $product;
|
47 |
$additionalData = $this->getAdditionalData();
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Gallery.php
CHANGED
@@ -41,9 +41,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Gallery extends Mage_XmlConnect_Bloc
|
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
$productId = $this->getRequest()->getParam('id', null);
|
44 |
-
$product = Mage::getModel('catalog/product')
|
45 |
-
->setStoreId(Mage::app()->getStore()->getId())
|
46 |
-
->load($productId);
|
47 |
$collection = $product->getMediaGalleryImages();
|
48 |
|
49 |
$imagesNode = Mage::getModel('xmlconnect/simplexml_element', '<images></images>');
|
@@ -55,9 +53,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Gallery extends Mage_XmlConnect_Bloc
|
|
55 |
/**
|
56 |
* Big image
|
57 |
*/
|
58 |
-
$bigImage = $helper->init($product, 'image', $item->getFile())
|
59 |
-
->constrainOnly(true)
|
60 |
-
->keepFrame(false)
|
61 |
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_gallery_big'));
|
62 |
|
63 |
$fileNode = $imageNode->addChild('file');
|
@@ -72,9 +68,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Gallery extends Mage_XmlConnect_Bloc
|
|
72 |
/**
|
73 |
* Small image
|
74 |
*/
|
75 |
-
$smallImage = $helper->init($product, 'thumbnail', $item->getFile())
|
76 |
-
->constrainOnly(true)
|
77 |
-
->keepFrame(false)
|
78 |
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_gallery_small'));
|
79 |
|
80 |
$fileNode = $imageNode->addChild('file');
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
$productId = $this->getRequest()->getParam('id', null);
|
44 |
+
$product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($productId);
|
|
|
|
|
45 |
$collection = $product->getMediaGalleryImages();
|
46 |
|
47 |
$imagesNode = Mage::getModel('xmlconnect/simplexml_element', '<images></images>');
|
53 |
/**
|
54 |
* Big image
|
55 |
*/
|
56 |
+
$bigImage = $helper->init($product, 'image', $item->getFile())->constrainOnly(true)->keepFrame(false)
|
|
|
|
|
57 |
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_gallery_big'));
|
58 |
|
59 |
$fileNode = $imageNode->addChild('file');
|
68 |
/**
|
69 |
* Small image
|
70 |
*/
|
71 |
+
$smallImage = $helper->init($product, 'thumbnail', $item->getFile())->constrainOnly(true)->keepFrame(false)
|
|
|
|
|
72 |
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_gallery_small'));
|
73 |
|
74 |
$fileNode = $imageNode->addChild('file');
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/List.php
CHANGED
@@ -108,8 +108,7 @@ class Mage_XmlConnect_Block_Catalog_Product_List extends Mage_XmlConnect_Block_C
|
|
108 |
$attributeCode = $attributeItem->getAttributeCode();
|
109 |
list($filterModel, $filterBlock) = $this->helper('xmlconnect')->getFilterByKey($attributeCode);
|
110 |
|
111 |
-
$filterModel->setLayer($layer)
|
112 |
-
->setAttributeModel($attributeItem);
|
113 |
|
114 |
$filterParam = parent::REQUEST_FILTER_PARAM_REFIX . $attributeCode;
|
115 |
/**
|
@@ -126,9 +125,8 @@ class Mage_XmlConnect_Block_Catalog_Product_List extends Mage_XmlConnect_Block_C
|
|
126 |
* Separately apply and save category filter
|
127 |
*/
|
128 |
list($categoryFilter, $categoryFilterBlock) = $this->helper('xmlconnect')->getFilterByKey('category');
|
129 |
-
$filterParam
|
130 |
-
$categoryFilter->setLayer($layer)
|
131 |
-
->setRequestVar($filterParam)
|
132 |
->apply($this->getRequest(), $categoryFilterBlock);
|
133 |
$filters[] = $categoryFilter;
|
134 |
|
@@ -156,7 +154,6 @@ class Mage_XmlConnect_Block_Catalog_Product_List extends Mage_XmlConnect_Block_C
|
|
156 |
$this->setHasProductItems(1);
|
157 |
}
|
158 |
$collection->getSelect()->limit($count, $offset);
|
159 |
-
|
160 |
$collection->setFlag('require_stock_items', true);
|
161 |
|
162 |
$this->_productCollection = $collection;
|
108 |
$attributeCode = $attributeItem->getAttributeCode();
|
109 |
list($filterModel, $filterBlock) = $this->helper('xmlconnect')->getFilterByKey($attributeCode);
|
110 |
|
111 |
+
$filterModel->setLayer($layer)->setAttributeModel($attributeItem);
|
|
|
112 |
|
113 |
$filterParam = parent::REQUEST_FILTER_PARAM_REFIX . $attributeCode;
|
114 |
/**
|
125 |
* Separately apply and save category filter
|
126 |
*/
|
127 |
list($categoryFilter, $categoryFilterBlock) = $this->helper('xmlconnect')->getFilterByKey('category');
|
128 |
+
$filterParam = parent::REQUEST_FILTER_PARAM_REFIX . $categoryFilter->getRequestVar();
|
129 |
+
$categoryFilter->setLayer($layer)->setRequestVar($filterParam)
|
|
|
130 |
->apply($this->getRequest(), $categoryFilterBlock);
|
131 |
$filters[] = $categoryFilter;
|
132 |
|
154 |
$this->setHasProductItems(1);
|
155 |
}
|
156 |
$collection->getSelect()->limit($count, $offset);
|
|
|
157 |
$collection->setFlag('require_stock_items', true);
|
158 |
|
159 |
$this->_productCollection = $collection;
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php
CHANGED
@@ -97,18 +97,11 @@ class Mage_XmlConnect_Block_Catalog_Product_Options extends Mage_XmlConnect_Bloc
|
|
97 |
*/
|
98 |
$price = $option->getPrice();
|
99 |
if ($price) {
|
100 |
-
$optionNode->addAttribute(
|
101 |
-
|
102 |
-
Mage::helper('xmlconnect')->formatPriceForXml($price)
|
103 |
-
);
|
104 |
-
$formattedPrice = Mage::app()->getStore(
|
105 |
-
$product->getStoreId())->formatPrice($price, false
|
106 |
-
);
|
107 |
$optionNode->addAttribute('formated_price', $formattedPrice);
|
108 |
}
|
109 |
-
if ($type == self::OPTION_TYPE_CHECKBOX
|
110 |
-
|| $type == self::OPTION_TYPE_SELECT
|
111 |
-
) {
|
112 |
foreach ($option->getValues() as $value) {
|
113 |
$valueNode = $optionNode->addChild('value');
|
114 |
$valueNode->addAttribute('code', $value->getId());
|
@@ -139,12 +132,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Options extends Mage_XmlConnect_Bloc
|
|
139 |
$priceIncTax = Mage::helper('tax')->getPrice($product, $price, true);
|
140 |
|
141 |
if (Mage::helper('tax')->displayBothPrices() && $priceTax != $priceIncTax) {
|
142 |
-
$formatted = Mage::helper('core')->currency($priceTax, true, false)
|
143 |
-
. '
|
144 |
-
. Mage::helper('
|
145 |
-
. ' '
|
146 |
-
. Mage::helper('tax')->__('Incl. Tax')
|
147 |
-
. ')';
|
148 |
} else {
|
149 |
$formatted = $this->helper('core')->currency($priceTax, true, false);
|
150 |
}
|
@@ -206,8 +196,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options extends Mage_XmlConnect_Bloc
|
|
206 |
protected function _toHtml()
|
207 |
{
|
208 |
$productId = $this->getRequest()->getParam('id', null);
|
209 |
-
$product = Mage::getModel('catalog/product')
|
210 |
-
->setStoreId(Mage::app()->getStore()->getId());
|
211 |
|
212 |
if ($productId) {
|
213 |
$product->load($productId);
|
97 |
*/
|
98 |
$price = $option->getPrice();
|
99 |
if ($price) {
|
100 |
+
$optionNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml($price));
|
101 |
+
$formattedPrice = Mage::app()->getStore($product->getStoreId())->formatPrice($price, false);
|
|
|
|
|
|
|
|
|
|
|
102 |
$optionNode->addAttribute('formated_price', $formattedPrice);
|
103 |
}
|
104 |
+
if ($type == self::OPTION_TYPE_CHECKBOX || $type == self::OPTION_TYPE_SELECT) {
|
|
|
|
|
105 |
foreach ($option->getValues() as $value) {
|
106 |
$valueNode = $optionNode->addChild('value');
|
107 |
$valueNode->addAttribute('code', $value->getId());
|
132 |
$priceIncTax = Mage::helper('tax')->getPrice($product, $price, true);
|
133 |
|
134 |
if (Mage::helper('tax')->displayBothPrices() && $priceTax != $priceIncTax) {
|
135 |
+
$formatted = Mage::helper('core')->currency($priceTax, true, false) . ' (+'
|
136 |
+
. Mage::helper('core')->currency($priceIncTax, true, false) . ' '
|
137 |
+
. Mage::helper('tax')->__('Incl. Tax') . ')';
|
|
|
|
|
|
|
138 |
} else {
|
139 |
$formatted = $this->helper('core')->currency($priceTax, true, false);
|
140 |
}
|
196 |
protected function _toHtml()
|
197 |
{
|
198 |
$productId = $this->getRequest()->getParam('id', null);
|
199 |
+
$product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId());
|
|
|
200 |
|
201 |
if ($productId) {
|
202 |
$product->load($productId);
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php
CHANGED
@@ -42,7 +42,6 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
42 |
*/
|
43 |
public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
|
44 |
{
|
45 |
-
|
46 |
$xmlModel = $this->getProductCustomOptionsXmlObject($product);
|
47 |
$optionsXmlObj = $xmlModel->options;
|
48 |
|
@@ -56,8 +55,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
56 |
$product->getTypeInstance(true)->setStoreFilter($product->getStoreId(), $product);
|
57 |
$optionCollection = $product->getTypeInstance(true)->getOptionsCollection($product);
|
58 |
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
59 |
-
$product->getTypeInstance(true)->getOptionsIds($product),
|
60 |
-
$product
|
61 |
);
|
62 |
$bundleOptions = $optionCollection->appendSelections($selectionCollection, false, false);
|
63 |
if (!sizeof($bundleOptions)) {
|
@@ -87,8 +85,6 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
87 |
$optionNode->addAttribute('is_required', 1);
|
88 |
}
|
89 |
|
90 |
-
// $_default = $_option->getDefaultSelection();
|
91 |
-
|
92 |
foreach ($selections as $_selection) {
|
93 |
if (!$_selection->isSaleable()) {
|
94 |
continue;
|
@@ -113,7 +109,6 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Bundle extends Mage_XmlConne
|
|
113 |
));
|
114 |
$valueNode->addAttribute('formated_price', $this->_formatPriceString($price, $product));
|
115 |
}
|
116 |
-
// $_selection->getIsDefault();
|
117 |
}
|
118 |
}
|
119 |
|
42 |
*/
|
43 |
public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
|
44 |
{
|
|
|
45 |
$xmlModel = $this->getProductCustomOptionsXmlObject($product);
|
46 |
$optionsXmlObj = $xmlModel->options;
|
47 |
|
55 |
$product->getTypeInstance(true)->setStoreFilter($product->getStoreId(), $product);
|
56 |
$optionCollection = $product->getTypeInstance(true)->getOptionsCollection($product);
|
57 |
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
|
58 |
+
$product->getTypeInstance(true)->getOptionsIds($product), $product
|
|
|
59 |
);
|
60 |
$bundleOptions = $optionCollection->appendSelections($selectionCollection, false, false);
|
61 |
if (!sizeof($bundleOptions)) {
|
85 |
$optionNode->addAttribute('is_required', 1);
|
86 |
}
|
87 |
|
|
|
|
|
88 |
foreach ($selections as $_selection) {
|
89 |
if (!$_selection->isSaleable()) {
|
90 |
continue;
|
109 |
));
|
110 |
$valueNode->addAttribute('formated_price', $this->_formatPriceString($price, $product));
|
111 |
}
|
|
|
112 |
}
|
113 |
}
|
114 |
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php
CHANGED
@@ -143,12 +143,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
143 |
$valueNode->addAttribute('formated_price', $option['formated_price']);
|
144 |
}
|
145 |
if (sizeof($_attributes) > 1) {
|
146 |
-
$this->_prepareRecursivelyRelatedValues(
|
147 |
-
$valueNode,
|
148 |
-
$_attributes,
|
149 |
-
$option['products'],
|
150 |
-
1
|
151 |
-
);
|
152 |
}
|
153 |
}
|
154 |
$isFirst = false;
|
@@ -204,12 +199,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Configurable extends Mage_Xm
|
|
204 |
$_attrClone = $attributes;
|
205 |
if (next($_attrClone) != false) {
|
206 |
reset($_attrClone);
|
207 |
-
$this->_prepareRecursivelyRelatedValues(
|
208 |
-
$_valueNode,
|
209 |
-
$_attrClone,
|
210 |
-
$intersect,
|
211 |
-
$cycle + 1
|
212 |
-
);
|
213 |
}
|
214 |
}
|
215 |
}
|
143 |
$valueNode->addAttribute('formated_price', $option['formated_price']);
|
144 |
}
|
145 |
if (sizeof($_attributes) > 1) {
|
146 |
+
$this->_prepareRecursivelyRelatedValues($valueNode, $_attributes, $option['products'], 1);
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
149 |
$isFirst = false;
|
199 |
$_attrClone = $attributes;
|
200 |
if (next($_attrClone) != false) {
|
201 |
reset($_attrClone);
|
202 |
+
$this->_prepareRecursivelyRelatedValues($_valueNode, $_attrClone, $intersect, $cycle + 1);
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
}
|
205 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Giftcard.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
|
35 |
-
extends Mage_XmlConnect_Block_Catalog_Product_Options
|
36 |
{
|
37 |
/**
|
38 |
* Get sender name
|
@@ -172,12 +171,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
|
|
172 |
if ($configValue == $price) {
|
173 |
$amountNode->addAttribute('selected', 1);
|
174 |
}
|
175 |
-
$amountNode->addAttribute(
|
176 |
-
|
177 |
-
|
178 |
-
$coreHelper->currency($price, true, false)
|
179 |
-
)
|
180 |
-
);
|
181 |
$amountNode->addAttribute('price', $price);
|
182 |
}
|
183 |
}
|
@@ -186,17 +182,13 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
|
|
186 |
/**
|
187 |
* Render open amount options
|
188 |
*/
|
189 |
-
|
190 |
/** @var $openAmountNode Mage_XmlConnect_Model_Simplexml_Element */
|
191 |
$openAmountNode = $optionsXmlObj->addChild('open_amount');
|
192 |
if ($product->getAllowOpenAmount()) {
|
193 |
$openAmountNode->addAttribute('enabled', 1);
|
194 |
|
195 |
if ($configValue == 'custom') {
|
196 |
-
$openAmountNode->addAttribute(
|
197 |
-
'selected_amount',
|
198 |
-
$this->getDefaultValue('custom_giftcard_amount')
|
199 |
-
);
|
200 |
}
|
201 |
if ($priceModel->getMinAmount($product)) {
|
202 |
$minPrice = $product->getOpenAmountMin();
|
@@ -204,10 +196,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
|
|
204 |
} else {
|
205 |
$minAmount = $minPrice = 0;
|
206 |
}
|
207 |
-
$openAmountNode->addAttribute(
|
208 |
-
'formatted_min_amount',
|
209 |
-
$xmlModel->xmlAttribute($minAmount)
|
210 |
-
);
|
211 |
$openAmountNode->addAttribute('min_amount', $minPrice);
|
212 |
|
213 |
if ($priceModel->getMaxAmount($product)) {
|
@@ -216,10 +205,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
|
|
216 |
} else {
|
217 |
$maxAmount = $maxPrice = 0;
|
218 |
}
|
219 |
-
$openAmountNode->addAttribute(
|
220 |
-
'formatted_max_amount',
|
221 |
-
$xmlModel->xmlAttribute($maxAmount)
|
222 |
-
);
|
223 |
$openAmountNode->addAttribute('max_amount', $maxPrice);
|
224 |
} else {
|
225 |
$openAmountNode->addAttribute('enabled', 0);
|
@@ -228,89 +214,56 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard
|
|
228 |
/**
|
229 |
* Render Gift Card form options
|
230 |
*/
|
231 |
-
$form = $optionsXmlObj->addCustomChild(
|
232 |
-
'form',
|
233 |
-
|
234 |
-
|
235 |
-
'name' => 'giftcard-send-form',
|
236 |
-
'method' => 'post'
|
237 |
-
)
|
238 |
-
);
|
239 |
|
240 |
-
$senderFieldset = $form->addCustomChild(
|
241 |
-
'
|
242 |
-
|
243 |
-
array(
|
244 |
-
'legend' => $this->__('Sender Information')
|
245 |
-
)
|
246 |
-
);
|
247 |
|
248 |
-
$senderFieldset->addField(
|
249 |
-
'
|
250 |
-
'
|
251 |
-
|
252 |
-
|
253 |
-
'required' => 'true',
|
254 |
-
'value' => $this->getSenderName()
|
255 |
-
)
|
256 |
-
);
|
257 |
|
258 |
-
$recipientFieldset = $form->addCustomChild(
|
259 |
-
'
|
260 |
-
|
261 |
-
array(
|
262 |
-
'legend' => $this->__('Recipient Information')
|
263 |
-
)
|
264 |
-
);
|
265 |
|
266 |
-
$recipientFieldset->addField(
|
267 |
-
'
|
268 |
-
'
|
269 |
-
|
270 |
-
|
271 |
-
'required' => 'true',
|
272 |
-
'value' => $this->getDefaultValue('giftcard_recipient_name')
|
273 |
-
)
|
274 |
-
);
|
275 |
|
276 |
if ($this->isEmailAvailable($product)) {
|
277 |
-
$senderFieldset->addField(
|
278 |
-
'
|
279 |
-
'
|
280 |
-
|
281 |
-
|
282 |
-
'required' => 'true',
|
283 |
-
'value' => $this->getSenderEmail()
|
284 |
-
)
|
285 |
-
);
|
286 |
|
287 |
-
$recipientFieldset->addField(
|
288 |
-
'
|
289 |
-
'
|
290 |
-
|
291 |
-
|
292 |
-
'required' => 'true',
|
293 |
-
'value' => $this->getDefaultValue('giftcard_recipient_email')
|
294 |
-
)
|
295 |
-
);
|
296 |
}
|
297 |
|
298 |
if ($this->isMessageAvailable($product)) {
|
299 |
$messageMaxLength = (int) Mage::getStoreConfig(
|
300 |
Enterprise_GiftCard_Model_Giftcard::XML_PATH_MESSAGE_MAX_LENGTH
|
301 |
);
|
302 |
-
$recipientFieldset->addField(
|
303 |
-
'
|
304 |
-
'
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
'max_length'=> $messageMaxLength,
|
309 |
-
'value' => $this->getDefaultValue('giftcard_message')
|
310 |
-
)
|
311 |
-
);
|
312 |
}
|
313 |
-
|
314 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
315 |
}
|
316 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Options_Giftcard extends Mage_XmlConnect_Block_Catalog_Product_Options
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Get sender name
|
171 |
if ($configValue == $price) {
|
172 |
$amountNode->addAttribute('selected', 1);
|
173 |
}
|
174 |
+
$amountNode->addAttribute('formatted_price', $xmlModel->xmlAttribute(
|
175 |
+
$coreHelper->currency($price, true, false)
|
176 |
+
));
|
|
|
|
|
|
|
177 |
$amountNode->addAttribute('price', $price);
|
178 |
}
|
179 |
}
|
182 |
/**
|
183 |
* Render open amount options
|
184 |
*/
|
|
|
185 |
/** @var $openAmountNode Mage_XmlConnect_Model_Simplexml_Element */
|
186 |
$openAmountNode = $optionsXmlObj->addChild('open_amount');
|
187 |
if ($product->getAllowOpenAmount()) {
|
188 |
$openAmountNode->addAttribute('enabled', 1);
|
189 |
|
190 |
if ($configValue == 'custom') {
|
191 |
+
$openAmountNode->addAttribute('selected_amount', $this->getDefaultValue('custom_giftcard_amount'));
|
|
|
|
|
|
|
192 |
}
|
193 |
if ($priceModel->getMinAmount($product)) {
|
194 |
$minPrice = $product->getOpenAmountMin();
|
196 |
} else {
|
197 |
$minAmount = $minPrice = 0;
|
198 |
}
|
199 |
+
$openAmountNode->addAttribute('formatted_min_amount', $xmlModel->xmlAttribute($minAmount));
|
|
|
|
|
|
|
200 |
$openAmountNode->addAttribute('min_amount', $minPrice);
|
201 |
|
202 |
if ($priceModel->getMaxAmount($product)) {
|
205 |
} else {
|
206 |
$maxAmount = $maxPrice = 0;
|
207 |
}
|
208 |
+
$openAmountNode->addAttribute('formatted_max_amount', $xmlModel->xmlAttribute($maxAmount));
|
|
|
|
|
|
|
209 |
$openAmountNode->addAttribute('max_amount', $maxPrice);
|
210 |
} else {
|
211 |
$openAmountNode->addAttribute('enabled', 0);
|
214 |
/**
|
215 |
* Render Gift Card form options
|
216 |
*/
|
217 |
+
$form = $optionsXmlObj->addCustomChild('form', null, array(
|
218 |
+
'name' => 'giftcard-send-form',
|
219 |
+
'method' => 'post'
|
220 |
+
));
|
|
|
|
|
|
|
|
|
221 |
|
222 |
+
$senderFieldset = $form->addCustomChild('fieldset', null, array(
|
223 |
+
'legend' => $this->__('Sender Information')
|
224 |
+
));
|
|
|
|
|
|
|
|
|
225 |
|
226 |
+
$senderFieldset->addField('giftcard_sender_name', 'text', array(
|
227 |
+
'label' => Mage::helper('enterprise_giftcard')->__('Sender Name'),
|
228 |
+
'required' => 'true',
|
229 |
+
'value' => $this->getSenderName()
|
230 |
+
));
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
$recipientFieldset = $form->addCustomChild('fieldset', null, array(
|
233 |
+
'legend' => $this->__('Recipient Information')
|
234 |
+
));
|
|
|
|
|
|
|
|
|
235 |
|
236 |
+
$recipientFieldset->addField('giftcard_recipient_name', 'text', array(
|
237 |
+
'label' => Mage::helper('enterprise_giftcard')->__('Recipient Name'),
|
238 |
+
'required' => 'true',
|
239 |
+
'value' => $this->getDefaultValue('giftcard_recipient_name')
|
240 |
+
));
|
|
|
|
|
|
|
|
|
241 |
|
242 |
if ($this->isEmailAvailable($product)) {
|
243 |
+
$senderFieldset->addField('giftcard_sender_email', 'email', array(
|
244 |
+
'label' => Mage::helper('enterprise_giftcard')->__('Sender Email'),
|
245 |
+
'required' => 'true',
|
246 |
+
'value' => $this->getSenderEmail()
|
247 |
+
));
|
|
|
|
|
|
|
|
|
248 |
|
249 |
+
$recipientFieldset->addField('giftcard_recipient_email', 'email', array(
|
250 |
+
'label' => Mage::helper('enterprise_giftcard')->__('Recipient Email'),
|
251 |
+
'required' => 'true',
|
252 |
+
'value' => $this->getDefaultValue('giftcard_recipient_email')
|
253 |
+
));
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
|
256 |
if ($this->isMessageAvailable($product)) {
|
257 |
$messageMaxLength = (int) Mage::getStoreConfig(
|
258 |
Enterprise_GiftCard_Model_Giftcard::XML_PATH_MESSAGE_MAX_LENGTH
|
259 |
);
|
260 |
+
$recipientFieldset->addField('giftcard_message', 'textarea', array(
|
261 |
+
'label' => Mage::helper('enterprise_giftcard')->__('Message'),
|
262 |
+
'required' => 'false',
|
263 |
+
'max_length'=> $messageMaxLength,
|
264 |
+
'value' => $this->getDefaultValue('giftcard_message')
|
265 |
+
));
|
|
|
|
|
|
|
|
|
266 |
}
|
|
|
267 |
return $isObject ? $xmlModel : $xmlModel->asNiceXml();
|
268 |
}
|
269 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php
CHANGED
@@ -83,16 +83,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Options_Grouped extends Mage_XmlConn
|
|
83 |
|
84 |
if ($productPrice != 0) {
|
85 |
$productPrice = Mage::helper('xmlconnect')->formatPriceForXml($productPrice);
|
86 |
-
$optionNode->addAttribute(
|
87 |
-
'
|
88 |
-
|
89 |
-
|
90 |
-
)
|
91 |
-
);
|
92 |
-
$optionNode->addAttribute(
|
93 |
-
'formated_price',
|
94 |
-
$this->_formatPriceString($productPrice, $product)
|
95 |
-
);
|
96 |
}
|
97 |
}
|
98 |
|
83 |
|
84 |
if ($productPrice != 0) {
|
85 |
$productPrice = Mage::helper('xmlconnect')->formatPriceForXml($productPrice);
|
86 |
+
$optionNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml(
|
87 |
+
Mage::helper('core')->currency($productPrice, false, false)
|
88 |
+
));
|
89 |
+
$optionNode->addAttribute('formated_price', $this->_formatPriceString($productPrice, $product));
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
}
|
92 |
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Simple.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Options_Simple
|
35 |
-
extends Mage_XmlConnect_Block_Catalog_Product_Options
|
36 |
{
|
37 |
/**
|
38 |
* Generate simple product options xml
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Options_Simple extends Mage_XmlConnect_Block_Catalog_Product_Options
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Generate simple product options xml
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Virtual.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Options_Virtual
|
35 |
-
extends Mage_XmlConnect_Block_Catalog_Product_Options
|
36 |
{
|
37 |
/**
|
38 |
* Generate virtual product options xml
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Options_Virtual extends Mage_XmlConnect_Block_Catalog_Product_Options
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Generate virtual product options xml
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Bundle.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
35 |
-
extends Mage_Bundle_Block_Catalog_Product_Price
|
36 |
{
|
37 |
/**
|
38 |
* Collect product prices to specified item xml object
|
@@ -41,13 +40,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
42 |
*/
|
43 |
public function collectProductPrices(
|
44 |
-
Mage_Catalog_Model_Product $product,
|
45 |
-
|
46 |
-
|
47 |
-
{
|
48 |
-
$this->setProduct($product)
|
49 |
-
->setDisplayMinimalPrice(true)
|
50 |
-
->setUseLinkForAsLowAs(false);
|
51 |
|
52 |
$priceXmlObj = $item->addChild('price');
|
53 |
|
@@ -93,8 +88,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
93 |
if ($product->getPriceView()) {
|
94 |
if ($_taxHelper->displayBothPrices()) {
|
95 |
$priceXmlObj->addAttribute(
|
96 |
-
'as_low_as_excluding_tax',
|
97 |
-
$_coreHelper->currency($_minimalPriceTax, true, false)
|
98 |
);
|
99 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
100 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
@@ -118,13 +112,11 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
118 |
}
|
119 |
}
|
120 |
$priceXmlObj->addAttribute(
|
121 |
-
'as_low_as_including_tax',
|
122 |
-
$_coreHelper->currency($_minimalPriceInclTax, true, false)
|
123 |
);
|
124 |
} else {
|
125 |
$priceXmlObj->addAttribute(
|
126 |
-
'as_low_as',
|
127 |
-
$_coreHelper->currency($_minimalPriceTax, true, false)
|
128 |
);
|
129 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
130 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
@@ -142,13 +134,14 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
142 |
$weeeItemXmlObj->addAttribute(
|
143 |
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
144 |
);
|
145 |
-
$weeeItemXmlObj->addAttribute(
|
|
|
|
|
146 |
}
|
147 |
}
|
148 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
149 |
$priceXmlObj->addAttribute(
|
150 |
-
'as_low_as_including_tax',
|
151 |
-
$_coreHelper->currency($_minimalPriceInclTax, true, false)
|
152 |
);
|
153 |
}
|
154 |
}
|
@@ -159,8 +152,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
159 |
if ($_minimalPrice <> $_maximalPrice) {
|
160 |
if ($_taxHelper->displayBothPrices()) {
|
161 |
$priceXmlObj->addAttribute(
|
162 |
-
'from_excluding_tax',
|
163 |
-
$_coreHelper->currency($_minimalPriceTax, true, false)
|
164 |
);
|
165 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
166 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
@@ -178,18 +170,16 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
178 |
$weeeItemXmlObj->addAttribute(
|
179 |
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
180 |
);
|
181 |
-
$weeeItemXmlObj->addAttribute(
|
|
|
|
|
182 |
}
|
183 |
}
|
184 |
$priceXmlObj->addAttribute(
|
185 |
-
'from_including_tax',
|
186 |
-
$_coreHelper->currency($_minimalPriceInclTax, true, false)
|
187 |
);
|
188 |
} else {
|
189 |
-
$priceXmlObj->addAttribute(
|
190 |
-
'from',
|
191 |
-
$_coreHelper->currency($_minimalPriceTax, true, false)
|
192 |
-
);
|
193 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
194 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
195 |
) {
|
@@ -211,8 +201,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
211 |
}
|
212 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
213 |
$priceXmlObj->addAttribute(
|
214 |
-
'from_including_tax',
|
215 |
-
$_coreHelper->currency($_minimalPriceInclTax, true, false)
|
216 |
);
|
217 |
}
|
218 |
}
|
@@ -232,8 +221,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
232 |
|
233 |
if ($_taxHelper->displayBothPrices()) {
|
234 |
$priceXmlObj->addAttribute(
|
235 |
-
'to_excluding_tax',
|
236 |
-
$_coreHelper->currency($_maximalPriceTax, true, false)
|
237 |
);
|
238 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
239 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
@@ -251,14 +239,18 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
251 |
$weeeItemXmlObj->addAttribute(
|
252 |
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
253 |
);
|
254 |
-
$weeeItemXmlObj->addAttribute(
|
|
|
|
|
255 |
}
|
256 |
}
|
257 |
$priceXmlObj->addAttribute(
|
258 |
'to_including_tax', $_coreHelper->currency($_maximalPriceInclTax, true, false)
|
259 |
);
|
260 |
} else {
|
261 |
-
$priceXmlObj->addAttribute(
|
|
|
|
|
262 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
263 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
264 |
) {
|
@@ -273,19 +265,16 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
273 |
}
|
274 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
275 |
$weeeItemXmlObj->addAttribute(
|
276 |
-
'name',
|
277 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
278 |
);
|
279 |
$weeeItemXmlObj->addAttribute(
|
280 |
-
'amount',
|
281 |
-
$_coreHelper->currency($amount, true, false)
|
282 |
);
|
283 |
}
|
284 |
}
|
285 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
286 |
$priceXmlObj->addAttribute(
|
287 |
-
'to_including_tax',
|
288 |
-
$_coreHelper->currency($_maximalPriceInclTax, true, false)
|
289 |
);
|
290 |
}
|
291 |
}
|
@@ -295,8 +284,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
295 |
} else {
|
296 |
if ($_taxHelper->displayBothPrices()) {
|
297 |
$priceXmlObj->addAttribute(
|
298 |
-
'excluding_tax',
|
299 |
-
$_coreHelper->currency($_minimalPriceTax, true, false)
|
300 |
);
|
301 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
302 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
@@ -312,23 +300,19 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
312 |
}
|
313 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
314 |
$weeeItemXmlObj->addAttribute(
|
315 |
-
'name',
|
316 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
317 |
);
|
318 |
$weeeItemXmlObj->addAttribute(
|
319 |
-
'amount',
|
320 |
-
$_coreHelper->currency($amount, true, false)
|
321 |
);
|
322 |
}
|
323 |
}
|
324 |
$priceXmlObj->addAttribute(
|
325 |
-
'including_tax',
|
326 |
-
$_coreHelper->currency($_minimalPriceInclTax, true, false)
|
327 |
);
|
328 |
} else {
|
329 |
$priceXmlObj->addAttribute(
|
330 |
-
'regular',
|
331 |
-
$_coreHelper->currency($_minimalPriceTax, true, false)
|
332 |
);
|
333 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
334 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
@@ -344,19 +328,16 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle
|
|
344 |
}
|
345 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
346 |
$weeeItemXmlObj->addAttribute(
|
347 |
-
'name',
|
348 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
349 |
);
|
350 |
$weeeItemXmlObj->addAttribute(
|
351 |
-
'amount',
|
352 |
-
$_coreHelper->currency($amount, true, false)
|
353 |
);
|
354 |
}
|
355 |
}
|
356 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
357 |
$priceXmlObj->addAttribute(
|
358 |
-
'including_tax',
|
359 |
-
$_coreHelper->currency($_minimalPriceInclTax, true, false)
|
360 |
);
|
361 |
}
|
362 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Price_Bundle extends Mage_Bundle_Block_Catalog_Product_Price
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Collect product prices to specified item xml object
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
41 |
*/
|
42 |
public function collectProductPrices(
|
43 |
+
Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $item
|
44 |
+
) {
|
45 |
+
$this->setProduct($product)->setDisplayMinimalPrice(true) ->setUseLinkForAsLowAs(false);
|
|
|
|
|
|
|
|
|
46 |
|
47 |
$priceXmlObj = $item->addChild('price');
|
48 |
|
88 |
if ($product->getPriceView()) {
|
89 |
if ($_taxHelper->displayBothPrices()) {
|
90 |
$priceXmlObj->addAttribute(
|
91 |
+
'as_low_as_excluding_tax', $_coreHelper->currency($_minimalPriceTax, true, false)
|
|
|
92 |
);
|
93 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
94 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
112 |
}
|
113 |
}
|
114 |
$priceXmlObj->addAttribute(
|
115 |
+
'as_low_as_including_tax', $_coreHelper->currency($_minimalPriceInclTax, true, false)
|
|
|
116 |
);
|
117 |
} else {
|
118 |
$priceXmlObj->addAttribute(
|
119 |
+
'as_low_as', $_coreHelper->currency($_minimalPriceTax, true, false)
|
|
|
120 |
);
|
121 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
122 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
134 |
$weeeItemXmlObj->addAttribute(
|
135 |
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
136 |
);
|
137 |
+
$weeeItemXmlObj->addAttribute(
|
138 |
+
'amount', $_coreHelper->currency($amount, true, false)
|
139 |
+
);
|
140 |
}
|
141 |
}
|
142 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
143 |
$priceXmlObj->addAttribute(
|
144 |
+
'as_low_as_including_tax', $_coreHelper->currency($_minimalPriceInclTax, true, false)
|
|
|
145 |
);
|
146 |
}
|
147 |
}
|
152 |
if ($_minimalPrice <> $_maximalPrice) {
|
153 |
if ($_taxHelper->displayBothPrices()) {
|
154 |
$priceXmlObj->addAttribute(
|
155 |
+
'from_excluding_tax', $_coreHelper->currency($_minimalPriceTax, true, false)
|
|
|
156 |
);
|
157 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
158 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
170 |
$weeeItemXmlObj->addAttribute(
|
171 |
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
172 |
);
|
173 |
+
$weeeItemXmlObj->addAttribute(
|
174 |
+
'amount', $_coreHelper->currency($amount, true, false)
|
175 |
+
);
|
176 |
}
|
177 |
}
|
178 |
$priceXmlObj->addAttribute(
|
179 |
+
'from_including_tax', $_coreHelper->currency($_minimalPriceInclTax, true, false)
|
|
|
180 |
);
|
181 |
} else {
|
182 |
+
$priceXmlObj->addAttribute('from', $_coreHelper->currency($_minimalPriceTax, true, false));
|
|
|
|
|
|
|
183 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
184 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
185 |
) {
|
201 |
}
|
202 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
203 |
$priceXmlObj->addAttribute(
|
204 |
+
'from_including_tax', $_coreHelper->currency($_minimalPriceInclTax, true, false)
|
|
|
205 |
);
|
206 |
}
|
207 |
}
|
221 |
|
222 |
if ($_taxHelper->displayBothPrices()) {
|
223 |
$priceXmlObj->addAttribute(
|
224 |
+
'to_excluding_tax', $_coreHelper->currency($_maximalPriceTax, true, false)
|
|
|
225 |
);
|
226 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
227 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
239 |
$weeeItemXmlObj->addAttribute(
|
240 |
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
241 |
);
|
242 |
+
$weeeItemXmlObj->addAttribute(
|
243 |
+
'amount', $_coreHelper->currency($amount, true, false)
|
244 |
+
);
|
245 |
}
|
246 |
}
|
247 |
$priceXmlObj->addAttribute(
|
248 |
'to_including_tax', $_coreHelper->currency($_maximalPriceInclTax, true, false)
|
249 |
);
|
250 |
} else {
|
251 |
+
$priceXmlObj->addAttribute(
|
252 |
+
'to', $_coreHelper->currency($_maximalPriceTax, true, false)
|
253 |
+
);
|
254 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
255 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
256 |
) {
|
265 |
}
|
266 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
267 |
$weeeItemXmlObj->addAttribute(
|
268 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
269 |
);
|
270 |
$weeeItemXmlObj->addAttribute(
|
271 |
+
'amount', $_coreHelper->currency($amount, true, false)
|
|
|
272 |
);
|
273 |
}
|
274 |
}
|
275 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
276 |
$priceXmlObj->addAttribute(
|
277 |
+
'to_including_tax', $_coreHelper->currency($_maximalPriceInclTax, true, false)
|
|
|
278 |
);
|
279 |
}
|
280 |
}
|
284 |
} else {
|
285 |
if ($_taxHelper->displayBothPrices()) {
|
286 |
$priceXmlObj->addAttribute(
|
287 |
+
'excluding_tax', $_coreHelper->currency($_minimalPriceTax, true, false)
|
|
|
288 |
);
|
289 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
290 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
300 |
}
|
301 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
302 |
$weeeItemXmlObj->addAttribute(
|
303 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
304 |
);
|
305 |
$weeeItemXmlObj->addAttribute(
|
306 |
+
'amount', $_coreHelper->currency($amount, true, false)
|
|
|
307 |
);
|
308 |
}
|
309 |
}
|
310 |
$priceXmlObj->addAttribute(
|
311 |
+
'including_tax', $_coreHelper->currency($_minimalPriceInclTax, true, false)
|
|
|
312 |
);
|
313 |
} else {
|
314 |
$priceXmlObj->addAttribute(
|
315 |
+
'regular', $_coreHelper->currency($_minimalPriceTax, true, false)
|
|
|
316 |
);
|
317 |
if ($_weeeTaxAmount && $product->getPriceType() == 1
|
318 |
&& $_weeeHelper->typeOfDisplay($product, array(2, 1, 4))
|
328 |
}
|
329 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
330 |
$weeeItemXmlObj->addAttribute(
|
331 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
332 |
);
|
333 |
$weeeItemXmlObj->addAttribute(
|
334 |
+
'amount', $_coreHelper->currency($amount, true, false)
|
|
|
335 |
);
|
336 |
}
|
337 |
}
|
338 |
if ($_weeeHelper->typeOfDisplay($product, 2) && $_weeeTaxAmount) {
|
339 |
$priceXmlObj->addAttribute(
|
340 |
+
'including_tax', $_coreHelper->currency($_minimalPriceInclTax, true, false)
|
|
|
341 |
);
|
342 |
}
|
343 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Default.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
35 |
-
extends Mage_Catalog_Block_Product_Price
|
36 |
{
|
37 |
/**
|
38 |
* Collect product prices to specified item xml object
|
@@ -41,13 +40,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
42 |
*/
|
43 |
public function collectProductPrices(
|
44 |
-
Mage_Catalog_Model_Product $product,
|
45 |
-
|
46 |
-
|
47 |
-
{
|
48 |
-
$this->setProduct($product)
|
49 |
-
->setDisplayMinimalPrice(true)
|
50 |
-
->setUseLinkForAsLowAs(false);
|
51 |
|
52 |
$priceXmlObj = $item->addChild('price');
|
53 |
$_tierPrices = $this->_getTierPrices($product);
|
@@ -86,24 +81,20 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
86 |
*/
|
87 |
if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
|
88 |
$priceXmlObj->addAttribute(
|
89 |
-
'excluding_tax',
|
90 |
-
$_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
91 |
);
|
92 |
$priceXmlObj->addAttribute(
|
93 |
-
'including_tax',
|
94 |
-
$_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
|
95 |
);
|
96 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
|
97 |
/**
|
98 |
* Including + Weee
|
99 |
*/
|
100 |
$priceXmlObj->addAttribute(
|
101 |
-
'excluding_tax',
|
102 |
-
$_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
103 |
);
|
104 |
$priceXmlObj->addAttribute(
|
105 |
-
'including_tax',
|
106 |
-
$_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
|
107 |
);
|
108 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
109 |
$_weeeSeparator = ' + ';
|
@@ -111,12 +102,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
111 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
112 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
113 |
$weeeItemXmlObj->addAttribute(
|
114 |
-
'name',
|
115 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
116 |
);
|
117 |
$weeeItemXmlObj->addAttribute(
|
118 |
-
'amount',
|
119 |
-
$_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
120 |
);
|
121 |
}
|
122 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
|
@@ -124,12 +113,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
124 |
* Including + Weee
|
125 |
*/
|
126 |
$priceXmlObj->addAttribute(
|
127 |
-
'excluding_tax',
|
128 |
-
$_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
129 |
);
|
130 |
$priceXmlObj->addAttribute(
|
131 |
-
'including_tax',
|
132 |
-
$_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
|
133 |
);
|
134 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
135 |
$_weeeSeparator = ' + ';
|
@@ -137,54 +124,34 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
137 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
138 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
139 |
$weeeItemXmlObj->addAttribute(
|
140 |
-
'name',
|
141 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
142 |
-
);
|
143 |
-
$weeeItemXmlObj->addAttribute(
|
144 |
-
'amount',
|
145 |
-
$_coreHelper->currency(
|
146 |
-
$_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(),
|
147 |
-
true,
|
148 |
-
false
|
149 |
-
)
|
150 |
);
|
|
|
|
|
|
|
151 |
}
|
152 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
|
153 |
/**
|
154 |
* Excluding + Weee + Final
|
155 |
*/
|
156 |
-
$priceXmlObj->addAttribute(
|
157 |
-
'excluding_tax',
|
158 |
-
$_coreHelper->currency($_price, true, false)
|
159 |
-
);
|
160 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
161 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
162 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
163 |
$weeeItemXmlObj->addAttribute(
|
164 |
-
'name',
|
165 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
166 |
);
|
167 |
$weeeItemXmlObj->addAttribute(
|
168 |
-
'amount',
|
169 |
-
$_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
170 |
);
|
171 |
}
|
172 |
-
$priceXmlObj->addAttribute(
|
173 |
-
|
174 |
-
|
175 |
-
$_finalPriceInclTax + $_weeeTaxAmount,
|
176 |
-
true,
|
177 |
-
false
|
178 |
-
)
|
179 |
-
);
|
180 |
} else {
|
|
|
181 |
$priceXmlObj->addAttribute(
|
182 |
-
'
|
183 |
-
$_coreHelper->currency($_price, true, false)
|
184 |
-
);
|
185 |
-
$priceXmlObj->addAttribute(
|
186 |
-
'including_tax',
|
187 |
-
$_coreHelper->currency($_finalPriceInclTax, true, false)
|
188 |
);
|
189 |
}
|
190 |
/**
|
@@ -195,100 +162,69 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
195 |
* Including
|
196 |
*/
|
197 |
if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
|
198 |
-
$priceXmlObj->addAttribute(
|
199 |
-
|
200 |
-
|
201 |
-
$_price + $_weeeTaxAmount,
|
202 |
-
true,
|
203 |
-
false
|
204 |
-
)
|
205 |
-
);
|
206 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
|
207 |
/**
|
208 |
* Including + Weee
|
209 |
*/
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
$_coreHelper->currency(
|
214 |
-
$_price + $_weeeTaxAmount,
|
215 |
-
true,
|
216 |
-
false
|
217 |
-
)
|
218 |
-
);
|
219 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
220 |
$_weeeSeparator = ' + ';
|
221 |
$weeeXmlObj->addAttribute('separator', $_weeeSeparator);
|
222 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
223 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
224 |
$weeeItemXmlObj->addAttribute(
|
225 |
-
'name',
|
226 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
227 |
);
|
228 |
$weeeItemXmlObj->addAttribute(
|
229 |
-
'amount',
|
230 |
-
$_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
231 |
);
|
232 |
}
|
233 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
|
234 |
/**
|
235 |
* Including + Weee
|
236 |
*/
|
237 |
-
$priceXmlObj->addAttribute(
|
238 |
-
|
239 |
-
|
240 |
-
$_price + $_weeeTaxAmount,
|
241 |
-
true,
|
242 |
-
false
|
243 |
-
)
|
244 |
-
);
|
245 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
246 |
$_weeeSeparator = ' + ';
|
247 |
$weeeXmlObj->addAttribute('separator', $_weeeSeparator);
|
248 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
249 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
250 |
$weeeItemXmlObj->addAttribute(
|
251 |
-
'name',
|
252 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
253 |
-
);
|
254 |
-
$weeeItemXmlObj->addAttribute(
|
255 |
-
'amount',
|
256 |
-
$_coreHelper->currency(
|
257 |
-
$_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(),
|
258 |
-
true,
|
259 |
-
false
|
260 |
-
)
|
261 |
);
|
|
|
|
|
|
|
262 |
}
|
263 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
|
264 |
/**
|
265 |
* Excluding + Weee + Final
|
266 |
*/
|
267 |
$priceXmlObj->addAttribute(
|
268 |
-
'regular',
|
269 |
-
$_coreHelper->currency($_price, true, false)
|
270 |
);
|
271 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
272 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
273 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
274 |
$weeeItemXmlObj->addAttribute(
|
275 |
-
'name',
|
276 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
277 |
);
|
278 |
$weeeItemXmlObj->addAttribute(
|
279 |
-
'amount',
|
280 |
-
$_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
281 |
);
|
282 |
}
|
283 |
$priceXmlObj->addAttribute(
|
284 |
-
'including_tax',
|
285 |
-
$_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
286 |
);
|
287 |
} else {
|
288 |
-
$priceXmlObj->addAttribute(
|
289 |
-
'regular',
|
290 |
-
$_coreHelper->currency($_price, true, false)
|
291 |
-
);
|
292 |
}
|
293 |
}
|
294 |
/**
|
@@ -300,190 +236,107 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
300 |
* Including
|
301 |
*/
|
302 |
if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
|
303 |
-
$priceXmlObj->addAttribute(
|
304 |
-
|
305 |
-
|
306 |
-
$_regularPrice + $_originalWeeeTaxAmount,
|
307 |
-
true,
|
308 |
-
false
|
309 |
-
)
|
310 |
-
);
|
311 |
if ($_taxHelper->displayBothPrices()) {
|
312 |
-
$priceXmlObj->addAttribute(
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
)
|
319 |
-
);
|
320 |
-
$priceXmlObj->addAttribute(
|
321 |
-
'special_including_tax',
|
322 |
-
$_coreHelper->currency(
|
323 |
-
$_finalPriceInclTax + $_weeeTaxAmount,
|
324 |
-
true,
|
325 |
-
false
|
326 |
-
)
|
327 |
-
);
|
328 |
} else {
|
329 |
-
$priceXmlObj->addAttribute(
|
330 |
-
|
331 |
-
|
332 |
-
$_finalPrice + $_weeeTaxAmount,
|
333 |
-
true,
|
334 |
-
false
|
335 |
-
)
|
336 |
-
);
|
337 |
}
|
338 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
|
339 |
/**
|
340 |
* Including + Weee
|
341 |
*/
|
342 |
-
$priceXmlObj->addAttribute(
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
)
|
349 |
-
);
|
350 |
-
$priceXmlObj->addAttribute(
|
351 |
-
'special_excluding_tax',
|
352 |
-
$_coreHelper->currency(
|
353 |
-
$_finalPrice + $_weeeTaxAmount,
|
354 |
-
true,
|
355 |
-
false
|
356 |
-
)
|
357 |
-
);
|
358 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
359 |
$_weeeSeparator = ' + ';
|
360 |
$weeeXmlObj->addAttribute('separator', $_weeeSeparator);
|
361 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
362 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
363 |
$weeeItemXmlObj->addAttribute(
|
364 |
-
'name',
|
365 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
366 |
-
);
|
367 |
-
$weeeItemXmlObj->addAttribute(
|
368 |
-
'amount',
|
369 |
-
$_coreHelper->currency(
|
370 |
-
$_weeeTaxAttribute->getAmount(),
|
371 |
-
true,
|
372 |
-
false
|
373 |
-
)
|
374 |
);
|
|
|
|
|
|
|
375 |
}
|
376 |
-
$priceXmlObj->addAttribute(
|
377 |
-
|
378 |
-
|
379 |
-
$_finalPriceInclTax + $_weeeTaxAmount,
|
380 |
-
true,
|
381 |
-
false
|
382 |
-
)
|
383 |
-
);
|
384 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
|
385 |
/**
|
386 |
* Including + Weee
|
387 |
*/
|
388 |
-
$priceXmlObj->addAttribute(
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
)
|
395 |
-
);
|
396 |
-
$priceXmlObj->addAttribute(
|
397 |
-
'special_excluding_tax',
|
398 |
-
$_coreHelper->currency(
|
399 |
-
$_finalPrice + $_weeeTaxAmount,
|
400 |
-
true,
|
401 |
-
false
|
402 |
-
)
|
403 |
-
);
|
404 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
405 |
$_weeeSeparator = ' + ';
|
406 |
$weeeXmlObj->addAttribute('separator', $_weeeSeparator);
|
407 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
408 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
409 |
$weeeItemXmlObj->addAttribute(
|
410 |
-
'name',
|
411 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
412 |
-
);
|
413 |
-
$weeeItemXmlObj->addAttribute(
|
414 |
-
'amount',
|
415 |
-
$_coreHelper->currency(
|
416 |
-
$_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(),
|
417 |
-
true,
|
418 |
-
false
|
419 |
-
)
|
420 |
);
|
|
|
|
|
|
|
421 |
}
|
422 |
-
$priceXmlObj->addAttribute(
|
423 |
-
|
424 |
-
|
425 |
-
$_finalPriceInclTax + $_weeeTaxAmount,
|
426 |
-
true,
|
427 |
-
false
|
428 |
-
)
|
429 |
-
);
|
430 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
|
431 |
/**
|
432 |
* Excluding + Weee + Final
|
433 |
*/
|
|
|
434 |
$priceXmlObj->addAttribute(
|
435 |
-
'
|
436 |
-
$_coreHelper->currency($_regularPrice, true, false)
|
437 |
-
);
|
438 |
-
$priceXmlObj->addAttribute(
|
439 |
-
'special_excluding_tax',
|
440 |
-
$_coreHelper->currency($_finalPrice, true, false)
|
441 |
);
|
442 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
443 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
444 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
445 |
$weeeItemXmlObj->addAttribute(
|
446 |
-
'name',
|
447 |
-
$weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
448 |
-
);
|
449 |
-
$weeeItemXmlObj->addAttribute(
|
450 |
-
'amount',
|
451 |
-
$_coreHelper->currency(
|
452 |
-
$_weeeTaxAttribute->getAmount(),
|
453 |
-
true,
|
454 |
-
false
|
455 |
-
)
|
456 |
);
|
|
|
|
|
|
|
457 |
}
|
458 |
-
$priceXmlObj->addAttribute(
|
459 |
-
|
460 |
-
|
461 |
-
$_finalPriceInclTax + $_weeeTaxAmount,
|
462 |
-
true,
|
463 |
-
false
|
464 |
-
)
|
465 |
-
);
|
466 |
} else {
|
467 |
/**
|
468 |
* Excluding
|
469 |
*/
|
470 |
-
$priceXmlObj->addAttribute(
|
471 |
-
'regular',
|
472 |
-
$_coreHelper->currency($_regularPrice, true, false)
|
473 |
-
);
|
474 |
if ($_taxHelper->displayBothPrices()) {
|
475 |
$priceXmlObj->addAttribute(
|
476 |
-
'special_excluding_tax',
|
477 |
-
$_coreHelper->currency($_finalPrice, true, false)
|
478 |
);
|
479 |
$priceXmlObj->addAttribute(
|
480 |
-
'special_including_tax',
|
481 |
-
$_coreHelper->currency($_finalPriceInclTax, true, false)
|
482 |
);
|
483 |
} else {
|
484 |
$priceXmlObj->addAttribute(
|
485 |
-
'special',
|
486 |
-
$_coreHelper->currency($_finalPrice, true, false)
|
487 |
);
|
488 |
}
|
489 |
}
|
@@ -500,14 +353,9 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
500 |
}
|
501 |
|
502 |
if (!$this->getUseLinkForAsLowAs()) {
|
503 |
-
$priceXmlObj->addAttribute(
|
504 |
-
|
505 |
-
|
506 |
-
$_minimalPriceDisplayValue,
|
507 |
-
true,
|
508 |
-
false
|
509 |
-
)
|
510 |
-
);
|
511 |
}
|
512 |
}
|
513 |
/**
|
@@ -519,35 +367,18 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
519 |
|
520 |
if ($this->getDisplayMinimalPrice() && $_minimalPriceValue) {
|
521 |
if ($_taxHelper->displayBothPrices()) {
|
522 |
-
$priceXmlObj->addAttribute(
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
)
|
529 |
-
);
|
530 |
-
$priceXmlObj->addAttribute(
|
531 |
-
'starting_at_including_tax',
|
532 |
-
$_coreHelper->currency(
|
533 |
-
$_inclTax,
|
534 |
-
true,
|
535 |
-
false
|
536 |
-
)
|
537 |
-
);
|
538 |
} else {
|
539 |
$_showPrice = $_inclTax;
|
540 |
if (!$_taxHelper->displayPriceIncludingTax()) {
|
541 |
$_showPrice = $_exclTax;
|
542 |
}
|
543 |
-
$priceXmlObj->addAttribute(
|
544 |
-
'starting_at',
|
545 |
-
$_coreHelper->currency(
|
546 |
-
$_showPrice,
|
547 |
-
true,
|
548 |
-
false
|
549 |
-
)
|
550 |
-
);
|
551 |
}
|
552 |
}
|
553 |
}
|
@@ -575,20 +406,13 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
575 |
$price['savePercent'] = ceil(100 - ((100 / $product->getFinalPrice()) * $price['price']));
|
576 |
$price['formated_price'] = Mage::app()->getStore()->formatPrice(
|
577 |
Mage::app()->getStore()->convertPrice(
|
578 |
-
Mage::helper('tax')->getPrice(
|
579 |
-
$product,
|
580 |
-
$price['website_price']
|
581 |
-
)
|
582 |
),
|
583 |
false
|
584 |
);
|
585 |
$price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
|
586 |
Mage::app()->getStore()->convertPrice(
|
587 |
-
Mage::helper('tax')->getPrice(
|
588 |
-
$product,
|
589 |
-
$price['website_price'],
|
590 |
-
true
|
591 |
-
)
|
592 |
),
|
593 |
false
|
594 |
);
|
@@ -599,20 +423,13 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
599 |
$price['savePercent'] = ceil(100 - ((100 / $product->getPrice()) * $price['price']));
|
600 |
$price['formated_price'] = Mage::app()->getStore()->formatPrice(
|
601 |
Mage::app()->getStore()->convertPrice(
|
602 |
-
Mage::helper('tax')->getPrice(
|
603 |
-
$product,
|
604 |
-
$price['website_price']
|
605 |
-
)
|
606 |
),
|
607 |
false
|
608 |
);
|
609 |
$price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
|
610 |
Mage::app()->getStore()->convertPrice(
|
611 |
-
Mage::helper('tax')->getPrice(
|
612 |
-
$product,
|
613 |
-
$price['website_price'],
|
614 |
-
true
|
615 |
-
)
|
616 |
),
|
617 |
false
|
618 |
);
|
@@ -621,7 +438,6 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
621 |
}
|
622 |
}
|
623 |
}
|
624 |
-
|
625 |
return $res;
|
626 |
}
|
627 |
|
@@ -635,7 +451,6 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
635 |
*/
|
636 |
protected function _getTierPricesTextArray($_tierPrices, $_product)
|
637 |
{
|
638 |
-
|
639 |
$pricesArray = array();
|
640 |
if (Mage::helper('weee')->typeOfDisplay($_product, array(1, 2, 4))) {
|
641 |
$_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
|
@@ -654,13 +469,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
654 |
} else if (Mage::helper('weee')->typeOfDisplay($_product, 1)) {
|
655 |
$s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
|
656 |
if ($_weeeTaxAttributes) {
|
657 |
-
$s .= '(';
|
658 |
-
$s .= $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']);
|
659 |
$separator = ' + ';
|
660 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
661 |
-
$s .= $separator;
|
662 |
-
$s .= $_attribute->getName();
|
663 |
-
$s .= ': ';
|
664 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
665 |
}
|
666 |
$s .= ')';
|
@@ -669,13 +481,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
669 |
} else if (Mage::helper('weee')->typeOfDisplay($_product, 4)) {
|
670 |
$s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
|
671 |
if ($_weeeTaxAttributes) {
|
672 |
-
$s .= '(';
|
673 |
-
$s .= $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']);
|
674 |
$separator = ' + ';
|
675 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
676 |
-
$s .= $separator;
|
677 |
-
$s .= $_attribute->getName();
|
678 |
-
$s .= ': ';
|
679 |
$s .= Mage::helper('core')->currency(
|
680 |
$_attribute->getAmount() + $_attribute->getTaxAmount()
|
681 |
);
|
@@ -688,12 +497,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
688 |
if ($_weeeTaxAttributes) {
|
689 |
$s .= '(';
|
690 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
691 |
-
$s .= $_attribute->getName();
|
692 |
-
$s .= ': ';
|
693 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
694 |
}
|
695 |
-
$s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']);
|
696 |
-
$s .= ')';
|
697 |
}
|
698 |
$s .= $this->__('each');
|
699 |
} else {
|
@@ -709,9 +516,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
709 |
$s .= '(';
|
710 |
$separator = '';
|
711 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
712 |
-
$s .= $separator;
|
713 |
-
$s .= $_attribute->getName();
|
714 |
-
$s .= ': ';
|
715 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
716 |
$separator = ' + ';
|
717 |
}
|
@@ -724,9 +529,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
724 |
$s .= '(';
|
725 |
$separator = '';
|
726 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
727 |
-
$s .= $separator;
|
728 |
-
$s .= $_attribute->getName();
|
729 |
-
$s .= ': ';
|
730 |
$s .= Mage::helper('core')->currency(
|
731 |
$_attribute->getAmount() + $_attribute->getTaxAmount()
|
732 |
);
|
@@ -740,12 +543,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
740 |
if ($_weeeTaxAttributes) {
|
741 |
$s .= '(';
|
742 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
743 |
-
$s .= $_attribute->getName();
|
744 |
-
$s .= ': ';
|
745 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
746 |
}
|
747 |
-
$s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']);
|
748 |
-
$s .= ')';
|
749 |
}
|
750 |
$s .= $this->__('each');
|
751 |
} else {
|
@@ -760,9 +561,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
760 |
$s .= '(';
|
761 |
$separator = '';
|
762 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
763 |
-
$s .= $separator;
|
764 |
-
$s .= $_attribute->getName();
|
765 |
-
$s .= ': ';
|
766 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
767 |
$separator = ' + ';
|
768 |
}
|
@@ -775,9 +574,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
775 |
$s .= '(';
|
776 |
$separator = '';
|
777 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
778 |
-
$s .= $separator;
|
779 |
-
$s .= $_attribute->getName();
|
780 |
-
$s .= ': ';
|
781 |
$s .= Mage::helper('core')->currency(
|
782 |
$_attribute->getAmount() + $_attribute->getTaxAmount()
|
783 |
);
|
@@ -791,12 +588,10 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
791 |
if ($_weeeTaxAttributes) {
|
792 |
$s .= '(';
|
793 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
794 |
-
$s .= $_attribute->getName();
|
795 |
-
$s .= ': ';
|
796 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
797 |
}
|
798 |
-
$s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee_only']);
|
799 |
-
$s .= ')';
|
800 |
}
|
801 |
$s .= $this->__('each');
|
802 |
} else {
|
@@ -812,13 +607,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Default
|
|
812 |
&& $_product->getFinalPrice() > $_price['price']);
|
813 |
|
814 |
if ($condition1 || $condition2) {
|
815 |
-
$s .= ' ';
|
816 |
-
$s .= $this->__('and');
|
817 |
-
$s .= ' ';
|
818 |
-
$s .= $this->__('save');
|
819 |
-
$s .= ' ';
|
820 |
-
$s .= $_price['savePercent'];
|
821 |
-
$s .= '%';
|
822 |
}
|
823 |
}
|
824 |
$pricesArray[] = $s;
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Price_Default extends Mage_Catalog_Block_Product_Price
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Collect product prices to specified item xml object
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $item
|
41 |
*/
|
42 |
public function collectProductPrices(
|
43 |
+
Mage_Catalog_Model_Product $product, 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);
|
81 |
*/
|
82 |
if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
|
83 |
$priceXmlObj->addAttribute(
|
84 |
+
'excluding_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
|
|
85 |
);
|
86 |
$priceXmlObj->addAttribute(
|
87 |
+
'including_tax', $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
|
|
|
88 |
);
|
89 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
|
90 |
/**
|
91 |
* Including + Weee
|
92 |
*/
|
93 |
$priceXmlObj->addAttribute(
|
94 |
+
'excluding_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
|
|
95 |
);
|
96 |
$priceXmlObj->addAttribute(
|
97 |
+
'including_tax', $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
|
|
|
98 |
);
|
99 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
100 |
$_weeeSeparator = ' + ';
|
102 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
103 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
104 |
$weeeItemXmlObj->addAttribute(
|
105 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
106 |
);
|
107 |
$weeeItemXmlObj->addAttribute(
|
108 |
+
'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
|
|
109 |
);
|
110 |
}
|
111 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
|
113 |
* Including + Weee
|
114 |
*/
|
115 |
$priceXmlObj->addAttribute(
|
116 |
+
'excluding_tax', $_coreHelper->currency($_price + $_weeeTaxAmount, true, false)
|
|
|
117 |
);
|
118 |
$priceXmlObj->addAttribute(
|
119 |
+
'including_tax', $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmount, true, false)
|
|
|
120 |
);
|
121 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
122 |
$_weeeSeparator = ' + ';
|
124 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
125 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
126 |
$weeeItemXmlObj->addAttribute(
|
127 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
);
|
129 |
+
$weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
|
130 |
+
$_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, false
|
131 |
+
));
|
132 |
}
|
133 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
|
134 |
/**
|
135 |
* Excluding + Weee + Final
|
136 |
*/
|
137 |
+
$priceXmlObj->addAttribute('excluding_tax', $_coreHelper->currency($_price, true, false));
|
|
|
|
|
|
|
138 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
139 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
140 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
141 |
$weeeItemXmlObj->addAttribute(
|
142 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
143 |
);
|
144 |
$weeeItemXmlObj->addAttribute(
|
145 |
+
'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
|
|
146 |
);
|
147 |
}
|
148 |
+
$priceXmlObj->addAttribute('including_tax', $_coreHelper->currency(
|
149 |
+
$_finalPriceInclTax + $_weeeTaxAmount, true, false
|
150 |
+
));
|
|
|
|
|
|
|
|
|
|
|
151 |
} else {
|
152 |
+
$priceXmlObj->addAttribute('excluding_tax', $_coreHelper->currency($_price, true, false));
|
153 |
$priceXmlObj->addAttribute(
|
154 |
+
'including_tax', $_coreHelper->currency($_finalPriceInclTax, true, false)
|
|
|
|
|
|
|
|
|
|
|
155 |
);
|
156 |
}
|
157 |
/**
|
162 |
* Including
|
163 |
*/
|
164 |
if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 0)) {
|
165 |
+
$priceXmlObj->addAttribute('regular', $_coreHelper->currency(
|
166 |
+
$_price + $_weeeTaxAmount, true, false
|
167 |
+
));
|
|
|
|
|
|
|
|
|
|
|
168 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 1)) {
|
169 |
/**
|
170 |
* Including + Weee
|
171 |
*/
|
172 |
+
$priceXmlObj->addAttribute('regular', $_coreHelper->currency(
|
173 |
+
$_price + $_weeeTaxAmount, true, false
|
174 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
176 |
$_weeeSeparator = ' + ';
|
177 |
$weeeXmlObj->addAttribute('separator', $_weeeSeparator);
|
178 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
179 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
180 |
$weeeItemXmlObj->addAttribute(
|
181 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
182 |
);
|
183 |
$weeeItemXmlObj->addAttribute(
|
184 |
+
'amount', $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, false)
|
|
|
185 |
);
|
186 |
}
|
187 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 4)) {
|
188 |
/**
|
189 |
* Including + Weee
|
190 |
*/
|
191 |
+
$priceXmlObj->addAttribute('regular', $_coreHelper->currency(
|
192 |
+
$_price + $_weeeTaxAmount, true, false
|
193 |
+
));
|
|
|
|
|
|
|
|
|
|
|
194 |
$weeeXmlObj = $priceXmlObj->addChild('weee');
|
195 |
$_weeeSeparator = ' + ';
|
196 |
$weeeXmlObj->addAttribute('separator', $_weeeSeparator);
|
197 |
foreach ($_weeeTaxAttributes as $_weeeTaxAttribute) {
|
198 |
$weeeItemXmlObj = $weeeXmlObj->addChild('item');
|
199 |
$weeeItemXmlObj->addAttribute(
|
200 |
+
'name', $weeeItemXmlObj->escapeXml($_weeeTaxAttribute->getName())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
);
|
202 |
+
$weeeItemXmlObj->addAttribute('amount', $_coreHelper->currency(
|
203 |
+
$_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, false
|
204 |
+
));
|
205 |
}
|
206 |
} elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($product, 2)) {
|
207 |
/**
|
208 |
* Excluding + Weee + Final
|
209 |
*/
|
210 |
$priceXmlObj->addAttribute(
|
211 |
+
'regular', $_coreHelper->currency($_price, true, false)
|
|
|
212 |
);
|
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 |
/**
|
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 |
}
|
353 |
}
|
354 |
|
355 |
if (!$this->getUseLinkForAsLowAs()) {
|
356 |
+
$priceXmlObj->addAttribute('as_low_as', $_coreHelper->currency(
|
357 |
+
$_minimalPriceDisplayValue, true, false
|
358 |
+
));
|
|
|
|
|
|
|
|
|
|
|
359 |
}
|
360 |
}
|
361 |
/**
|
367 |
|
368 |
if ($this->getDisplayMinimalPrice() && $_minimalPriceValue) {
|
369 |
if ($_taxHelper->displayBothPrices()) {
|
370 |
+
$priceXmlObj->addAttribute('starting_at_excluding_tax', $_coreHelper->currency(
|
371 |
+
$_exclTax, true, false
|
372 |
+
));
|
373 |
+
$priceXmlObj->addAttribute('starting_at_including_tax', $_coreHelper->currency(
|
374 |
+
$_inclTax, true, false
|
375 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
} else {
|
377 |
$_showPrice = $_inclTax;
|
378 |
if (!$_taxHelper->displayPriceIncludingTax()) {
|
379 |
$_showPrice = $_exclTax;
|
380 |
}
|
381 |
+
$priceXmlObj->addAttribute('starting_at', $_coreHelper->currency($_showPrice, true, false));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
}
|
383 |
}
|
384 |
}
|
406 |
$price['savePercent'] = ceil(100 - ((100 / $product->getFinalPrice()) * $price['price']));
|
407 |
$price['formated_price'] = Mage::app()->getStore()->formatPrice(
|
408 |
Mage::app()->getStore()->convertPrice(
|
409 |
+
Mage::helper('tax')->getPrice($product, $price['website_price'])
|
|
|
|
|
|
|
410 |
),
|
411 |
false
|
412 |
);
|
413 |
$price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
|
414 |
Mage::app()->getStore()->convertPrice(
|
415 |
+
Mage::helper('tax')->getPrice($product, $price['website_price'], true)
|
|
|
|
|
|
|
|
|
416 |
),
|
417 |
false
|
418 |
);
|
423 |
$price['savePercent'] = ceil(100 - ((100 / $product->getPrice()) * $price['price']));
|
424 |
$price['formated_price'] = Mage::app()->getStore()->formatPrice(
|
425 |
Mage::app()->getStore()->convertPrice(
|
426 |
+
Mage::helper('tax')->getPrice($product, $price['website_price'])
|
|
|
|
|
|
|
427 |
),
|
428 |
false
|
429 |
);
|
430 |
$price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(
|
431 |
Mage::app()->getStore()->convertPrice(
|
432 |
+
Mage::helper('tax')->getPrice($product, $price['website_price'], true)
|
|
|
|
|
|
|
|
|
433 |
),
|
434 |
false
|
435 |
);
|
438 |
}
|
439 |
}
|
440 |
}
|
|
|
441 |
return $res;
|
442 |
}
|
443 |
|
451 |
*/
|
452 |
protected function _getTierPricesTextArray($_tierPrices, $_product)
|
453 |
{
|
|
|
454 |
$pricesArray = array();
|
455 |
if (Mage::helper('weee')->typeOfDisplay($_product, array(1, 2, 4))) {
|
456 |
$_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
|
469 |
} else if (Mage::helper('weee')->typeOfDisplay($_product, 1)) {
|
470 |
$s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
|
471 |
if ($_weeeTaxAttributes) {
|
472 |
+
$s .= '(' . $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']);
|
|
|
473 |
$separator = ' + ';
|
474 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
475 |
+
$s .= $separator . $_attribute->getName() . ': ';
|
|
|
|
|
476 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
477 |
}
|
478 |
$s .= ')';
|
481 |
} else if (Mage::helper('weee')->typeOfDisplay($_product, 4)) {
|
482 |
$s .= $this->__('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']);
|
483 |
if ($_weeeTaxAttributes) {
|
484 |
+
$s .= '(' . $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']);
|
|
|
485 |
$separator = ' + ';
|
486 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
487 |
+
$s .= $separator . $_attribute->getName() . ': ';
|
|
|
|
|
488 |
$s .= Mage::helper('core')->currency(
|
489 |
$_attribute->getAmount() + $_attribute->getTaxAmount()
|
490 |
);
|
497 |
if ($_weeeTaxAttributes) {
|
498 |
$s .= '(';
|
499 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
500 |
+
$s .= $_attribute->getName() . ': ';
|
|
|
501 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
502 |
}
|
503 |
+
$s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']) . ')';
|
|
|
504 |
}
|
505 |
$s .= $this->__('each');
|
506 |
} else {
|
516 |
$s .= '(';
|
517 |
$separator = '';
|
518 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
519 |
+
$s .= $separator . $_attribute->getName() . ': ';
|
|
|
|
|
520 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
521 |
$separator = ' + ';
|
522 |
}
|
529 |
$s .= '(';
|
530 |
$separator = '';
|
531 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
532 |
+
$s .= $separator . $_attribute->getName() . ': ';
|
|
|
|
|
533 |
$s .= Mage::helper('core')->currency(
|
534 |
$_attribute->getAmount() + $_attribute->getTaxAmount()
|
535 |
);
|
543 |
if ($_weeeTaxAttributes) {
|
544 |
$s .= '(';
|
545 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
546 |
+
$s .= $_attribute->getName() . ': ';
|
|
|
547 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
548 |
}
|
549 |
+
$s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']) . ')';
|
|
|
550 |
}
|
551 |
$s .= $this->__('each');
|
552 |
} else {
|
561 |
$s .= '(';
|
562 |
$separator = '';
|
563 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
564 |
+
$s .= $separator . $_attribute->getName() . ': ';
|
|
|
|
|
565 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
566 |
$separator = ' + ';
|
567 |
}
|
574 |
$s .= '(';
|
575 |
$separator = '';
|
576 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
577 |
+
$s .= $separator . $_attribute->getName() . ': ';
|
|
|
|
|
578 |
$s .= Mage::helper('core')->currency(
|
579 |
$_attribute->getAmount() + $_attribute->getTaxAmount()
|
580 |
);
|
588 |
if ($_weeeTaxAttributes) {
|
589 |
$s .= '(';
|
590 |
foreach ($_weeeTaxAttributes as $_attribute) {
|
591 |
+
$s .= $_attribute->getName() . ': ';
|
|
|
592 |
$s .= Mage::helper('core')->currency($_attribute->getAmount());
|
593 |
}
|
594 |
+
$s .= $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee_only']) . ')';
|
|
|
595 |
}
|
596 |
$s .= $this->__('each');
|
597 |
} else {
|
607 |
&& $_product->getFinalPrice() > $_price['price']);
|
608 |
|
609 |
if ($condition1 || $condition2) {
|
610 |
+
$s .= ' ' . $this->__('and') . ' ' . $this->__('save') . ' ' . $_price['savePercent'] . '%';
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
}
|
612 |
}
|
613 |
$pricesArray[] = $s;
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Price/Giftcard.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Price_Giftcard
|
35 |
-
extends Mage_Bundle_Block_Catalog_Product_Price
|
36 |
{
|
37 |
/**
|
38 |
* Return minimal amount for Giftcard product using price model
|
@@ -71,24 +70,19 @@ class Mage_XmlConnect_Block_Catalog_Product_Price_Giftcard
|
|
71 |
public function collectProductPrices(
|
72 |
Mage_Catalog_Model_Product $product,
|
73 |
Mage_XmlConnect_Model_Simplexml_Element $item
|
74 |
-
)
|
75 |
-
{
|
76 |
$this->setProduct($product);
|
77 |
|
78 |
if ($product->getCanShowPrice() !== false) {
|
79 |
$priceXmlObj = $item->addChild('price');
|
80 |
|
81 |
if (($_min = $this->getMinAmount()) && ($_max = $this->getMaxAmount()) && ($_min == $_max)) {
|
82 |
-
$priceXmlObj->addAttribute(
|
83 |
-
'regular',
|
84 |
-
Mage::helper('core')->currency($_min, true, false)
|
85 |
-
);
|
86 |
} elseif (($_min = $this->getMinAmount()) && $_min != 0) {
|
87 |
$priceXmlObj->addAttribute(
|
88 |
'regular',
|
89 |
-
Mage::helper('enterprise_giftcard')->__('From')
|
90 |
-
|
91 |
-
. Mage::helper('core')->currency($_min, true, false)
|
92 |
);
|
93 |
}
|
94 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Price_Giftcard extends Mage_Bundle_Block_Catalog_Product_Price
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Return minimal amount for Giftcard product using price model
|
70 |
public function collectProductPrices(
|
71 |
Mage_Catalog_Model_Product $product,
|
72 |
Mage_XmlConnect_Model_Simplexml_Element $item
|
73 |
+
) {
|
|
|
74 |
$this->setProduct($product);
|
75 |
|
76 |
if ($product->getCanShowPrice() !== false) {
|
77 |
$priceXmlObj = $item->addChild('price');
|
78 |
|
79 |
if (($_min = $this->getMinAmount()) && ($_max = $this->getMaxAmount()) && ($_min == $_max)) {
|
80 |
+
$priceXmlObj->addAttribute('regular', Mage::helper('core')->currency($_min, true, false));
|
|
|
|
|
|
|
81 |
} elseif (($_min = $this->getMinAmount()) && $_min != 0) {
|
82 |
$priceXmlObj->addAttribute(
|
83 |
'regular',
|
84 |
+
Mage::helper('enterprise_giftcard')->__('From') . ': '
|
85 |
+
. Mage::helper('core')->currency($_min, true, false)
|
|
|
86 |
);
|
87 |
}
|
88 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Related.php
CHANGED
@@ -42,20 +42,15 @@ class Mage_XmlConnect_Block_Catalog_Product_Related extends Mage_XmlConnect_Bloc
|
|
42 |
public function getRelatedProductsXmlObj()
|
43 |
{
|
44 |
/** @var $relatedXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
45 |
-
$relatedXmlObj = Mage::getModel(
|
46 |
-
'xmlconnect/simplexml_element',
|
47 |
-
'<related_products></related_products>'
|
48 |
-
);
|
49 |
|
50 |
$productObj = $this->getParentBlock()->getProduct();
|
51 |
|
52 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_TargetRule'))) {
|
53 |
Mage::register('product', $productObj);
|
54 |
|
55 |
-
$productBlock = $this->getLayout()
|
56 |
-
|
57 |
-
'enterprise_targetrule/catalog_product_list_related',
|
58 |
-
'relatedProducts'
|
59 |
);
|
60 |
|
61 |
$collection = $productBlock->getItemCollection();
|
@@ -85,15 +80,16 @@ class Mage_XmlConnect_Block_Catalog_Product_Related extends Mage_XmlConnect_Bloc
|
|
85 |
{
|
86 |
foreach ($collection as $product) {
|
87 |
$productXmlObj = $this->productToXmlObject($product);
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
->setProduct($product)
|
92 |
-
->setProductXmlObj($productXmlObj)
|
93 |
-
->collectProductPrices();
|
94 |
-
}
|
95 |
-
$relatedXmlObj->appendChild($productXmlObj);
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
return $relatedXmlObj;
|
99 |
}
|
@@ -116,15 +112,12 @@ class Mage_XmlConnect_Block_Catalog_Product_Related extends Mage_XmlConnect_Bloc
|
|
116 |
protected function _getProductCollection()
|
117 |
{
|
118 |
if (is_null($this->_productCollection)) {
|
119 |
-
$collection = $this->getParentBlock()
|
120 |
-
->getProduct()
|
121 |
-
->getRelatedProductCollection();
|
122 |
Mage::getSingleton('catalog/layer')->prepareProductCollection($collection);
|
123 |
/**
|
124 |
* Add rating and review summary, image attribute, apply sort params
|
125 |
*/
|
126 |
$this->_prepareCollection($collection);
|
127 |
-
|
128 |
$this->_productCollection = $collection;
|
129 |
}
|
130 |
return $this->_productCollection;
|
42 |
public function getRelatedProductsXmlObj()
|
43 |
{
|
44 |
/** @var $relatedXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
45 |
+
$relatedXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<related_products></related_products>');
|
|
|
|
|
|
|
46 |
|
47 |
$productObj = $this->getParentBlock()->getProduct();
|
48 |
|
49 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_TargetRule'))) {
|
50 |
Mage::register('product', $productObj);
|
51 |
|
52 |
+
$productBlock = $this->getLayout()->addBlock(
|
53 |
+
'enterprise_targetrule/catalog_product_list_related', 'relatedProducts'
|
|
|
|
|
54 |
);
|
55 |
|
56 |
$collection = $productBlock->getItemCollection();
|
80 |
{
|
81 |
foreach ($collection as $product) {
|
82 |
$productXmlObj = $this->productToXmlObject($product);
|
83 |
+
|
84 |
+
if (!$productXmlObj) {
|
85 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
+
|
88 |
+
if ($this->getParentBlock()->getChild('product_price')) {
|
89 |
+
$this->getParentBlock()->getChild('product_price')->setProduct($product)
|
90 |
+
->setProductXmlObj($productXmlObj)->collectProductPrices();
|
91 |
+
}
|
92 |
+
$relatedXmlObj->appendChild($productXmlObj);
|
93 |
}
|
94 |
return $relatedXmlObj;
|
95 |
}
|
112 |
protected function _getProductCollection()
|
113 |
{
|
114 |
if (is_null($this->_productCollection)) {
|
115 |
+
$collection = $this->getParentBlock()->getProduct()->getRelatedProductCollection();
|
|
|
|
|
116 |
Mage::getSingleton('catalog/layer')->prepareProductCollection($collection);
|
117 |
/**
|
118 |
* Add rating and review summary, image attribute, apply sort params
|
119 |
*/
|
120 |
$this->_prepareCollection($collection);
|
|
|
121 |
$this->_productCollection = $collection;
|
122 |
}
|
123 |
return $this->_productCollection;
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review.php
CHANGED
@@ -83,8 +83,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Review extends Mage_XmlConnect_Block
|
|
83 |
*/
|
84 |
protected function _toHtml()
|
85 |
{
|
86 |
-
$review = Mage::getModel('review/review')
|
87 |
-
->load((int)$this->getRequest()->getParam('id', 0));
|
88 |
return $this->reviewToXmlObject($review, 'review')->asNiceXml();
|
89 |
}
|
90 |
}
|
83 |
*/
|
84 |
protected function _toHtml()
|
85 |
{
|
86 |
+
$review = Mage::getModel('review/review')->load((int)$this->getRequest()->getParam('id', 0));
|
|
|
87 |
return $this->reviewToXmlObject($review, 'review')->asNiceXml();
|
88 |
}
|
89 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review/List.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Catalog_Product_Review_List
|
35 |
-
extends Mage_XmlConnect_Block_Catalog_Product_Review
|
36 |
{
|
37 |
/**
|
38 |
* Store reviews collection
|
@@ -49,7 +48,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Review_List
|
|
49 |
public function getReviewsXmlObject()
|
50 |
{
|
51 |
$reviewsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<reviews></reviews>');
|
52 |
-
$collection
|
53 |
|
54 |
if (!$collection) {
|
55 |
return $reviewsXmlObj;
|
@@ -79,10 +78,8 @@ class Mage_XmlConnect_Block_Catalog_Product_Review_List
|
|
79 |
}
|
80 |
/** @var $collection Mage_Review_Model_Mysql4_Review_Collection */
|
81 |
$collection = Mage::getResourceModel('review/review_collection')
|
82 |
-
->addEntityFilter('product', $product->getId())
|
83 |
-
->
|
84 |
-
->addStatusFilter('approved')
|
85 |
-
->setDateOrder();
|
86 |
|
87 |
/**
|
88 |
* Apply offset and count
|
@@ -104,8 +101,7 @@ class Mage_XmlConnect_Block_Catalog_Product_Review_List
|
|
104 |
*/
|
105 |
protected function _toHtml()
|
106 |
{
|
107 |
-
$product = Mage::getModel('catalog/product')
|
108 |
-
->load((int)$this->getRequest()->getParam('id', 0));
|
109 |
if ($product->getId()) {
|
110 |
$this->setProduct($product);
|
111 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Catalog_Product_Review_List extends Mage_XmlConnect_Block_Catalog_Product_Review
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Store reviews collection
|
48 |
public function getReviewsXmlObject()
|
49 |
{
|
50 |
$reviewsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<reviews></reviews>');
|
51 |
+
$collection = $this->_getReviewCollection();
|
52 |
|
53 |
if (!$collection) {
|
54 |
return $reviewsXmlObj;
|
78 |
}
|
79 |
/** @var $collection Mage_Review_Model_Mysql4_Review_Collection */
|
80 |
$collection = Mage::getResourceModel('review/review_collection')
|
81 |
+
->addEntityFilter('product', $product->getId())->addStoreFilter(Mage::app()->getStore()->getId())
|
82 |
+
->addStatusFilter('approved')->setDateOrder();
|
|
|
|
|
83 |
|
84 |
/**
|
85 |
* Apply offset and count
|
101 |
*/
|
102 |
protected function _toHtml()
|
103 |
{
|
104 |
+
$product = Mage::getModel('catalog/product')->load((int)$this->getRequest()->getParam('id', 0));
|
|
|
105 |
if ($product->getId()) {
|
106 |
$this->setProduct($product);
|
107 |
}
|
app/code/core/Mage/XmlConnect/Block/Catalog/Search.php
CHANGED
@@ -48,9 +48,11 @@ class Mage_XmlConnect_Block_Catalog_Search extends Mage_XmlConnect_Block_Catalog
|
|
48 |
$helper = Mage::helper('catalogsearch');
|
49 |
if (method_exists($helper, 'getEngine')) {
|
50 |
$engine = Mage::helper('catalogsearch')->getEngine();
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
} else {
|
55 |
$isLayeredNavigationAllowed = true;
|
56 |
}
|
@@ -64,8 +66,7 @@ class Mage_XmlConnect_Block_Catalog_Search extends Mage_XmlConnect_Block_Catalog
|
|
64 |
if ($productListBlock) {
|
65 |
$layer = Mage::getSingleton('catalogsearch/layer');
|
66 |
$productsXmlObj = $productListBlock->setLayer($layer)
|
67 |
-
->setNeedBlockApplyingFilters(!$isLayeredNavigationAllowed)
|
68 |
-
->getProductsXmlObject();
|
69 |
$searchXmlObject->appendChild($productsXmlObj);
|
70 |
$hasMoreProductItems = (int)$productListBlock->getHasProductItems();
|
71 |
}
|
48 |
$helper = Mage::helper('catalogsearch');
|
49 |
if (method_exists($helper, 'getEngine')) {
|
50 |
$engine = Mage::helper('catalogsearch')->getEngine();
|
51 |
+
if ($engine instanceof Varien_Object) {
|
52 |
+
$isLayeredNavigationAllowed = $engine->isLeyeredNavigationAllowed();
|
53 |
+
} else {
|
54 |
+
$isLayeredNavigationAllowed = true;
|
55 |
+
}
|
56 |
} else {
|
57 |
$isLayeredNavigationAllowed = true;
|
58 |
}
|
66 |
if ($productListBlock) {
|
67 |
$layer = Mage::getSingleton('catalogsearch/layer');
|
68 |
$productsXmlObj = $productListBlock->setLayer($layer)
|
69 |
+
->setNeedBlockApplyingFilters(!$isLayeredNavigationAllowed)->getProductsXmlObject();
|
|
|
70 |
$searchXmlObject->appendChild($productsXmlObj);
|
71 |
$hasMoreProductItems = (int)$productListBlock->getHasProductItems();
|
72 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Address/Billing.php
CHANGED
@@ -54,7 +54,9 @@ class Mage_XmlConnect_Block_Checkout_Address_Billing extends Mage_Checkout_Block
|
|
54 |
$item->addAttribute('selected', 1);
|
55 |
}
|
56 |
$this->getChild('address_list')->prepareAddressData($address, $item);
|
57 |
-
$item->addChild(
|
|
|
|
|
58 |
}
|
59 |
|
60 |
return $billingXmlObj->asNiceXml();
|
54 |
$item->addAttribute('selected', 1);
|
55 |
}
|
56 |
$this->getChild('address_list')->prepareAddressData($address, $item);
|
57 |
+
$item->addChild(
|
58 |
+
'address_line', $billingXmlObj->escapeXml($address->format('oneline'))
|
59 |
+
);
|
60 |
}
|
61 |
|
62 |
return $billingXmlObj->asNiceXml();
|
app/code/core/Mage/XmlConnect/Block/Checkout/Address/Form.php
CHANGED
@@ -50,75 +50,63 @@ class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Templa
|
|
50 |
$addressType = 'billing';
|
51 |
}
|
52 |
|
53 |
-
$isAllowedGuestCheckout = Mage::getSingleton('checkout/session')
|
54 |
-
->getQuote()
|
55 |
-
->isAllowedGuestCheckout();
|
56 |
|
57 |
$countries = $this->_getCountryOptions();
|
58 |
|
59 |
$xmlModel->addField($addressType . '[firstname]', 'text', array(
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
);
|
65 |
|
66 |
$xmlModel->addField($addressType . '[lastname]', 'text', array(
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
);
|
72 |
|
73 |
$xmlModel->addField($addressType . '[company]', 'text', array(
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
);
|
79 |
|
80 |
-
if ($isAllowedGuestCheckout
|
81 |
-
&& !Mage::getSingleton('customer/session')->isLoggedIn()
|
82 |
&& $addressType == 'billing'
|
83 |
) {
|
84 |
$emailField = $xmlModel->addField($addressType . '[email]', 'text', array(
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
);
|
90 |
$emailValidator = $emailField->addChild('validators')->addChild('validator');
|
91 |
$emailValidator->addAttribute('type', 'email');
|
92 |
$emailValidator->addAttribute('message', $this->__('Wrong email format'));
|
93 |
}
|
94 |
|
95 |
$xmlModel->addField($addressType . '[street][]', 'text', array(
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
);
|
101 |
|
102 |
$xmlModel->addField($addressType . '[street][]', 'text', array(
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
);
|
107 |
|
108 |
$xmlModel->addField($addressType . '[city]', 'text', array(
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
);
|
114 |
|
115 |
$countryOptionsXml = $xmlModel->addField($addressType . '[country_id]', 'select', array(
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
)
|
121 |
-
->addChild('values');
|
122 |
|
123 |
foreach ($countries as $data) {
|
124 |
$regions = array();
|
@@ -129,15 +117,11 @@ class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Templa
|
|
129 |
|
130 |
$regionStr = (!empty($regions) ? 'region_id' : 'region');
|
131 |
|
132 |
-
$countryXml = $countryOptionsXml->addCustomChild('item', null, array(
|
133 |
-
'relation' => $regionStr
|
134 |
-
)
|
135 |
-
);
|
136 |
$countryXml->addCustomChild('label', (string)$data['label']);
|
137 |
$countryXml->addCustomChild('value', (string)$data['value']);
|
138 |
if (!empty($regions)) {
|
139 |
$regionXml = $countryXml->addChild('regions');
|
140 |
-
|
141 |
foreach ($regions as $_data) {
|
142 |
$regionItemXml = $regionXml->addChild('region_item');
|
143 |
$regionItemXml->addCustomChild('label', (string)$_data['label']);
|
@@ -147,42 +131,36 @@ class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Templa
|
|
147 |
}
|
148 |
|
149 |
$xmlModel->addField($addressType . '[region]', 'text', array(
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
);
|
154 |
|
155 |
$xmlModel->addField($addressType . '[region_id]', 'select', array(
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
);
|
161 |
|
162 |
$xmlModel->addField($addressType . '[postcode]', 'text', array(
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
);
|
168 |
|
169 |
$xmlModel->addField($addressType . '[telephone]', 'text', array(
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
);
|
175 |
|
176 |
$xmlModel->addField($addressType . '[fax]', 'text', array(
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
);
|
181 |
|
182 |
$xmlModel->addField($addressType . '[save_in_address_book]', 'checkbox', array(
|
183 |
-
|
184 |
-
|
185 |
-
);
|
186 |
|
187 |
return $xmlModel->asNiceXml();
|
188 |
}
|
@@ -196,11 +174,11 @@ class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Templa
|
|
196 |
protected function _getRegionOptions($countryId)
|
197 |
{
|
198 |
$cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . Mage::app()->getStore()->getId() . $countryId;
|
199 |
-
|
|
|
200 |
$options = unserialize($cache);
|
201 |
} else {
|
202 |
-
$collection = Mage::getModel('directory/region')->getResourceCollection()
|
203 |
-
->addCountryFilter($countryId)
|
204 |
->load();
|
205 |
$options = $collection->toOptionArray();
|
206 |
if (Mage::app()->useCache('config')) {
|
@@ -218,12 +196,12 @@ class Mage_XmlConnect_Block_Checkout_Address_Form extends Mage_Core_Block_Templa
|
|
218 |
protected function _getCountryOptions()
|
219 |
{
|
220 |
$cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
221 |
-
|
|
|
222 |
$options = unserialize($cache);
|
223 |
} else {
|
224 |
/** @var $collection Mage_Directory_Model_Mysql4_Country_Collection */
|
225 |
-
$collection = Mage::getModel('directory/country')->getResourceCollection()
|
226 |
-
->loadByStore();
|
227 |
$options = $collection->toOptionArray(false);
|
228 |
if (Mage::app()->useCache('config')) {
|
229 |
Mage::app()->saveCache(serialize($options), $cacheKey, array('config'));
|
50 |
$addressType = 'billing';
|
51 |
}
|
52 |
|
53 |
+
$isAllowedGuestCheckout = Mage::getSingleton('checkout/session')->getQuote()->isAllowedGuestCheckout();
|
|
|
|
|
54 |
|
55 |
$countries = $this->_getCountryOptions();
|
56 |
|
57 |
$xmlModel->addField($addressType . '[firstname]', 'text', array(
|
58 |
+
'label' => $this->__('First Name'),
|
59 |
+
'required' => 'true',
|
60 |
+
'value' => ''
|
61 |
+
));
|
|
|
62 |
|
63 |
$xmlModel->addField($addressType . '[lastname]', 'text', array(
|
64 |
+
'label' => $this->__('Last Name'),
|
65 |
+
'required' => 'true',
|
66 |
+
'value' => ''
|
67 |
+
));
|
|
|
68 |
|
69 |
$xmlModel->addField($addressType . '[company]', 'text', array(
|
70 |
+
'label' => $this->__('Company'),
|
71 |
+
'required' => 'true',
|
72 |
+
'value' => ''
|
73 |
+
));
|
|
|
74 |
|
75 |
+
if ($isAllowedGuestCheckout && !Mage::getSingleton('customer/session')->isLoggedIn()
|
|
|
76 |
&& $addressType == 'billing'
|
77 |
) {
|
78 |
$emailField = $xmlModel->addField($addressType . '[email]', 'text', array(
|
79 |
+
'label' => $this->__('Email Address'),
|
80 |
+
'required' => 'true',
|
81 |
+
'value' => ''
|
82 |
+
));
|
|
|
83 |
$emailValidator = $emailField->addChild('validators')->addChild('validator');
|
84 |
$emailValidator->addAttribute('type', 'email');
|
85 |
$emailValidator->addAttribute('message', $this->__('Wrong email format'));
|
86 |
}
|
87 |
|
88 |
$xmlModel->addField($addressType . '[street][]', 'text', array(
|
89 |
+
'label' => $this->__('Address'),
|
90 |
+
'required' => 'true',
|
91 |
+
'value' => ''
|
92 |
+
));
|
|
|
93 |
|
94 |
$xmlModel->addField($addressType . '[street][]', 'text', array(
|
95 |
+
'label' => $this->__('Address 2'),
|
96 |
+
'value' => ''
|
97 |
+
));
|
|
|
98 |
|
99 |
$xmlModel->addField($addressType . '[city]', 'text', array(
|
100 |
+
'label' => $this->__('City'),
|
101 |
+
'required' => 'true',
|
102 |
+
'value' => ''
|
103 |
+
));
|
|
|
104 |
|
105 |
$countryOptionsXml = $xmlModel->addField($addressType . '[country_id]', 'select', array(
|
106 |
+
'label' => $this->__('Country'),
|
107 |
+
'required' => 'true',
|
108 |
+
'value' => ''
|
109 |
+
))->addChild('values');
|
|
|
|
|
110 |
|
111 |
foreach ($countries as $data) {
|
112 |
$regions = array();
|
117 |
|
118 |
$regionStr = (!empty($regions) ? 'region_id' : 'region');
|
119 |
|
120 |
+
$countryXml = $countryOptionsXml->addCustomChild('item', null, array('relation' => $regionStr));
|
|
|
|
|
|
|
121 |
$countryXml->addCustomChild('label', (string)$data['label']);
|
122 |
$countryXml->addCustomChild('value', (string)$data['value']);
|
123 |
if (!empty($regions)) {
|
124 |
$regionXml = $countryXml->addChild('regions');
|
|
|
125 |
foreach ($regions as $_data) {
|
126 |
$regionItemXml = $regionXml->addChild('region_item');
|
127 |
$regionItemXml->addCustomChild('label', (string)$_data['label']);
|
131 |
}
|
132 |
|
133 |
$xmlModel->addField($addressType . '[region]', 'text', array(
|
134 |
+
'label' => $this->__('State/Province'),
|
135 |
+
'value' => ''
|
136 |
+
));
|
|
|
137 |
|
138 |
$xmlModel->addField($addressType . '[region_id]', 'select', array(
|
139 |
+
'label' => $this->__('State/Province'),
|
140 |
+
'required' => 'true',
|
141 |
+
'value' => ''
|
142 |
+
));
|
|
|
143 |
|
144 |
$xmlModel->addField($addressType . '[postcode]', 'text', array(
|
145 |
+
'label' => $this->__('Zip/Postal Code'),
|
146 |
+
'required' => 'true',
|
147 |
+
'value' => ''
|
148 |
+
));
|
|
|
149 |
|
150 |
$xmlModel->addField($addressType . '[telephone]', 'text', array(
|
151 |
+
'label' => $this->__('Telephone'),
|
152 |
+
'required' => 'true',
|
153 |
+
'value' => ''
|
154 |
+
));
|
|
|
155 |
|
156 |
$xmlModel->addField($addressType . '[fax]', 'text', array(
|
157 |
+
'label' => $this->__('Fax'),
|
158 |
+
'value' => ''
|
159 |
+
));
|
|
|
160 |
|
161 |
$xmlModel->addField($addressType . '[save_in_address_book]', 'checkbox', array(
|
162 |
+
'label' => $this->__('Save in address book'),
|
163 |
+
));
|
|
|
164 |
|
165 |
return $xmlModel->asNiceXml();
|
166 |
}
|
174 |
protected function _getRegionOptions($countryId)
|
175 |
{
|
176 |
$cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . Mage::app()->getStore()->getId() . $countryId;
|
177 |
+
$cache = Mage::app()->loadCache($cacheKey);
|
178 |
+
if (Mage::app()->useCache('config') && $cache) {
|
179 |
$options = unserialize($cache);
|
180 |
} else {
|
181 |
+
$collection = Mage::getModel('directory/region')->getResourceCollection()->addCountryFilter($countryId)
|
|
|
182 |
->load();
|
183 |
$options = $collection->toOptionArray();
|
184 |
if (Mage::app()->useCache('config')) {
|
196 |
protected function _getCountryOptions()
|
197 |
{
|
198 |
$cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_' . Mage::app()->getStore()->getCode();
|
199 |
+
$cache = Mage::app()->loadCache($cacheKey);
|
200 |
+
if (Mage::app()->useCache('config') && $cache) {
|
201 |
$options = unserialize($cache);
|
202 |
} else {
|
203 |
/** @var $collection Mage_Directory_Model_Mysql4_Country_Collection */
|
204 |
+
$collection = Mage::getModel('directory/country')->getResourceCollection()->loadByStore();
|
|
|
205 |
$options = $collection->toOptionArray(false);
|
206 |
if (Mage::app()->useCache('config')) {
|
207 |
Mage::app()->saveCache(serialize($options), $cacheKey, array('config'));
|
app/code/core/Mage/XmlConnect/Block/Checkout/Agreements.php
CHANGED
@@ -40,6 +40,7 @@ class Mage_XmlConnect_Block_Checkout_Agreements extends Mage_Checkout_Block_Agre
|
|
40 |
*/
|
41 |
protected function _toHtml()
|
42 |
{
|
|
|
43 |
$agreementsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<agreements></agreements>');
|
44 |
if ($this->getAgreements()) {
|
45 |
foreach ($this->getAgreements() as $agreement) {
|
40 |
*/
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
+
/** @var $agreementsXmlObj Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
$agreementsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<agreements></agreements>');
|
45 |
if ($this->getAgreements()) {
|
46 |
foreach ($this->getAgreements() as $agreement) {
|
app/code/core/Mage/XmlConnect/Block/Checkout/Order/Review/Info.php
CHANGED
@@ -123,8 +123,7 @@ class Mage_XmlConnect_Block_Checkout_Order_Review_Info extends Mage_Checkout_Blo
|
|
123 |
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
124 |
$typeOfDisplay = Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales');
|
125 |
if ($typeOfDisplay && $item->getWeeeTaxAppliedAmount()) {
|
126 |
-
$exclPrice = $item->getRowTotal()
|
127 |
-
+ $item->getWeeeTaxAppliedRowAmount()
|
128 |
+ $item->getWeeeTaxRowDisposition();
|
129 |
} else {
|
130 |
$exclPrice = $item->getRowTotal();
|
123 |
if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
|
124 |
$typeOfDisplay = Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales');
|
125 |
if ($typeOfDisplay && $item->getWeeeTaxAppliedAmount()) {
|
126 |
+
$exclPrice = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
|
|
|
127 |
+ $item->getWeeeTaxRowDisposition();
|
128 |
} else {
|
129 |
$exclPrice = $item->getRowTotal();
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Ccsave.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Ccsave
|
35 |
-
extends Mage_Payment_Block_Form_Ccsave
|
36 |
{
|
37 |
/**
|
38 |
* Prevent any rendering
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Ccsave extends Mage_Payment_Block_Form_Ccsave
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Prevent any rendering
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Checkmo.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Checkmo
|
35 |
-
extends Mage_Payment_Block_Form_Checkmo
|
36 |
{
|
37 |
/**
|
38 |
* Prevent any rendering
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Checkmo extends Mage_Payment_Block_Form_Checkmo
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Prevent any rendering
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Authorizenet.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Authorizenet
|
35 |
-
extends Mage_Paygate_Block_Authorizenet_Info_Cc
|
36 |
{
|
37 |
/**
|
38 |
* Add Authorizenet info to order XML object
|
@@ -44,31 +43,20 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Authorizenet
|
|
44 |
{
|
45 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
46 |
if (!$this->getHideTitle()) {
|
47 |
-
$orderItemXmlObj->addAttribute(
|
48 |
-
'title',
|
49 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
50 |
-
);
|
51 |
}
|
52 |
|
53 |
$cards = $this->getCards();
|
54 |
$showCount = count($cards) > 1;
|
55 |
|
56 |
foreach ($cards as $key => $card) {
|
57 |
-
$creditCard = $orderItemXmlObj->addCustomChild(
|
58 |
-
'
|
59 |
-
|
60 |
-
array(
|
61 |
-
'label' => $showCount ? $this->__('Credit Card %s', $key + 1) : $this->__('Credit Card')
|
62 |
-
)
|
63 |
-
);
|
64 |
foreach ($card as $label => $value) {
|
65 |
-
$creditCard->addCustomChild(
|
66 |
-
'
|
67 |
-
|
68 |
-
array(
|
69 |
-
'label' => $label
|
70 |
-
)
|
71 |
-
);
|
72 |
}
|
73 |
}
|
74 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Authorizenet extends Mage_Paygate_Block_Authorizenet_Info_Cc
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add Authorizenet info to order XML object
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
if (!$this->getHideTitle()) {
|
46 |
+
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
$cards = $this->getCards();
|
50 |
$showCount = count($cards) > 1;
|
51 |
|
52 |
foreach ($cards as $key => $card) {
|
53 |
+
$creditCard = $orderItemXmlObj->addCustomChild('item', null, array(
|
54 |
+
'label' => $showCount ? $this->__('Credit Card %s', $key + 1) : $this->__('Credit Card')
|
55 |
+
));
|
|
|
|
|
|
|
|
|
56 |
foreach ($card as $label => $value) {
|
57 |
+
$creditCard->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
58 |
+
'label' => $label
|
59 |
+
));
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
}
|
62 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Ccsave.php
CHANGED
@@ -42,20 +42,13 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Ccsave extends Mage_Pay
|
|
42 |
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
-
$orderItemXmlObj->addAttribute(
|
46 |
-
'title',
|
47 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
48 |
-
);
|
49 |
|
50 |
if ($_specificInfo = $this->getSpecificInformation()) {
|
51 |
foreach ($_specificInfo as $label => $value) {
|
52 |
-
$orderItemXmlObj->addCustomChild(
|
53 |
-
'
|
54 |
-
|
55 |
-
array(
|
56 |
-
'label' => $label
|
57 |
-
)
|
58 |
-
);
|
59 |
}
|
60 |
}
|
61 |
}
|
42 |
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
43 |
{
|
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 |
+
));
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
}
|
54 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Checkmo.php
CHANGED
@@ -43,28 +43,19 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Checkmo extends Mage_Pa
|
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
$orderItemXmlObj->addAttribute(
|
46 |
-
'title',
|
47 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
48 |
);
|
49 |
|
50 |
if ($this->getInfo()->getAdditionalData()) {
|
51 |
if ($this->getPayableTo()) {
|
52 |
-
$orderItemXmlObj->addCustomChild(
|
53 |
-
'
|
54 |
-
|
55 |
-
array(
|
56 |
-
'label' => Mage::helper('sales')->__('Make Check payable to:')
|
57 |
-
)
|
58 |
-
);
|
59 |
}
|
60 |
if ($this->getMailingAddress()) {
|
61 |
-
$orderItemXmlObj->addCustomChild(
|
62 |
-
'
|
63 |
-
|
64 |
-
array(
|
65 |
-
'label' => Mage::helper('payment')->__('Send Check to:')
|
66 |
-
)
|
67 |
-
);
|
68 |
}
|
69 |
}
|
70 |
}
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
$orderItemXmlObj->addAttribute(
|
46 |
+
'title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
|
|
47 |
);
|
48 |
|
49 |
if ($this->getInfo()->getAdditionalData()) {
|
50 |
if ($this->getPayableTo()) {
|
51 |
+
$orderItemXmlObj->addCustomChild('item', $this->getPayableTo(), array(
|
52 |
+
'label' => Mage::helper('sales')->__('Make Check payable to:')
|
53 |
+
));
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
if ($this->getMailingAddress()) {
|
56 |
+
$orderItemXmlObj->addCustomChild('item', $this->getMailingAddress(), array(
|
57 |
+
'label' => Mage::helper('payment')->__('Send Check to:')
|
58 |
+
));
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
}
|
61 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Free.php
CHANGED
@@ -42,9 +42,6 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Free extends Mage_Payme
|
|
42 |
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
-
$orderItemXmlObj->addAttribute(
|
46 |
-
'title',
|
47 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
48 |
-
);
|
49 |
}
|
50 |
}
|
42 |
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
+
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
|
|
|
|
|
|
46 |
}
|
47 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Paypal/Abstract.php
CHANGED
@@ -44,19 +44,14 @@ abstract class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Paypal_Abstrac
|
|
44 |
{
|
45 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
46 |
$orderItemXmlObj->addAttribute(
|
47 |
-
'title',
|
48 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
49 |
);
|
50 |
|
51 |
if ($_specificInfo = $this->getSpecificInformation()) {
|
52 |
foreach ($_specificInfo as $label => $value) {
|
53 |
-
$orderItemXmlObj->addCustomChild(
|
54 |
-
'
|
55 |
-
|
56 |
-
array(
|
57 |
-
'label' => $label
|
58 |
-
)
|
59 |
-
);
|
60 |
}
|
61 |
}
|
62 |
}
|
44 |
{
|
45 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
46 |
$orderItemXmlObj->addAttribute(
|
47 |
+
'title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
|
|
48 |
);
|
49 |
|
50 |
if ($_specificInfo = $this->getSpecificInformation()) {
|
51 |
foreach ($_specificInfo as $label => $value) {
|
52 |
+
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
53 |
+
'label' => $label
|
54 |
+
));
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
}
|
57 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Pbridge/Verisign.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Pbridge_Verisign
|
35 |
-
extends Mage_Payment_Block_Info_Cc
|
36 |
{
|
37 |
/**
|
38 |
* Add CC Save Payment info to order XML object
|
@@ -44,19 +43,14 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Pbridge_Verisign
|
|
44 |
{
|
45 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
46 |
$orderItemXmlObj->addAttribute(
|
47 |
-
'title',
|
48 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
49 |
);
|
50 |
|
51 |
if ($_specificInfo = $this->getSpecificInformation()) {
|
52 |
foreach ($_specificInfo as $label => $value) {
|
53 |
-
$orderItemXmlObj->addCustomChild(
|
54 |
-
'
|
55 |
-
|
56 |
-
array(
|
57 |
-
'label' => $label
|
58 |
-
)
|
59 |
-
);
|
60 |
}
|
61 |
}
|
62 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Pbridge_Verisign extends Mage_Payment_Block_Info_Cc
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add CC Save Payment info to order XML object
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
$orderItemXmlObj->addAttribute(
|
46 |
+
'title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
|
|
47 |
);
|
48 |
|
49 |
if ($_specificInfo = $this->getSpecificInformation()) {
|
50 |
foreach ($_specificInfo as $label => $value) {
|
51 |
+
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'), array(
|
52 |
+
'label' => $label
|
53 |
+
));
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Info/Purchaseorder.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Purchaseorder
|
35 |
-
extends Mage_Payment_Block_Info_Purchaseorder
|
36 |
{
|
37 |
/**
|
38 |
* Add Purchase Order Payment info to order XML object
|
@@ -43,17 +42,10 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Purchaseorder
|
|
43 |
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
44 |
{
|
45 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
46 |
-
$orderItemXmlObj->addAttribute(
|
47 |
-
'title',
|
48 |
-
$orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle())
|
49 |
-
);
|
50 |
|
51 |
-
$orderItemXmlObj->addCustomChild(
|
52 |
-
'
|
53 |
-
|
54 |
-
array(
|
55 |
-
'label' => Mage::helper('sales')->__('Purchase Order Number:')
|
56 |
-
)
|
57 |
-
);
|
58 |
}
|
59 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Info_Purchaseorder extends Mage_Payment_Block_Info_Purchaseorder
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add Purchase Order Payment info to order XML object
|
42 |
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
43 |
{
|
44 |
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
|
45 |
+
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
|
|
|
|
|
|
|
46 |
|
47 |
+
$orderItemXmlObj->addCustomChild('item', $this->getInfo()->getPoNumber(), array(
|
48 |
+
'label' => Mage::helper('sales')->__('Purchase Order Number:')
|
49 |
+
));
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/List.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_List
|
35 |
-
extends Mage_Payment_Block_Form_Container
|
36 |
{
|
37 |
/**
|
38 |
* Pre-defined array of methods that we are going to render
|
@@ -57,10 +56,7 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_List
|
|
57 |
* @var array
|
58 |
*/
|
59 |
protected $_pbridgeMethodArray = array(
|
60 |
-
'pbridge_authorizenet',
|
61 |
-
'pbridge_paypal',
|
62 |
-
'pbridge_verisign',
|
63 |
-
'pbridge_paypaluk',
|
64 |
);
|
65 |
|
66 |
/**
|
@@ -96,17 +92,13 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_List
|
|
96 |
$storeCreditFlag = (int) Mage::getStoreConfig(Enterprise_CustomerBalance_Helper_Data::XML_PATH_ENABLED);
|
97 |
if ($storeCreditFlag && $customerBalanceBlock->isDisplayContainer()) {
|
98 |
$balance = $this->getQuote()->getStore()->formatPrice($customerBalanceBlock->getBalance(), false);
|
99 |
-
$methodsXmlObj->addCustomChild(
|
100 |
-
'
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
'is_cover_a_quote' => intval($customerBalanceBlock->isFullyPaidAfterApplication()),
|
107 |
-
'selected' => intval($customerBalanceBlock->isCustomerBalanceUsed())
|
108 |
-
)
|
109 |
-
);
|
110 |
}
|
111 |
}
|
112 |
|
@@ -118,37 +110,23 @@ class Mage_XmlConnect_Block_Checkout_Payment_Method_List
|
|
118 |
public function addGiftcardToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $methodsXmlObj)
|
119 |
{
|
120 |
$giftcardInfoBlock = $this->getLayout()->addBlock(
|
121 |
-
'enterprise_giftcardaccount/checkout_onepage_payment_additional',
|
122 |
-
'giftcard_info'
|
123 |
);
|
124 |
|
125 |
if (intval($giftcardInfoBlock->getAppliedGiftCardAmount())) {
|
126 |
-
$amount = $this->getQuote()
|
127 |
-
->getStore()
|
128 |
-
->formatPrice($giftcardInfoBlock->getAppliedGiftCardAmount(), false);
|
129 |
$amount = $this->__('Gift Card amount applied to order: %s', $amount);
|
130 |
|
131 |
-
$methodsXmlObj->addCustomChild(
|
132 |
-
'information',
|
133 |
-
null,
|
134 |
-
array(
|
135 |
-
'label' => $amount,
|
136 |
-
'disabled' => '1'
|
137 |
-
)
|
138 |
-
);
|
139 |
|
140 |
if ($this->_isPaymentRequired()) {
|
141 |
-
$methodsXmlObj->addCustomChild(
|
142 |
-
'method',
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
'selected' => '1',
|
149 |
-
'disabled' => '1'
|
150 |
-
)
|
151 |
-
);
|
152 |
}
|
153 |
$this->setIsUsedGiftCard(true);
|
154 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_List extends Mage_Payment_Block_Form_Container
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Pre-defined array of methods that we are going to render
|
56 |
* @var array
|
57 |
*/
|
58 |
protected $_pbridgeMethodArray = array(
|
59 |
+
'pbridge_authorizenet', 'pbridge_paypal', 'pbridge_verisign', 'pbridge_paypaluk'
|
|
|
|
|
|
|
60 |
);
|
61 |
|
62 |
/**
|
92 |
$storeCreditFlag = (int) Mage::getStoreConfig(Enterprise_CustomerBalance_Helper_Data::XML_PATH_ENABLED);
|
93 |
if ($storeCreditFlag && $customerBalanceBlock->isDisplayContainer()) {
|
94 |
$balance = $this->getQuote()->getStore()->formatPrice($customerBalanceBlock->getBalance(), false);
|
95 |
+
$methodsXmlObj->addCustomChild('customer_balance', null, array(
|
96 |
+
'post_name' => 'payment[use_customer_balance]',
|
97 |
+
'code' => 1,
|
98 |
+
'label' => $this->__('Use Store Credit (%s available)', $balance),
|
99 |
+
'is_cover_a_quote' => intval($customerBalanceBlock->isFullyPaidAfterApplication()),
|
100 |
+
'selected' => intval($customerBalanceBlock->isCustomerBalanceUsed())
|
101 |
+
));
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
}
|
104 |
|
110 |
public function addGiftcardToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $methodsXmlObj)
|
111 |
{
|
112 |
$giftcardInfoBlock = $this->getLayout()->addBlock(
|
113 |
+
'enterprise_giftcardaccount/checkout_onepage_payment_additional', 'giftcard_info'
|
|
|
114 |
);
|
115 |
|
116 |
if (intval($giftcardInfoBlock->getAppliedGiftCardAmount())) {
|
117 |
+
$amount = $this->getQuote()->getStore()->formatPrice($giftcardInfoBlock->getAppliedGiftCardAmount(), false);
|
|
|
|
|
118 |
$amount = $this->__('Gift Card amount applied to order: %s', $amount);
|
119 |
|
120 |
+
$methodsXmlObj->addCustomChild('information', null, array('label' => $amount, 'disabled' => '1'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
if ($this->_isPaymentRequired()) {
|
123 |
+
$methodsXmlObj->addCustomChild('method', null, array(
|
124 |
+
'post_name' => 'payment[method]',
|
125 |
+
'code' => 'free',
|
126 |
+
'label' => $this->__('No Payment Information Required'),
|
127 |
+
'selected' => '1',
|
128 |
+
'disabled' => '1'
|
129 |
+
));
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
$this->setIsUsedGiftCard(true);
|
132 |
}
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Paypal/Payflow.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Paypal_Payflow
|
35 |
-
extends Mage_Payment_Block_Form_Ccsave
|
36 |
{
|
37 |
/**
|
38 |
* Prevent any rendering
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Paypal_Payflow extends Mage_Payment_Block_Form_Ccsave
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Prevent any rendering
|
app/code/core/Mage/XmlConnect/Block/Checkout/Payment/Method/Purchaseorder.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Checkout_Payment_Method_Purchaseorder
|
35 |
-
extends Mage_Payment_Block_Form_Purchaseorder
|
36 |
{
|
37 |
/**
|
38 |
* Prevent any rendering
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Checkout_Payment_Method_Purchaseorder extends Mage_Payment_Block_Form_Purchaseorder
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Prevent any rendering
|
app/code/core/Mage/XmlConnect/Block/Configuration.php
CHANGED
@@ -99,7 +99,7 @@ class Mage_XmlConnect_Block_Configuration extends Mage_Core_Block_Template
|
|
99 |
} else {
|
100 |
$value = (string)$value;
|
101 |
if ($value != '') {
|
102 |
-
$section->addChild($key, Mage::helper('core')->
|
103 |
}
|
104 |
}
|
105 |
}
|
@@ -113,13 +113,7 @@ class Mage_XmlConnect_Block_Configuration extends Mage_Core_Block_Template
|
|
113 |
protected function _toHtml()
|
114 |
{
|
115 |
$xml = Mage::getModel('xmlconnect/simplexml_element', '<configuration></configuration>');
|
116 |
-
$this->_buildRecursive(
|
117 |
-
$xml,
|
118 |
-
Mage::helper('xmlconnect')
|
119 |
-
->excludeXmlConfigKeys(
|
120 |
-
$this->_app->getRenderConf()
|
121 |
-
)
|
122 |
-
);
|
123 |
return $xml->asNiceXml();
|
124 |
}
|
125 |
}
|
99 |
} else {
|
100 |
$value = (string)$value;
|
101 |
if ($value != '') {
|
102 |
+
$section->addChild($key, Mage::helper('core')->escapeHtml($value));
|
103 |
}
|
104 |
}
|
105 |
}
|
113 |
protected function _toHtml()
|
114 |
{
|
115 |
$xml = Mage::getModel('xmlconnect/simplexml_element', '<configuration></configuration>');
|
116 |
+
$this->_buildRecursive($xml, Mage::helper('xmlconnect')->excludeXmlConfigKeys($this->_app->getRenderConf()));
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
return $xml->asNiceXml();
|
118 |
}
|
119 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php
CHANGED
@@ -51,7 +51,7 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
51 |
* - 'select' => 'enterprise_customer/form_renderer_select',
|
52 |
* - 'multiselect' => 'enterprise_customer/form_renderer_multiselect',
|
53 |
* - 'boolean' => 'enterprise_customer/form_renderer_boolean',
|
54 |
-
* - 'file'
|
55 |
* - 'image' => 'enterprise_customer/form_renderer_image'
|
56 |
*
|
57 |
* @see customer.xml layout customer_form_template_handle node
|
@@ -85,12 +85,8 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
85 |
$billingChecked = $shippingChecked = false;
|
86 |
|
87 |
if ($addressId && $address && $address->getId()) {
|
88 |
-
$defaultBillingAddressId = Mage::getSingleton('customer/session')
|
89 |
-
|
90 |
-
->getDefaultBilling();
|
91 |
-
$defaultShippingAddressId = Mage::getSingleton('customer/session')
|
92 |
-
->getCustomer()
|
93 |
-
->getDefaultShipping();
|
94 |
|
95 |
$billingChecked = (int)$addressId == $defaultBillingAddressId;
|
96 |
$shippingChecked = (int)$addressId == $defaultShippingAddressId;
|
@@ -107,8 +103,7 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
107 |
$fax = $address->getFax();
|
108 |
}
|
109 |
|
110 |
-
$action = Mage::helper('xmlconnect')
|
111 |
-
->getActionUrl('xmlconnect/customer/saveaddress');
|
112 |
|
113 |
/** @var Mage_XmlConnect_Model_Simplexml_Form $fromXmlObj */
|
114 |
$fromXmlObj = Mage::getModel('xmlconnect/simplexml_form', array(
|
@@ -117,13 +112,9 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
117 |
'use_container' => true
|
118 |
));
|
119 |
|
120 |
-
$contactInfoFieldset = $fromXmlObj->addFieldset(
|
121 |
-
|
122 |
-
|
123 |
-
)
|
124 |
-
->setCustomAttributes(
|
125 |
-
array('legend')
|
126 |
-
);
|
127 |
|
128 |
$this->_addCustomerContactInfo($contactInfoFieldset);
|
129 |
|
@@ -141,13 +132,8 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
141 |
'value' => isset($fax) ? $fax : ''
|
142 |
));
|
143 |
|
144 |
-
$addressFieldset = $fromXmlObj->addFieldset(
|
145 |
-
|
146 |
-
array('legend' => $this->__('Address'))
|
147 |
-
)
|
148 |
-
->setCustomAttributes(
|
149 |
-
array('legend')
|
150 |
-
);
|
151 |
|
152 |
$addressFieldset->addField('street', 'text', array(
|
153 |
'name' => 'street[]',
|
@@ -171,9 +157,9 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
171 |
$region = isset($region) ? $region : null;
|
172 |
|
173 |
$addressFieldset->addField('country_id', 'countryListSelect', array(
|
174 |
-
'label'
|
175 |
-
'required'
|
176 |
-
'value'
|
177 |
'country_id' => $countryId,
|
178 |
'region_id' => $regionId,
|
179 |
'region' => $region
|
@@ -216,13 +202,12 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
216 |
*/
|
217 |
protected function _addCustomerContactInfo(
|
218 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
219 |
-
)
|
220 |
-
{
|
221 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
222 |
-
$this->setNameWidgetBlock(
|
223 |
-
->createBlock('customer/widget_name')
|
224 |
-
|
225 |
-
);
|
226 |
|
227 |
if ($this->getNameWidgetBlock()->showPrefix()) {
|
228 |
$this->_addPrefix($contactInfoFieldset);
|
@@ -252,34 +237,28 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
252 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
253 |
* @return Mage_XmlConnect_Block_Customer_Address_Form
|
254 |
*/
|
255 |
-
protected function _addPrefix(
|
256 |
-
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
257 |
-
)
|
258 |
{
|
259 |
$attributes = array();
|
260 |
$attributes += $contactInfoFieldset->checkAttribute(
|
261 |
-
'value',
|
262 |
-
$this->getNameWidgetBlock()->getObject()->getPrefix()
|
263 |
);
|
264 |
|
265 |
$attributes += $contactInfoFieldset->checkAttribute(
|
266 |
-
'required',
|
267 |
-
(int)$this->getNameWidgetBlock()->isPrefixRequired()
|
268 |
);
|
269 |
|
270 |
if ($this->getNameWidgetBlock()->getPrefixOptions() === false) {
|
271 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('prefix'), 'text', array(
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
);
|
276 |
} else {
|
277 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('prefix'), 'select', array(
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
);
|
283 |
}
|
284 |
return $this;
|
285 |
}
|
@@ -296,28 +275,24 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
296 |
{
|
297 |
$attributes = array();
|
298 |
$attributes += $contactInfoFieldset->checkAttribute(
|
299 |
-
'value',
|
300 |
-
$this->getNameWidgetBlock()->getObject()->getSuffix()
|
301 |
);
|
302 |
|
303 |
$attributes += $contactInfoFieldset->checkAttribute(
|
304 |
-
'required',
|
305 |
-
(int)$this->getNameWidgetBlock()->isSuffixRequired()
|
306 |
);
|
307 |
|
308 |
if ($this->getNameWidgetBlock()->getSuffixOptions() === false) {
|
309 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('suffix'), 'text', array(
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
);
|
314 |
} else {
|
315 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('suffix'), 'select', array(
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
);
|
321 |
}
|
322 |
return $this;
|
323 |
}
|
@@ -339,10 +314,10 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
339 |
);
|
340 |
|
341 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('middlename'), 'text', array(
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
return $this;
|
347 |
}
|
348 |
|
@@ -354,10 +329,9 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
354 |
*/
|
355 |
protected function _addFirstName(
|
356 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
357 |
-
)
|
358 |
-
{
|
359 |
$firstName = $this->getAddress()->getFirstname();
|
360 |
-
$contactInfoFieldset->addField('firstname', 'text',array(
|
361 |
'label' => $this->__('First Name'),
|
362 |
'required' => 'true',
|
363 |
'value' => isset($firstName) ? $firstName : ''
|
@@ -373,8 +347,7 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
373 |
*/
|
374 |
protected function _addLastName(
|
375 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
376 |
-
)
|
377 |
-
{
|
378 |
$lastName = $this->getAddress()->getLastname();
|
379 |
$contactInfoFieldset->addField('lastname', 'text', array(
|
380 |
'label' => $this->__('Last Name'),
|
@@ -392,8 +365,7 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
392 |
*/
|
393 |
protected function _addCustomAddressAttributes(
|
394 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $addressFieldset
|
395 |
-
)
|
396 |
-
{
|
397 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
398 |
/** @var $addressAttrBlock Enterprise_Customer_Block_Form */
|
399 |
$addressAttrBlock = $this->getLayout()
|
@@ -406,12 +378,11 @@ class Mage_XmlConnect_Block_Customer_Address_Form extends Mage_Customer_Block_Ad
|
|
406 |
}
|
407 |
|
408 |
if ($addressAttrBlock->hasUserDefinedAttributes()) {
|
409 |
-
foreach ($addressAttrBlock->getUserDefinedAttributes() as $
|
410 |
$type = $attribute->getFrontendInput();
|
411 |
$block = $addressAttrBlock->getRenderer($type);
|
412 |
if ($block) {
|
413 |
-
$block->setAttributeObject($attribute)
|
414 |
-
->setEntity($addressAttrBlock->getEntity())
|
415 |
->addFieldToXmlObj($addressFieldset);
|
416 |
}
|
417 |
}
|
51 |
* - 'select' => 'enterprise_customer/form_renderer_select',
|
52 |
* - 'multiselect' => 'enterprise_customer/form_renderer_multiselect',
|
53 |
* - 'boolean' => 'enterprise_customer/form_renderer_boolean',
|
54 |
+
* - 'file' => 'enterprise_customer/form_renderer_file'
|
55 |
* - 'image' => 'enterprise_customer/form_renderer_image'
|
56 |
*
|
57 |
* @see customer.xml layout customer_form_template_handle node
|
85 |
$billingChecked = $shippingChecked = false;
|
86 |
|
87 |
if ($addressId && $address && $address->getId()) {
|
88 |
+
$defaultBillingAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
|
89 |
+
$defaultShippingAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping();
|
|
|
|
|
|
|
|
|
90 |
|
91 |
$billingChecked = (int)$addressId == $defaultBillingAddressId;
|
92 |
$shippingChecked = (int)$addressId == $defaultShippingAddressId;
|
103 |
$fax = $address->getFax();
|
104 |
}
|
105 |
|
106 |
+
$action = Mage::helper('xmlconnect')->getActionUrl('xmlconnect/customer/saveaddress');
|
|
|
107 |
|
108 |
/** @var Mage_XmlConnect_Model_Simplexml_Form $fromXmlObj */
|
109 |
$fromXmlObj = Mage::getModel('xmlconnect/simplexml_form', array(
|
112 |
'use_container' => true
|
113 |
));
|
114 |
|
115 |
+
$contactInfoFieldset = $fromXmlObj->addFieldset('contact_info', array(
|
116 |
+
'legend' => $this->__('Contact Information')
|
117 |
+
))->setCustomAttributes(array('legend'));
|
|
|
|
|
|
|
|
|
118 |
|
119 |
$this->_addCustomerContactInfo($contactInfoFieldset);
|
120 |
|
132 |
'value' => isset($fax) ? $fax : ''
|
133 |
));
|
134 |
|
135 |
+
$addressFieldset = $fromXmlObj->addFieldset('address_info', array('legend' => $this->__('Address')))
|
136 |
+
->setCustomAttributes(array('legend'));
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
$addressFieldset->addField('street', 'text', array(
|
139 |
'name' => 'street[]',
|
157 |
$region = isset($region) ? $region : null;
|
158 |
|
159 |
$addressFieldset->addField('country_id', 'countryListSelect', array(
|
160 |
+
'label' => $this->__('Country'),
|
161 |
+
'required' => 'true',
|
162 |
+
'value' => array(
|
163 |
'country_id' => $countryId,
|
164 |
'region_id' => $regionId,
|
165 |
'region' => $region
|
202 |
*/
|
203 |
protected function _addCustomerContactInfo(
|
204 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
205 |
+
) {
|
|
|
206 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
207 |
+
$this->setNameWidgetBlock(
|
208 |
+
$this->getLayout()->createBlock('customer/widget_name')->setObject(
|
209 |
+
$this->getAddress()->getFirstname() ? $this->getAddress() : $this->getCustomer()
|
210 |
+
));
|
211 |
|
212 |
if ($this->getNameWidgetBlock()->showPrefix()) {
|
213 |
$this->_addPrefix($contactInfoFieldset);
|
237 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
238 |
* @return Mage_XmlConnect_Block_Customer_Address_Form
|
239 |
*/
|
240 |
+
protected function _addPrefix(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset)
|
|
|
|
|
241 |
{
|
242 |
$attributes = array();
|
243 |
$attributes += $contactInfoFieldset->checkAttribute(
|
244 |
+
'value', $this->getNameWidgetBlock()->getObject()->getPrefix()
|
|
|
245 |
);
|
246 |
|
247 |
$attributes += $contactInfoFieldset->checkAttribute(
|
248 |
+
'required', (int)$this->getNameWidgetBlock()->isPrefixRequired()
|
|
|
249 |
);
|
250 |
|
251 |
if ($this->getNameWidgetBlock()->getPrefixOptions() === false) {
|
252 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('prefix'), 'text', array(
|
253 |
+
'label' => $this->__('Prefix'),
|
254 |
+
'name' => $this->getNameWidgetBlock()->getFieldName('prefix')
|
255 |
+
) + $attributes);
|
|
|
256 |
} else {
|
257 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('prefix'), 'select', array(
|
258 |
+
'label' => $this->__('Prefix'),
|
259 |
+
'name' => $this->getNameWidgetBlock()->getFieldName('prefix'),
|
260 |
+
'options' => $this->getNameWidgetBlock()->getPrefixOptions()
|
261 |
+
) + $attributes);
|
|
|
262 |
}
|
263 |
return $this;
|
264 |
}
|
275 |
{
|
276 |
$attributes = array();
|
277 |
$attributes += $contactInfoFieldset->checkAttribute(
|
278 |
+
'value', $this->getNameWidgetBlock()->getObject()->getSuffix()
|
|
|
279 |
);
|
280 |
|
281 |
$attributes += $contactInfoFieldset->checkAttribute(
|
282 |
+
'required', (int)$this->getNameWidgetBlock()->isSuffixRequired()
|
|
|
283 |
);
|
284 |
|
285 |
if ($this->getNameWidgetBlock()->getSuffixOptions() === false) {
|
286 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('suffix'), 'text', array(
|
287 |
+
'label' => $this->__('Suffix'),
|
288 |
+
'name' => $this->getNameWidgetBlock()->getFieldName('suffix')
|
289 |
+
) + $attributes);
|
|
|
290 |
} else {
|
291 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('suffix'), 'select', array(
|
292 |
+
'label' => $this->__('Suffix'),
|
293 |
+
'name' => $this->getNameWidgetBlock()->getFieldName('suffix'),
|
294 |
+
'options' => $this->getNameWidgetBlock()->getSuffixOptions()
|
295 |
+
) + $attributes);
|
|
|
296 |
}
|
297 |
return $this;
|
298 |
}
|
314 |
);
|
315 |
|
316 |
$contactInfoFieldset->addField($this->getNameWidgetBlock()->getFieldId('middlename'), 'text', array(
|
317 |
+
'label' => $this->__('M.I.'),
|
318 |
+
'name' => $this->getNameWidgetBlock()->getFieldName('middlename')
|
319 |
+
) + $attributes);
|
320 |
+
|
321 |
return $this;
|
322 |
}
|
323 |
|
329 |
*/
|
330 |
protected function _addFirstName(
|
331 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
332 |
+
) {
|
|
|
333 |
$firstName = $this->getAddress()->getFirstname();
|
334 |
+
$contactInfoFieldset->addField('firstname', 'text', array(
|
335 |
'label' => $this->__('First Name'),
|
336 |
'required' => 'true',
|
337 |
'value' => isset($firstName) ? $firstName : ''
|
347 |
*/
|
348 |
protected function _addLastName(
|
349 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset
|
350 |
+
) {
|
|
|
351 |
$lastName = $this->getAddress()->getLastname();
|
352 |
$contactInfoFieldset->addField('lastname', 'text', array(
|
353 |
'label' => $this->__('Last Name'),
|
365 |
*/
|
366 |
protected function _addCustomAddressAttributes(
|
367 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $addressFieldset
|
368 |
+
) {
|
|
|
369 |
if (is_object(Mage::getConfig()->getNode('modules/Enterprise_Customer'))) {
|
370 |
/** @var $addressAttrBlock Enterprise_Customer_Block_Form */
|
371 |
$addressAttrBlock = $this->getLayout()
|
378 |
}
|
379 |
|
380 |
if ($addressAttrBlock->hasUserDefinedAttributes()) {
|
381 |
+
foreach ($addressAttrBlock->getUserDefinedAttributes() as $attribute) {
|
382 |
$type = $attribute->getFrontendInput();
|
383 |
$block = $addressAttrBlock->getRenderer($type);
|
384 |
if ($block) {
|
385 |
+
$block->setAttributeObject($attribute)->setEntity($addressAttrBlock->getEntity())
|
|
|
386 |
->addFieldToXmlObj($addressFieldset);
|
387 |
}
|
388 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Address/List.php
CHANGED
@@ -82,19 +82,15 @@ class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Templa
|
|
82 |
* @return array
|
83 |
*/
|
84 |
public function prepareAddressData(
|
85 |
-
Mage_Customer_Model_Address $address,
|
86 |
-
|
87 |
-
)
|
88 |
-
{
|
89 |
if (!$address) {
|
90 |
return array();
|
91 |
}
|
92 |
|
93 |
$attributes = Mage::helper('customer/address')->getAttributes();
|
94 |
|
95 |
-
$data = array(
|
96 |
-
'entity_id' => $address->getId()
|
97 |
-
);
|
98 |
|
99 |
foreach ($attributes as $attribute) {
|
100 |
/* @var $attribute Mage_Customer_Model_Attribute */
|
@@ -110,7 +106,7 @@ class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Templa
|
|
110 |
$dataModel = Mage_Customer_Model_Attribute_Data::factory($attribute, $address);
|
111 |
$value = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ONELINE);
|
112 |
if ($attribute->getFrontendInput() == 'multiline') {
|
113 |
-
$values
|
114 |
// explode lines
|
115 |
foreach ($values as $k => $v) {
|
116 |
$key = sprintf('%s%d', $attribute->getAttributeCode(), $k + 1);
|
@@ -122,9 +118,10 @@ class Mage_XmlConnect_Block_Customer_Address_List extends Mage_Core_Block_Templa
|
|
122 |
}
|
123 |
|
124 |
foreach ($data as $key => $value) {
|
125 |
-
if (
|
126 |
-
|
127 |
}
|
|
|
128 |
}
|
129 |
}
|
130 |
}
|
82 |
* @return array
|
83 |
*/
|
84 |
public function prepareAddressData(
|
85 |
+
Mage_Customer_Model_Address $address, Mage_XmlConnect_Model_Simplexml_Element $item
|
86 |
+
) {
|
|
|
|
|
87 |
if (!$address) {
|
88 |
return array();
|
89 |
}
|
90 |
|
91 |
$attributes = Mage::helper('customer/address')->getAttributes();
|
92 |
|
93 |
+
$data = array('entity_id' => $address->getId());
|
|
|
|
|
94 |
|
95 |
foreach ($attributes as $attribute) {
|
96 |
/* @var $attribute Mage_Customer_Model_Attribute */
|
106 |
$dataModel = Mage_Customer_Model_Attribute_Data::factory($attribute, $address);
|
107 |
$value = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ONELINE);
|
108 |
if ($attribute->getFrontendInput() == 'multiline') {
|
109 |
+
$values = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ARRAY);
|
110 |
// explode lines
|
111 |
foreach ($values as $k => $v) {
|
112 |
$key = sprintf('%s%d', $attribute->getAttributeCode(), $k + 1);
|
118 |
}
|
119 |
|
120 |
foreach ($data as $key => $value) {
|
121 |
+
if (empty($value)) {
|
122 |
+
continue;
|
123 |
}
|
124 |
+
$item->addChild($key, $item->escapeXml($value));
|
125 |
}
|
126 |
}
|
127 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Boolean.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Boolean
|
35 |
-
extends Mage_XmlConnect_Block_Customer_Form_Renderer_Select
|
36 |
{
|
37 |
/**
|
38 |
* Return array of select options
|
@@ -42,18 +41,9 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Boolean
|
|
42 |
public function getOptions()
|
43 |
{
|
44 |
return array(
|
45 |
-
array(
|
46 |
-
|
47 |
-
|
48 |
-
),
|
49 |
-
array(
|
50 |
-
'value' => '0',
|
51 |
-
'label' => Mage::helper('enterprise_customer')->__('No')
|
52 |
-
),
|
53 |
-
array(
|
54 |
-
'value' => '1',
|
55 |
-
'label' => Mage::helper('enterprise_customer')->__('Yes')
|
56 |
-
),
|
57 |
);
|
58 |
}
|
59 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Boolean extends Mage_XmlConnect_Block_Customer_Form_Renderer_Select
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Return array of select options
|
41 |
public function getOptions()
|
42 |
{
|
43 |
return array(
|
44 |
+
array('value' => '', 'label' => ''),
|
45 |
+
array('value' => '0', 'label' => Mage::helper('enterprise_customer')->__('No')),
|
46 |
+
array('value' => '1', 'label' => Mage::helper('enterprise_customer')->__('Yes'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
);
|
48 |
}
|
49 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Date.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Date
|
35 |
-
extends Enterprise_Customer_Block_Form_Renderer_Date
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
@@ -48,26 +47,22 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Date
|
|
48 |
*/
|
49 |
protected function _prepareValues()
|
50 |
{
|
51 |
-
return array(
|
52 |
-
'
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
),
|
58 |
-
'
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
),
|
64 |
-
'
|
65 |
-
|
66 |
-
|
67 |
-
'label' => $this->__('YYYY'),
|
68 |
-
'value' => $this->getYear()
|
69 |
-
)
|
70 |
-
);
|
71 |
}
|
72 |
|
73 |
/**
|
@@ -81,27 +76,19 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Date
|
|
81 |
$attributes = array(
|
82 |
'label' => $this->getLabel(),
|
83 |
'name' => $this->getFieldName(),
|
84 |
-
'format'
|
85 |
'value' => $this->_prepareValues()
|
86 |
);
|
87 |
|
88 |
$attributes += Mage::helper('xmlconnect/customer_form_renderer')
|
89 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
90 |
-
|
91 |
-
$fieldXmlObj = $fieldsetXmlObj->addField(
|
92 |
-
$this->getHtmlId('full'),
|
93 |
-
$this->_filedType,
|
94 |
-
$attributes
|
95 |
-
);
|
96 |
-
|
97 |
$validateRules = $this->getAttributeObject()->getValidateRules();
|
98 |
|
99 |
if (!empty($validateRules)) {
|
100 |
$validatorXmlObj = $fieldXmlObj->addValidator();
|
101 |
if (!empty($validateRules['input_validation'])) {
|
102 |
-
$validatorXmlObj->addRule(array
|
103 |
-
'type' => $validateRules['input_validation']
|
104 |
-
));
|
105 |
}
|
106 |
}
|
107 |
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Date extends Enterprise_Customer_Block_Form_Renderer_Date
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
47 |
*/
|
48 |
protected function _prepareValues()
|
49 |
{
|
50 |
+
return array('day' => array(
|
51 |
+
'id' => $this->getHtmlId('day'),
|
52 |
+
'title' => $this->__('Day'),
|
53 |
+
'label' => $this->__('DD'),
|
54 |
+
'value' => $this->getDay()
|
55 |
+
), 'month' => array(
|
56 |
+
'id' => $this->getHtmlId('month'),
|
57 |
+
'title' => $this->__('Month'),
|
58 |
+
'label' => $this->__('MM'),
|
59 |
+
'value' => $this->getMonth()
|
60 |
+
), 'year' => array(
|
61 |
+
'id' => $this->getHtmlId('year'),
|
62 |
+
'title' => $this->__('Year'),
|
63 |
+
'label' => $this->__('YYYY'),
|
64 |
+
'value' => $this->getYear()
|
65 |
+
));
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
|
68 |
/**
|
76 |
$attributes = array(
|
77 |
'label' => $this->getLabel(),
|
78 |
'name' => $this->getFieldName(),
|
79 |
+
'format'=> $this->getDateFormat(),
|
80 |
'value' => $this->_prepareValues()
|
81 |
);
|
82 |
|
83 |
$attributes += Mage::helper('xmlconnect/customer_form_renderer')
|
84 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
85 |
+
$fieldXmlObj = $fieldsetXmlObj->addField($this->getHtmlId('full'), $this->_filedType, $attributes);
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
$validateRules = $this->getAttributeObject()->getValidateRules();
|
87 |
|
88 |
if (!empty($validateRules)) {
|
89 |
$validatorXmlObj = $fieldXmlObj->addValidator();
|
90 |
if (!empty($validateRules['input_validation'])) {
|
91 |
+
$validatorXmlObj->addRule(array('type' => $validateRules['input_validation']));
|
|
|
|
|
92 |
}
|
93 |
}
|
94 |
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/File.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_File
|
35 |
-
extends Enterprise_Customer_Block_Form_Renderer_File
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
@@ -65,19 +64,13 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_File
|
|
65 |
$this->_setFormPostParams($fieldsetXmlObj);
|
66 |
|
67 |
$attributes = array(
|
68 |
-
'label' => $this->getLabel(),
|
69 |
-
'name' => $this->getFieldName(),
|
70 |
-
'value' => $this->getEscapedValue()
|
71 |
);
|
72 |
|
73 |
$attributes += Mage::helper('xmlconnect/customer_form_renderer')
|
74 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
75 |
|
76 |
-
$fieldXmlObj = $fieldsetXmlObj->addField(
|
77 |
-
$this->getHtmlId(),
|
78 |
-
$this->_filedType,
|
79 |
-
$attributes
|
80 |
-
);
|
81 |
$this->_addValidator($fieldXmlObj);
|
82 |
|
83 |
return $this;
|
@@ -98,19 +91,19 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_File
|
|
98 |
|
99 |
if (!empty($validateRules['max_file_size'])) {
|
100 |
$minTextLength = (int) $validateRules['max_file_size'];
|
101 |
-
$validatorXmlObj->addRule(array
|
102 |
-
'type'
|
103 |
-
'value'
|
104 |
-
'field_label'
|
105 |
));
|
106 |
}
|
107 |
|
108 |
if (!empty($validateRules['file_extensions'])) {
|
109 |
$maxTextLength = $validateRules['file_extensions'];
|
110 |
-
$validatorXmlObj->addRule(array
|
111 |
-
'type'
|
112 |
-
'value'
|
113 |
-
'field_label'
|
114 |
));
|
115 |
}
|
116 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_File extends Enterprise_Customer_Block_Form_Renderer_File
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
64 |
$this->_setFormPostParams($fieldsetXmlObj);
|
65 |
|
66 |
$attributes = array(
|
67 |
+
'label' => $this->getLabel(), 'name' => $this->getFieldName(), 'value' => $this->getEscapedValue()
|
|
|
|
|
68 |
);
|
69 |
|
70 |
$attributes += Mage::helper('xmlconnect/customer_form_renderer')
|
71 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
72 |
|
73 |
+
$fieldXmlObj = $fieldsetXmlObj->addField($this->getHtmlId(), $this->_filedType, $attributes);
|
|
|
|
|
|
|
|
|
74 |
$this->_addValidator($fieldXmlObj);
|
75 |
|
76 |
return $this;
|
91 |
|
92 |
if (!empty($validateRules['max_file_size'])) {
|
93 |
$minTextLength = (int) $validateRules['max_file_size'];
|
94 |
+
$validatorXmlObj->addRule(array(
|
95 |
+
'type' => 'max_file_size',
|
96 |
+
'value' => $minTextLength,
|
97 |
+
'field_label' => $this->getLabel()
|
98 |
));
|
99 |
}
|
100 |
|
101 |
if (!empty($validateRules['file_extensions'])) {
|
102 |
$maxTextLength = $validateRules['file_extensions'];
|
103 |
+
$validatorXmlObj->addRule(array(
|
104 |
+
'type' => 'file_extensions',
|
105 |
+
'value' => $maxTextLength,
|
106 |
+
'field_label' => $this->getLabel()
|
107 |
));
|
108 |
}
|
109 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Image.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Image
|
35 |
-
extends Mage_XmlConnect_Block_Customer_Form_Renderer_File
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
@@ -67,19 +66,15 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Image
|
|
67 |
|
68 |
if (!empty($validateRules['max_image_width'])) {
|
69 |
$minTextLength = (int) $validateRules['max_image_width'];
|
70 |
-
$validatorXmlObj->addRule(array
|
71 |
-
'type' => 'max_image_width',
|
72 |
-
'value' => $minTextLength,
|
73 |
-
'field_label' => $this->getLabel()
|
74 |
));
|
75 |
}
|
76 |
|
77 |
if (!empty($validateRules['max_image_heght'])) {
|
78 |
$maxTextLength = $validateRules['max_image_heght'];
|
79 |
-
$validatorXmlObj->addRule(array
|
80 |
-
'type' => 'max_image_height',
|
81 |
-
'value' => $maxTextLength,
|
82 |
-
'field_label' => $this->getLabel()
|
83 |
));
|
84 |
}
|
85 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Image extends Mage_XmlConnect_Block_Customer_Form_Renderer_File
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
66 |
|
67 |
if (!empty($validateRules['max_image_width'])) {
|
68 |
$minTextLength = (int) $validateRules['max_image_width'];
|
69 |
+
$validatorXmlObj->addRule(array(
|
70 |
+
'type' => 'max_image_width', 'value' => $minTextLength, 'field_label' => $this->getLabel()
|
|
|
|
|
71 |
));
|
72 |
}
|
73 |
|
74 |
if (!empty($validateRules['max_image_heght'])) {
|
75 |
$maxTextLength = $validateRules['max_image_heght'];
|
76 |
+
$validatorXmlObj->addRule(array(
|
77 |
+
'type' => 'max_image_height', 'value' => $maxTextLength, 'field_label' => $this->getLabel()
|
|
|
|
|
78 |
));
|
79 |
}
|
80 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Multiline.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Multiline
|
35 |
-
extends Enterprise_Customer_Block_Form_Renderer_Multiline
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
@@ -61,9 +60,7 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Multiline
|
|
61 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
62 |
|
63 |
$fieldXmlObj = $fieldsetXmlObj->addField(
|
64 |
-
$this->_filedType . '_' . $this->getHtmlId(),
|
65 |
-
$this->_filedType,
|
66 |
-
$attributes
|
67 |
);
|
68 |
|
69 |
$validateRules = $this->getAttributeObject()->getValidateRules();
|
@@ -73,24 +70,16 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Multiline
|
|
73 |
|
74 |
if (!empty($validateRules['min_text_length'])) {
|
75 |
$minTextLength = (int) $validateRules['min_text_length'];
|
76 |
-
$validatorXmlObj->addRule(array
|
77 |
-
'type' => 'min_length',
|
78 |
-
'value' => $minTextLength,
|
79 |
-
));
|
80 |
}
|
81 |
|
82 |
if (!empty($validateRules['max_text_length'])) {
|
83 |
$maxTextLength = (int) $validateRules['max_text_length'];
|
84 |
-
$validatorXmlObj->addRule(array
|
85 |
-
'type' => 'max_length',
|
86 |
-
'value' => $maxTextLength
|
87 |
-
));
|
88 |
}
|
89 |
|
90 |
if (!empty($validateRules['input_validation'])) {
|
91 |
-
$validatorXmlObj->addRule(array
|
92 |
-
'type' => $validateRules['input_validation']
|
93 |
-
));
|
94 |
}
|
95 |
}
|
96 |
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Multiline extends Enterprise_Customer_Block_Form_Renderer_Multiline
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
60 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
61 |
|
62 |
$fieldXmlObj = $fieldsetXmlObj->addField(
|
63 |
+
$this->_filedType . '_' . $this->getHtmlId(), $this->_filedType, $attributes
|
|
|
|
|
64 |
);
|
65 |
|
66 |
$validateRules = $this->getAttributeObject()->getValidateRules();
|
70 |
|
71 |
if (!empty($validateRules['min_text_length'])) {
|
72 |
$minTextLength = (int) $validateRules['min_text_length'];
|
73 |
+
$validatorXmlObj->addRule(array('type' => 'min_length', 'value' => $minTextLength));
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
if (!empty($validateRules['max_text_length'])) {
|
77 |
$maxTextLength = (int) $validateRules['max_text_length'];
|
78 |
+
$validatorXmlObj->addRule(array('type' => 'max_length', 'value' => $maxTextLength));
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
if (!empty($validateRules['input_validation'])) {
|
82 |
+
$validatorXmlObj->addRule(array('type' => $validateRules['input_validation']));
|
|
|
|
|
83 |
}
|
84 |
}
|
85 |
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Select.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Select
|
35 |
-
extends Enterprise_Customer_Block_Form_Renderer_Select
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Select extends Enterprise_Customer_Block_Form_Renderer_Select
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Text.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
35 |
-
extends Enterprise_Customer_Block_Form_Renderer_Text
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
@@ -47,24 +46,16 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
|
47 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $fieldsetXmlObj
|
48 |
* @return Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
49 |
*/
|
50 |
-
public function addFieldToXmlObj(
|
51 |
-
Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $fieldsetXmlObj
|
52 |
-
)
|
53 |
{
|
54 |
$attributes = array(
|
55 |
-
'label' => $this->getLabel(),
|
56 |
-
'name' => $this->getFieldName(),
|
57 |
-
'value' => $this->getEscapedValue()
|
58 |
);
|
59 |
|
60 |
$attributes += Mage::helper('xmlconnect/customer_form_renderer')
|
61 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
62 |
|
63 |
-
$fieldXmlObj = $fieldsetXmlObj->addField(
|
64 |
-
$this->getHtmlId(),
|
65 |
-
$this->_filedType,
|
66 |
-
$attributes
|
67 |
-
);
|
68 |
|
69 |
$validateRules = $this->getAttributeObject()->getValidateRules();
|
70 |
|
@@ -73,24 +64,16 @@ class Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
|
73 |
|
74 |
if (!empty($validateRules['min_text_length'])) {
|
75 |
$minTextLength = (int) $validateRules['min_text_length'];
|
76 |
-
$validatorXmlObj->addRule(array
|
77 |
-
'type' => 'min_length',
|
78 |
-
'value' => $minTextLength,
|
79 |
-
));
|
80 |
}
|
81 |
|
82 |
if (!empty($validateRules['max_text_length'])) {
|
83 |
$maxTextLength = (int) $validateRules['max_text_length'];
|
84 |
-
$validatorXmlObj->addRule(array
|
85 |
-
'type' => 'max_length',
|
86 |
-
'value' => $maxTextLength
|
87 |
-
));
|
88 |
}
|
89 |
|
90 |
if (!empty($validateRules['input_validation'])) {
|
91 |
-
$validatorXmlObj->addRule(array
|
92 |
-
'type' => $validateRules['input_validation']
|
93 |
-
));
|
94 |
}
|
95 |
}
|
96 |
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Text extends Enterprise_Customer_Block_Form_Renderer_Text
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
46 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $fieldsetXmlObj
|
47 |
* @return Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
48 |
*/
|
49 |
+
public function addFieldToXmlObj(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $fieldsetXmlObj)
|
|
|
|
|
50 |
{
|
51 |
$attributes = array(
|
52 |
+
'label' => $this->getLabel(), 'name' => $this->getFieldName(), 'value' => $this->getEscapedValue()
|
|
|
|
|
53 |
);
|
54 |
|
55 |
$attributes += Mage::helper('xmlconnect/customer_form_renderer')
|
56 |
->addTitleAndRequiredAttr($fieldsetXmlObj, $this);
|
57 |
|
58 |
+
$fieldXmlObj = $fieldsetXmlObj->addField($this->getHtmlId(), $this->_filedType, $attributes);
|
|
|
|
|
|
|
|
|
59 |
|
60 |
$validateRules = $this->getAttributeObject()->getValidateRules();
|
61 |
|
64 |
|
65 |
if (!empty($validateRules['min_text_length'])) {
|
66 |
$minTextLength = (int) $validateRules['min_text_length'];
|
67 |
+
$validatorXmlObj->addRule(array('type' => 'min_length', 'value' => $minTextLength));
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
if (!empty($validateRules['max_text_length'])) {
|
71 |
$maxTextLength = (int) $validateRules['max_text_length'];
|
72 |
+
$validatorXmlObj->addRule(array('type' => 'max_length', 'value' => $maxTextLength));
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
if (!empty($validateRules['input_validation'])) {
|
76 |
+
$validatorXmlObj->addRule(array('type' => $validateRules['input_validation']));
|
|
|
|
|
77 |
}
|
78 |
}
|
79 |
|
app/code/core/Mage/XmlConnect/Block/Customer/Form/Renderer/Textarea.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Form_Renderer_Textarea
|
35 |
-
extends Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
36 |
{
|
37 |
/**
|
38 |
* Field type
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Form_Renderer_Textarea extends Mage_XmlConnect_Block_Customer_Form_Renderer_Text
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Field type
|
app/code/core/Mage/XmlConnect/Block/Customer/GiftcardCheck.php
CHANGED
@@ -43,10 +43,7 @@ class Mage_XmlConnect_Block_Customer_GiftcardCheck extends Enterprise_GiftCardAc
|
|
43 |
$card = $this->getCard();
|
44 |
if ($card->getId()) {
|
45 |
/** @var $xmlModel Mage_XmlConnect_Model_Simplexml_Element */
|
46 |
-
$xmlModel = Mage::getModel(
|
47 |
-
'xmlconnect/simplexml_element',
|
48 |
-
'<gift_card_account></gift_card_account>'
|
49 |
-
);
|
50 |
|
51 |
$balance = Mage::helper('core')->currency($card->getBalance(), true, false);
|
52 |
|
@@ -58,20 +55,9 @@ class Mage_XmlConnect_Block_Customer_GiftcardCheck extends Enterprise_GiftCardAc
|
|
58 |
}
|
59 |
$xmlModel->addCustomChild('info', implode(PHP_EOL, $result));
|
60 |
} else {
|
61 |
-
$xmlModel = Mage::getModel(
|
62 |
-
|
63 |
-
|
64 |
-
);
|
65 |
-
|
66 |
-
$xmlModel->addCustomChild(
|
67 |
-
'status',
|
68 |
-
Mage_XmlConnect_Controller_Action::MESSAGE_STATUS_ERROR
|
69 |
-
);
|
70 |
-
|
71 |
-
$xmlModel->addCustomChild(
|
72 |
-
'text',
|
73 |
-
$this->__('Wrong or expired Gift Card Code.')
|
74 |
-
);
|
75 |
}
|
76 |
|
77 |
return $xmlModel->asNiceXml();
|
43 |
$card = $this->getCard();
|
44 |
if ($card->getId()) {
|
45 |
/** @var $xmlModel Mage_XmlConnect_Model_Simplexml_Element */
|
46 |
+
$xmlModel = Mage::getModel('xmlconnect/simplexml_element', '<gift_card_account></gift_card_account>');
|
|
|
|
|
|
|
47 |
|
48 |
$balance = Mage::helper('core')->currency($card->getBalance(), true, false);
|
49 |
|
55 |
}
|
56 |
$xmlModel->addCustomChild('info', implode(PHP_EOL, $result));
|
57 |
} else {
|
58 |
+
$xmlModel = Mage::getModel('xmlconnect/simplexml_element', '<message></message>');
|
59 |
+
$xmlModel->addCustomChild('status', Mage_XmlConnect_Controller_Action::MESSAGE_STATUS_ERROR);
|
60 |
+
$xmlModel->addCustomChild('text', $this->__('Wrong or expired Gift Card Code.'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
return $xmlModel->asNiceXml();
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Details.php
CHANGED
@@ -50,17 +50,8 @@ class Mage_XmlConnect_Block_Customer_Order_Details extends Mage_Payment_Block_In
|
|
50 |
* - 'free' => Mage_Payment_Block_Info
|
51 |
*/
|
52 |
protected $_methodArray = array(
|
53 |
-
'ccsave',
|
54 |
-
'
|
55 |
-
'purchaseorder',
|
56 |
-
'authorizenet',
|
57 |
-
'pbridge_authorizenet',
|
58 |
-
'pbridge_verisign',
|
59 |
-
'paypal_express',
|
60 |
-
'paypal_mecl',
|
61 |
-
'pbridge_paypal_direct',
|
62 |
-
'pbridge_paypaluk_direct',
|
63 |
-
'free'
|
64 |
);
|
65 |
|
66 |
/**
|
@@ -76,17 +67,13 @@ class Mage_XmlConnect_Block_Customer_Order_Details extends Mage_Payment_Block_In
|
|
76 |
$order = $this->_getOrder();
|
77 |
|
78 |
$orderDate = $this->formatDate($order->getCreatedAtStoreDate(), 'long');
|
79 |
-
$orderXmlObj->addCustomChild(
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
'label' => $this->__('Order #%s - %s', $order->getRealOrderId(), $order->getStatusLabel()),
|
84 |
-
'order_date' => $this->__('Order Date: %s', $orderDate)
|
85 |
-
)
|
86 |
-
);
|
87 |
if (!$order->getIsVirtual()) {
|
88 |
-
$shipping =
|
89 |
-
$billing =
|
90 |
|
91 |
$orderXmlObj->addCustomChild('shipping_address', $shipping);
|
92 |
$orderXmlObj->addCustomChild('billing_address', $billing);
|
@@ -154,9 +141,7 @@ class Mage_XmlConnect_Block_Customer_Order_Details extends Mage_Payment_Block_In
|
|
154 |
if (!empty($specificInfo)) {
|
155 |
foreach ($specificInfo as $label => $value) {
|
156 |
if ($value) {
|
157 |
-
$paymentNode->addCustomChild(
|
158 |
-
'item',
|
159 |
-
implode($this->getValueAsArray($value, true), PHP_EOL),
|
160 |
array('label' => $label)
|
161 |
);
|
162 |
}
|
@@ -185,6 +170,7 @@ class Mage_XmlConnect_Block_Customer_Order_Details extends Mage_Payment_Block_In
|
|
185 |
/**
|
186 |
* Format address string
|
187 |
*
|
|
|
188 |
* @param string $address
|
189 |
* @return string
|
190 |
*/
|
@@ -192,7 +178,7 @@ class Mage_XmlConnect_Block_Customer_Order_Details extends Mage_Payment_Block_In
|
|
192 |
{
|
193 |
return preg_replace(
|
194 |
array('@\r@', '@\n+@'),
|
195 |
-
array('',
|
196 |
$address
|
197 |
);
|
198 |
}
|
50 |
* - 'free' => Mage_Payment_Block_Info
|
51 |
*/
|
52 |
protected $_methodArray = array(
|
53 |
+
'ccsave', 'checkmo', 'purchaseorder', 'authorizenet', 'pbridge_authorizenet', 'pbridge_verisign',
|
54 |
+
'paypal_express', 'paypal_mecl', 'pbridge_paypal_direct', 'pbridge_paypaluk_direct', 'free'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
);
|
56 |
|
57 |
/**
|
67 |
$order = $this->_getOrder();
|
68 |
|
69 |
$orderDate = $this->formatDate($order->getCreatedAtStoreDate(), 'long');
|
70 |
+
$orderXmlObj->addCustomChild('order', null, array(
|
71 |
+
'label' => $this->__('Order #%s - %s', $order->getRealOrderId(), $order->getStatusLabel()),
|
72 |
+
'order_date' => $this->__('Order Date: %s', $orderDate)
|
73 |
+
));
|
|
|
|
|
|
|
|
|
74 |
if (!$order->getIsVirtual()) {
|
75 |
+
$shipping = Mage::helper('xmlconnect')->trimLineBreaks($order->getShippingAddress()->format('text'));
|
76 |
+
$billing = Mage::helper('xmlconnect')->trimLineBreaks($order->getBillingAddress()->format('text'));
|
77 |
|
78 |
$orderXmlObj->addCustomChild('shipping_address', $shipping);
|
79 |
$orderXmlObj->addCustomChild('billing_address', $billing);
|
141 |
if (!empty($specificInfo)) {
|
142 |
foreach ($specificInfo as $label => $value) {
|
143 |
if ($value) {
|
144 |
+
$paymentNode->addCustomChild('item', implode($this->getValueAsArray($value, true), '\n'),
|
|
|
|
|
145 |
array('label' => $label)
|
146 |
);
|
147 |
}
|
170 |
/**
|
171 |
* Format address string
|
172 |
*
|
173 |
+
* @deprecated after 1.6.0.0
|
174 |
* @param string $address
|
175 |
* @return string
|
176 |
*/
|
178 |
{
|
179 |
return preg_replace(
|
180 |
array('@\r@', '@\n+@'),
|
181 |
+
array('', '\n'),
|
182 |
$address
|
183 |
);
|
184 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Bundle.php
CHANGED
@@ -31,21 +31,19 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle
|
35 |
-
extends Mage_Bundle_Block_Sales_Order_Items_Renderer
|
36 |
{
|
37 |
/**
|
38 |
* Add item to XML object
|
39 |
* (get from template: bundle/sales/order/items/renderer.phtml)
|
40 |
*
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
45 |
{
|
46 |
/** @var $parentItem Mage_Sales_Model_Order_Item */
|
47 |
$parentItem = $this->getItem();
|
48 |
-
|
49 |
$items = array_merge(array($parentItem), $parentItem->getChildrenItems());
|
50 |
$_prevOptionId = '';
|
51 |
|
@@ -72,10 +70,10 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle
|
|
72 |
&& $this->getWeeeTaxAppliedAmount();
|
73 |
|
74 |
$this->setTypesOfDisplay(array(
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
));
|
80 |
$this->setWeeeTaxes($weeeHelper->getApplied($parentItem));
|
81 |
|
@@ -129,11 +127,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle
|
|
129 |
// Price including tax
|
130 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
|
131 |
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
132 |
-
$this,
|
133 |
-
$parentItem,
|
134 |
-
$priceXml,
|
135 |
-
$subtotalXml,
|
136 |
-
true
|
137 |
);
|
138 |
}
|
139 |
}
|
@@ -145,54 +139,38 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle
|
|
145 |
) {
|
146 |
$qtyXml = $objectXml->addChild('qty');
|
147 |
if ($item->getQtyOrdered() > 0) {
|
148 |
-
$qtyXml->addCustomChild(
|
149 |
-
'
|
150 |
-
|
151 |
-
array('label' => Mage::helper('sales')->__('Ordered'))
|
152 |
-
);
|
153 |
}
|
154 |
if ($item->getQtyShipped() > 0 && !$this->isShipmentSeparately()) {
|
155 |
-
$qtyXml->addCustomChild(
|
156 |
-
'
|
157 |
-
|
158 |
-
array('label' => Mage::helper('sales')->__('Shipped'))
|
159 |
-
);
|
160 |
}
|
161 |
if ($item->getQtyCanceled() > 0) {
|
162 |
-
$qtyXml->addCustomChild(
|
163 |
-
'
|
164 |
-
|
165 |
-
array('label' => Mage::helper('sales')->__('Canceled'))
|
166 |
-
);
|
167 |
}
|
168 |
if ($item->getQtyRefunded() > 0) {
|
169 |
-
$qtyXml->addCustomChild(
|
170 |
-
'
|
171 |
-
|
172 |
-
array('label' => Mage::helper('sales')->__('Refunded'))
|
173 |
-
);
|
174 |
}
|
175 |
} elseif ($item->getQtyShipped() > 0 && $isOption && $this->isShipmentSeparately()) {
|
176 |
$qtyXml = $objectXml->addChild('qty');
|
177 |
-
$qtyXml->addCustomChild(
|
178 |
-
'
|
179 |
-
|
180 |
-
array('label' => Mage::helper('sales')->__('Shipped'))
|
181 |
-
);
|
182 |
}
|
183 |
}
|
184 |
|
185 |
if ($parentItem->getDescription()) {
|
186 |
-
$itemXml->addCustomChild(
|
187 |
-
'description',
|
188 |
-
$parentItem->getDescription()
|
189 |
-
);
|
190 |
}
|
191 |
|
192 |
-
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml(
|
193 |
-
$this,
|
194 |
-
$itemXml
|
195 |
-
);
|
196 |
}
|
197 |
|
198 |
/**
|
@@ -205,9 +183,8 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle
|
|
205 |
{
|
206 |
$attributes = $this->getSelectionAttributes($item);
|
207 |
if ($attributes) {
|
208 |
-
return sprintf('%d', $attributes['qty']) . ' x '
|
209 |
-
. $
|
210 |
-
. ' - ' . $this->_formatPrice($attributes['price']);
|
211 |
} else {
|
212 |
return $item->getName();
|
213 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Bundle extends Mage_Bundle_Block_Sales_Order_Items_Renderer
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add item to XML object
|
38 |
* (get from template: bundle/sales/order/items/renderer.phtml)
|
39 |
*
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
41 |
+
* @return null
|
42 |
*/
|
43 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
44 |
{
|
45 |
/** @var $parentItem Mage_Sales_Model_Order_Item */
|
46 |
$parentItem = $this->getItem();
|
|
|
47 |
$items = array_merge(array($parentItem), $parentItem->getChildrenItems());
|
48 |
$_prevOptionId = '';
|
49 |
|
70 |
&& $this->getWeeeTaxAppliedAmount();
|
71 |
|
72 |
$this->setTypesOfDisplay(array(
|
73 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_1 => $typeOfDisplay1,
|
74 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_2 => $typeOfDisplay2,
|
75 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_4 => $typeOfDisplay4,
|
76 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_14 => $typeOfDisplay014,
|
77 |
));
|
78 |
$this->setWeeeTaxes($weeeHelper->getApplied($parentItem));
|
79 |
|
127 |
// Price including tax
|
128 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
|
129 |
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
130 |
+
$this, $parentItem, $priceXml, $subtotalXml, true
|
|
|
|
|
|
|
|
|
131 |
);
|
132 |
}
|
133 |
}
|
139 |
) {
|
140 |
$qtyXml = $objectXml->addChild('qty');
|
141 |
if ($item->getQtyOrdered() > 0) {
|
142 |
+
$qtyXml->addCustomChild('value', $item->getQtyOrdered() * 1, array(
|
143 |
+
'label' => Mage::helper('sales')->__('Ordered')
|
144 |
+
));
|
|
|
|
|
145 |
}
|
146 |
if ($item->getQtyShipped() > 0 && !$this->isShipmentSeparately()) {
|
147 |
+
$qtyXml->addCustomChild('value', $item->getQtyShipped() * 1, array(
|
148 |
+
'label' => Mage::helper('sales')->__('Shipped')
|
149 |
+
));
|
|
|
|
|
150 |
}
|
151 |
if ($item->getQtyCanceled() > 0) {
|
152 |
+
$qtyXml->addCustomChild('value', $item->getQtyCanceled() * 1, array(
|
153 |
+
'label' => Mage::helper('sales')->__('Canceled')
|
154 |
+
));
|
|
|
|
|
155 |
}
|
156 |
if ($item->getQtyRefunded() > 0) {
|
157 |
+
$qtyXml->addCustomChild('value', $item->getQtyRefunded() * 1, array(
|
158 |
+
'label' => Mage::helper('sales')->__('Refunded')
|
159 |
+
));
|
|
|
|
|
160 |
}
|
161 |
} elseif ($item->getQtyShipped() > 0 && $isOption && $this->isShipmentSeparately()) {
|
162 |
$qtyXml = $objectXml->addChild('qty');
|
163 |
+
$qtyXml->addCustomChild('value', $item->getQtyShipped() * 1, array(
|
164 |
+
'label' => Mage::helper('sales')->__('Shipped')
|
165 |
+
));
|
|
|
|
|
166 |
}
|
167 |
}
|
168 |
|
169 |
if ($parentItem->getDescription()) {
|
170 |
+
$itemXml->addCustomChild('description', $parentItem->getDescription());
|
|
|
|
|
|
|
171 |
}
|
172 |
|
173 |
+
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
|
|
|
|
|
|
174 |
}
|
175 |
|
176 |
/**
|
183 |
{
|
184 |
$attributes = $this->getSelectionAttributes($item);
|
185 |
if ($attributes) {
|
186 |
+
return sprintf('%d', $attributes['qty']) . ' x ' . $item->getName() . ' - '
|
187 |
+
. $this->_formatPrice($attributes['price']);
|
|
|
188 |
} else {
|
189 |
return $item->getName();
|
190 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Default.php
CHANGED
@@ -31,15 +31,14 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Default
|
35 |
-
extends Mage_Sales_Block_Order_Item_Renderer_Default
|
36 |
{
|
37 |
/**
|
38 |
* Add item to XML object
|
39 |
* (get from template: sales/order/items/renderer/default.phtml)
|
40 |
*
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
45 |
{
|
@@ -47,13 +46,9 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Default
|
|
47 |
$item = $this->getItem();
|
48 |
|
49 |
/** @var $itemXml Mage_XmlConnect_Model_Simplexml_Element */
|
50 |
-
$itemXml = $orderItemXmlObj->addCustomChild(
|
51 |
-
'item
|
52 |
-
|
53 |
-
array(
|
54 |
-
'product_id' => $item->getProductId()
|
55 |
-
)
|
56 |
-
);
|
57 |
$itemXml->addCustomChild('name', $item->getName());
|
58 |
|
59 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
@@ -61,10 +56,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Default
|
|
61 |
/** @var $taxHelper Mage_Tax_Helper_Data */
|
62 |
$taxHelper = $this->helper('tax');
|
63 |
|
64 |
-
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml(
|
65 |
-
$this,
|
66 |
-
$itemXml
|
67 |
-
);
|
68 |
|
69 |
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
|
70 |
if ($addtInfoBlock) {
|
@@ -89,10 +81,10 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Default
|
|
89 |
&& $this->getWeeeTaxAppliedAmount();
|
90 |
|
91 |
$this->setTypesOfDisplay(array(
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
));
|
97 |
$this->setWeeeTaxes($weeeHelper->getApplied($item));
|
98 |
|
@@ -100,33 +92,20 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Default
|
|
100 |
$priceXml = $itemXml->addChild('price');
|
101 |
|
102 |
// Quantity: Ordered, Shipped, Cancelled, Refunded
|
103 |
-
Mage::helper('xmlconnect/customer_order')->addQuantityToXml(
|
104 |
-
$this,
|
105 |
-
$itemXml->addChild('qty'),
|
106 |
-
$item
|
107 |
-
);
|
108 |
|
109 |
/** @var $subtotalXml Mage_XmlConnect_Model_Simplexml_Element */
|
110 |
$subtotalXml = $itemXml->addChild('subtotal');
|
111 |
|
112 |
// Price & subtotal - excluding tax
|
113 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceExclTax()) {
|
114 |
-
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
115 |
-
$this,
|
116 |
-
$item,
|
117 |
-
$priceXml,
|
118 |
-
$subtotalXml
|
119 |
-
);
|
120 |
}
|
121 |
|
122 |
// Price & subtotal - including tax
|
123 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
|
124 |
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
125 |
-
$this,
|
126 |
-
$item,
|
127 |
-
$priceXml,
|
128 |
-
$subtotalXml,
|
129 |
-
true
|
130 |
);
|
131 |
}
|
132 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Add item to XML object
|
38 |
* (get from template: sales/order/items/renderer/default.phtml)
|
39 |
*
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
41 |
+
* @return null
|
42 |
*/
|
43 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
44 |
{
|
46 |
$item = $this->getItem();
|
47 |
|
48 |
/** @var $itemXml Mage_XmlConnect_Model_Simplexml_Element */
|
49 |
+
$itemXml = $orderItemXmlObj->addCustomChild('item', null, array(
|
50 |
+
'product_id' => $item->getProductId()
|
51 |
+
));
|
|
|
|
|
|
|
|
|
52 |
$itemXml->addCustomChild('name', $item->getName());
|
53 |
|
54 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
56 |
/** @var $taxHelper Mage_Tax_Helper_Data */
|
57 |
$taxHelper = $this->helper('tax');
|
58 |
|
59 |
+
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
|
|
|
|
|
|
60 |
|
61 |
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
|
62 |
if ($addtInfoBlock) {
|
81 |
&& $this->getWeeeTaxAppliedAmount();
|
82 |
|
83 |
$this->setTypesOfDisplay(array(
|
84 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_1 => $typeOfDisplay1,
|
85 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_2 => $typeOfDisplay2,
|
86 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_4 => $typeOfDisplay4,
|
87 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_14 => $typeOfDisplay014,
|
88 |
));
|
89 |
$this->setWeeeTaxes($weeeHelper->getApplied($item));
|
90 |
|
92 |
$priceXml = $itemXml->addChild('price');
|
93 |
|
94 |
// Quantity: Ordered, Shipped, Cancelled, Refunded
|
95 |
+
Mage::helper('xmlconnect/customer_order')->addQuantityToXml($this, $itemXml->addChild('qty'), $item);
|
|
|
|
|
|
|
|
|
96 |
|
97 |
/** @var $subtotalXml Mage_XmlConnect_Model_Simplexml_Element */
|
98 |
$subtotalXml = $itemXml->addChild('subtotal');
|
99 |
|
100 |
// Price & subtotal - excluding tax
|
101 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceExclTax()) {
|
102 |
+
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml($this, $item, $priceXml, $subtotalXml);
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
// Price & subtotal - including tax
|
106 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
|
107 |
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
108 |
+
$this, $item, $priceXml, $subtotalXml, true
|
|
|
|
|
|
|
|
|
109 |
);
|
110 |
}
|
111 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Downloadable.php
CHANGED
@@ -39,7 +39,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
39 |
* (get from template: downloadable/sales/order/items/renderer/downloadable.phtml)
|
40 |
*
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
45 |
{
|
@@ -47,13 +47,9 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
47 |
$item = $this->getItem();
|
48 |
|
49 |
/** @var $itemXml Mage_XmlConnect_Model_Simplexml_Element */
|
50 |
-
$itemXml = $orderItemXmlObj->addCustomChild(
|
51 |
-
'item
|
52 |
-
|
53 |
-
array(
|
54 |
-
'product_id' => $item->getProductId()
|
55 |
-
)
|
56 |
-
);
|
57 |
$itemXml->addCustomChild('name', $item->getName());
|
58 |
|
59 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
@@ -61,10 +57,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
61 |
/** @var $taxHelper Mage_Tax_Helper_Data */
|
62 |
$taxHelper = $this->helper('tax');
|
63 |
|
64 |
-
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml(
|
65 |
-
$this,
|
66 |
-
$itemXml
|
67 |
-
);
|
68 |
|
69 |
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
|
70 |
if ($addtInfoBlock) {
|
@@ -74,16 +67,9 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
74 |
|
75 |
$links = $this->getLinks();
|
76 |
if ($links) {
|
77 |
-
$linksXml = $itemXml->addCustomChild(
|
78 |
-
'links',
|
79 |
-
null,
|
80 |
-
array('label' => $this->getLinksTitle())
|
81 |
-
);
|
82 |
foreach ($links->getPurchasedItems() as $link) {
|
83 |
-
$linksXml->addCustomChild(
|
84 |
-
'link',
|
85 |
-
$link->getLinkTitle()
|
86 |
-
);
|
87 |
}
|
88 |
}
|
89 |
|
@@ -95,11 +81,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
95 |
$priceXml = $itemXml->addChild('price');
|
96 |
|
97 |
// Quantity: Ordered, Shipped, Cancelled, Refunded
|
98 |
-
Mage::helper('xmlconnect/customer_order')->addQuantityToXml(
|
99 |
-
$this,
|
100 |
-
$itemXml->addChild('qty'),
|
101 |
-
$item
|
102 |
-
);
|
103 |
|
104 |
/** @var $subtotalXml Mage_XmlConnect_Model_Simplexml_Element */
|
105 |
$subtotalXml = $itemXml->addChild('subtotal');
|
@@ -117,10 +99,10 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
117 |
&& $this->getWeeeTaxAppliedAmount();
|
118 |
|
119 |
$this->setTypesOfDisplay(array(
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
));
|
125 |
$this->setWeeeTaxes($weeeHelper->getApplied($item));
|
126 |
|
@@ -137,11 +119,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Downloadable
|
|
137 |
// Price & subtotal - including tax
|
138 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
|
139 |
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
140 |
-
$this,
|
141 |
-
$item,
|
142 |
-
$priceXml,
|
143 |
-
$subtotalXml,
|
144 |
-
true
|
145 |
);
|
146 |
}
|
147 |
}
|
39 |
* (get from template: downloadable/sales/order/items/renderer/downloadable.phtml)
|
40 |
*
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
42 |
+
* @return null
|
43 |
*/
|
44 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
45 |
{
|
47 |
$item = $this->getItem();
|
48 |
|
49 |
/** @var $itemXml Mage_XmlConnect_Model_Simplexml_Element */
|
50 |
+
$itemXml = $orderItemXmlObj->addCustomChild('item', null, array(
|
51 |
+
'product_id' => $item->getProductId()
|
52 |
+
));
|
|
|
|
|
|
|
|
|
53 |
$itemXml->addCustomChild('name', $item->getName());
|
54 |
|
55 |
/** @var $weeeHelper Mage_Weee_Helper_Data */
|
57 |
/** @var $taxHelper Mage_Tax_Helper_Data */
|
58 |
$taxHelper = $this->helper('tax');
|
59 |
|
60 |
+
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
|
|
|
|
|
|
|
61 |
|
62 |
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
|
63 |
if ($addtInfoBlock) {
|
67 |
|
68 |
$links = $this->getLinks();
|
69 |
if ($links) {
|
70 |
+
$linksXml = $itemXml->addCustomChild('links', null, array('label' => $this->getLinksTitle()));
|
|
|
|
|
|
|
|
|
71 |
foreach ($links->getPurchasedItems() as $link) {
|
72 |
+
$linksXml->addCustomChild('link', $link->getLinkTitle());
|
|
|
|
|
|
|
73 |
}
|
74 |
}
|
75 |
|
81 |
$priceXml = $itemXml->addChild('price');
|
82 |
|
83 |
// Quantity: Ordered, Shipped, Cancelled, Refunded
|
84 |
+
Mage::helper('xmlconnect/customer_order')->addQuantityToXml($this, $itemXml->addChild('qty'), $item);
|
|
|
|
|
|
|
|
|
85 |
|
86 |
/** @var $subtotalXml Mage_XmlConnect_Model_Simplexml_Element */
|
87 |
$subtotalXml = $itemXml->addChild('subtotal');
|
99 |
&& $this->getWeeeTaxAppliedAmount();
|
100 |
|
101 |
$this->setTypesOfDisplay(array(
|
102 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_1 => $typeOfDisplay1,
|
103 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_2 => $typeOfDisplay2,
|
104 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_4 => $typeOfDisplay4,
|
105 |
+
Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_14 => $typeOfDisplay014,
|
106 |
));
|
107 |
$this->setWeeeTaxes($weeeHelper->getApplied($item));
|
108 |
|
119 |
// Price & subtotal - including tax
|
120 |
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
|
121 |
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml(
|
122 |
+
$this, $item, $priceXml, $subtotalXml, true
|
|
|
|
|
|
|
|
|
123 |
);
|
124 |
}
|
125 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Giftcard.php
CHANGED
@@ -65,7 +65,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Giftcard
|
|
65 |
* (get from template: sales/order/items/renderer/default.phtml)
|
66 |
*
|
67 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
68 |
-
* @return
|
69 |
*/
|
70 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
71 |
{
|
65 |
* (get from template: sales/order/items/renderer/default.phtml)
|
66 |
*
|
67 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
68 |
+
* @return null
|
69 |
*/
|
70 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
71 |
{
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Item/Renderer/Grouped.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Grouped
|
35 |
-
extends Mage_Sales_Block_Order_Item_Renderer_Grouped
|
36 |
{
|
37 |
/**
|
38 |
* Default product type
|
@@ -44,7 +43,7 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Grouped
|
|
44 |
* (get from template: sales/order/items/renderer/default.phtml)
|
45 |
*
|
46 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
47 |
-
* @return
|
48 |
*/
|
49 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
50 |
{
|
@@ -56,7 +55,6 @@ class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Grouped
|
|
56 |
}
|
57 |
$renderer = $this->getRenderedBlock()->getItemRenderer($productType);
|
58 |
$renderer->setItem($this->getItem());
|
59 |
-
|
60 |
$renderer->addItemToXmlObject($orderItemXmlObj);
|
61 |
}
|
62 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Customer_Order_Item_Renderer_Grouped extends Mage_Sales_Block_Order_Item_Renderer_Grouped
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Default product type
|
43 |
* (get from template: sales/order/items/renderer/default.phtml)
|
44 |
*
|
45 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
|
46 |
+
* @return null
|
47 |
*/
|
48 |
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
|
49 |
{
|
55 |
}
|
56 |
$renderer = $this->getRenderedBlock()->getItemRenderer($productType);
|
57 |
$renderer->setItem($this->getItem());
|
|
|
58 |
$renderer->addItemToXmlObject($orderItemXmlObj);
|
59 |
}
|
60 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Items.php
CHANGED
@@ -56,8 +56,7 @@ class Mage_XmlConnect_Block_Customer_Order_Items extends Mage_Sales_Block_Order_
|
|
56 |
|
57 |
if (is_null($this->_itemRenders[$type]['renderer'])) {
|
58 |
$this->_itemRenders[$type]['renderer'] = $this->getLayout()
|
59 |
-
->createBlock($this->_itemRenders[$type]['block'])
|
60 |
-
->setRenderedBlock($this);
|
61 |
}
|
62 |
return $this->_itemRenders[$type]['renderer'];
|
63 |
}
|
@@ -67,7 +66,7 @@ class Mage_XmlConnect_Block_Customer_Order_Items extends Mage_Sales_Block_Order_
|
|
67 |
* (get from template: sales/order/items.phtml)
|
68 |
*
|
69 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj
|
70 |
-
* @return
|
71 |
*/
|
72 |
public function addItemsToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj)
|
73 |
{
|
56 |
|
57 |
if (is_null($this->_itemRenders[$type]['renderer'])) {
|
58 |
$this->_itemRenders[$type]['renderer'] = $this->getLayout()
|
59 |
+
->createBlock($this->_itemRenders[$type]['block'])->setRenderedBlock($this);
|
|
|
60 |
}
|
61 |
return $this->_itemRenders[$type]['renderer'];
|
62 |
}
|
66 |
* (get from template: sales/order/items.phtml)
|
67 |
*
|
68 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj
|
69 |
+
* @return null
|
70 |
*/
|
71 |
public function addItemsToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj)
|
72 |
{
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/List.php
CHANGED
@@ -47,19 +47,13 @@ class Mage_XmlConnect_Block_Customer_Order_List extends Mage_Core_Block_Template
|
|
47 |
{
|
48 |
$ordersXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<orders></orders>');
|
49 |
|
50 |
-
$orders = Mage::getResourceModel('sales/order_collection')
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'state',
|
58 |
-
array(
|
59 |
-
'in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()
|
60 |
-
)
|
61 |
-
)
|
62 |
-
->setOrder('created_at', 'desc');
|
63 |
|
64 |
$orders->getSelect()->limit(self::ORDERS_LIST_LIMIT, 0);
|
65 |
$orders->load();
|
@@ -73,16 +67,9 @@ class Mage_XmlConnect_Block_Customer_Order_List extends Mage_Core_Block_Template
|
|
73 |
if ($_order->getShippingAddress()) {
|
74 |
$item->addChild('ship_to', $ordersXmlObj->escapeXml($_order->getShippingAddress()->getName()));
|
75 |
}
|
76 |
-
$item->addChild(
|
77 |
-
|
78 |
-
|
79 |
-
$_order->getGrandTotal(),
|
80 |
-
2,
|
81 |
-
array(),
|
82 |
-
false,
|
83 |
-
false
|
84 |
-
)
|
85 |
-
);
|
86 |
$item->addChild('status', $_order->getStatusLabel());
|
87 |
}
|
88 |
}
|
47 |
{
|
48 |
$ordersXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<orders></orders>');
|
49 |
|
50 |
+
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('*')->addFieldToFilter(
|
51 |
+
'customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId()
|
52 |
+
)
|
53 |
+
->addFieldToFilter(
|
54 |
+
'state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates())
|
55 |
+
)
|
56 |
+
->setOrder('created_at', 'desc');
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
$orders->getSelect()->limit(self::ORDERS_LIST_LIMIT, 0);
|
59 |
$orders->load();
|
67 |
if ($_order->getShippingAddress()) {
|
68 |
$item->addChild('ship_to', $ordersXmlObj->escapeXml($_order->getShippingAddress()->getName()));
|
69 |
}
|
70 |
+
$item->addChild('total', $_order->getOrderCurrency()->formatPrecision(
|
71 |
+
$_order->getGrandTotal(), 2, array(), false, false
|
72 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
$item->addChild('status', $_order->getStatusLabel());
|
74 |
}
|
75 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals.php
CHANGED
@@ -38,7 +38,7 @@ class Mage_XmlConnect_Block_Customer_Order_Totals extends Mage_Sales_Block_Order
|
|
38 |
* (get from template: sales/order/totals.phtml)
|
39 |
*
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj
|
41 |
-
* @return
|
42 |
*/
|
43 |
public function addTotalsToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj)
|
44 |
{
|
@@ -113,20 +113,13 @@ class Mage_XmlConnect_Block_Customer_Order_Totals extends Mage_Sales_Block_Order
|
|
113 |
*
|
114 |
* @param Varien_Object $total
|
115 |
* @param Mage_XmlConnect_Model_Simplexml_Element $totalsXml
|
116 |
-
* @return
|
117 |
*/
|
118 |
private function _addTotalToXml($total, Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
119 |
{
|
120 |
-
if (
|
121 |
-
$
|
122 |
-
|
123 |
-
&& $total->getLabel()
|
124 |
-
&& $total->hasData('value')
|
125 |
-
) {
|
126 |
-
$totalsXml->addCustomChild(
|
127 |
-
preg_replace('@[\W]+@', '_', trim($total->getCode())),
|
128 |
-
$this->_formatPrice($total),
|
129 |
-
array('label' => strip_tags($total->getLabel()))
|
130 |
);
|
131 |
}
|
132 |
}
|
38 |
* (get from template: sales/order/totals.phtml)
|
39 |
*
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj
|
41 |
+
* @return null
|
42 |
*/
|
43 |
public function addTotalsToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderXmlObj)
|
44 |
{
|
113 |
*
|
114 |
* @param Varien_Object $total
|
115 |
* @param Mage_XmlConnect_Model_Simplexml_Element $totalsXml
|
116 |
+
* @return null
|
117 |
*/
|
118 |
private function _addTotalToXml($total, Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
119 |
{
|
120 |
+
if ($total instanceof Varien_Object && $total->getCode() && $total->getLabel() && $total->hasData('value')) {
|
121 |
+
$totalsXml->addCustomChild(preg_replace('@[\W]+@', '_', trim($total->getCode())),
|
122 |
+
$this->_formatPrice($total), array('label' => strip_tags($total->getLabel()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
);
|
124 |
}
|
125 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance.php
CHANGED
@@ -36,18 +36,15 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Customerbalance
|
|
36 |
{
|
37 |
/**
|
38 |
* Add order total rendered to XML object
|
39 |
-
* (get from template: )
|
40 |
*
|
41 |
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
45 |
{
|
46 |
$balance = $this->getSource()->getCustomerBalanceAmount();
|
47 |
if ($balance) {
|
48 |
-
$totalsXml->addCustomChild(
|
49 |
-
$this->getTotal()->getCode(),
|
50 |
-
'-' . $this->_formatPrice($balance),
|
51 |
array('label' => Mage::helper('enterprise_giftcardaccount')->__('Store Credit'))
|
52 |
);
|
53 |
}
|
36 |
{
|
37 |
/**
|
38 |
* Add order total rendered to XML object
|
|
|
39 |
*
|
40 |
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
|
41 |
+
* @return null
|
42 |
*/
|
43 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
44 |
{
|
45 |
$balance = $this->getSource()->getCustomerBalanceAmount();
|
46 |
if ($balance) {
|
47 |
+
$totalsXml->addCustomChild($this->getTotal()->getCode(), '-' . $this->_formatPrice($balance),
|
|
|
|
|
48 |
array('label' => Mage::helper('enterprise_giftcardaccount')->__('Store Credit'))
|
49 |
);
|
50 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Customerbalance/Refunded.php
CHANGED
@@ -36,18 +36,15 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Customerbalance_Refunded
|
|
36 |
{
|
37 |
/**
|
38 |
* Add order total rendered to XML object
|
39 |
-
* (get from template: )
|
40 |
*
|
41 |
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
45 |
{
|
46 |
$balance = $this->getSource()->getCustomerBalanceTotalRefunded();
|
47 |
if ($balance) {
|
48 |
-
$totalsXml->addCustomChild(
|
49 |
-
$this->getTotal()->getCode(),
|
50 |
-
$this->_formatPrice($balance),
|
51 |
array('label' => Mage::helper('enterprise_giftcardaccount')->__('Refunded to Store Credit'))
|
52 |
);
|
53 |
}
|
36 |
{
|
37 |
/**
|
38 |
* Add order total rendered to XML object
|
|
|
39 |
*
|
40 |
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
|
41 |
+
* @return null
|
42 |
*/
|
43 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
44 |
{
|
45 |
$balance = $this->getSource()->getCustomerBalanceTotalRefunded();
|
46 |
if ($balance) {
|
47 |
+
$totalsXml->addCustomChild($this->getTotal()->getCode(), $this->_formatPrice($balance),
|
|
|
|
|
48 |
array('label' => Mage::helper('enterprise_giftcardaccount')->__('Refunded to Store Credit'))
|
49 |
);
|
50 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Giftcards.php
CHANGED
@@ -36,10 +36,9 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Giftcards
|
|
36 |
{
|
37 |
/**
|
38 |
* Add order total rendered to XML object
|
39 |
-
* (get from template: )
|
40 |
*
|
41 |
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
45 |
{
|
@@ -47,18 +46,14 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Giftcards
|
|
47 |
if ($cards) {
|
48 |
foreach ($cards as $card) {
|
49 |
$label = Mage::helper('enterprise_giftcardaccount')->__('Gift Card (%s)', $card->getCode());
|
50 |
-
$totalsXml->addCustomChild(
|
51 |
-
$this->getTotal()->getCode(),
|
52 |
-
'-' . $this->_formatPrice($card->getAmount()),
|
53 |
array('label' => $label)
|
54 |
);
|
55 |
}
|
56 |
} else {
|
57 |
$cardsAmount = $this->getSource()->getGiftCardsAmount();
|
58 |
if ($cardsAmount > 0) {
|
59 |
-
$totalsXml->addCustomChild(
|
60 |
-
$this->getTotal()->getCode(),
|
61 |
-
'-' . $this->_formatPrice($cardsAmount),
|
62 |
array('label' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card'))
|
63 |
);
|
64 |
}
|
36 |
{
|
37 |
/**
|
38 |
* Add order total rendered to XML object
|
|
|
39 |
*
|
40 |
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
|
41 |
+
* @return null
|
42 |
*/
|
43 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
|
44 |
{
|
46 |
if ($cards) {
|
47 |
foreach ($cards as $card) {
|
48 |
$label = Mage::helper('enterprise_giftcardaccount')->__('Gift Card (%s)', $card->getCode());
|
49 |
+
$totalsXml->addCustomChild($this->getTotal()->getCode(), '-' . $this->_formatPrice($card->getAmount()),
|
|
|
|
|
50 |
array('label' => $label)
|
51 |
);
|
52 |
}
|
53 |
} else {
|
54 |
$cardsAmount = $this->getSource()->getGiftCardsAmount();
|
55 |
if ($cardsAmount > 0) {
|
56 |
+
$totalsXml->addCustomChild($this->getTotal()->getCode(), '-' . $this->_formatPrice($cardsAmount),
|
|
|
|
|
57 |
array('label' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card'))
|
58 |
);
|
59 |
}
|
app/code/core/Mage/XmlConnect/Block/Customer/Order/Totals/Tax.php
CHANGED
@@ -35,10 +35,9 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Tax extends Mage_Tax_Block_Sal
|
|
35 |
{
|
36 |
/**
|
37 |
* Add order taxes rendered to XML object
|
38 |
-
* (get from template: )
|
39 |
*
|
40 |
* @param Mage_XmlConnect_Model_Simplexml_Element $totalsXmlObj
|
41 |
-
* @return
|
42 |
*/
|
43 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXmlObj)
|
44 |
{
|
@@ -55,16 +54,12 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Tax extends Mage_Tax_Block_Sal
|
|
55 |
|
56 |
foreach ((array)$info['rates'] as $rate) {
|
57 |
if (isset($info['amount'])) {
|
58 |
-
$config = array(
|
59 |
-
'label' => $rate['title']
|
60 |
-
);
|
61 |
if (!is_null($rate['percent'])) {
|
62 |
$config['percent'] = sprintf('(%0.2f%%)', $rate['percent']);
|
63 |
}
|
64 |
$taxesXmlObj->addCustomChild(
|
65 |
-
'item',
|
66 |
-
is_null($rate['percent']) ? '' : $this->_formatPrice($info['amount']),
|
67 |
-
$config
|
68 |
);
|
69 |
}
|
70 |
}
|
@@ -72,11 +67,7 @@ class Mage_XmlConnect_Block_Customer_Order_Totals_Tax extends Mage_Tax_Block_Sal
|
|
72 |
}
|
73 |
|
74 |
$taxesXmlObj->addCustomChild(
|
75 |
-
'summary',
|
76 |
-
$this->_formatPrice($this->getSource()->getTaxAmount()),
|
77 |
-
array(
|
78 |
-
'label' => $this->__('Tax')
|
79 |
-
)
|
80 |
);
|
81 |
}
|
82 |
|
35 |
{
|
36 |
/**
|
37 |
* Add order taxes rendered to XML object
|
|
|
38 |
*
|
39 |
* @param Mage_XmlConnect_Model_Simplexml_Element $totalsXmlObj
|
40 |
+
* @return null
|
41 |
*/
|
42 |
public function addToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $totalsXmlObj)
|
43 |
{
|
54 |
|
55 |
foreach ((array)$info['rates'] as $rate) {
|
56 |
if (isset($info['amount'])) {
|
57 |
+
$config = array('label' => $rate['title']);
|
|
|
|
|
58 |
if (!is_null($rate['percent'])) {
|
59 |
$config['percent'] = sprintf('(%0.2f%%)', $rate['percent']);
|
60 |
}
|
61 |
$taxesXmlObj->addCustomChild(
|
62 |
+
'item', is_null($rate['percent']) ? '' : $this->_formatPrice($info['amount']), $config
|
|
|
|
|
63 |
);
|
64 |
}
|
65 |
}
|
67 |
}
|
68 |
|
69 |
$taxesXmlObj->addCustomChild(
|
70 |
+
'summary', $this->_formatPrice($this->getSource()->getTaxAmount()), array('label' => $this->__('Tax'))
|
|
|
|
|
|
|
|
|
71 |
);
|
72 |
}
|
73 |
|
app/code/core/Mage/XmlConnect/Block/Customer/Storecredit.php
CHANGED
@@ -41,78 +41,46 @@ class Mage_XmlConnect_Block_Customer_Storecredit extends Mage_Core_Block_Templat
|
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
/** @var $xmlModel Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
-
$xmlModel = Mage::getModel(
|
45 |
-
'xmlconnect/simplexml_element',
|
46 |
-
'<store_credits_info></store_credits_info>'
|
47 |
-
);
|
48 |
|
49 |
$accountBalance = $this->getLayout()
|
50 |
->addBlock('enterprise_customerbalance/account_balance', 'account_balance');
|
51 |
|
52 |
-
$
|
53 |
-
|
54 |
-
|
55 |
-
'
|
56 |
-
|
57 |
-
array(
|
58 |
-
'label' => $customerBalanceHelper->__('Your current balance is:'),
|
59 |
-
'value' => $accountBalance->getBalance(),
|
60 |
-
'formatted_value' => Mage::helper('core')->currency($accountBalance->getBalance(), true, false)
|
61 |
-
)
|
62 |
-
);
|
63 |
|
64 |
$accountHistory = $this->getLayout()
|
65 |
->addBlock('enterprise_customerbalance/account_history', 'account_history');
|
66 |
|
67 |
-
if ($accountHistory->canShow()
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
'
|
73 |
-
|
74 |
-
|
75 |
-
'label' => $customerBalanceHelper->__('Balance History'),
|
76 |
-
'action_label' => $customerBalanceHelper->__('Action'),
|
77 |
-
'balance_change_label' => $customerBalanceHelper->__('Balance Change'),
|
78 |
-
'balance_label' => $customerBalanceHelper->__('Balance'),
|
79 |
-
'date_label' => $customerBalanceHelper->__('Date')
|
80 |
-
)
|
81 |
-
);
|
82 |
|
83 |
foreach ($accountHistory->getEvents() as $event) {
|
84 |
$item = $balanceHistory->addCustomChild('item');
|
85 |
-
$item->addCustomChild(
|
86 |
-
'
|
87 |
-
|
88 |
-
array(
|
89 |
-
'value' => $accountHistory->getActionLabel($event->getAction())
|
90 |
-
)
|
91 |
-
);
|
92 |
|
93 |
-
$item->addCustomChild(
|
94 |
-
'
|
95 |
-
|
96 |
-
array(
|
97 |
-
'value' => Mage::helper('core')->currency($event->getBalanceDelta(), true, false)
|
98 |
-
)
|
99 |
-
);
|
100 |
|
101 |
-
$item->addCustomChild(
|
102 |
-
'
|
103 |
-
|
104 |
-
array(
|
105 |
-
'value' => Mage::helper('core')->currency($event->getBalanceAmount(), true, false)
|
106 |
-
)
|
107 |
-
);
|
108 |
|
109 |
-
$item->addCustomChild(
|
110 |
-
'
|
111 |
-
|
112 |
-
array(
|
113 |
-
'value' => Mage::helper('core')->formatDate($event->getUpdatedAt(), 'short', true)
|
114 |
-
)
|
115 |
-
);
|
116 |
}
|
117 |
}
|
118 |
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
/** @var $xmlModel Mage_XmlConnect_Model_Simplexml_Element */
|
44 |
+
$xmlModel = Mage::getModel('xmlconnect/simplexml_element', '<store_credits_info></store_credits_info>');
|
|
|
|
|
|
|
45 |
|
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 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
$accountHistory = $this->getLayout()
|
56 |
->addBlock('enterprise_customerbalance/account_history', 'account_history');
|
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) {
|
68 |
$item = $balanceHistory->addCustomChild('item');
|
69 |
+
$item->addCustomChild('action', null, array(
|
70 |
+
'value' => $accountHistory->getActionLabel($event->getAction())
|
71 |
+
));
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
$item->addCustomChild('balance_change', null, array(
|
74 |
+
'value' => Mage::helper('core')->currency($event->getBalanceDelta(), true, false)
|
75 |
+
));
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
$item->addCustomChild('balance', null, array(
|
78 |
+
'value' => Mage::helper('core')->currency($event->getBalanceAmount(), true, false)
|
79 |
+
));
|
|
|
|
|
|
|
|
|
80 |
|
81 |
+
$item->addCustomChild('date', null, array(
|
82 |
+
'value' => Mage::helper('core')->formatDate($event->getUpdatedAt(), 'short', true)
|
83 |
+
));
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
|
app/code/core/Mage/XmlConnect/Block/Home.php
CHANGED
@@ -76,9 +76,7 @@ class Mage_XmlConnect_Block_Home extends Mage_XmlConnect_Block_Catalog
|
|
76 |
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('category'));
|
77 |
|
78 |
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
79 |
-
|
80 |
$file = Mage::helper('xmlconnect')->urlToPath($icon);
|
81 |
-
|
82 |
$iconXml->addAttribute('modification_time', filemtime($file));
|
83 |
}
|
84 |
$homeXmlObj->addChild('home_banner', '/current/media/catalog/category/banner_home.png');
|
76 |
->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('category'));
|
77 |
|
78 |
$iconXml = $itemXmlObj->addChild('icon', $icon);
|
|
|
79 |
$file = Mage::helper('xmlconnect')->urlToPath($icon);
|
|
|
80 |
$iconXml->addAttribute('modification_time', filemtime($file));
|
81 |
}
|
82 |
$homeXmlObj->addChild('home_banner', '/current/media/catalog/category/banner_home.png');
|
app/code/core/Mage/XmlConnect/Block/Review/Form.php
CHANGED
@@ -59,21 +59,15 @@ class Mage_XmlConnect_Block_Review_Form extends Mage_Core_Block_Template
|
|
59 |
}
|
60 |
|
61 |
if ($this->getRatings()) {
|
62 |
-
$ratingsFieldset = $xmlReview->addCustomChild(
|
63 |
-
'
|
64 |
-
|
65 |
-
array('label' => $this->__('How do you rate this product?'))
|
66 |
-
);
|
67 |
|
68 |
foreach ($this->getRatings() as $rating) {
|
69 |
-
$ratingField = $ratingsFieldset->addField(
|
70 |
-
'
|
71 |
-
'
|
72 |
-
|
73 |
-
'label' => $rating->getRatingCode(),
|
74 |
-
'required' => 'true'
|
75 |
-
)
|
76 |
-
);
|
77 |
foreach ($rating->getOptions() as $option) {
|
78 |
$ratingField->addCustomChild('value', $option->getId());
|
79 |
}
|
@@ -81,31 +75,19 @@ class Mage_XmlConnect_Block_Review_Form extends Mage_Core_Block_Template
|
|
81 |
}
|
82 |
|
83 |
$reviewFieldset = $xmlReview->addCustomChild('fieldset');
|
84 |
-
$reviewFieldset->addField(
|
85 |
-
'
|
86 |
-
'
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
);
|
93 |
-
$reviewFieldset->addField(
|
94 |
-
'
|
95 |
-
'
|
96 |
-
|
97 |
-
'label' => $this->__('Summary of Your Review'),
|
98 |
-
'required' => 'true'
|
99 |
-
)
|
100 |
-
);
|
101 |
-
$reviewFieldset->addField(
|
102 |
-
'detail',
|
103 |
-
'textarea',
|
104 |
-
array(
|
105 |
-
'label' => $this->__('Review'),
|
106 |
-
'required' => 'true'
|
107 |
-
)
|
108 |
-
);
|
109 |
|
110 |
return $xmlReview->asNiceXml();
|
111 |
}
|
@@ -118,14 +100,9 @@ class Mage_XmlConnect_Block_Review_Form extends Mage_Core_Block_Template
|
|
118 |
public function getRatings()
|
119 |
{
|
120 |
if (is_null($this->_ratings)) {
|
121 |
-
$this->_ratings = Mage::getModel('rating/rating')
|
122 |
-
->
|
123 |
-
->
|
124 |
-
->setPositionOrder()
|
125 |
-
->addRatingPerStoreName(Mage::app()->getStore()->getId())
|
126 |
-
->setStoreFilter(Mage::app()->getStore()->getId())
|
127 |
-
->load()
|
128 |
-
->addOptionToItems();
|
129 |
|
130 |
if (!$this->_ratings->getSize()) {
|
131 |
$this->_ratings = false;
|
59 |
}
|
60 |
|
61 |
if ($this->getRatings()) {
|
62 |
+
$ratingsFieldset = $xmlReview->addCustomChild('fieldset', null, array(
|
63 |
+
'label' => $this->__('How do you rate this product?')
|
64 |
+
));
|
|
|
|
|
65 |
|
66 |
foreach ($this->getRatings() as $rating) {
|
67 |
+
$ratingField = $ratingsFieldset->addField('ratings[' . $rating->getId() . ']', 'radio', array(
|
68 |
+
'label' => $rating->getRatingCode(),
|
69 |
+
'required' => 'true'
|
70 |
+
));
|
|
|
|
|
|
|
|
|
71 |
foreach ($rating->getOptions() as $option) {
|
72 |
$ratingField->addCustomChild('value', $option->getId());
|
73 |
}
|
75 |
}
|
76 |
|
77 |
$reviewFieldset = $xmlReview->addCustomChild('fieldset');
|
78 |
+
$reviewFieldset->addField('nickname', 'text', array(
|
79 |
+
'label' => $this->__('Nickname'),
|
80 |
+
'required' => 'true',
|
81 |
+
'value' => $nickname
|
82 |
+
));
|
83 |
+
$reviewFieldset->addField('title', 'text', array(
|
84 |
+
'label' => $this->__('Summary of Your Review'),
|
85 |
+
'required' => 'true'
|
86 |
+
));
|
87 |
+
$reviewFieldset->addField('detail', 'textarea', array(
|
88 |
+
'label' => $this->__('Review'),
|
89 |
+
'required' => 'true'
|
90 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
return $xmlReview->asNiceXml();
|
93 |
}
|
100 |
public function getRatings()
|
101 |
{
|
102 |
if (is_null($this->_ratings)) {
|
103 |
+
$this->_ratings = Mage::getModel('rating/rating')->getResourceCollection()->addEntityFilter('product')
|
104 |
+
->setPositionOrder()->addRatingPerStoreName(Mage::app()->getStore()->getId())
|
105 |
+
->setStoreFilter(Mage::app()->getStore()->getId())->load()->addOptionToItems();
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
if (!$this->_ratings->getSize()) {
|
108 |
$this->_ratings = false;
|
app/code/core/Mage/XmlConnect/Controller/Action.php
CHANGED
@@ -62,7 +62,7 @@ abstract class Mage_XmlConnect_Controller_Action extends Mage_Core_Controller_Fr
|
|
62 |
* Declare content type header
|
63 |
* Validate current application
|
64 |
*
|
65 |
-
* @return
|
66 |
*/
|
67 |
public function preDispatch()
|
68 |
{
|
@@ -78,8 +78,7 @@ abstract class Mage_XmlConnect_Controller_Action extends Mage_Core_Controller_Fr
|
|
78 |
$screenSize = isset($_COOKIE[$screenSizeCookieName]) ? (string) $_COOKIE[$screenSizeCookieName] : '';
|
79 |
if (!$appCode) {
|
80 |
$this->_message(
|
81 |
-
Mage::helper('xmlconnect')->__('Specified invalid app code.'),
|
82 |
-
self::MESSAGE_STATUS_ERROR
|
83 |
);
|
84 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
85 |
return;
|
@@ -91,8 +90,7 @@ abstract class Mage_XmlConnect_Controller_Action extends Mage_Core_Controller_Fr
|
|
91 |
&& (int)Mage::getStoreConfig('general/restriction/mode') == 0
|
92 |
) {
|
93 |
$this->_message(
|
94 |
-
Mage::helper('xmlconnect')->__('Website is offline.'),
|
95 |
-
self::MESSAGE_STATUS_SUCCESS
|
96 |
);
|
97 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
98 |
return;
|
@@ -108,8 +106,7 @@ abstract class Mage_XmlConnect_Controller_Action extends Mage_Core_Controller_Fr
|
|
108 |
Mage::register('current_app', $appModel);
|
109 |
} else {
|
110 |
$this->_message(
|
111 |
-
Mage::helper('xmlconnect')->__('Specified invalid app code.'),
|
112 |
-
self::MESSAGE_STATUS_ERROR
|
113 |
);
|
114 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
115 |
return;
|
@@ -119,7 +116,7 @@ abstract class Mage_XmlConnect_Controller_Action extends Mage_Core_Controller_Fr
|
|
119 |
/**
|
120 |
* Validate response body
|
121 |
*
|
122 |
-
* @return
|
123 |
*/
|
124 |
public function postDispatch()
|
125 |
{
|
@@ -139,7 +136,7 @@ abstract class Mage_XmlConnect_Controller_Action extends Mage_Core_Controller_Fr
|
|
139 |
* @param string $text
|
140 |
* @param string $status
|
141 |
* @param array $children
|
142 |
-
* @return
|
143 |
*/
|
144 |
protected function _message($text, $status, $children = array())
|
145 |
{
|
62 |
* Declare content type header
|
63 |
* Validate current application
|
64 |
*
|
65 |
+
* @return null
|
66 |
*/
|
67 |
public function preDispatch()
|
68 |
{
|
78 |
$screenSize = isset($_COOKIE[$screenSizeCookieName]) ? (string) $_COOKIE[$screenSizeCookieName] : '';
|
79 |
if (!$appCode) {
|
80 |
$this->_message(
|
81 |
+
Mage::helper('xmlconnect')->__('Specified invalid app code.'), self::MESSAGE_STATUS_ERROR
|
|
|
82 |
);
|
83 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
84 |
return;
|
90 |
&& (int)Mage::getStoreConfig('general/restriction/mode') == 0
|
91 |
) {
|
92 |
$this->_message(
|
93 |
+
Mage::helper('xmlconnect')->__('Website is offline.'), self::MESSAGE_STATUS_SUCCESS
|
|
|
94 |
);
|
95 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
96 |
return;
|
106 |
Mage::register('current_app', $appModel);
|
107 |
} else {
|
108 |
$this->_message(
|
109 |
+
Mage::helper('xmlconnect')->__('Specified invalid app code.'), self::MESSAGE_STATUS_ERROR
|
|
|
110 |
);
|
111 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
112 |
return;
|
116 |
/**
|
117 |
* Validate response body
|
118 |
*
|
119 |
+
* @return null
|
120 |
*/
|
121 |
public function postDispatch()
|
122 |
{
|
136 |
* @param string $text
|
137 |
* @param string $status
|
138 |
* @param array $children
|
139 |
+
* @return null
|
140 |
*/
|
141 |
protected function _message($text, $status, $children = array())
|
142 |
{
|
app/code/core/Mage/XmlConnect/Helper/Android.php
CHANGED
@@ -582,8 +582,7 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
582 |
public function validateConfig($native)
|
583 |
{
|
584 |
$errors = array();
|
585 |
-
if ($native === false
|
586 |
-
|| !isset($native['navigationBar']['icon'])
|
587 |
|| !Zend_Validate::is($native['navigationBar']['icon'], 'NotEmpty')
|
588 |
) {
|
589 |
$errors[] = Mage::helper('xmlconnect')->__('Please upload an image for "Logo in Header" field from Design Tab.');
|
@@ -692,7 +691,7 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
692 |
*
|
693 |
* @throws Mage_Core_Exception
|
694 |
* @param array $data
|
695 |
-
* @return
|
696 |
*/
|
697 |
public function checkRequiredConfigFields($data)
|
698 |
{
|
@@ -701,15 +700,11 @@ class Mage_XmlConnect_Helper_Android extends Mage_Core_Helper_Abstract
|
|
701 |
}
|
702 |
|
703 |
if (isset($data['navigationBar']['icon']) && empty($data['navigationBar']['icon'])) {
|
704 |
-
Mage::throwException(
|
705 |
-
Mage::helper('xmlconnect')->__('Logo in Header image missing.')
|
706 |
-
);
|
707 |
}
|
708 |
|
709 |
if (isset($data['body']['bannerAndroidImage']) && empty($data['body']['bannerAndroidImage'])) {
|
710 |
-
Mage::throwException(
|
711 |
-
Mage::helper('xmlconnect')->__('Banner on Home Screen image missing.')
|
712 |
-
);
|
713 |
}
|
714 |
}
|
715 |
|
582 |
public function validateConfig($native)
|
583 |
{
|
584 |
$errors = array();
|
585 |
+
if ($native === false || !isset($native['navigationBar']['icon'])
|
|
|
586 |
|| !Zend_Validate::is($native['navigationBar']['icon'], 'NotEmpty')
|
587 |
) {
|
588 |
$errors[] = Mage::helper('xmlconnect')->__('Please upload an image for "Logo in Header" field from Design Tab.');
|
691 |
*
|
692 |
* @throws Mage_Core_Exception
|
693 |
* @param array $data
|
694 |
+
* @return null
|
695 |
*/
|
696 |
public function checkRequiredConfigFields($data)
|
697 |
{
|
700 |
}
|
701 |
|
702 |
if (isset($data['navigationBar']['icon']) && empty($data['navigationBar']['icon'])) {
|
703 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Logo in Header image missing.'));
|
|
|
|
|
704 |
}
|
705 |
|
706 |
if (isset($data['body']['bannerAndroidImage']) && empty($data['body']['bannerAndroidImage'])) {
|
707 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Banner on Home Screen image missing.'));
|
|
|
|
|
708 |
}
|
709 |
}
|
710 |
|
app/code/core/Mage/XmlConnect/Helper/Catalog/Category/Image.php
CHANGED
@@ -40,6 +40,7 @@ class Mage_XmlConnect_Helper_Catalog_Category_Image extends Mage_Catalog_Helper_
|
|
40 |
* @param string $attributeName
|
41 |
* @param string $imageFile
|
42 |
* @return Mage_XmlConnect_Helper_Catalog_Category_Image
|
|
|
43 |
*/
|
44 |
public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
|
45 |
{
|
40 |
* @param string $attributeName
|
41 |
* @param string $imageFile
|
42 |
* @return Mage_XmlConnect_Helper_Catalog_Category_Image
|
43 |
+
*
|
44 |
*/
|
45 |
public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
|
46 |
{
|
app/code/core/Mage/XmlConnect/Helper/Customer/Form/Renderer.php
CHANGED
@@ -40,8 +40,7 @@ class Mage_XmlConnect_Helper_Customer_Form_Renderer extends Mage_Core_Helper_Abs
|
|
40 |
* @param Enterprise_Eav_Block_Form_Renderer_Abstract $blockObject
|
41 |
* @return array
|
42 |
*/
|
43 |
-
public function addTitleAndRequiredAttr(
|
44 |
-
Mage_XmlConnect_Model_Simplexml_Form_Abstract $fieldsetXmlObj,
|
45 |
Enterprise_Eav_Block_Form_Renderer_Abstract $blockObject
|
46 |
) {
|
47 |
$attributes = array();
|
40 |
* @param Enterprise_Eav_Block_Form_Renderer_Abstract $blockObject
|
41 |
* @return array
|
42 |
*/
|
43 |
+
public function addTitleAndRequiredAttr(Mage_XmlConnect_Model_Simplexml_Form_Abstract $fieldsetXmlObj,
|
|
|
44 |
Enterprise_Eav_Block_Form_Renderer_Abstract $blockObject
|
45 |
) {
|
46 |
$attributes = array();
|
app/code/core/Mage/XmlConnect/Helper/Customer/Order.php
CHANGED
@@ -33,6 +33,16 @@
|
|
33 |
*/
|
34 |
class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Add Weee taxes child to the XML
|
38 |
*
|
@@ -41,27 +51,23 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
41 |
* @param Mage_XmlConnect_Model_Simplexml_Element $priceXml
|
42 |
* @param Mage_XmlConnect_Model_Simplexml_Element $subtotalXml
|
43 |
* @param bool $isIncludeTax
|
44 |
-
* @return
|
45 |
*/
|
46 |
-
public function addPriceAndSubtotalToXml(
|
47 |
-
|
48 |
-
Mage_Sales_Model_Order_Item $item,
|
49 |
-
Mage_XmlConnect_Model_Simplexml_Element $priceXml,
|
50 |
-
Mage_XmlConnect_Model_Simplexml_Element $subtotalXml,
|
51 |
$isIncludeTax = false
|
52 |
-
)
|
53 |
-
{
|
54 |
$weeeParams = array();
|
55 |
|
56 |
$typesOfDisplay = $renderer->getTypesOfDisplay();
|
57 |
if ($isIncludeTax) {
|
58 |
$nodeName = 'including_tax';
|
59 |
-
$nodeLabel =
|
60 |
|
61 |
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
|
62 |
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
|
63 |
|
64 |
-
if ($typesOfDisplay[
|
65 |
$price = $inclPrice + $renderer->getWeeeTaxAppliedAmount();
|
66 |
$subtotal = $inclSubtotal + $item->getWeeeTaxAppliedRowAmount();
|
67 |
} else {
|
@@ -71,14 +77,12 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
71 |
$weeeParams['include'] = $inclPrice;
|
72 |
} else {
|
73 |
$nodeName = 'excluding_tax';
|
74 |
-
$nodeLabel =
|
75 |
|
76 |
-
if ($typesOfDisplay[
|
77 |
-
$price = $item->getPrice()
|
78 |
-
+ $renderer->getWeeeTaxAppliedAmount()
|
79 |
+ $renderer->getWeeeTaxDisposition();
|
80 |
-
$subtotal = $item->getRowTotal()
|
81 |
-
+ $item->getWeeeTaxAppliedRowAmount()
|
82 |
+ $item->getWeeeTaxRowDisposition();
|
83 |
} else {
|
84 |
$price = $item->getPrice();
|
@@ -94,28 +98,14 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
94 |
}
|
95 |
|
96 |
$this->addWeeeTaxesToPriceXml(
|
97 |
-
$renderer,
|
98 |
-
$item,
|
99 |
-
$priceXml->addCustomChild(
|
100 |
-
$nodeName,
|
101 |
-
null,
|
102 |
-
$configNode
|
103 |
-
),
|
104 |
-
$weeeParams
|
105 |
);
|
106 |
|
107 |
$configNode['value'] = $this->formatPrice($renderer, $subtotal);
|
108 |
$weeeParams['include'] = $isIncludeTax ? $inclSubtotal : null;
|
109 |
$weeeParams['is_subtotal'] = true;
|
110 |
$this->addWeeeTaxesToPriceXml(
|
111 |
-
$renderer,
|
112 |
-
$item,
|
113 |
-
$subtotalXml->addCustomChild(
|
114 |
-
$nodeName,
|
115 |
-
null,
|
116 |
-
$configNode
|
117 |
-
),
|
118 |
-
$weeeParams
|
119 |
);
|
120 |
}
|
121 |
|
@@ -124,13 +114,11 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
124 |
*
|
125 |
* @param Mage_Core_Block_Template $renderer Product renderer
|
126 |
* @param Mage_XmlConnect_Model_Simplexml_Element $itemXml
|
127 |
-
* @return
|
128 |
*/
|
129 |
-
public function addItemOptionsToXml(
|
130 |
-
Mage_Core_Block_Template $renderer,
|
131 |
Mage_XmlConnect_Model_Simplexml_Element $itemXml
|
132 |
-
)
|
133 |
-
{
|
134 |
$options = $renderer->getItemOptions();
|
135 |
if (!empty($options)) {
|
136 |
$optionsXml = $itemXml->addChild('options');
|
@@ -146,11 +134,7 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
146 |
$value = $option['value'];
|
147 |
}
|
148 |
if ($value) {
|
149 |
-
$optionsXml->addCustomChild(
|
150 |
-
'option',
|
151 |
-
strip_tags($value),
|
152 |
-
array('label' => $option['label'])
|
153 |
-
);
|
154 |
}
|
155 |
}
|
156 |
}
|
@@ -163,15 +147,11 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
163 |
* @param Mage_Sales_Model_Order_Item $item
|
164 |
* @param Mage_XmlConnect_Model_Simplexml_Element $parentXml
|
165 |
* @param array $params Params for Weee taxes: 'include' - Price including tax, 'is_subtotal' - Flag of subtotal
|
166 |
-
* @return
|
167 |
*/
|
168 |
-
public function addWeeeTaxesToPriceXml(
|
169 |
-
|
170 |
-
|
171 |
-
Mage_XmlConnect_Model_Simplexml_Element $parentXml,
|
172 |
-
$params = array()
|
173 |
-
)
|
174 |
-
{
|
175 |
$weeTaxes = $renderer->getWeeeTaxes();
|
176 |
if (empty($weeTaxes)) {
|
177 |
return;
|
@@ -182,27 +162,23 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
182 |
$row = isset($params['is_subtotal']) && $params['is_subtotal'] ? 'row_' : '';
|
183 |
|
184 |
/** @var $weeeXml Mage_XmlConnect_Model_Simplexml_Element */
|
185 |
-
if ($typesOfDisplay[
|
186 |
$weeeXml = $parentXml->addChild('weee');
|
187 |
foreach ($weeTaxes as $tax) {
|
188 |
-
$weeeXml->addCustomChild(
|
189 |
-
'tax',
|
190 |
-
$this->formatPrice($renderer, $tax[$row . 'amount']),
|
191 |
array('label' => $tax['title'])
|
192 |
);
|
193 |
}
|
194 |
-
} elseif ($typesOfDisplay[
|
195 |
$weeeXml = $parentXml->addChild('weee');
|
196 |
foreach ($weeTaxes as $tax) {
|
197 |
-
$weeeXml->addCustomChild(
|
198 |
-
'tax',
|
199 |
-
$this->formatPrice($renderer, $tax[$row . 'amount_incl_tax']),
|
200 |
array('label' => $tax['title'])
|
201 |
);
|
202 |
}
|
203 |
}
|
204 |
|
205 |
-
if ($typesOfDisplay[
|
206 |
if (!is_null($params['include'])) {
|
207 |
// including tax
|
208 |
if (isset($params['is_subtotal'])) {
|
@@ -213,12 +189,10 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
213 |
} else {
|
214 |
// excluding tax
|
215 |
if ($params['is_subtotal']) {
|
216 |
-
$total = $item->getRowTotal()
|
217 |
-
+ $item->getWeeeTaxAppliedRowAmount()
|
218 |
+ $item->getWeeeTaxRowDisposition();
|
219 |
} else {
|
220 |
-
$total = $item->getPrice()
|
221 |
-
+ $renderer->getWeeeTaxAppliedAmount()
|
222 |
+ $renderer->getWeeeTaxDisposition();
|
223 |
}
|
224 |
}
|
@@ -235,58 +209,31 @@ class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
|
235 |
}
|
236 |
|
237 |
/**
|
238 |
-
* Add item
|
239 |
*
|
240 |
* @param Mage_Core_Block_Template $renderer Product renderer
|
241 |
-
* @param Mage_XmlConnect_Model_Simplexml_Element $
|
242 |
* @param Mage_Sales_Model_Order_Item $item
|
243 |
-
* @return
|
244 |
*/
|
245 |
-
public function addQuantityToXml(
|
246 |
-
|
247 |
-
|
248 |
-
Mage_Sales_Model_Order_Item $item
|
249 |
-
)
|
250 |
-
{
|
251 |
$qty = 1 * $item->getQtyOrdered();
|
252 |
if ($qty > 0) {
|
253 |
-
$quantityXml->addCustomChild(
|
254 |
-
'value',
|
255 |
-
$qty,
|
256 |
-
array(
|
257 |
-
'label' => $renderer->__('Ordered')
|
258 |
-
)
|
259 |
-
);
|
260 |
}
|
261 |
$qty = 1 * $item->getQtyShipped();
|
262 |
if ($qty > 0) {
|
263 |
-
$quantityXml->addCustomChild(
|
264 |
-
'value',
|
265 |
-
$qty,
|
266 |
-
array(
|
267 |
-
'label' => $renderer->__('Shipped')
|
268 |
-
)
|
269 |
-
);
|
270 |
}
|
271 |
$qty = 1 * $item->getQtyCanceled();
|
272 |
if ($qty > 0) {
|
273 |
-
$quantityXml->addCustomChild(
|
274 |
-
'value',
|
275 |
-
$qty,
|
276 |
-
array(
|
277 |
-
'label' => $renderer->__('Canceled')
|
278 |
-
)
|
279 |
-
);
|
280 |
}
|
281 |
$qty = 1 * $item->getQtyRefunded();
|
282 |
if ($qty > 0) {
|
283 |
-
$quantityXml->addCustomChild(
|
284 |
-
'value',
|
285 |
-
$qty,
|
286 |
-
array(
|
287 |
-
'label' => $renderer->__('Refunded')
|
288 |
-
)
|
289 |
-
);
|
290 |
}
|
291 |
}
|
292 |
|
33 |
*/
|
34 |
class Mage_XmlConnect_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
35 |
{
|
36 |
+
/**#@+
|
37 |
+
* Price display type
|
38 |
+
* @see Mage_Weee_Helper_Data::typeOfDisplay(...);
|
39 |
+
*/
|
40 |
+
const PRICE_DISPLAY_TYPE_1 = 1;
|
41 |
+
const PRICE_DISPLAY_TYPE_2 = 2;
|
42 |
+
const PRICE_DISPLAY_TYPE_4 = 4;
|
43 |
+
const PRICE_DISPLAY_TYPE_14 = 14;
|
44 |
+
/**#@-*/
|
45 |
+
|
46 |
/**
|
47 |
* Add Weee taxes child to the XML
|
48 |
*
|
51 |
* @param Mage_XmlConnect_Model_Simplexml_Element $priceXml
|
52 |
* @param Mage_XmlConnect_Model_Simplexml_Element $subtotalXml
|
53 |
* @param bool $isIncludeTax
|
54 |
+
* @return null
|
55 |
*/
|
56 |
+
public function addPriceAndSubtotalToXml(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item,
|
57 |
+
Mage_XmlConnect_Model_Simplexml_Element $priceXml, Mage_XmlConnect_Model_Simplexml_Element $subtotalXml,
|
|
|
|
|
|
|
58 |
$isIncludeTax = false
|
59 |
+
) {
|
|
|
60 |
$weeeParams = array();
|
61 |
|
62 |
$typesOfDisplay = $renderer->getTypesOfDisplay();
|
63 |
if ($isIncludeTax) {
|
64 |
$nodeName = 'including_tax';
|
65 |
+
$nodeLabel = Mage::helper('tax')->__('Incl. Tax');
|
66 |
|
67 |
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
|
68 |
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
|
69 |
|
70 |
+
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
|
71 |
$price = $inclPrice + $renderer->getWeeeTaxAppliedAmount();
|
72 |
$subtotal = $inclSubtotal + $item->getWeeeTaxAppliedRowAmount();
|
73 |
} else {
|
77 |
$weeeParams['include'] = $inclPrice;
|
78 |
} else {
|
79 |
$nodeName = 'excluding_tax';
|
80 |
+
$nodeLabel = Mage::helper('tax')->__('Excl. Tax');
|
81 |
|
82 |
+
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
|
83 |
+
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount()
|
|
|
84 |
+ $renderer->getWeeeTaxDisposition();
|
85 |
+
$subtotal = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
|
|
|
86 |
+ $item->getWeeeTaxRowDisposition();
|
87 |
} else {
|
88 |
$price = $item->getPrice();
|
98 |
}
|
99 |
|
100 |
$this->addWeeeTaxesToPriceXml(
|
101 |
+
$renderer, $item, $priceXml->addCustomChild($nodeName, null, $configNode), $weeeParams
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
);
|
103 |
|
104 |
$configNode['value'] = $this->formatPrice($renderer, $subtotal);
|
105 |
$weeeParams['include'] = $isIncludeTax ? $inclSubtotal : null;
|
106 |
$weeeParams['is_subtotal'] = true;
|
107 |
$this->addWeeeTaxesToPriceXml(
|
108 |
+
$renderer, $item, $subtotalXml->addCustomChild($nodeName, null, $configNode), $weeeParams
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
);
|
110 |
}
|
111 |
|
114 |
*
|
115 |
* @param Mage_Core_Block_Template $renderer Product renderer
|
116 |
* @param Mage_XmlConnect_Model_Simplexml_Element $itemXml
|
117 |
+
* @return null
|
118 |
*/
|
119 |
+
public function addItemOptionsToXml(Mage_Core_Block_Template $renderer,
|
|
|
120 |
Mage_XmlConnect_Model_Simplexml_Element $itemXml
|
121 |
+
) {
|
|
|
122 |
$options = $renderer->getItemOptions();
|
123 |
if (!empty($options)) {
|
124 |
$optionsXml = $itemXml->addChild('options');
|
134 |
$value = $option['value'];
|
135 |
}
|
136 |
if ($value) {
|
137 |
+
$optionsXml->addCustomChild('option', strip_tags($value), array('label' => $option['label']));
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
}
|
147 |
* @param Mage_Sales_Model_Order_Item $item
|
148 |
* @param Mage_XmlConnect_Model_Simplexml_Element $parentXml
|
149 |
* @param array $params Params for Weee taxes: 'include' - Price including tax, 'is_subtotal' - Flag of subtotal
|
150 |
+
* @return null
|
151 |
*/
|
152 |
+
public function addWeeeTaxesToPriceXml(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item,
|
153 |
+
Mage_XmlConnect_Model_Simplexml_Element $parentXml, $params = array()
|
154 |
+
) {
|
|
|
|
|
|
|
|
|
155 |
$weeTaxes = $renderer->getWeeeTaxes();
|
156 |
if (empty($weeTaxes)) {
|
157 |
return;
|
162 |
$row = isset($params['is_subtotal']) && $params['is_subtotal'] ? 'row_' : '';
|
163 |
|
164 |
/** @var $weeeXml Mage_XmlConnect_Model_Simplexml_Element */
|
165 |
+
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_1]) {
|
166 |
$weeeXml = $parentXml->addChild('weee');
|
167 |
foreach ($weeTaxes as $tax) {
|
168 |
+
$weeeXml->addCustomChild('tax', $this->formatPrice($renderer, $tax[$row . 'amount']),
|
|
|
|
|
169 |
array('label' => $tax['title'])
|
170 |
);
|
171 |
}
|
172 |
+
} elseif ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_2] || $typesOfDisplay[self::PRICE_DISPLAY_TYPE_4]) {
|
173 |
$weeeXml = $parentXml->addChild('weee');
|
174 |
foreach ($weeTaxes as $tax) {
|
175 |
+
$weeeXml->addCustomChild('tax', $this->formatPrice($renderer, $tax[$row . 'amount_incl_tax']),
|
|
|
|
|
176 |
array('label' => $tax['title'])
|
177 |
);
|
178 |
}
|
179 |
}
|
180 |
|
181 |
+
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_2]) {
|
182 |
if (!is_null($params['include'])) {
|
183 |
// including tax
|
184 |
if (isset($params['is_subtotal'])) {
|
189 |
} else {
|
190 |
// excluding tax
|
191 |
if ($params['is_subtotal']) {
|
192 |
+
$total = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount()
|
|
|
193 |
+ $item->getWeeeTaxRowDisposition();
|
194 |
} else {
|
195 |
+
$total = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount()
|
|
|
196 |
+ $renderer->getWeeeTaxDisposition();
|
197 |
}
|
198 |
}
|
209 |
}
|
210 |
|
211 |
/**
|
212 |
+
* Add item quantities to the XML
|
213 |
*
|
214 |
* @param Mage_Core_Block_Template $renderer Product renderer
|
215 |
+
* @param Mage_XmlConnect_Model_Simplexml_Element $quantityXml
|
216 |
* @param Mage_Sales_Model_Order_Item $item
|
217 |
+
* @return null
|
218 |
*/
|
219 |
+
public function addQuantityToXml(Mage_Core_Block_Template $renderer,
|
220 |
+
Mage_XmlConnect_Model_Simplexml_Element $quantityXml, Mage_Sales_Model_Order_Item $item
|
221 |
+
) {
|
|
|
|
|
|
|
222 |
$qty = 1 * $item->getQtyOrdered();
|
223 |
if ($qty > 0) {
|
224 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => Mage::helper('xmlconnect')->__('Ordered')));
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
$qty = 1 * $item->getQtyShipped();
|
227 |
if ($qty > 0) {
|
228 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => Mage::helper('xmlconnect')->__('Shipped')));
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
$qty = 1 * $item->getQtyCanceled();
|
231 |
if ($qty > 0) {
|
232 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => Mage::helper('xmlconnect')->__('Canceled')));
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
234 |
$qty = 1 * $item->getQtyRefunded();
|
235 |
if ($qty > 0) {
|
236 |
+
$quantityXml->addCustomChild('value', $qty, array('label' => Mage::helper('xmlconnect')->__('Refunded')));
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
}
|
238 |
}
|
239 |
|
app/code/core/Mage/XmlConnect/Helper/Data.php
CHANGED
@@ -43,14 +43,17 @@ class Mage_XmlConnect_Helper_Data extends Mage_Core_Helper_Abstract
|
|
43 |
*/
|
44 |
const MESSAGE_TITLE_LENGTH = 255;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* List of the keys for xml config that have to be excluded form application config
|
48 |
*
|
49 |
* @var array
|
50 |
*/
|
51 |
-
protected $_excludedXmlConfigKeys = array(
|
52 |
-
'notifications/applicationMasterSecret',
|
53 |
-
);
|
54 |
|
55 |
/**
|
56 |
* Application names array
|
@@ -238,9 +241,10 @@ class Mage_XmlConnect_Helper_Data extends Mage_Core_Helper_Abstract
|
|
238 |
* Retrieve device specific country options array
|
239 |
*
|
240 |
* @throws Mage_Core_Exception
|
|
|
241 |
* @return array
|
242 |
*/
|
243 |
-
public function getCountryOptionsArray()
|
244 |
{
|
245 |
Varien_Profiler::start('TEST: ' . __METHOD__);
|
246 |
$deviceType = $this->getDeviceType();
|
@@ -265,10 +269,8 @@ class Mage_XmlConnect_Helper_Data extends Mage_Core_Helper_Abstract
|
|
265 |
$options = unserialize($cache);
|
266 |
} else {
|
267 |
if (isset($deviceCountries)) {
|
268 |
-
$options = Mage::getModel('directory/country')
|
269 |
-
->
|
270 |
-
->addFieldToFilter('country_id', array('in' => $deviceCountries))
|
271 |
-
->loadByStore()
|
272 |
->toOptionArray(false);
|
273 |
}
|
274 |
if (Mage::app()->useCache('config')) {
|
@@ -570,19 +572,12 @@ EOT;
|
|
570 |
$options = array();
|
571 |
/** @var $app Mage_XmlConnect_Model_Application */
|
572 |
foreach (Mage::getModel('xmlconnect/application')->getCollection() as $app) {
|
573 |
-
$options[] = array(
|
574 |
-
'value' => $app->getCode(),
|
575 |
-
'label' => $app->getName()
|
576 |
-
);
|
577 |
}
|
578 |
if (count($options) > 1) {
|
579 |
-
array_unshift(
|
580 |
-
|
581 |
-
|
582 |
-
'value' => '',
|
583 |
-
'label' => Mage::helper('xmlconnect')->__('Please Select Application')
|
584 |
-
)
|
585 |
-
);
|
586 |
}
|
587 |
return $options;
|
588 |
}
|
@@ -605,6 +600,18 @@ EOT;
|
|
605 |
return $apps;
|
606 |
}
|
607 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
/**
|
609 |
* Send broadcast message
|
610 |
*
|
@@ -618,13 +625,13 @@ EOT;
|
|
618 |
}
|
619 |
|
620 |
try {
|
621 |
-
$
|
622 |
/** @var $app Mage_XmlConnect_Model_Application */
|
623 |
-
$app = Mage::getModel('xmlconnect/application')->
|
624 |
|
625 |
if (!$app->getId()) {
|
626 |
Mage::throwException(
|
627 |
-
Mage::helper('xmlconnect')->__('Can\'t load application with
|
628 |
);
|
629 |
}
|
630 |
|
@@ -647,27 +654,19 @@ EOT;
|
|
647 |
break;
|
648 |
}
|
649 |
|
650 |
-
$
|
651 |
-
|
652 |
-
$httpHeaders = $this->getHttpHeaders();
|
653 |
-
|
654 |
-
curl_setopt($curlHandler, CURLOPT_POST, 1);
|
655 |
-
curl_setopt($curlHandler, CURLOPT_HTTPHEADER, $httpHeaders);
|
656 |
-
curl_setopt($curlHandler, CURLOPT_POSTFIELDS, $params);
|
657 |
-
curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);
|
658 |
-
curl_setopt($curlHandler, CURLOPT_USERPWD, $app->getUserpwd());
|
659 |
-
curl_setopt($curlHandler, CURLOPT_TIMEOUT, 60);
|
660 |
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
// close cURL resource, and free up system resources
|
666 |
-
curl_close($curlHandler);
|
667 |
|
668 |
-
if ($
|
669 |
$queue->setStatus(Mage_XmlConnect_Model_Queue::STATUS_COMPLETED);
|
670 |
}
|
|
|
|
|
671 |
$queue->setIsSent(true);
|
672 |
$queue->save();
|
673 |
return;
|
@@ -687,6 +686,18 @@ EOT;
|
|
687 |
return array('Content-Type: application/json');
|
688 |
}
|
689 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
/**
|
691 |
* Remove from array the unnecessary parameters by given keys
|
692 |
*
|
@@ -823,10 +834,8 @@ EOT;
|
|
823 |
*/
|
824 |
public function validateConfFieldNotEmpty($field, $native)
|
825 |
{
|
826 |
-
if (($native === false)
|
827 |
-
||
|
828 |
-
|| !isset($native['body'][$field])
|
829 |
-
|| !Zend_Validate::is($native['body'][$field], 'NotEmpty'))
|
830 |
) {
|
831 |
return false;
|
832 |
}
|
@@ -861,4 +870,15 @@ EOT;
|
|
861 |
$params = array_merge($defaultParams, $params);
|
862 |
return Mage::getUrl($action, $params);
|
863 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
864 |
}
|
43 |
*/
|
44 |
const MESSAGE_TITLE_LENGTH = 255;
|
45 |
|
46 |
+
/**
|
47 |
+
* Curl default timeout
|
48 |
+
*/
|
49 |
+
const CURLOPT_DEFAULT_TIMEOUT = 60;
|
50 |
+
|
51 |
/**
|
52 |
* List of the keys for xml config that have to be excluded form application config
|
53 |
*
|
54 |
* @var array
|
55 |
*/
|
56 |
+
protected $_excludedXmlConfigKeys = array('notifications/applicationMasterSecret');
|
|
|
|
|
57 |
|
58 |
/**
|
59 |
* Application names array
|
241 |
* Retrieve device specific country options array
|
242 |
*
|
243 |
* @throws Mage_Core_Exception
|
244 |
+
* @param bool $isItunes deprecated after 1.6.0.0
|
245 |
* @return array
|
246 |
*/
|
247 |
+
public function getCountryOptionsArray($isItunes = false)
|
248 |
{
|
249 |
Varien_Profiler::start('TEST: ' . __METHOD__);
|
250 |
$deviceType = $this->getDeviceType();
|
269 |
$options = unserialize($cache);
|
270 |
} else {
|
271 |
if (isset($deviceCountries)) {
|
272 |
+
$options = Mage::getModel('directory/country')->getResourceCollection()
|
273 |
+
->addFieldToFilter('country_id', array('in' => $deviceCountries))->loadByStore()
|
|
|
|
|
274 |
->toOptionArray(false);
|
275 |
}
|
276 |
if (Mage::app()->useCache('config')) {
|
572 |
$options = array();
|
573 |
/** @var $app Mage_XmlConnect_Model_Application */
|
574 |
foreach (Mage::getModel('xmlconnect/application')->getCollection() as $app) {
|
575 |
+
$options[] = array('value' => $app->getId(), 'label' => $app->getName());
|
|
|
|
|
|
|
576 |
}
|
577 |
if (count($options) > 1) {
|
578 |
+
array_unshift($options, array(
|
579 |
+
'value' => '', 'label' => Mage::helper('xmlconnect')->__('Please Select Application')
|
580 |
+
));
|
|
|
|
|
|
|
|
|
581 |
}
|
582 |
return $options;
|
583 |
}
|
600 |
return $apps;
|
601 |
}
|
602 |
|
603 |
+
/**
|
604 |
+
* Check if creating AirMail template for the application is allowed
|
605 |
+
*
|
606 |
+
* @param Mage_XmlConnect_Model_Application $application
|
607 |
+
* @deprecated after 1.6.0.0
|
608 |
+
* @return boolean
|
609 |
+
*/
|
610 |
+
public static function isTemplateAllowedForApplication($application = null)
|
611 |
+
{
|
612 |
+
return true;
|
613 |
+
}
|
614 |
+
|
615 |
/**
|
616 |
* Send broadcast message
|
617 |
*
|
625 |
}
|
626 |
|
627 |
try {
|
628 |
+
$applicationId = Mage::getModel('xmlconnect/template')->load($queue->getTemplateId())->getApplicationId();
|
629 |
/** @var $app Mage_XmlConnect_Model_Application */
|
630 |
+
$app = Mage::getModel('xmlconnect/application')->load($applicationId);
|
631 |
|
632 |
if (!$app->getId()) {
|
633 |
Mage::throwException(
|
634 |
+
Mage::helper('xmlconnect')->__('Can\'t load application with id "%s"', $applicationId)
|
635 |
);
|
636 |
}
|
637 |
|
654 |
break;
|
655 |
}
|
656 |
|
657 |
+
$curl = new Varien_Http_Adapter_Curl();
|
658 |
+
$curl->setConfig($this->_getCurlConfig($app->getUserpwd()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
|
660 |
+
$urbanUrl = Mage::getStoreConfig($configPath);
|
661 |
+
$curl->write(
|
662 |
+
Zend_Http_Client::POST, $urbanUrl, HTTP_REQUEST_HTTP_VER_1_1, $this->getHttpHeaders(), $params
|
663 |
+
);
|
|
|
|
|
664 |
|
665 |
+
if ($curl->read() && $curl->getInfo(CURLINFO_HTTP_CODE) == 200) {
|
666 |
$queue->setStatus(Mage_XmlConnect_Model_Queue::STATUS_COMPLETED);
|
667 |
}
|
668 |
+
$curl->close();
|
669 |
+
|
670 |
$queue->setIsSent(true);
|
671 |
$queue->save();
|
672 |
return;
|
686 |
return array('Content-Type: application/json');
|
687 |
}
|
688 |
|
689 |
+
/**
|
690 |
+
* Get urban airship curl request configuration
|
691 |
+
*
|
692 |
+
* @param string $userPwd
|
693 |
+
* @param int $timeout
|
694 |
+
* @return array
|
695 |
+
*/
|
696 |
+
protected function _getCurlConfig($userPwd, $timeout = self::CURLOPT_DEFAULT_TIMEOUT)
|
697 |
+
{
|
698 |
+
return array ('timeout' => $timeout, 'userpwd' => $userPwd);
|
699 |
+
}
|
700 |
+
|
701 |
/**
|
702 |
* Remove from array the unnecessary parameters by given keys
|
703 |
*
|
834 |
*/
|
835 |
public function validateConfFieldNotEmpty($field, $native)
|
836 |
{
|
837 |
+
if (($native === false) || (!isset($native['body']) || !is_array($native['body'])
|
838 |
+
|| !isset($native['body'][$field]) || !Zend_Validate::is($native['body'][$field], 'NotEmpty'))
|
|
|
|
|
839 |
) {
|
840 |
return false;
|
841 |
}
|
870 |
$params = array_merge($defaultParams, $params);
|
871 |
return Mage::getUrl($action, $params);
|
872 |
}
|
873 |
+
|
874 |
+
/**
|
875 |
+
* Remove trilling line breaks
|
876 |
+
*
|
877 |
+
* @param string $string
|
878 |
+
* @return string
|
879 |
+
*/
|
880 |
+
public function trimLineBreaks($string)
|
881 |
+
{
|
882 |
+
return preg_replace(array('@\r@', '@\n+@'), array('', PHP_EOL), $string);
|
883 |
+
}
|
884 |
}
|
app/code/core/Mage/XmlConnect/Helper/Image.php
CHANGED
@@ -163,11 +163,7 @@ class Mage_XmlConnect_Helper_Image extends Mage_Core_Helper_Abstract
|
|
163 |
|
164 |
$isCopied = copy($originalSizeFileName, $customSizeFileName);
|
165 |
clearstatcache();
|
166 |
-
if ($isCopied
|
167 |
-
&& (is_readable($customSizeFileName)
|
168 |
-
|| chmod($customSizeFileName, 0644)
|
169 |
-
)
|
170 |
-
) {
|
171 |
$this->_handleResize($fieldPath, $customSizeFileName);
|
172 |
} else {
|
173 |
$fileName = '';
|
@@ -184,7 +180,7 @@ class Mage_XmlConnect_Helper_Image extends Mage_Core_Helper_Abstract
|
|
184 |
*
|
185 |
* @param string $fieldPath
|
186 |
* @param string $file
|
187 |
-
* @return
|
188 |
*/
|
189 |
protected function _handleResize($fieldPath, $file)
|
190 |
{
|
@@ -219,9 +215,7 @@ class Mage_XmlConnect_Helper_Image extends Mage_Core_Helper_Abstract
|
|
219 |
$height = $conf['height'];
|
220 |
}
|
221 |
|
222 |
-
if (($width != $image->getOriginalWidth())
|
223 |
-
|| ($height != $image->getOriginalHeight())
|
224 |
-
) {
|
225 |
$image->keepTransparency(true);
|
226 |
$image->keepFrame(true);
|
227 |
$image->keepAspectRatio(true);
|
@@ -647,7 +641,7 @@ class Mage_XmlConnect_Helper_Image extends Mage_Core_Helper_Abstract
|
|
647 |
* @param mixed $item (argument to change)
|
648 |
* @param mixed $key (used with array_walk_recursive function as a key of given array)
|
649 |
* @param string $value (contains float)
|
650 |
-
* @return
|
651 |
*/
|
652 |
protected function _zoom(&$item, $key, $value)
|
653 |
{
|
163 |
|
164 |
$isCopied = copy($originalSizeFileName, $customSizeFileName);
|
165 |
clearstatcache();
|
166 |
+
if ($isCopied && (is_readable($customSizeFileName) || chmod($customSizeFileName, 0644))) {
|
|
|
|
|
|
|
|
|
167 |
$this->_handleResize($fieldPath, $customSizeFileName);
|
168 |
} else {
|
169 |
$fileName = '';
|
180 |
*
|
181 |
* @param string $fieldPath
|
182 |
* @param string $file
|
183 |
+
* @return null
|
184 |
*/
|
185 |
protected function _handleResize($fieldPath, $file)
|
186 |
{
|
215 |
$height = $conf['height'];
|
216 |
}
|
217 |
|
218 |
+
if (($width != $image->getOriginalWidth()) || ($height != $image->getOriginalHeight())) {
|
|
|
|
|
219 |
$image->keepTransparency(true);
|
220 |
$image->keepFrame(true);
|
221 |
$image->keepAspectRatio(true);
|
641 |
* @param mixed $item (argument to change)
|
642 |
* @param mixed $key (used with array_walk_recursive function as a key of given array)
|
643 |
* @param string $value (contains float)
|
644 |
+
* @return null
|
645 |
*/
|
646 |
protected function _zoom(&$item, $key, $value)
|
647 |
{
|
app/code/core/Mage/XmlConnect/Helper/Ipad.php
CHANGED
@@ -98,11 +98,8 @@ class Mage_XmlConnect_Helper_Ipad extends Mage_Core_Helper_Abstract
|
|
98 |
*
|
99 |
* @var array
|
100 |
*/
|
101 |
-
protected $_imageIds = array(
|
102 |
-
'ipad_loader_portrait_image',
|
103 |
-
'ipad_loader_landscape_image',
|
104 |
-
'ipad_logo',
|
105 |
-
'big_logo'
|
106 |
);
|
107 |
|
108 |
/**
|
@@ -693,7 +690,7 @@ class Mage_XmlConnect_Helper_Ipad extends Mage_Core_Helper_Abstract
|
|
693 |
*
|
694 |
* @throws Mage_Core_Exception
|
695 |
* @param array $data
|
696 |
-
* @return
|
697 |
*/
|
698 |
public function checkRequiredConfigFields($data)
|
699 |
{
|
@@ -701,23 +698,17 @@ class Mage_XmlConnect_Helper_Ipad extends Mage_Core_Helper_Abstract
|
|
701 |
return;
|
702 |
}
|
703 |
|
704 |
-
if (isset($data['navigationBar']['icon'])
|
705 |
-
&& empty($data['navigationBar']['icon'])
|
706 |
-
) {
|
707 |
Mage::throwException(
|
708 |
Mage::helper('xmlconnect')->__('Logo in Header image missing.')
|
709 |
);
|
710 |
}
|
711 |
-
if (isset($data['body']['bannerIpadImage'])
|
712 |
-
&& empty($data['body']['bannerIpadImage'])
|
713 |
-
) {
|
714 |
Mage::throwException(
|
715 |
Mage::helper('xmlconnect')->__('Banner on Home Screen (portrait mode) image missing.')
|
716 |
);
|
717 |
}
|
718 |
-
if (isset($data['body']['bannerIpadLandscapeImage'])
|
719 |
-
&& empty($data['body']['bannerIpadLandscapeImage'])
|
720 |
-
) {
|
721 |
Mage::throwException(
|
722 |
Mage::helper('xmlconnect')->__('Banner on Home Screen (landscape mode) image missing.')
|
723 |
);
|
98 |
*
|
99 |
* @var array
|
100 |
*/
|
101 |
+
protected $_imageIds = array(
|
102 |
+
'icon', 'ipad_loader_portrait_image', 'ipad_loader_landscape_image', 'ipad_logo', 'big_logo'
|
|
|
|
|
|
|
103 |
);
|
104 |
|
105 |
/**
|
690 |
*
|
691 |
* @throws Mage_Core_Exception
|
692 |
* @param array $data
|
693 |
+
* @return null
|
694 |
*/
|
695 |
public function checkRequiredConfigFields($data)
|
696 |
{
|
698 |
return;
|
699 |
}
|
700 |
|
701 |
+
if (isset($data['navigationBar']['icon']) && empty($data['navigationBar']['icon'])) {
|
|
|
|
|
702 |
Mage::throwException(
|
703 |
Mage::helper('xmlconnect')->__('Logo in Header image missing.')
|
704 |
);
|
705 |
}
|
706 |
+
if (isset($data['body']['bannerIpadImage']) && empty($data['body']['bannerIpadImage'])) {
|
|
|
|
|
707 |
Mage::throwException(
|
708 |
Mage::helper('xmlconnect')->__('Banner on Home Screen (portrait mode) image missing.')
|
709 |
);
|
710 |
}
|
711 |
+
if (isset($data['body']['bannerIpadLandscapeImage']) && empty($data['body']['bannerIpadLandscapeImage'])) {
|
|
|
|
|
712 |
Mage::throwException(
|
713 |
Mage::helper('xmlconnect')->__('Banner on Home Screen (landscape mode) image missing.')
|
714 |
);
|
app/code/core/Mage/XmlConnect/Helper/Iphone.php
CHANGED
@@ -59,13 +59,7 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
59 |
* @var array
|
60 |
*/
|
61 |
protected $_imageIds = array(
|
62 |
-
'icon',
|
63 |
-
'loader_image',
|
64 |
-
'loader_image_i4',
|
65 |
-
'logo',
|
66 |
-
'logo_i4',
|
67 |
-
'big_logo',
|
68 |
-
'big_logo_i4'
|
69 |
);
|
70 |
|
71 |
/**
|
@@ -641,10 +635,8 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
641 |
{
|
642 |
$errors = array();
|
643 |
|
644 |
-
if ($native === false
|
645 |
-
||
|
646 |
-
|| !Zend_Validate::is($native['navigationBar']['icon'], 'NotEmpty')
|
647 |
-
)
|
648 |
) {
|
649 |
$errors[] = Mage::helper('xmlconnect')->__('Please upload an image for "Logo in Header" field from Design Tab.');
|
650 |
}
|
@@ -754,7 +746,7 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
754 |
*
|
755 |
* @throws Mage_Core_Exception
|
756 |
* @param array $data
|
757 |
-
* @return
|
758 |
*/
|
759 |
public function checkRequiredConfigFields($data)
|
760 |
{
|
@@ -762,26 +754,14 @@ class Mage_XmlConnect_Helper_Iphone extends Mage_Core_Helper_Abstract
|
|
762 |
return;
|
763 |
}
|
764 |
|
765 |
-
if (isset($data['navigationBar']['icon'])
|
766 |
-
|
767 |
-
) {
|
768 |
-
Mage::throwException(
|
769 |
-
Mage::helper('xmlconnect')->__('Logo in Header image missing.')
|
770 |
-
);
|
771 |
}
|
772 |
-
if (isset($data['body']['bannerImage'])
|
773 |
-
|
774 |
-
) {
|
775 |
-
Mage::throwException(
|
776 |
-
Mage::helper('xmlconnect')->__('Banner on Home Screen image missing.')
|
777 |
-
);
|
778 |
}
|
779 |
-
if (isset($data['body']['backgroundImage'])
|
780 |
-
|
781 |
-
) {
|
782 |
-
Mage::throwException(
|
783 |
-
Mage::helper('xmlconnect')->__('App Background image missing.')
|
784 |
-
);
|
785 |
}
|
786 |
}
|
787 |
|
59 |
* @var array
|
60 |
*/
|
61 |
protected $_imageIds = array(
|
62 |
+
'icon', 'loader_image', 'loader_image_i4', 'logo', 'logo_i4', 'big_logo', 'big_logo_i4'
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
);
|
64 |
|
65 |
/**
|
635 |
{
|
636 |
$errors = array();
|
637 |
|
638 |
+
if ($native === false || (!isset($native['navigationBar']['icon'])
|
639 |
+
|| !Zend_Validate::is($native['navigationBar']['icon'], 'NotEmpty'))
|
|
|
|
|
640 |
) {
|
641 |
$errors[] = Mage::helper('xmlconnect')->__('Please upload an image for "Logo in Header" field from Design Tab.');
|
642 |
}
|
746 |
*
|
747 |
* @throws Mage_Core_Exception
|
748 |
* @param array $data
|
749 |
+
* @return null
|
750 |
*/
|
751 |
public function checkRequiredConfigFields($data)
|
752 |
{
|
754 |
return;
|
755 |
}
|
756 |
|
757 |
+
if (isset($data['navigationBar']['icon']) && empty($data['navigationBar']['icon'])) {
|
758 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Logo in Header image missing.'));
|
|
|
|
|
|
|
|
|
759 |
}
|
760 |
+
if (isset($data['body']['bannerImage']) && empty($data['body']['bannerImage'])) {
|
761 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Banner on Home Screen image missing.'));
|
|
|
|
|
|
|
|
|
762 |
}
|
763 |
+
if (isset($data['body']['backgroundImage']) && empty($data['body']['backgroundImage'])) {
|
764 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('App Background image missing.'));
|
|
|
|
|
|
|
|
|
765 |
}
|
766 |
}
|
767 |
|
app/code/core/Mage/XmlConnect/Helper/Theme.php
CHANGED
@@ -226,9 +226,7 @@ EOT;
|
|
226 |
Mage::logException($e);
|
227 |
}
|
228 |
if (!count($defaultThemeArray)) {
|
229 |
-
Mage::throwException(
|
230 |
-
Mage::helper('xmlconnect')->__('Can\'t load default themes.')
|
231 |
-
);
|
232 |
}
|
233 |
return $defaultThemeArray;
|
234 |
}
|
@@ -273,7 +271,7 @@ EOT;
|
|
273 |
*
|
274 |
* @throws Mage_Core_Exception
|
275 |
* @param null $theme
|
276 |
-
* @return
|
277 |
*/
|
278 |
public function resetTheme($theme = null)
|
279 |
{
|
@@ -293,9 +291,7 @@ EOT;
|
|
293 |
}
|
294 |
|
295 |
if (!$ioFile->cp($src, $dst)) {
|
296 |
-
Mage::throwException(
|
297 |
-
Mage::helper('xmlconnect')->__('Can\'t copy file "%s" to "%s".', $src, $dst)
|
298 |
-
);
|
299 |
} else {
|
300 |
$ioFile->chmod($dst, 0755);
|
301 |
}
|
226 |
Mage::logException($e);
|
227 |
}
|
228 |
if (!count($defaultThemeArray)) {
|
229 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Can\'t load default themes.'));
|
|
|
|
|
230 |
}
|
231 |
return $defaultThemeArray;
|
232 |
}
|
271 |
*
|
272 |
* @throws Mage_Core_Exception
|
273 |
* @param null $theme
|
274 |
+
* @return null
|
275 |
*/
|
276 |
public function resetTheme($theme = null)
|
277 |
{
|
291 |
}
|
292 |
|
293 |
if (!$ioFile->cp($src, $dst)) {
|
294 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Can\'t copy file "%s" to "%s".', $src, $dst));
|
|
|
|
|
295 |
} else {
|
296 |
$ioFile->chmod($dst, 0755);
|
297 |
}
|
app/code/core/Mage/XmlConnect/Model/Adminhtml/System/Config/Backend/Baseurl.php
CHANGED
@@ -37,7 +37,7 @@ class Mage_XmlConnect_Model_Adminhtml_System_Config_Backend_Baseurl
|
|
37 |
/**
|
38 |
* Update all applications "updated at" parameter with current date
|
39 |
*
|
40 |
-
* @return
|
41 |
*/
|
42 |
protected function _afterSave()
|
43 |
{
|
37 |
/**
|
38 |
* Update all applications "updated at" parameter with current date
|
39 |
*
|
40 |
+
* @return Mage_XmlConnect_Model_Adminhtml_System_Config_Backend_Baseurl
|
41 |
*/
|
42 |
protected function _afterSave()
|
43 |
{
|
app/code/core/Mage/XmlConnect/Model/Application.php
CHANGED
@@ -27,8 +27,8 @@
|
|
27 |
/**
|
28 |
* Xmlconnect Application model
|
29 |
*
|
30 |
-
* @method
|
31 |
-
* @method
|
32 |
* @method string getName()
|
33 |
* @method Mage_XmlConnect_Model_Application setName(string $value)
|
34 |
* @method string getCode()
|
@@ -257,15 +257,13 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
257 |
/**
|
258 |
* Initialize application
|
259 |
*
|
260 |
-
* @return
|
261 |
*/
|
262 |
protected function _construct()
|
263 |
{
|
264 |
$this->_init('xmlconnect/application');
|
265 |
$this->_configModel = Mage::getModel('xmlconnect/configData');
|
266 |
-
$this->_configModel->setDeleteOnUpdate(
|
267 |
-
$this->getDeleteOnUpdateConfig()
|
268 |
-
);
|
269 |
}
|
270 |
|
271 |
/**
|
@@ -345,7 +343,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
345 |
/**
|
346 |
* Set default configuration data
|
347 |
*
|
348 |
-
* @return
|
349 |
*/
|
350 |
public function loadDefaultConfiguration()
|
351 |
{
|
@@ -471,8 +469,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
471 |
->getStore($this->getStoreId())->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
|
472 |
$result['general']['magentoVersion'] = Mage::getVersion();
|
473 |
$result['general']['copyright'] = Mage::getStoreConfig(
|
474 |
-
self::XML_PATH_DESIGN_FOOTER_COPYRIGHT,
|
475 |
-
$this->getStoreId()
|
476 |
);
|
477 |
$result['general']['xmlconnectVersion'] = Mage::getConfig()->getNode(self::XML_PATH_MODULE_VERSION);
|
478 |
|
@@ -564,10 +561,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
564 |
*/
|
565 |
public function getSecureBaseUrl()
|
566 |
{
|
567 |
-
return Mage::getStoreConfig(
|
568 |
-
self::XML_PATH_SECURE_BASE_LINK_URL,
|
569 |
-
$this->getStoreId()
|
570 |
-
);
|
571 |
}
|
572 |
|
573 |
/**
|
@@ -577,9 +571,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
577 |
*/
|
578 |
public function getUseSecureURLInFrontend()
|
579 |
{
|
580 |
-
return (int) Mage::getStoreConfigFlag(
|
581 |
-
Mage_Core_Model_Store::XML_PATH_SECURE_IN_FRONTEND
|
582 |
-
);
|
583 |
}
|
584 |
|
585 |
/**
|
@@ -633,9 +625,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
633 |
if (!empty($value)) {
|
634 |
if (is_array($value)) {
|
635 |
$subtree[$key] = $this->_absPath($value);
|
636 |
-
} elseif (strtolower(substr($key, -4)) == 'icon'
|
637 |
-
|| strtolower(substr($key, -5)) == 'image'
|
638 |
-
) {
|
639 |
$subtree[$key] = Mage::getBaseUrl('media') . 'xmlconnect/' . $value;
|
640 |
}
|
641 |
}
|
@@ -673,9 +663,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
673 |
*/
|
674 |
protected function _beforeSave()
|
675 |
{
|
676 |
-
$this->setUpdatedAt(
|
677 |
-
Mage::getSingleton('core/date')->gmtDate()
|
678 |
-
);
|
679 |
return $this;
|
680 |
}
|
681 |
|
@@ -701,9 +689,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
701 |
{
|
702 |
$configuration = $this->getData('config_data');
|
703 |
if (is_array($configuration)) {
|
704 |
-
$this->getConfigModel()
|
705 |
-
->setConfigData($this->getId(), $configuration)
|
706 |
-
->initSaveConfig();
|
707 |
}
|
708 |
return $this;
|
709 |
}
|
@@ -719,9 +705,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
719 |
$deprecatedConfig = $this->getData('conf');
|
720 |
if (is_array($deprecatedConfig)) {
|
721 |
$this->getConfigModel()->saveConfig(
|
722 |
-
$this->getId(),
|
723 |
-
$this->convertOldConfing($deprecatedConfig),
|
724 |
-
self::DEPRECATED_CONFIG_FLAG
|
725 |
);
|
726 |
}
|
727 |
return $this;
|
@@ -758,8 +742,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
758 |
{
|
759 |
if (!$this->_isConfigurationLoaded) {
|
760 |
if ($this->getId()) {
|
761 |
-
$this->_loadDeprecatedConfig()
|
762 |
-
->_loadConfigData();
|
763 |
$this->_isConfigurationLoaded = true;
|
764 |
}
|
765 |
}
|
@@ -774,15 +757,11 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
774 |
*/
|
775 |
protected function _loadConfigData()
|
776 |
{
|
777 |
-
$configuration = $this->getConfigModel()
|
778 |
-
->
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
'category' => 'payment'
|
783 |
-
)
|
784 |
-
)
|
785 |
-
->toOptionArray();
|
786 |
$this->setData('config_data', $configuration);
|
787 |
return $this;
|
788 |
}
|
@@ -796,15 +775,10 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
796 |
private function _loadDeprecatedConfig()
|
797 |
{
|
798 |
$configuration = $this->_convertConfig(
|
799 |
-
$this->getConfigModel()
|
800 |
-
->
|
801 |
-
|
802 |
-
|
803 |
-
'application_id' => $this->getId(),
|
804 |
-
'category' => self::DEPRECATED_CONFIG_FLAG
|
805 |
-
)
|
806 |
-
)
|
807 |
-
->toOptionArray()
|
808 |
);
|
809 |
$this->setData('conf', $configuration);
|
810 |
return $this;
|
@@ -867,9 +841,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
867 |
$conf['submit_restore'] = array();
|
868 |
}
|
869 |
foreach ($params as $id => $value) {
|
870 |
-
$deviceImages = Mage::helper('xmlconnect')
|
871 |
-
->getDeviceHelper()
|
872 |
-
->getSubmitImages();
|
873 |
|
874 |
if (!in_array($id, $deviceImages)) {
|
875 |
$conf['submit_text'][$id] = $value;
|
@@ -1047,9 +1019,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
1047 |
$params['code'] = $this->getCode();
|
1048 |
$params['type'] = $this->getType();
|
1049 |
$params['url'] = Mage::getUrl('xmlconnect/configuration/index', array(
|
1050 |
-
'_store' => $this->getStoreId(),
|
1051 |
-
'_nosid' => true,
|
1052 |
-
'app_code' => $this->getCode()
|
1053 |
));
|
1054 |
|
1055 |
$params['magentoversion'] = Mage::getVersion();
|
@@ -1079,9 +1049,7 @@ class Mage_XmlConnect_Model_Application extends Mage_Core_Model_Abstract
|
|
1079 |
$submitRestore = $this->_data['conf']['submit_restore'];
|
1080 |
}
|
1081 |
|
1082 |
-
$deviceImages = Mage::helper('xmlconnect')
|
1083 |
-
->getDeviceHelper()
|
1084 |
-
->getSubmitImages();
|
1085 |
|
1086 |
foreach ($deviceImages as $id) {
|
1087 |
if (isset($submit[$id])) {
|
27 |
/**
|
28 |
* Xmlconnect Application model
|
29 |
*
|
30 |
+
* @method Mage_XmlConnect_Model_Resource_Application _getResource()
|
31 |
+
* @method Mage_XmlConnect_Model_Resource_Application getResource()
|
32 |
* @method string getName()
|
33 |
* @method Mage_XmlConnect_Model_Application setName(string $value)
|
34 |
* @method string getCode()
|
257 |
/**
|
258 |
* Initialize application
|
259 |
*
|
260 |
+
* @return null
|
261 |
*/
|
262 |
protected function _construct()
|
263 |
{
|
264 |
$this->_init('xmlconnect/application');
|
265 |
$this->_configModel = Mage::getModel('xmlconnect/configData');
|
266 |
+
$this->_configModel->setDeleteOnUpdate($this->getDeleteOnUpdateConfig());
|
|
|
|
|
267 |
}
|
268 |
|
269 |
/**
|
343 |
/**
|
344 |
* Set default configuration data
|
345 |
*
|
346 |
+
* @return null
|
347 |
*/
|
348 |
public function loadDefaultConfiguration()
|
349 |
{
|
469 |
->getStore($this->getStoreId())->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
|
470 |
$result['general']['magentoVersion'] = Mage::getVersion();
|
471 |
$result['general']['copyright'] = Mage::getStoreConfig(
|
472 |
+
self::XML_PATH_DESIGN_FOOTER_COPYRIGHT, $this->getStoreId()
|
|
|
473 |
);
|
474 |
$result['general']['xmlconnectVersion'] = Mage::getConfig()->getNode(self::XML_PATH_MODULE_VERSION);
|
475 |
|
561 |
*/
|
562 |
public function getSecureBaseUrl()
|
563 |
{
|
564 |
+
return Mage::getStoreConfig(self::XML_PATH_SECURE_BASE_LINK_URL, $this->getStoreId());
|
|
|
|
|
|
|
565 |
}
|
566 |
|
567 |
/**
|
571 |
*/
|
572 |
public function getUseSecureURLInFrontend()
|
573 |
{
|
574 |
+
return (int) Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_SECURE_IN_FRONTEND);
|
|
|
|
|
575 |
}
|
576 |
|
577 |
/**
|
625 |
if (!empty($value)) {
|
626 |
if (is_array($value)) {
|
627 |
$subtree[$key] = $this->_absPath($value);
|
628 |
+
} elseif (strtolower(substr($key, -4)) == 'icon' || strtolower(substr($key, -5)) == 'image') {
|
|
|
|
|
629 |
$subtree[$key] = Mage::getBaseUrl('media') . 'xmlconnect/' . $value;
|
630 |
}
|
631 |
}
|
663 |
*/
|
664 |
protected function _beforeSave()
|
665 |
{
|
666 |
+
$this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
|
|
|
|
|
667 |
return $this;
|
668 |
}
|
669 |
|
689 |
{
|
690 |
$configuration = $this->getData('config_data');
|
691 |
if (is_array($configuration)) {
|
692 |
+
$this->getConfigModel()->setConfigData($this->getId(), $configuration)->initSaveConfig();
|
|
|
|
|
693 |
}
|
694 |
return $this;
|
695 |
}
|
705 |
$deprecatedConfig = $this->getData('conf');
|
706 |
if (is_array($deprecatedConfig)) {
|
707 |
$this->getConfigModel()->saveConfig(
|
708 |
+
$this->getId(), $this->convertOldConfing($deprecatedConfig), self::DEPRECATED_CONFIG_FLAG
|
|
|
|
|
709 |
);
|
710 |
}
|
711 |
return $this;
|
742 |
{
|
743 |
if (!$this->_isConfigurationLoaded) {
|
744 |
if ($this->getId()) {
|
745 |
+
$this->_loadDeprecatedConfig()->_loadConfigData();
|
|
|
746 |
$this->_isConfigurationLoaded = true;
|
747 |
}
|
748 |
}
|
757 |
*/
|
758 |
protected function _loadConfigData()
|
759 |
{
|
760 |
+
$configuration = $this->getConfigModel()->getCollection()->addArrayFilter(array(
|
761 |
+
'application_id' => $this->getId(),
|
762 |
+
'category' => 'payment'
|
763 |
+
))->toOptionArray();
|
764 |
+
|
|
|
|
|
|
|
|
|
765 |
$this->setData('config_data', $configuration);
|
766 |
return $this;
|
767 |
}
|
775 |
private function _loadDeprecatedConfig()
|
776 |
{
|
777 |
$configuration = $this->_convertConfig(
|
778 |
+
$this->getConfigModel()->getCollection()->addArrayFilter(array(
|
779 |
+
'application_id' => $this->getId(),
|
780 |
+
'category' => self::DEPRECATED_CONFIG_FLAG
|
781 |
+
))->toOptionArray()
|
|
|
|
|
|
|
|
|
|
|
782 |
);
|
783 |
$this->setData('conf', $configuration);
|
784 |
return $this;
|
841 |
$conf['submit_restore'] = array();
|
842 |
}
|
843 |
foreach ($params as $id => $value) {
|
844 |
+
$deviceImages = Mage::helper('xmlconnect')->getDeviceHelper()->getSubmitImages();
|
|
|
|
|
845 |
|
846 |
if (!in_array($id, $deviceImages)) {
|
847 |
$conf['submit_text'][$id] = $value;
|
1019 |
$params['code'] = $this->getCode();
|
1020 |
$params['type'] = $this->getType();
|
1021 |
$params['url'] = Mage::getUrl('xmlconnect/configuration/index', array(
|
1022 |
+
'_store' => $this->getStoreId(), '_nosid' => true, 'app_code' => $this->getCode()
|
|
|
|
|
1023 |
));
|
1024 |
|
1025 |
$params['magentoversion'] = Mage::getVersion();
|
1049 |
$submitRestore = $this->_data['conf']['submit_restore'];
|
1050 |
}
|
1051 |
|
1052 |
+
$deviceImages = Mage::helper('xmlconnect')->getDeviceHelper()->getSubmitImages();
|
|
|
|
|
1053 |
|
1054 |
foreach ($deviceImages as $id) {
|
1055 |
if (isset($submit[$id])) {
|
app/code/core/Mage/XmlConnect/Model/Catalog/Category/Image.php
CHANGED
@@ -59,9 +59,7 @@ class Mage_XmlConnect_Model_Catalog_Category_Image extends Mage_Catalog_Model_Pr
|
|
59 |
if (!$file) {
|
60 |
// check if placeholder defined in config
|
61 |
$isConfigPlaceholder = Mage::getStoreConfig(
|
62 |
-
'catalog/placeholder/'
|
63 |
-
. $this->getDestinationSubdir()
|
64 |
-
. '_placeholder'
|
65 |
);
|
66 |
$configPlaceholder = '/placeholder/' . $isConfigPlaceholder;
|
67 |
if ($isConfigPlaceholder && file_exists($baseDir . $configPlaceholder)) {
|
@@ -69,21 +67,17 @@ class Mage_XmlConnect_Model_Catalog_Category_Image extends Mage_Catalog_Model_Pr
|
|
69 |
} else {
|
70 |
// replace file with skin or default skin placeholder
|
71 |
$skinBaseDir = Mage::getDesign()->getSkinBaseDir();
|
72 |
-
$skinPlaceholder = '/images/xmlconnect/catalog/category/placeholder/'
|
73 |
-
. $this->getDestinationSubdir()
|
74 |
. '.jpg';
|
75 |
|
76 |
$file = $skinPlaceholder;
|
77 |
if (file_exists($skinBaseDir . $file)) {
|
78 |
$baseDir = $skinBaseDir;
|
79 |
} else {
|
80 |
-
$baseDir = Mage::getDesign()->getSkinBaseDir(
|
81 |
-
array('_theme' => 'default')
|
82 |
-
);
|
83 |
if (!file_exists($baseDir . $file)) {
|
84 |
-
$baseDir = Mage::getDesign()
|
85 |
-
array('_theme' => 'default', '_package' => 'base')
|
86 |
-
);
|
87 |
}
|
88 |
}
|
89 |
}
|
@@ -93,33 +87,24 @@ class Mage_XmlConnect_Model_Catalog_Category_Image extends Mage_Catalog_Model_Pr
|
|
93 |
$baseFile = $baseDir . $file;
|
94 |
|
95 |
if ((!$file) || (!file_exists($baseFile))) {
|
96 |
-
Mage::throwException(
|
97 |
-
Mage::helper('xmlconnect')->__('Image file was not found.')
|
98 |
-
);
|
99 |
}
|
100 |
|
101 |
$this->_baseFile = $baseFile;
|
102 |
|
103 |
// build new filename (most important params)
|
104 |
-
$path = array(
|
105 |
-
Mage::
|
106 |
-
'cache',
|
107 |
-
Mage::app()->getStore()->getId(),
|
108 |
-
$path[] = $this->getDestinationSubdir()
|
109 |
);
|
110 |
if ((!empty($this->_width)) || (!empty($this->_height))) {
|
111 |
$path[] = "{$this->_width}x{$this->_height}";
|
112 |
}
|
113 |
|
114 |
// add misk params as a hash
|
115 |
-
$miscParams = array(
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
|
120 |
-
$this->_rgbToString($this->_backgroundColor),
|
121 |
-
'angle' . $this->_angle,
|
122 |
-
'quality' . $this->_quality
|
123 |
);
|
124 |
|
125 |
// if has watermark add watermark params to hash
|
@@ -176,7 +161,7 @@ class Mage_XmlConnect_Model_Catalog_Category_Image extends Mage_Catalog_Model_Pr
|
|
176 |
/**
|
177 |
* Clear catalog cache
|
178 |
*
|
179 |
-
* @return
|
180 |
*/
|
181 |
public function clearCache()
|
182 |
{
|
59 |
if (!$file) {
|
60 |
// check if placeholder defined in config
|
61 |
$isConfigPlaceholder = Mage::getStoreConfig(
|
62 |
+
'catalog/placeholder/' . $this->getDestinationSubdir() . '_placeholder'
|
|
|
|
|
63 |
);
|
64 |
$configPlaceholder = '/placeholder/' . $isConfigPlaceholder;
|
65 |
if ($isConfigPlaceholder && file_exists($baseDir . $configPlaceholder)) {
|
67 |
} else {
|
68 |
// replace file with skin or default skin placeholder
|
69 |
$skinBaseDir = Mage::getDesign()->getSkinBaseDir();
|
70 |
+
$skinPlaceholder = '/images/xmlconnect/catalog/category/placeholder/' . $this->getDestinationSubdir()
|
|
|
71 |
. '.jpg';
|
72 |
|
73 |
$file = $skinPlaceholder;
|
74 |
if (file_exists($skinBaseDir . $file)) {
|
75 |
$baseDir = $skinBaseDir;
|
76 |
} else {
|
77 |
+
$baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default'));
|
|
|
|
|
78 |
if (!file_exists($baseDir . $file)) {
|
79 |
+
$baseDir = Mage::getDesign()
|
80 |
+
->getSkinBaseDir(array('_theme' => 'default', '_package' => 'base'));
|
|
|
81 |
}
|
82 |
}
|
83 |
}
|
87 |
$baseFile = $baseDir . $file;
|
88 |
|
89 |
if ((!$file) || (!file_exists($baseFile))) {
|
90 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Image file was not found.'));
|
|
|
|
|
91 |
}
|
92 |
|
93 |
$this->_baseFile = $baseFile;
|
94 |
|
95 |
// build new filename (most important params)
|
96 |
+
$path = array(Mage::getSingleton('xmlconnect/catalog_category_media_config')->getBaseMediaPath(), 'cache',
|
97 |
+
Mage::app()->getStore()->getId(), $path[] = $this->getDestinationSubdir()
|
|
|
|
|
|
|
98 |
);
|
99 |
if ((!empty($this->_width)) || (!empty($this->_height))) {
|
100 |
$path[] = "{$this->_width}x{$this->_height}";
|
101 |
}
|
102 |
|
103 |
// add misk params as a hash
|
104 |
+
$miscParams = array(($this->_keepAspectRatio ? '' : 'non') . 'proportional',
|
105 |
+
($this->_keepFrame ? '' : 'no') . 'frame', ($this->_keepTransparency ? '' : 'no') . 'transparency',
|
106 |
+
($this->_constrainOnly ? 'do' : 'not') . 'constrainonly', $this->_rgbToString($this->_backgroundColor),
|
107 |
+
'angle' . $this->_angle, 'quality' . $this->_quality
|
|
|
|
|
|
|
|
|
108 |
);
|
109 |
|
110 |
// if has watermark add watermark params to hash
|
161 |
/**
|
162 |
* Clear catalog cache
|
163 |
*
|
164 |
+
* @return null
|
165 |
*/
|
166 |
public function clearCache()
|
167 |
{
|
app/code/core/Mage/XmlConnect/Model/ConfigData.php
CHANGED
@@ -60,7 +60,7 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
60 |
/**
|
61 |
* Initialize configuration data
|
62 |
*
|
63 |
-
* @return
|
64 |
*/
|
65 |
protected function _construct()
|
66 |
{
|
@@ -154,11 +154,7 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
154 |
$applicationId = str_ireplace(self::CONFIG_PREFIX, '', $application);
|
155 |
$this->_deleteOnUpdate($applicationId);
|
156 |
foreach ($data as $category => $config) {
|
157 |
-
$this->saveConfig(
|
158 |
-
$applicationId,
|
159 |
-
$config,
|
160 |
-
$category
|
161 |
-
);
|
162 |
}
|
163 |
}
|
164 |
return $this;
|
@@ -176,9 +172,7 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
176 |
{
|
177 |
foreach ($configData as $path => $value) {
|
178 |
if (!is_scalar($value)) {
|
179 |
-
Mage::throwException(
|
180 |
-
Mage::helper('xmlconnect')->__('Unsupported value type received')
|
181 |
-
);
|
182 |
}
|
183 |
$this->getResource()->saveConfig($applicationId, $category, $path, $value);
|
184 |
}
|
60 |
/**
|
61 |
* Initialize configuration data
|
62 |
*
|
63 |
+
* @return null
|
64 |
*/
|
65 |
protected function _construct()
|
66 |
{
|
154 |
$applicationId = str_ireplace(self::CONFIG_PREFIX, '', $application);
|
155 |
$this->_deleteOnUpdate($applicationId);
|
156 |
foreach ($data as $category => $config) {
|
157 |
+
$this->saveConfig($applicationId, $config, $category);
|
|
|
|
|
|
|
|
|
158 |
}
|
159 |
}
|
160 |
return $this;
|
172 |
{
|
173 |
foreach ($configData as $path => $value) {
|
174 |
if (!is_scalar($value)) {
|
175 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Unsupported value type received'));
|
|
|
|
|
176 |
}
|
177 |
$this->getResource()->saveConfig($applicationId, $category, $path, $value);
|
178 |
}
|
app/code/core/Mage/XmlConnect/Model/History.php
CHANGED
@@ -27,8 +27,8 @@
|
|
27 |
/**
|
28 |
* Xmlconnect history model
|
29 |
*
|
30 |
-
* @method
|
31 |
-
* @method
|
32 |
* @method int getApplicationId()
|
33 |
* @method Mage_XmlConnect_Model_History setApplicationId(int $value)
|
34 |
* @method string getCreatedAt()
|
@@ -45,7 +45,7 @@
|
|
45 |
* @method Mage_XmlConnect_Model_History setCode(string $value)
|
46 |
*
|
47 |
* @category Mage
|
48 |
-
* @package
|
49 |
* @author Magento Core Team <core@magentocommerce.com>
|
50 |
*/
|
51 |
class Mage_XmlConnect_Model_History extends Mage_Core_Model_Abstract
|
@@ -53,7 +53,7 @@ class Mage_XmlConnect_Model_History extends Mage_Core_Model_Abstract
|
|
53 |
/**
|
54 |
* Initialize application
|
55 |
*
|
56 |
-
* @return
|
57 |
*/
|
58 |
protected function _construct()
|
59 |
{
|
27 |
/**
|
28 |
* Xmlconnect history model
|
29 |
*
|
30 |
+
* @method Mage_XmlConnect_Model_Resource_History _getResource()
|
31 |
+
* @method Mage_XmlConnect_Model_Resource_History getResource()
|
32 |
* @method int getApplicationId()
|
33 |
* @method Mage_XmlConnect_Model_History setApplicationId(int $value)
|
34 |
* @method string getCreatedAt()
|
45 |
* @method Mage_XmlConnect_Model_History setCode(string $value)
|
46 |
*
|
47 |
* @category Mage
|
48 |
+
* @package Mage_XmlConnect
|
49 |
* @author Magento Core Team <core@magentocommerce.com>
|
50 |
*/
|
51 |
class Mage_XmlConnect_Model_History extends Mage_Core_Model_Abstract
|
53 |
/**
|
54 |
* Initialize application
|
55 |
*
|
56 |
+
* @return null
|
57 |
*/
|
58 |
protected function _construct()
|
59 |
{
|
app/code/core/Mage/XmlConnect/Model/Input/Filter/MaliciousCode.php
DELETED
@@ -1,100 +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 |
-
* Filter for removing malicious code from HTML
|
29 |
-
*
|
30 |
-
* Current class is a copy of Mage_Core_Model_Input_Filter_MaliciousCode
|
31 |
-
* and added for back compatibility with older versions of Magento
|
32 |
-
* due to the fact that we use these code for packages in Magento Connect
|
33 |
-
*
|
34 |
-
* @category Mage
|
35 |
-
* @package Mage_XmlConnect
|
36 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
37 |
-
*/
|
38 |
-
class Mage_XmlConnect_Model_Input_Filter_MaliciousCode implements Zend_Filter_Interface
|
39 |
-
{
|
40 |
-
/**
|
41 |
-
* Regular expressions for cutting malicious code
|
42 |
-
*
|
43 |
-
* @var array
|
44 |
-
*/
|
45 |
-
protected $_expressions = array(
|
46 |
-
//comments, must be first
|
47 |
-
'/(\/\*.*\*\/)/Us',
|
48 |
-
//tabs
|
49 |
-
'/(\t)/',
|
50 |
-
//javasript prefix
|
51 |
-
'/(javascript\s*:)/Usi',
|
52 |
-
//import styles
|
53 |
-
'/(@import)/Usi',
|
54 |
-
//js in the style attribute
|
55 |
-
'/style=[^<]*((expression\s*?\([^<]*?\))|(behavior\s*:))[^<]*(?=\>)/Uis',
|
56 |
-
//js attributes
|
57 |
-
'/(ondblclick|onclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onload|onunload|onerror)=[^<]*(?=\>)/Uis',
|
58 |
-
//tags
|
59 |
-
'/<\/?(script|meta|link|frame|iframe).*>/Uis',
|
60 |
-
//base64 usage
|
61 |
-
'/src=[^<]*base64[^<]*(?=\>)/Uis',
|
62 |
-
);
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Filter value
|
66 |
-
*
|
67 |
-
* @param string|array $value
|
68 |
-
* @return string|array Filtered value
|
69 |
-
*/
|
70 |
-
public function filter($value)
|
71 |
-
{
|
72 |
-
return preg_replace($this->_expressions, '', $value);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Add expression
|
77 |
-
*
|
78 |
-
* @param string $expression
|
79 |
-
* @return Mage_Core_Model_Input_Filter_MaliciousCode
|
80 |
-
*/
|
81 |
-
public function addExpression($expression)
|
82 |
-
{
|
83 |
-
if (!in_array($expression, $this->_expressions)) {
|
84 |
-
$this->_expressions[] = $expression;
|
85 |
-
}
|
86 |
-
return $this;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Set expressions
|
91 |
-
*
|
92 |
-
* @param array $expressions
|
93 |
-
* @return Mage_Core_Model_Input_Filter_MaliciousCode
|
94 |
-
*/
|
95 |
-
public function setExpressions(array $expressions)
|
96 |
-
{
|
97 |
-
$this->_expressions = $expressions;
|
98 |
-
return $this;
|
99 |
-
}
|
100 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Application.php
CHANGED
@@ -25,104 +25,12 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Model_Mysql4_Application extends
|
35 |
{
|
36 |
-
/**
|
37 |
-
* Constructor, setting table and index field
|
38 |
-
*
|
39 |
-
* @return void
|
40 |
-
*/
|
41 |
-
protected function _construct()
|
42 |
-
{
|
43 |
-
$this->_init('xmlconnect/application', 'application_id');
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Update Application Status field, insert data to history table
|
48 |
-
*
|
49 |
-
* @param int $applicationId
|
50 |
-
* @param string $status
|
51 |
-
* @return Mage_XmlConnect_Model_Mysql4_Application
|
52 |
-
*/
|
53 |
-
public function updateApplicationStatus($applicationId, $status)
|
54 |
-
{
|
55 |
-
$this->_getWriteAdapter()->update(
|
56 |
-
$this->getMainTable(),
|
57 |
-
array('status' => $status),
|
58 |
-
$this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $applicationId)
|
59 |
-
);
|
60 |
-
return $this;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Processing object before save data
|
65 |
-
* Update app_code as Store + Device
|
66 |
-
*
|
67 |
-
* @param Mage_Core_Model_Abstract $object
|
68 |
-
* @return Mage_Core_Model_Abstract
|
69 |
-
*/
|
70 |
-
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
71 |
-
{
|
72 |
-
if (!$object->getId()) {
|
73 |
-
$object->setCode($object->getCodePrefix());
|
74 |
-
}
|
75 |
-
return parent::_beforeSave($object);
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Processing object after save data
|
80 |
-
* Update app_code as Store + Device + 123 (increment).
|
81 |
-
*
|
82 |
-
* @param Mage_Core_Model_Abstract $object
|
83 |
-
* @return Mage_Core_Model_Abstract
|
84 |
-
*/
|
85 |
-
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
86 |
-
{
|
87 |
-
$appCode = $object->getCode();
|
88 |
-
$isCodePrefixed = $object->isCodePrefixed();
|
89 |
-
if (!$isCodePrefixed) {
|
90 |
-
$this->_getWriteAdapter()->update(
|
91 |
-
$this->getMainTable(),
|
92 |
-
array('code' => $appCode . $object->getId()),
|
93 |
-
$this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $object->getId())
|
94 |
-
);
|
95 |
-
}
|
96 |
-
return parent::_afterSave($object);
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Collect existing stores and type unique pairs
|
101 |
-
*
|
102 |
-
* @return array
|
103 |
-
*/
|
104 |
-
public function getExistingStoreDeviceType()
|
105 |
-
{
|
106 |
-
$select = $this->_getWriteAdapter()->select()
|
107 |
-
->from($this->getMainTable(), array('store_id', 'type'))
|
108 |
-
->group(array('store_id', 'type'))
|
109 |
-
->order(array('store_id', 'type'));
|
110 |
-
return $this->_getReadAdapter()->fetchAll($select, array('store_id', 'type'));
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Update all applications "updated at" parameter with current date
|
115 |
-
*
|
116 |
-
* @return Mage_XmlConnect_Model_Mysql4_Application
|
117 |
-
*/
|
118 |
-
public function updateAllAppsUpdatedAtParameter()
|
119 |
-
{
|
120 |
-
$this->_getWriteAdapter()->update(
|
121 |
-
$this->getMainTable(),
|
122 |
-
array(
|
123 |
-
'updated_at' => date('Y-m-d H:i:s')
|
124 |
-
)
|
125 |
-
);
|
126 |
-
return $this;
|
127 |
-
}
|
128 |
}
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* XmlConnect Model Resource Application
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_Application extends Mage_XmlConnect_Model_Resource_Application
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Application/Collection.php
CHANGED
@@ -23,15 +23,14 @@
|
|
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 |
-
/**
|
29 |
-
* Constructor, setting table
|
30 |
-
*
|
31 |
-
* @return void
|
32 |
-
*/
|
33 |
-
protected function _construct()
|
34 |
-
{
|
35 |
-
$this->_init('xmlconnect/application');
|
36 |
-
}
|
37 |
}
|
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 |
+
* XmlConnect Model Resource Application Collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_Application_Collection extends Mage_XmlConnect_Model_Resource_Application_Collection
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Cms/Page/Collection.php
CHANGED
@@ -27,37 +27,10 @@
|
|
27 |
/**
|
28 |
* Extended CMS page collection
|
29 |
*
|
30 |
-
* @category
|
31 |
-
* @package
|
32 |
-
* @author
|
33 |
*/
|
34 |
-
|
35 |
-
class Mage_XmlConnect_Model_Mysql4_Cms_Page_Collection extends Mage_Cms_Model_Mysql4_Page_Collection
|
36 |
{
|
37 |
-
/**
|
38 |
-
* Returns pairs identifier - title for unique identifiers
|
39 |
-
* and pairs identifier|page_id - title for non-unique after first
|
40 |
-
*
|
41 |
-
* @return array
|
42 |
-
*/
|
43 |
-
public function toOptionIdArray()
|
44 |
-
{
|
45 |
-
$res = array();
|
46 |
-
$existingIdentifiers = array();
|
47 |
-
foreach ($this as $item) {
|
48 |
-
$identifier = $item->getData('identifier');
|
49 |
-
|
50 |
-
$data['value'] = $identifier;
|
51 |
-
$data['label'] = $item->getData('title');
|
52 |
-
if (in_array($identifier, $existingIdentifiers)) {
|
53 |
-
$data['value'] .= '|' . $item->getData('page_id');
|
54 |
-
} else {
|
55 |
-
$existingIdentifiers[] = $identifier;
|
56 |
-
}
|
57 |
-
|
58 |
-
$res[] = $data;
|
59 |
-
}
|
60 |
-
|
61 |
-
return $res;
|
62 |
-
}
|
63 |
}
|
27 |
/**
|
28 |
* Extended CMS page collection
|
29 |
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_Cms_Page_Collection extends Mage_XmlConnect_Model_Resource_Cms_Page_Collection
|
|
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData.php
CHANGED
@@ -31,77 +31,6 @@
|
|
31 |
* @package Mage_Xmlconnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Model_Mysql4_ConfigData extends
|
35 |
{
|
36 |
-
/**
|
37 |
-
* Initialize configuration data
|
38 |
-
*
|
39 |
-
* @return void
|
40 |
-
*/
|
41 |
-
protected function _construct()
|
42 |
-
{
|
43 |
-
$this->_init('xmlconnect/configData', null);
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Save config value
|
48 |
-
*
|
49 |
-
* @param int $applicationId
|
50 |
-
* @param string $category
|
51 |
-
* @param string $path
|
52 |
-
* @param string $value
|
53 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData
|
54 |
-
*/
|
55 |
-
public function saveConfig($applicationId, $category, $path, $value)
|
56 |
-
{
|
57 |
-
$newData = array(
|
58 |
-
'application_id' => $applicationId,
|
59 |
-
'category' => $category,
|
60 |
-
'path' => $path,
|
61 |
-
'value' => $value
|
62 |
-
);
|
63 |
-
|
64 |
-
$this->_getWriteAdapter()->insertOnDuplicate(
|
65 |
-
$this->getMainTable(),
|
66 |
-
$newData,
|
67 |
-
array('value')
|
68 |
-
);
|
69 |
-
return $this;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Delete config value
|
74 |
-
*
|
75 |
-
* @param int $applicationId
|
76 |
-
* @param bool $category
|
77 |
-
* @param bool $path
|
78 |
-
* @param bool $pathLike
|
79 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData
|
80 |
-
*/
|
81 |
-
public function deleteConfig($applicationId, $category = false, $path = false, $pathLike = true)
|
82 |
-
{
|
83 |
-
try {
|
84 |
-
$this->_getWriteAdapter()->beginTransaction();
|
85 |
-
$writeAdapter = $this->_getWriteAdapter();
|
86 |
-
$deleteWhere[] = $writeAdapter->quoteInto('application_id=?', $applicationId);
|
87 |
-
if ($category) {
|
88 |
-
$deleteWhere[] = $writeAdapter->quoteInto('category=?', $category);
|
89 |
-
}
|
90 |
-
if ($path) {
|
91 |
-
$deleteWhere[] = $pathLike
|
92 |
-
? $writeAdapter->quoteInto('path like ?', $path . '/%')
|
93 |
-
: $writeAdapter->quoteInto('path=?', $path);
|
94 |
-
}
|
95 |
-
$writeAdapter->delete($this->getMainTable(), $deleteWhere);
|
96 |
-
$this->_getWriteAdapter()->commit();
|
97 |
-
} catch (Mage_Core_Exception $e) {
|
98 |
-
$this->_getWriteAdapter()->rollBack();
|
99 |
-
throw $e;
|
100 |
-
} catch (Exception $e){
|
101 |
-
$this->_getWriteAdapter()->rollBack();
|
102 |
-
Mage::logException($e);
|
103 |
-
}
|
104 |
-
|
105 |
-
return $this;
|
106 |
-
}
|
107 |
}
|
31 |
* @package Mage_Xmlconnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_ConfigData extends Mage_XmlConnect_Model_Resource_ConfigData
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/ConfigData/Collection.php
CHANGED
@@ -32,146 +32,6 @@
|
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
35 |
-
extends
|
36 |
{
|
37 |
-
/**
|
38 |
-
* Is application filter applied
|
39 |
-
*
|
40 |
-
* @var bool
|
41 |
-
*/
|
42 |
-
protected $_applicationFilter = false;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Internal constructor
|
46 |
-
*/
|
47 |
-
protected function _construct()
|
48 |
-
{
|
49 |
-
$this->_init('xmlconnect/configData');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Add application filter
|
54 |
-
*
|
55 |
-
* @param $applicationId
|
56 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
57 |
-
*/
|
58 |
-
public function addApplicationIdFilter($applicationId)
|
59 |
-
{
|
60 |
-
$this->_applicationFilter = true;
|
61 |
-
$this->getSelect()
|
62 |
-
->where('application_id=?', $applicationId);
|
63 |
-
return $this;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Add path filter
|
68 |
-
*
|
69 |
-
* @param $path
|
70 |
-
* @param bool $like
|
71 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
72 |
-
*/
|
73 |
-
public function addPathFilter($path, $like = true)
|
74 |
-
{
|
75 |
-
if ($like) {
|
76 |
-
$this->getSelect()
|
77 |
-
->where('path like ?', $path . '/%');
|
78 |
-
} else {
|
79 |
-
$this->getSelect()
|
80 |
-
->where('path=?', $path);
|
81 |
-
}
|
82 |
-
return $this;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Add category filter
|
87 |
-
*
|
88 |
-
* @param $category
|
89 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
90 |
-
*/
|
91 |
-
public function addCategoryFilter($category)
|
92 |
-
{
|
93 |
-
$this->getSelect()->where('category=?', $category);
|
94 |
-
return $this;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Add value filter
|
99 |
-
*
|
100 |
-
* @param $value
|
101 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
102 |
-
*/
|
103 |
-
public function addValueFilter($value)
|
104 |
-
{
|
105 |
-
$this->getSelect()->where('value=?', $value);
|
106 |
-
return $this;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Add filter by array
|
111 |
-
*
|
112 |
-
* @param array $array
|
113 |
-
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
114 |
-
*/
|
115 |
-
public function addArrayFilter(array $array)
|
116 |
-
{
|
117 |
-
foreach ($array as $key => $val) {
|
118 |
-
$method = 'add' . uc_words($key, '') . 'Filter';
|
119 |
-
if (is_callable($this->$method($val))) {
|
120 |
-
return $this->$method($val);
|
121 |
-
}
|
122 |
-
}
|
123 |
-
return $this;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Convert items array to array for select options
|
128 |
-
*
|
129 |
-
* return items array
|
130 |
-
* array(
|
131 |
-
* application_id => array(
|
132 |
-
* category => array(
|
133 |
-
* path
|
134 |
-
* )
|
135 |
-
* )
|
136 |
-
* )
|
137 |
-
*
|
138 |
-
* @return array
|
139 |
-
*/
|
140 |
-
public function toOptionArray()
|
141 |
-
{
|
142 |
-
$result = array();
|
143 |
-
foreach ($this as $item) {
|
144 |
-
$appId = $item->getData('application_id');
|
145 |
-
$category = $item->getData('category');
|
146 |
-
$path = $item->getData('path');
|
147 |
-
$value = $item->getData('value');
|
148 |
-
|
149 |
-
if ($this->_applicationFilter) {
|
150 |
-
$result[$category][$path] = $value;
|
151 |
-
} else {
|
152 |
-
$result[$appId][$category][$path] = $value;
|
153 |
-
}
|
154 |
-
}
|
155 |
-
return $result;
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Get Application filter status
|
160 |
-
*
|
161 |
-
* @return boolean
|
162 |
-
*/
|
163 |
-
public function getApplicationFilter()
|
164 |
-
{
|
165 |
-
return $this->_applicationFilter;
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Set Application filter status
|
170 |
-
*
|
171 |
-
* @param boolean $applicationFilter
|
172 |
-
*/
|
173 |
-
public function setApplicationFilter($applicationFilter)
|
174 |
-
{
|
175 |
-
$this->_applicationFilter = $applicationFilter;
|
176 |
-
}
|
177 |
}
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
35 |
+
extends Mage_XmlConnect_Model_Resource_ConfigData_Collection
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Filter/Collection.php
CHANGED
@@ -28,74 +28,9 @@
|
|
28 |
* Filter collection
|
29 |
*
|
30 |
* @category Mage
|
31 |
-
* @package
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Model_Mysql4_Filter_Collection extends
|
35 |
{
|
36 |
-
/**
|
37 |
-
* Set CategoryId filter
|
38 |
-
*
|
39 |
-
* @param int $categoryId
|
40 |
-
* @return Mage_XmlConnect_Model_Mysql4_Filter_Collection
|
41 |
-
*/
|
42 |
-
public function setCategoryId($categoryId)
|
43 |
-
{
|
44 |
-
if ((int)$categoryId > 0) {
|
45 |
-
$this->addFilter('category_id', $categoryId);
|
46 |
-
}
|
47 |
-
return $this;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Load data
|
52 |
-
*
|
53 |
-
* @param bool $printQuery
|
54 |
-
* @param bool $logQuery
|
55 |
-
* @return Mage_XmlConnect_Model_Mysql4_Filter_Collection
|
56 |
-
*/
|
57 |
-
public function load($printQuery = false, $logQuery = false)
|
58 |
-
{
|
59 |
-
if (empty($this->_items)) {
|
60 |
-
$layer = Mage::getSingleton('catalog/layer');
|
61 |
-
foreach ($this->_filters as $filter) {
|
62 |
-
if ('category_id' == $filter['field']) {
|
63 |
-
$layer->setCurrentCategory((int)$filter['value']);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
if ($layer->getCurrentCategory()->getIsAnchor()) {
|
67 |
-
foreach ($layer->getFilterableAttributes() as $attributeItem) {
|
68 |
-
$filterModelName = 'catalog/layer_filter_attribute';
|
69 |
-
switch ($attributeItem->getAttributeCode()) {
|
70 |
-
case 'price':
|
71 |
-
$filterModelName = 'catalog/layer_filter_price';
|
72 |
-
break;
|
73 |
-
case 'decimal':
|
74 |
-
$filterModelName = 'catalog/layer_filter_decimal';
|
75 |
-
break;
|
76 |
-
default:
|
77 |
-
$filterModelName = 'catalog/layer_filter_attribute';
|
78 |
-
break;
|
79 |
-
}
|
80 |
-
|
81 |
-
$filterModel = Mage::getModel($filterModelName);
|
82 |
-
$filterModel->setLayer($layer)->setAttributeModel($attributeItem);
|
83 |
-
$filterValues = new Varien_Data_Collection;
|
84 |
-
foreach ($filterModel->getItems() as $valueItem) {
|
85 |
-
$valueObject = new Varien_Object();
|
86 |
-
$valueObject->setLabel($valueItem->getLabel());
|
87 |
-
$valueObject->setValueString($valueItem->getValueString());
|
88 |
-
$valueObject->setProductsCount($valueItem->getCount());
|
89 |
-
$filterValues->addItem($valueObject);
|
90 |
-
}
|
91 |
-
$item = new Varien_Object;
|
92 |
-
$item->setCode($attributeItem->getAttributeCode());
|
93 |
-
$item->setName($filterModel->getName());
|
94 |
-
$item->setValues($filterValues);
|
95 |
-
$this->addItem($item);
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
return $this;
|
100 |
-
}
|
101 |
}
|
28 |
* Filter collection
|
29 |
*
|
30 |
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_Filter_Collection extends Mage_XmlConnect_Model_Resource_Filter_Collection
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/History.php
CHANGED
@@ -23,62 +23,14 @@
|
|
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 |
-
class Mage_XmlConnect_Model_Mysql4_History extends Mage_Core_Model_Mysql4_Abstract
|
27 |
-
{
|
28 |
-
/**
|
29 |
-
* Constructor, setting table and index field
|
30 |
-
*
|
31 |
-
* @return void
|
32 |
-
*/
|
33 |
-
protected function _construct()
|
34 |
-
{
|
35 |
-
$this->_init('xmlconnect/history', 'history_id');
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Serialization for 'params' variable
|
40 |
-
*
|
41 |
-
* @param Mage_Core_Model_Abstract $object
|
42 |
-
* @return Mage_Core_Model_Abstract
|
43 |
-
*/
|
44 |
-
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
45 |
-
{
|
46 |
-
$object->setParams(serialize($object->getParams()));
|
47 |
-
return parent::_beforeSave($object);
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Deserialization for 'params' variable
|
52 |
-
*
|
53 |
-
* @param Mage_Core_Model_Abstract $object
|
54 |
-
* @return Mage_Core_Model_Abstract
|
55 |
-
*/
|
56 |
-
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
57 |
-
{
|
58 |
-
$object->setParams(unserialize($object->getParams()));
|
59 |
-
return parent::_afterLoad($object);
|
60 |
-
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$idFieldName = Mage::getModel('xmlconnect/application')->getIdFieldName();
|
72 |
-
$select = $this->_getReadAdapter()->select()
|
73 |
-
->from($this->getMainTable(), 'params')
|
74 |
-
->where($idFieldName . '=?', $id)
|
75 |
-
->order(array('created_at DESC'));
|
76 |
-
|
77 |
-
$params = $this->_getReadAdapter()->fetchOne($select);
|
78 |
-
|
79 |
-
if (isset($params)) {
|
80 |
-
$paramArray = unserialize($params);
|
81 |
-
}
|
82 |
-
return $paramArray;
|
83 |
-
}
|
84 |
}
|
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 |
+
* XmlConnect Model Resource History
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_History extends Mage_XmlConnect_Model_Resource_History
|
35 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/History/Collection.php
CHANGED
@@ -24,46 +24,14 @@
|
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
-
|
28 |
/**
|
29 |
* History resource collection
|
30 |
*
|
31 |
-
* @category
|
32 |
-
* @package
|
33 |
-
* @author
|
34 |
*/
|
35 |
class Mage_XmlConnect_Model_Mysql4_History_Collection
|
36 |
-
extends
|
37 |
{
|
38 |
-
/**
|
39 |
-
* Internal constructor
|
40 |
-
*/
|
41 |
-
protected function _construct()
|
42 |
-
{
|
43 |
-
$this->_init('xmlconnect/history');
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Filter collection by store
|
48 |
-
*
|
49 |
-
* @param int $storeId
|
50 |
-
* @return Mage_Core_Model_Mysql4_Collection_Abstract
|
51 |
-
*/
|
52 |
-
public function addStoreFilter($storeId)
|
53 |
-
{
|
54 |
-
$this->addFieldToFilter('store_id', $storeId);
|
55 |
-
return $this;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Filter collection by application_id
|
60 |
-
*
|
61 |
-
* @param int $applicationId
|
62 |
-
* @return Mage_Core_Model_Mysql4_Collection_Abstract
|
63 |
-
*/
|
64 |
-
public function addApplicationFilter($applicationId)
|
65 |
-
{
|
66 |
-
$this->addFieldToFilter('application_id', $applicationId);
|
67 |
-
return $this;
|
68 |
-
}
|
69 |
}
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
|
|
27 |
/**
|
28 |
* History resource collection
|
29 |
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_History_Collection
|
35 |
+
extends Mage_XmlConnect_Model_Resource_History_Collection
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Queue.php
CHANGED
@@ -23,15 +23,14 @@
|
|
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 |
-
/**
|
29 |
-
* Constructor, setting table and index field
|
30 |
-
*
|
31 |
-
* @return void
|
32 |
-
*/
|
33 |
-
protected function _construct()
|
34 |
-
{
|
35 |
-
$this->_init('xmlconnect/queue', 'id');
|
36 |
-
}
|
37 |
}
|
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 |
+
* XmlConnect Model Resource Queue
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_Queue extends Mage_XmlConnect_Model_Resource_Queue
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Queue/Collection.php
CHANGED
@@ -24,7 +24,6 @@
|
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
-
|
28 |
/**
|
29 |
* Queue resource collection
|
30 |
*
|
@@ -33,71 +32,6 @@
|
|
33 |
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
*/
|
35 |
class Mage_XmlConnect_Model_Mysql4_Queue_Collection
|
36 |
-
extends
|
37 |
{
|
38 |
-
/**
|
39 |
-
* Internal constructor
|
40 |
-
*
|
41 |
-
* @return void
|
42 |
-
*/
|
43 |
-
protected function _construct()
|
44 |
-
{
|
45 |
-
$this->_init('xmlconnect/queue');
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Initialize collection select
|
50 |
-
*
|
51 |
-
* @return Mage_XmlConnect_Model_Mysql4_Queue_Collection
|
52 |
-
*/
|
53 |
-
protected function _initSelect()
|
54 |
-
{
|
55 |
-
parent::_initSelect();
|
56 |
-
$this->_joinTemplateName()
|
57 |
-
->_joinApplicationName();
|
58 |
-
return $this;
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Join Template Name to collection
|
63 |
-
*
|
64 |
-
* @return Mage_XmlConnect_Model_Mysql4_Queue_Collection
|
65 |
-
*/
|
66 |
-
protected function _joinTemplateName()
|
67 |
-
{
|
68 |
-
$this->getSelect()
|
69 |
-
->joinLeft(array('t' => $this->getTable('xmlconnect/template')), 't.id = template_id', array(
|
70 |
-
'template_name' => 't.name',
|
71 |
-
));
|
72 |
-
return $this;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Join Application Name to collection
|
77 |
-
*
|
78 |
-
* @return Mage_XmlConnect_Model_Mysql4_Queue_Collection
|
79 |
-
*/
|
80 |
-
protected function _joinApplicationName()
|
81 |
-
{
|
82 |
-
$this->getSelect()
|
83 |
-
->joinLeft(array('app' => $this->getTable('xmlconnect/application')), 'app.code = main_table.app_code', array(
|
84 |
-
'application_name' => 'app.name',
|
85 |
-
));
|
86 |
-
return $this;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Add filter by only ready fot sending item
|
91 |
-
*
|
92 |
-
* @return Mage_XmlConnect_Model_Mysql4_Queue_Collection
|
93 |
-
*/
|
94 |
-
public function addOnlyForSendingFilter()
|
95 |
-
{
|
96 |
-
$this->getSelect()
|
97 |
-
->where('main_table.status in (?)', array(Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE))
|
98 |
-
->where('main_table.exec_time < ?', Mage::getSingleton('core/date')->gmtDate())
|
99 |
-
->order(new Zend_Db_Expr('main_table.exec_time ' . Zend_Db_Select::SQL_ASC));
|
100 |
-
|
101 |
-
return $this;
|
102 |
-
}
|
103 |
}
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
|
|
27 |
/**
|
28 |
* Queue resource collection
|
29 |
*
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_Queue_Collection
|
35 |
+
extends Mage_XmlConnect_Model_Resource_Queue_Collection
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Setup.php
CHANGED
@@ -23,7 +23,15 @@
|
|
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 |
-
class Mage_XmlConnect_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
|
27 |
-
{
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
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 |
+
/**
|
29 |
+
* XML Connect Setup Resource Model
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_XmlConnect
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_XmlConnect_Model_Mysql4_Setup extends Mage_XmlConnect_Model_Resource_Setup
|
36 |
+
{
|
37 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Template.php
CHANGED
@@ -23,15 +23,14 @@
|
|
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 |
-
/**
|
29 |
-
* Constructor, setting table and index field
|
30 |
-
*
|
31 |
-
* @return void
|
32 |
-
*/
|
33 |
-
protected function _construct()
|
34 |
-
{
|
35 |
-
$this->_init('xmlconnect/template', 'id');
|
36 |
-
}
|
37 |
}
|
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 |
+
* XmlConnect Model Resource Template
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Mysql4_Template extends Mage_XmlConnect_Model_Resource_Template
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Template/Collection.php
CHANGED
@@ -32,41 +32,6 @@
|
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_Template_Collection
|
35 |
-
extends
|
36 |
{
|
37 |
-
/**
|
38 |
-
* Internal constructor
|
39 |
-
*
|
40 |
-
* @return void
|
41 |
-
*/
|
42 |
-
protected function _construct()
|
43 |
-
{
|
44 |
-
$this->_init('xmlconnect/template');
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Initialize collection select
|
49 |
-
*
|
50 |
-
* @return Mage_XmlConnect_Model_Mysql4_Template_Collection
|
51 |
-
*/
|
52 |
-
protected function _initSelect()
|
53 |
-
{
|
54 |
-
parent::_initSelect();
|
55 |
-
$this->_joinApplicationName();
|
56 |
-
return $this;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Join Application Name to collection
|
61 |
-
*
|
62 |
-
* @return Mage_XmlConnect_Model_Mysql4_Template_Collection
|
63 |
-
*/
|
64 |
-
protected function _joinApplicationName()
|
65 |
-
{
|
66 |
-
$this->getSelect()
|
67 |
-
->joinLeft(array('app' => $this->getTable('xmlconnect/application')), 'app.code = app_code', array(
|
68 |
-
'app_name' => 'app.name',
|
69 |
-
));
|
70 |
-
return $this;
|
71 |
-
}
|
72 |
}
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_Template_Collection
|
35 |
+
extends Mage_XmlConnect_Model_Resource_Template_Collection
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
app/code/core/Mage/XmlConnect/Model/Observer.php
CHANGED
@@ -70,8 +70,7 @@ class Mage_XmlConnect_Model_Observer
|
|
70 |
public function changeUpdatedAtParamOnConfigSave($observer)
|
71 |
{
|
72 |
$configData = $observer->getEvent()->getConfigData();
|
73 |
-
if ($configData
|
74 |
-
&& (int)$configData->isValueChanged()
|
75 |
&& in_array($configData->getPath(), $this->_appDependOnConfigFieldPathes)
|
76 |
) {
|
77 |
Mage::getModel('xmlconnect/application')->updateAllAppsUpdatedAtParameter();
|
@@ -87,10 +86,8 @@ class Mage_XmlConnect_Model_Observer
|
|
87 |
public function sendMessageImmediately($observer)
|
88 |
{
|
89 |
$message = $observer->getEvent()->getData('queueMessage');
|
90 |
-
if ($message instanceof Mage_XmlConnect_Model_Queue
|
91 |
-
|
92 |
-
|| !$message->getExecTime()
|
93 |
-
)
|
94 |
) {
|
95 |
$message->setExecTime(Mage::getSingleton('core/date')->gmtDate());
|
96 |
Mage::helper('xmlconnect')->sendBroadcastMessage($message);
|
@@ -103,7 +100,7 @@ class Mage_XmlConnect_Model_Observer
|
|
103 |
/**
|
104 |
* Send scheduled messages
|
105 |
*
|
106 |
-
* @return
|
107 |
*/
|
108 |
public function scheduledSend()
|
109 |
{
|
70 |
public function changeUpdatedAtParamOnConfigSave($observer)
|
71 |
{
|
72 |
$configData = $observer->getEvent()->getConfigData();
|
73 |
+
if ($configData && (int)$configData->isValueChanged()
|
|
|
74 |
&& in_array($configData->getPath(), $this->_appDependOnConfigFieldPathes)
|
75 |
) {
|
76 |
Mage::getModel('xmlconnect/application')->updateAllAppsUpdatedAtParameter();
|
86 |
public function sendMessageImmediately($observer)
|
87 |
{
|
88 |
$message = $observer->getEvent()->getData('queueMessage');
|
89 |
+
if ($message instanceof Mage_XmlConnect_Model_Queue && (strtolower($message->getExecTime()) == 'null'
|
90 |
+
|| !$message->getExecTime())
|
|
|
|
|
91 |
) {
|
92 |
$message->setExecTime(Mage::getSingleton('core/date')->gmtDate());
|
93 |
Mage::helper('xmlconnect')->sendBroadcastMessage($message);
|
100 |
/**
|
101 |
* Send scheduled messages
|
102 |
*
|
103 |
+
* @return null
|
104 |
*/
|
105 |
public function scheduledSend()
|
106 |
{
|
app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Config.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Model_Payment_Method_Paypal_Config
|
35 |
-
extends Mage_Paypal_Model_Config
|
36 |
{
|
37 |
/**
|
38 |
* PayPal Website Payments Pro - PayPal Mobile Express Checkout Library
|
@@ -47,9 +46,6 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Config
|
|
47 |
*/
|
48 |
public function getExpressCheckoutStartUrl($token)
|
49 |
{
|
50 |
-
return $this->getPaypalUrl(array(
|
51 |
-
'cmd' => '_express-checkout-mobile',
|
52 |
-
'token' => $token,
|
53 |
-
));
|
54 |
}
|
55 |
}
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Payment_Method_Paypal_Config extends Mage_Paypal_Model_Config
|
|
|
35 |
{
|
36 |
/**
|
37 |
* PayPal Website Payments Pro - PayPal Mobile Express Checkout Library
|
46 |
*/
|
47 |
public function getExpressCheckoutStartUrl($token)
|
48 |
{
|
49 |
+
return $this->getPaypalUrl(array('cmd' => '_express-checkout-mobile', 'token' => $token));
|
|
|
|
|
|
|
50 |
}
|
51 |
}
|
app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mecl.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl
|
35 |
-
extends Mage_Paypal_Model_Express
|
36 |
{
|
37 |
/**
|
38 |
* Store MECL payment method code
|
@@ -44,7 +43,7 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl
|
|
44 |
*
|
45 |
* @var string
|
46 |
*/
|
47 |
-
protected $_code
|
48 |
|
49 |
/**
|
50 |
* Can use method for a frontend checkout
|
@@ -53,9 +52,18 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl
|
|
53 |
*/
|
54 |
protected $_canUseCheckout = false;
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
protected $_canManageRecurringProfiles = false;
|
60 |
|
61 |
/**
|
@@ -69,7 +77,7 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl
|
|
69 |
$storeId = false;
|
70 |
$model = Mage::registry('current_app');
|
71 |
|
72 |
-
if (
|
73 |
$storeId = $model->getStoreId();
|
74 |
}
|
75 |
|
@@ -77,8 +85,7 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl
|
|
77 |
$storeId = $quote ? $quote->getStoreId() : Mage::app()->getStore()->getId();
|
78 |
}
|
79 |
|
80 |
-
return (bool) Mage::getModel('paypal/config')
|
81 |
-
->setStoreId($storeId)
|
82 |
->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS);
|
83 |
}
|
84 |
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl extends Mage_Paypal_Model_Express
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Store MECL payment method code
|
43 |
*
|
44 |
* @var string
|
45 |
*/
|
46 |
+
protected $_code = self::MECL_METHOD_CODE;
|
47 |
|
48 |
/**
|
49 |
* Can use method for a frontend checkout
|
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 |
/**
|
77 |
$storeId = false;
|
78 |
$model = Mage::registry('current_app');
|
79 |
|
80 |
+
if ($model instanceof Mage_XmlConnect_Model_Application) {
|
81 |
$storeId = $model->getStoreId();
|
82 |
}
|
83 |
|
85 |
$storeId = $quote ? $quote->getStoreId() : Mage::app()->getStore()->getId();
|
86 |
}
|
87 |
|
88 |
+
return (bool) Mage::getModel('paypal/config')->setStoreId($storeId)
|
|
|
89 |
->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS);
|
90 |
}
|
91 |
|
app/code/core/Mage/XmlConnect/Model/Payment/Method/Paypal/Mep.php
CHANGED
@@ -81,8 +81,7 @@ class Mage_XmlConnect_Model_Payment_Method_Paypal_Mep extends Mage_Paypal_Model_
|
|
81 |
$storeId = $quote ? $quote->getStoreId() : Mage::app()->getStore()->getId();
|
82 |
}
|
83 |
|
84 |
-
return (bool) Mage::getModel('paypal/config')
|
85 |
-
->setStoreId($storeId)
|
86 |
->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS);
|
87 |
}
|
88 |
|
81 |
$storeId = $quote ? $quote->getStoreId() : Mage::app()->getStore()->getId();
|
82 |
}
|
83 |
|
84 |
+
return (bool) Mage::getModel('paypal/config')->setStoreId($storeId)
|
|
|
85 |
->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS);
|
86 |
}
|
87 |
|
app/code/core/Mage/XmlConnect/Model/Paypal/Mecl/Checkout.php
CHANGED
@@ -31,8 +31,7 @@
|
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_XmlConnect_Model_Paypal_Mecl_Checkout
|
35 |
-
extends Mage_Paypal_Model_Express_Checkout
|
36 |
{
|
37 |
/**
|
38 |
* Payment method type
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Paypal_Mecl_Checkout extends Mage_Paypal_Model_Express_Checkout
|
|
|
35 |
{
|
36 |
/**
|
37 |
* Payment method type
|
app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php
CHANGED
@@ -175,9 +175,7 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
175 |
$billing->unsAddressId()->unsAddressType();
|
176 |
$shipping = $this->_quote->getShippingAddress();
|
177 |
$shippingMethod = $shipping->getShippingMethod();
|
178 |
-
$shipping->addData($billing->getData())
|
179 |
-
->setSameAsBilling(1)
|
180 |
-
->setShippingMethod($shippingMethod)
|
181 |
->setCollectShippingRates(true);
|
182 |
}
|
183 |
|
@@ -206,10 +204,8 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
206 |
if (!$this->_quote->getIsVirtual() && $shippingAddress) {
|
207 |
if ($shippingMethod != $shippingAddress->getShippingMethod()) {
|
208 |
$this->_ignoreAddressValidation();
|
209 |
-
$this->_quote->getShippingAddress()
|
210 |
-
|
211 |
-
$this->_quote->collectTotals()
|
212 |
-
->save();
|
213 |
}
|
214 |
}
|
215 |
|
@@ -237,8 +233,7 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
237 |
$email = isset($data['payer']) ? $data['payer'] : null;
|
238 |
$payment->setAdditionalInformation(self::PAYMENT_INFO_PAYER_EMAIL, $email);
|
239 |
$payment->setAdditionalInformation(
|
240 |
-
self::PAYMENT_INFO_TRANSACTION_ID,
|
241 |
-
isset($data['transaction_id']) ? $data['transaction_id'] : null
|
242 |
);
|
243 |
$this->_quote->setCustomerEmail($email);
|
244 |
|
@@ -266,11 +261,8 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
266 |
* Prepare session to success or cancellation page
|
267 |
*/
|
268 |
$quoteId = $this->_quote->getId();
|
269 |
-
$this->_getCheckoutSession()
|
270 |
-
->
|
271 |
-
->setLastSuccessQuoteId($quoteId)
|
272 |
-
->setLastOrderId($order->getId())
|
273 |
-
->setLastRealOrderId($order->getIncrementId());
|
274 |
|
275 |
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
|
276 |
&& Mage::getSingleton('customer/session')->isLoggedIn()
|
@@ -305,7 +297,7 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
305 |
/**
|
306 |
* Make sure addresses will be saved without validation errors
|
307 |
*
|
308 |
-
* @return
|
309 |
*/
|
310 |
protected function _ignoreAddressValidation()
|
311 |
{
|
@@ -333,8 +325,7 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
333 |
protected function _prepareGuestQuote()
|
334 |
{
|
335 |
$quote = $this->_quote;
|
336 |
-
$quote->setCustomerId(null)
|
337 |
-
->setCustomerIsGuest(true)
|
338 |
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
339 |
return $this;
|
340 |
}
|
@@ -343,7 +334,7 @@ class Mage_XmlConnect_Model_Paypal_Mep_Checkout
|
|
343 |
* Adopt specified request array from PayPal
|
344 |
*
|
345 |
* @param array $request
|
346 |
-
* @return
|
347 |
*/
|
348 |
protected function _applyCountryWorkarounds(&$request)
|
349 |
{
|
175 |
$billing->unsAddressId()->unsAddressType();
|
176 |
$shipping = $this->_quote->getShippingAddress();
|
177 |
$shippingMethod = $shipping->getShippingMethod();
|
178 |
+
$shipping->addData($billing->getData())->setSameAsBilling(1)->setShippingMethod($shippingMethod)
|
|
|
|
|
179 |
->setCollectShippingRates(true);
|
180 |
}
|
181 |
|
204 |
if (!$this->_quote->getIsVirtual() && $shippingAddress) {
|
205 |
if ($shippingMethod != $shippingAddress->getShippingMethod()) {
|
206 |
$this->_ignoreAddressValidation();
|
207 |
+
$this->_quote->getShippingAddress()->setShippingMethod($shippingMethod);
|
208 |
+
$this->_quote->collectTotals()->save();
|
|
|
|
|
209 |
}
|
210 |
}
|
211 |
|
233 |
$email = isset($data['payer']) ? $data['payer'] : null;
|
234 |
$payment->setAdditionalInformation(self::PAYMENT_INFO_PAYER_EMAIL, $email);
|
235 |
$payment->setAdditionalInformation(
|
236 |
+
self::PAYMENT_INFO_TRANSACTION_ID, isset($data['transaction_id']) ? $data['transaction_id'] : null
|
|
|
237 |
);
|
238 |
$this->_quote->setCustomerEmail($email);
|
239 |
|
261 |
* Prepare session to success or cancellation page
|
262 |
*/
|
263 |
$quoteId = $this->_quote->getId();
|
264 |
+
$this->_getCheckoutSession()->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId)
|
265 |
+
->setLastOrderId($order->getId())->setLastRealOrderId($order->getIncrementId());
|
|
|
|
|
|
|
266 |
|
267 |
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING
|
268 |
&& Mage::getSingleton('customer/session')->isLoggedIn()
|
297 |
/**
|
298 |
* Make sure addresses will be saved without validation errors
|
299 |
*
|
300 |
+
* @return null
|
301 |
*/
|
302 |
protected function _ignoreAddressValidation()
|
303 |
{
|
325 |
protected function _prepareGuestQuote()
|
326 |
{
|
327 |
$quote = $this->_quote;
|
328 |
+
$quote->setCustomerId(null)->setCustomerIsGuest(true)
|
|
|
329 |
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
330 |
return $this;
|
331 |
}
|
334 |
* Adopt specified request array from PayPal
|
335 |
*
|
336 |
* @param array $request
|
337 |
+
* @return null
|
338 |
*/
|
339 |
protected function _applyCountryWorkarounds(&$request)
|
340 |
{
|
app/code/core/Mage/XmlConnect/Model/Preview/Abstract.php
CHANGED
@@ -58,7 +58,7 @@ abstract class Mage_XmlConnect_Model_Preview_Abstract extends Varien_Object
|
|
58 |
* Internal constructor not depended on params.
|
59 |
* It's used for application object initialization
|
60 |
*
|
61 |
-
* @return
|
62 |
*/
|
63 |
final function _construct()
|
64 |
{
|
58 |
* Internal constructor not depended on params.
|
59 |
* It's used for application object initialization
|
60 |
*
|
61 |
+
* @return null
|
62 |
*/
|
63 |
final function _construct()
|
64 |
{
|
app/code/core/Mage/XmlConnect/Model/Queue.php
CHANGED
@@ -84,7 +84,7 @@ class Mage_XmlConnect_Model_Queue extends Mage_Core_Model_Template
|
|
84 |
/**
|
85 |
* Initialize queue message
|
86 |
*
|
87 |
-
* @return
|
88 |
*/
|
89 |
protected function _construct()
|
90 |
{
|
@@ -103,9 +103,7 @@ class Mage_XmlConnect_Model_Queue extends Mage_Core_Model_Template
|
|
103 |
parent::load($id, $field);
|
104 |
|
105 |
if ($this->getTemplateId()) {
|
106 |
-
$this->setName(
|
107 |
-
Mage::getModel('xmlconnect/template')->load($this->getTemplateId())->getName()
|
108 |
-
);
|
109 |
}
|
110 |
return $this;
|
111 |
}
|
@@ -188,16 +186,16 @@ EOT;
|
|
188 |
switch ($this->getData('type')) {
|
189 |
case Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_AIRMAIL:
|
190 |
$html = sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Push title'))
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
break;
|
197 |
case Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_PUSH:
|
198 |
default:
|
199 |
$html = sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Push title'))
|
200 |
-
|
201 |
break;
|
202 |
}
|
203 |
return $html;
|
@@ -242,11 +240,7 @@ EOT;
|
|
242 |
);
|
243 |
|
244 |
$payload = array(
|
245 |
-
'push' => array(
|
246 |
-
$notificationType => array(
|
247 |
-
'alert' => $this->getPushTitle(),
|
248 |
-
)
|
249 |
-
),
|
250 |
'title' => $this->getMessageTitle(),
|
251 |
'message' => $this->getContent(),
|
252 |
);
|
84 |
/**
|
85 |
* Initialize queue message
|
86 |
*
|
87 |
+
* @return null
|
88 |
*/
|
89 |
protected function _construct()
|
90 |
{
|
103 |
parent::load($id, $field);
|
104 |
|
105 |
if ($this->getTemplateId()) {
|
106 |
+
$this->setName(Mage::getModel('xmlconnect/template')->load($this->getTemplateId())->getName());
|
|
|
|
|
107 |
}
|
108 |
return $this;
|
109 |
}
|
186 |
switch ($this->getData('type')) {
|
187 |
case Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_AIRMAIL:
|
188 |
$html = sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Push title'))
|
189 |
+
. $this->getPushTitle()
|
190 |
+
. sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Message title'))
|
191 |
+
. $this->getMessageTitle()
|
192 |
+
. sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Message content'))
|
193 |
+
. $processor->filter($this->getContent());
|
194 |
break;
|
195 |
case Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_PUSH:
|
196 |
default:
|
197 |
$html = sprintf($htmlDescription, Mage::helper('xmlconnect')->__('Push title'))
|
198 |
+
. $this->getPushTitle();
|
199 |
break;
|
200 |
}
|
201 |
return $html;
|
240 |
);
|
241 |
|
242 |
$payload = array(
|
243 |
+
'push' => array($notificationType => array('alert' => $this->getPushTitle())),
|
|
|
|
|
|
|
|
|
244 |
'title' => $this->getMessageTitle(),
|
245 |
'message' => $this->getContent(),
|
246 |
);
|
app/code/core/Mage/XmlConnect/Model/Resource/Application.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* XmlConnect Model Resource Application
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Application extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Constructor, setting table and index field
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/application', 'application_id');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Update Application Status field, insert data to history table
|
48 |
+
*
|
49 |
+
* @param int $applicationId
|
50 |
+
* @param string $status
|
51 |
+
* @return Mage_XmlConnect_Model_Resource_Application
|
52 |
+
*/
|
53 |
+
public function updateApplicationStatus($applicationId, $status)
|
54 |
+
{
|
55 |
+
$this->_getWriteAdapter()->update(
|
56 |
+
$this->getMainTable(),
|
57 |
+
array('status' => $status),
|
58 |
+
$this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $applicationId)
|
59 |
+
);
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Processing object before save data
|
65 |
+
* Update app_code as Store + Device
|
66 |
+
*
|
67 |
+
* @param Mage_Core_Model_Abstract $object
|
68 |
+
* @return Mage_Core_Model_Abstract
|
69 |
+
*/
|
70 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
71 |
+
{
|
72 |
+
if (!$object->getId()) {
|
73 |
+
$object->setCode($object->getCodePrefix());
|
74 |
+
}
|
75 |
+
return parent::_beforeSave($object);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Processing object after save data
|
80 |
+
* Update app_code as Store + Device + 123 (increment).
|
81 |
+
*
|
82 |
+
* @param Mage_Core_Model_Abstract $object
|
83 |
+
* @return Mage_Core_Model_Abstract
|
84 |
+
*/
|
85 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
86 |
+
{
|
87 |
+
$appCode = $object->getCode();
|
88 |
+
$isCodePrefixed = $object->isCodePrefixed();
|
89 |
+
if (!$isCodePrefixed) {
|
90 |
+
$this->_getWriteAdapter()->update(
|
91 |
+
$this->getMainTable(),
|
92 |
+
array('code' => $appCode . $object->getId()),
|
93 |
+
$this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $object->getId())
|
94 |
+
);
|
95 |
+
}
|
96 |
+
return parent::_afterSave($object);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Collect existing stores and type unique pairs
|
101 |
+
*
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
public function getExistingStoreDeviceType()
|
105 |
+
{
|
106 |
+
$select = $this->_getWriteAdapter()->select()->from($this->getMainTable(), array('store_id', 'type'))
|
107 |
+
->group(array('store_id', 'type'))->order(array('store_id', 'type'));
|
108 |
+
return $this->_getReadAdapter()->fetchAll($select, array('store_id', 'type'));
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Update all applications "updated at" parameter with current date
|
113 |
+
*
|
114 |
+
* @return Mage_XmlConnect_Model_Resource_Application
|
115 |
+
*/
|
116 |
+
public function updateAllAppsUpdatedAtParameter()
|
117 |
+
{
|
118 |
+
$this->_getWriteAdapter()->update($this->getMainTable(), array('updated_at' => date('Y-m-d H:i:s')));
|
119 |
+
return $this;
|
120 |
+
}
|
121 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Application/Collection.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* XmlConnect Model Resource Application Collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Application_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Constructor, setting table
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/application');
|
44 |
+
}
|
45 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Cms/Page/Collection.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Extended CMS page collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Cms_Page_Collection extends Mage_Cms_Model_Resource_Page_Collection
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Returns pairs identifier - title for unique identifiers
|
38 |
+
* and pairs identifier|page_id - title for non-unique after first
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function toOptionIdArray()
|
43 |
+
{
|
44 |
+
$res = array();
|
45 |
+
$existingIdentifiers = array();
|
46 |
+
foreach ($this as $item) {
|
47 |
+
$identifier = $item->getData('identifier');
|
48 |
+
|
49 |
+
$data['value'] = $identifier;
|
50 |
+
$data['label'] = $item->getData('title');
|
51 |
+
if (in_array($identifier, $existingIdentifiers)) {
|
52 |
+
$data['value'] .= '|' . $item->getData('page_id');
|
53 |
+
} else {
|
54 |
+
$existingIdentifiers[] = $identifier;
|
55 |
+
}
|
56 |
+
|
57 |
+
$res[] = $data;
|
58 |
+
}
|
59 |
+
|
60 |
+
return $res;
|
61 |
+
}
|
62 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/ConfigData.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Configuration data recourse model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Xmlconnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_ConfigData extends Mage_Core_Model_Mysql4_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Initialize configuration data
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/configData', null);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Save config value
|
48 |
+
*
|
49 |
+
* @param int $applicationId
|
50 |
+
* @param string $category
|
51 |
+
* @param string $path
|
52 |
+
* @param string $value
|
53 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData
|
54 |
+
*/
|
55 |
+
public function saveConfig($applicationId, $category, $path, $value)
|
56 |
+
{
|
57 |
+
$newData = array(
|
58 |
+
'application_id' => $applicationId,
|
59 |
+
'category' => $category,
|
60 |
+
'path' => $path,
|
61 |
+
'value' => $value
|
62 |
+
);
|
63 |
+
|
64 |
+
$this->_getWriteAdapter()->insertOnDuplicate($this->getMainTable(), $newData, array('value'));
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Delete config value
|
70 |
+
*
|
71 |
+
* @param int $applicationId
|
72 |
+
* @param bool $category
|
73 |
+
* @param bool $path
|
74 |
+
* @param bool $pathLike
|
75 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData
|
76 |
+
*/
|
77 |
+
public function deleteConfig($applicationId, $category = false, $path = false, $pathLike = true)
|
78 |
+
{
|
79 |
+
try {
|
80 |
+
$this->_getWriteAdapter()->beginTransaction();
|
81 |
+
$writeAdapter = $this->_getWriteAdapter();
|
82 |
+
$deleteWhere[] = $writeAdapter->quoteInto('application_id=?', $applicationId);
|
83 |
+
if ($category) {
|
84 |
+
$deleteWhere[] = $writeAdapter->quoteInto('category=?', $category);
|
85 |
+
}
|
86 |
+
if ($path) {
|
87 |
+
$deleteWhere[] = $pathLike ? $writeAdapter->quoteInto('path like ?', $path . '/%')
|
88 |
+
: $writeAdapter->quoteInto('path=?', $path);
|
89 |
+
}
|
90 |
+
$writeAdapter->delete($this->getMainTable(), $deleteWhere);
|
91 |
+
$this->_getWriteAdapter()->commit();
|
92 |
+
} catch (Mage_Core_Exception $e) {
|
93 |
+
$this->_getWriteAdapter()->rollBack();
|
94 |
+
throw $e;
|
95 |
+
} catch (Exception $e){
|
96 |
+
$this->_getWriteAdapter()->rollBack();
|
97 |
+
Mage::logException($e);
|
98 |
+
}
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/ConfigData/Collection.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Configuration data collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Xmlconnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_ConfigData_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Is application filter applied
|
38 |
+
*
|
39 |
+
* @var bool
|
40 |
+
*/
|
41 |
+
protected $_applicationFilter = false;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Internal constructor
|
45 |
+
*/
|
46 |
+
protected function _construct()
|
47 |
+
{
|
48 |
+
$this->_init('xmlconnect/configData');
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Add application filter
|
53 |
+
*
|
54 |
+
* @param $applicationId
|
55 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
56 |
+
*/
|
57 |
+
public function addApplicationIdFilter($applicationId)
|
58 |
+
{
|
59 |
+
$this->_applicationFilter = true;
|
60 |
+
$this->getSelect()->where('application_id=?', $applicationId);
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Add path filter
|
66 |
+
*
|
67 |
+
* @param $path
|
68 |
+
* @param bool $like
|
69 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
70 |
+
*/
|
71 |
+
public function addPathFilter($path, $like = true)
|
72 |
+
{
|
73 |
+
if ($like) {
|
74 |
+
$this->getSelect()->where('path like ?', $path . '/%');
|
75 |
+
} else {
|
76 |
+
$this->getSelect()->where('path=?', $path);
|
77 |
+
}
|
78 |
+
return $this;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Add category filter
|
83 |
+
*
|
84 |
+
* @param $category
|
85 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
86 |
+
*/
|
87 |
+
public function addCategoryFilter($category)
|
88 |
+
{
|
89 |
+
$this->getSelect()->where('category=?', $category);
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Add value filter
|
95 |
+
*
|
96 |
+
* @param $value
|
97 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
98 |
+
*/
|
99 |
+
public function addValueFilter($value)
|
100 |
+
{
|
101 |
+
$this->getSelect()->where('value=?', $value);
|
102 |
+
return $this;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Add filter by array
|
107 |
+
*
|
108 |
+
* @param array $array
|
109 |
+
* @return Mage_XmlConnect_Model_Mysql4_ConfigData_Collection
|
110 |
+
*/
|
111 |
+
public function addArrayFilter(array $array)
|
112 |
+
{
|
113 |
+
foreach ($array as $key => $val) {
|
114 |
+
$method = 'add' . uc_words($key, '') . 'Filter';
|
115 |
+
if (is_callable($this->$method($val))) {
|
116 |
+
return $this->$method($val);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
return $this;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Convert items array to array for select options
|
124 |
+
*
|
125 |
+
* return items array
|
126 |
+
* array(
|
127 |
+
* application_id => array(
|
128 |
+
* category => array(
|
129 |
+
* path
|
130 |
+
* )
|
131 |
+
* )
|
132 |
+
* )
|
133 |
+
*
|
134 |
+
* @return array
|
135 |
+
*/
|
136 |
+
public function toOptionArray()
|
137 |
+
{
|
138 |
+
$result = array();
|
139 |
+
foreach ($this as $item) {
|
140 |
+
$appId = $item->getData('application_id');
|
141 |
+
$category = $item->getData('category');
|
142 |
+
$path = $item->getData('path');
|
143 |
+
$value = $item->getData('value');
|
144 |
+
|
145 |
+
if ($this->_applicationFilter) {
|
146 |
+
$result[$category][$path] = $value;
|
147 |
+
} else {
|
148 |
+
$result[$appId][$category][$path] = $value;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
return $result;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Get Application filter status
|
156 |
+
*
|
157 |
+
* @return boolean
|
158 |
+
*/
|
159 |
+
public function getApplicationFilter()
|
160 |
+
{
|
161 |
+
return $this->_applicationFilter;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Set Application filter status
|
166 |
+
*
|
167 |
+
* @param boolean $applicationFilter
|
168 |
+
*/
|
169 |
+
public function setApplicationFilter($applicationFilter)
|
170 |
+
{
|
171 |
+
$this->_applicationFilter = $applicationFilter;
|
172 |
+
}
|
173 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Filter/Collection.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Filter collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Filter_Collection extends Varien_Data_Collection
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Set CategoryId filter
|
38 |
+
*
|
39 |
+
* @param int $categoryId
|
40 |
+
* @return Mage_XmlConnect_Model_Resource_Filter_Collection
|
41 |
+
*/
|
42 |
+
public function setCategoryId($categoryId)
|
43 |
+
{
|
44 |
+
if ((int)$categoryId > 0) {
|
45 |
+
$this->addFilter('category_id', $categoryId);
|
46 |
+
}
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Load data
|
52 |
+
*
|
53 |
+
* @param bool $printQuery
|
54 |
+
* @param bool $logQuery
|
55 |
+
* @return Mage_XmlConnect_Model_Resource_Filter_Collection
|
56 |
+
*/
|
57 |
+
public function load($printQuery = false, $logQuery = false)
|
58 |
+
{
|
59 |
+
if (empty($this->_items)) {
|
60 |
+
$layer = Mage::getSingleton('catalog/layer');
|
61 |
+
foreach ($this->_filters as $filter) {
|
62 |
+
if ('category_id' == $filter['field']) {
|
63 |
+
$layer->setCurrentCategory((int)$filter['value']);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
if ($layer->getCurrentCategory()->getIsAnchor()) {
|
67 |
+
foreach ($layer->getFilterableAttributes() as $attributeItem) {
|
68 |
+
$filterModelName = 'catalog/layer_filter_attribute';
|
69 |
+
switch ($attributeItem->getAttributeCode()) {
|
70 |
+
case 'price':
|
71 |
+
$filterModelName = 'catalog/layer_filter_price';
|
72 |
+
break;
|
73 |
+
case 'decimal':
|
74 |
+
$filterModelName = 'catalog/layer_filter_decimal';
|
75 |
+
break;
|
76 |
+
default:
|
77 |
+
$filterModelName = 'catalog/layer_filter_attribute';
|
78 |
+
break;
|
79 |
+
}
|
80 |
+
|
81 |
+
$filterModel = Mage::getModel($filterModelName);
|
82 |
+
$filterModel->setLayer($layer)->setAttributeModel($attributeItem);
|
83 |
+
$filterValues = new Varien_Data_Collection;
|
84 |
+
foreach ($filterModel->getItems() as $valueItem) {
|
85 |
+
$valueObject = new Varien_Object();
|
86 |
+
$valueObject->setLabel($valueItem->getLabel());
|
87 |
+
$valueObject->setValueString($valueItem->getValueString());
|
88 |
+
$valueObject->setProductsCount($valueItem->getCount());
|
89 |
+
$filterValues->addItem($valueObject);
|
90 |
+
}
|
91 |
+
$item = new Varien_Object;
|
92 |
+
$item->setCode($attributeItem->getAttributeCode());
|
93 |
+
$item->setName($filterModel->getName());
|
94 |
+
$item->setValues($filterValues);
|
95 |
+
$this->addItem($item);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/History.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* XmlConnect Model Resource History
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_History extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Constructor, setting table and index field
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/history', 'history_id');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Serialization for 'params' variable
|
48 |
+
*
|
49 |
+
* @param Mage_Core_Model_Abstract $object
|
50 |
+
* @return Mage_Core_Model_Abstract
|
51 |
+
*/
|
52 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
53 |
+
{
|
54 |
+
$object->setParams(serialize($object->getParams()));
|
55 |
+
return parent::_beforeSave($object);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Deserialization for 'params' variable
|
60 |
+
*
|
61 |
+
* @param Mage_Core_Model_Abstract $object
|
62 |
+
* @return Mage_Core_Model_Abstract
|
63 |
+
*/
|
64 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
65 |
+
{
|
66 |
+
$object->setParams(unserialize($object->getParams()));
|
67 |
+
return parent::_afterLoad($object);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Returns array of existing images
|
72 |
+
*
|
73 |
+
* @param int $id application instance Id
|
74 |
+
* @return array
|
75 |
+
*/
|
76 |
+
public function getLastParams($id)
|
77 |
+
{
|
78 |
+
$paramArray = array();
|
79 |
+
$idFieldName = Mage::getModel('xmlconnect/application')->getIdFieldName();
|
80 |
+
$select = $this->_getReadAdapter()->select()->from($this->getMainTable(), 'params')
|
81 |
+
->where($idFieldName . '=?', $id)->order(array('created_at ' . Zend_Db_Select::SQL_DESC));
|
82 |
+
|
83 |
+
$params = $this->_getReadAdapter()->fetchOne($select);
|
84 |
+
|
85 |
+
if (isset($params)) {
|
86 |
+
$paramArray = unserialize($params);
|
87 |
+
}
|
88 |
+
return $paramArray;
|
89 |
+
}
|
90 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/History/Collection.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* History resource collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_History_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Internal constructor
|
38 |
+
*/
|
39 |
+
protected function _construct()
|
40 |
+
{
|
41 |
+
$this->_init('xmlconnect/history');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Filter collection by store
|
46 |
+
*
|
47 |
+
* @param int $storeId
|
48 |
+
* @return Mage_XmlConnect_Model_Resource_History_Collection
|
49 |
+
*/
|
50 |
+
public function addStoreFilter($storeId)
|
51 |
+
{
|
52 |
+
$this->addFieldToFilter('store_id', $storeId);
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Filter collection by application_id
|
58 |
+
*
|
59 |
+
* @param int $applicationId
|
60 |
+
* @return Mage_XmlConnect_Model_Resource_History_Collection
|
61 |
+
*/
|
62 |
+
public function addApplicationFilter($applicationId)
|
63 |
+
{
|
64 |
+
$this->addFieldToFilter('application_id', $applicationId);
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Queue.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* XmlConnect Model Resource Queue
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Queue extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Constructor, setting table and index field
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/queue', 'queue_id');
|
44 |
+
}
|
45 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Queue/Collection.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Queue resource collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Queue_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Internal constructor
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/queue');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Initialize collection select
|
48 |
+
*
|
49 |
+
* @return Mage_XmlConnect_Model_Resource_Queue_Collection
|
50 |
+
*/
|
51 |
+
protected function _initSelect()
|
52 |
+
{
|
53 |
+
parent::_initSelect();
|
54 |
+
$this->_joinNames();
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Join Template Name and Application Name to collection
|
60 |
+
*
|
61 |
+
* @return Mage_XmlConnect_Model_Resource_Queue_Collection
|
62 |
+
*/
|
63 |
+
protected function _joinNames()
|
64 |
+
{
|
65 |
+
$this->_joinTemplateName();
|
66 |
+
$this->_joinApplicationName();
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Join Template Name to collection
|
72 |
+
*
|
73 |
+
* @return Mage_XmlConnect_Model_Resource_Queue_Collection
|
74 |
+
*/
|
75 |
+
protected function _joinTemplateName()
|
76 |
+
{
|
77 |
+
$this->getSelect()->joinLeft(
|
78 |
+
array('t' => $this->getTable('xmlconnect/template')),
|
79 |
+
't.template_id = main_table.template_id',
|
80 |
+
array('template_name' => 't.name')
|
81 |
+
);
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Join Application Name to collection
|
87 |
+
*
|
88 |
+
* @return Mage_XmlConnect_Model_Resource_Queue_Collection
|
89 |
+
*/
|
90 |
+
protected function _joinApplicationName()
|
91 |
+
{
|
92 |
+
$this->getSelect()->joinLeft(
|
93 |
+
array('app' => $this->getTable('xmlconnect/application')),
|
94 |
+
'app.application_id = t.application_id',
|
95 |
+
array('application_name' => 'app.name')
|
96 |
+
);
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Add filter by only ready fot sending item
|
102 |
+
*
|
103 |
+
* @return Mage_XmlConnect_Model_Resource_Queue_Collection
|
104 |
+
*/
|
105 |
+
public function addOnlyForSendingFilter()
|
106 |
+
{
|
107 |
+
$this->getSelect()->where('main_table.status in (?)', array(Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE))
|
108 |
+
->where('main_table.exec_time < ?', Mage::getSingleton('core/date')->gmtDate())
|
109 |
+
->order(new Zend_Db_Expr('main_table.exec_time ' . Zend_Db_Select::SQL_ASC)
|
110 |
+
);
|
111 |
+
return $this;
|
112 |
+
}
|
113 |
+
}
|
app/code/core/Mage/XmlConnect/{Block/Checkout/Shipping/Method/Avaliable.php → Model/Resource/Setup.php}
RENAMED
@@ -25,15 +25,12 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
-
* This class is an alias for properly named class
|
30 |
*
|
31 |
-
* @deprecated Misspelling has been fixed
|
32 |
* @category Mage
|
33 |
* @package Mage_XmlConnect
|
34 |
* @author Magento Core Team <core@magentocommerce.com>
|
35 |
*/
|
36 |
-
class
|
37 |
-
extends Mage_XmlConnect_Block_Checkout_Shipping_Method_Available
|
38 |
{
|
39 |
}
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* XML Connect Setup Resource Model
|
|
|
29 |
*
|
|
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
|
|
|
35 |
{
|
36 |
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Template.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* XmlConnect Model Resource Template
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Template extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Constructor, setting table and index field
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/template', 'template_id');
|
44 |
+
}
|
45 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Resource/Template/Collection.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Template resource collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_Resource_Template_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Internal constructor
|
38 |
+
*
|
39 |
+
* @return null
|
40 |
+
*/
|
41 |
+
protected function _construct()
|
42 |
+
{
|
43 |
+
$this->_init('xmlconnect/template');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Initialize collection select
|
48 |
+
*
|
49 |
+
* @return Mage_XmlConnect_Model_Resource_Template_Collection
|
50 |
+
*/
|
51 |
+
protected function _initSelect()
|
52 |
+
{
|
53 |
+
parent::_initSelect();
|
54 |
+
$this->_joinApplicationName();
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Join Application Name to collection
|
60 |
+
*
|
61 |
+
* @return Mage_XmlConnect_Model_Resource_Template_Collection
|
62 |
+
*/
|
63 |
+
protected function _joinApplicationName()
|
64 |
+
{
|
65 |
+
$this->getSelect()->joinLeft(
|
66 |
+
array('app' => $this->getTable('xmlconnect/application')),
|
67 |
+
'app.application_id = main_table.application_id',
|
68 |
+
array('app_name' => 'app.name', 'app_code' => 'app.code')
|
69 |
+
);
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php
CHANGED
@@ -42,14 +42,7 @@ class Mage_XmlConnect_Model_Simplexml_Element extends Varien_Simplexml_Element
|
|
42 |
public function appendChild($source)
|
43 |
{
|
44 |
if (sizeof($source->children())) {
|
45 |
-
|
46 |
-
* @link http://bugs.php.net/bug.php?id=41867 , fixed in 5.2.4
|
47 |
-
*/
|
48 |
-
if (version_compare(phpversion(), '5.2.4', '<') === true) {
|
49 |
-
$name = $source->children()->getName();
|
50 |
-
} else {
|
51 |
-
$name = $source->getName();
|
52 |
-
}
|
53 |
$child = $this->addChild($name);
|
54 |
} else {
|
55 |
$child = $this->addChild($source->getName(), $this->xmlentities($source));
|
@@ -104,7 +97,7 @@ class Mage_XmlConnect_Model_Simplexml_Element extends Varien_Simplexml_Element
|
|
104 |
*
|
105 |
* @param string $value
|
106 |
* @param bool $stripTags
|
107 |
-
* @return string|
|
108 |
*/
|
109 |
public function xmlAttribute($value = null, $stripTags = true)
|
110 |
{
|
42 |
public function appendChild($source)
|
43 |
{
|
44 |
if (sizeof($source->children())) {
|
45 |
+
$name = $source->getName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
$child = $this->addChild($name);
|
47 |
} else {
|
48 |
$child = $this->addChild($source->getName(), $this->xmlentities($source));
|
97 |
*
|
98 |
* @param string $value
|
99 |
* @param bool $stripTags
|
100 |
+
* @return string|this
|
101 |
*/
|
102 |
public function xmlAttribute($value = null, $stripTags = true)
|
103 |
{
|
app/code/core/Mage/XmlConnect/Model/Simplexml/Form.php
CHANGED
@@ -68,7 +68,7 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
68 |
{
|
69 |
parent::__construct($attributes);
|
70 |
$this->setType('form');
|
71 |
-
$this->_allElements =
|
72 |
}
|
73 |
|
74 |
/**
|
@@ -76,12 +76,11 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
76 |
*
|
77 |
* @static $_defaultElementRenderer
|
78 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
79 |
-
* @return
|
80 |
*/
|
81 |
public static function setElementRenderer(
|
82 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
83 |
-
)
|
84 |
-
{
|
85 |
self::$_defaultElementRenderer = $renderer;
|
86 |
}
|
87 |
|
@@ -90,12 +89,11 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
90 |
*
|
91 |
* @static $_defaultValidatorRenderer
|
92 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
93 |
-
* @return
|
94 |
*/
|
95 |
public static function setValidatorRenderer(
|
96 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
97 |
-
)
|
98 |
-
{
|
99 |
self::$_defaultValidatorRenderer = $renderer;
|
100 |
}
|
101 |
|
@@ -104,12 +102,11 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
104 |
*
|
105 |
* @static $_defaultValidatorRuleRenderer
|
106 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
107 |
-
* @return
|
108 |
*/
|
109 |
public static function setValidatorRuleRenderer(
|
110 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
111 |
-
)
|
112 |
-
{
|
113 |
self::$_defaultValidatorRuleRenderer = $renderer;
|
114 |
}
|
115 |
|
@@ -118,12 +115,11 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
118 |
*
|
119 |
* @static $_defaultFieldsetRenderer
|
120 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
121 |
-
* @return
|
122 |
*/
|
123 |
public static function setFieldsetRenderer(
|
124 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
125 |
-
)
|
126 |
-
{
|
127 |
self::$_defaultFieldsetRenderer = $renderer;
|
128 |
}
|
129 |
|
@@ -132,12 +128,11 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
132 |
*
|
133 |
* @static $_defaultFieldsetElementRenderer
|
134 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
135 |
-
* @return
|
136 |
*/
|
137 |
public static function setFieldsetElementRenderer(
|
138 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
139 |
-
)
|
140 |
-
{
|
141 |
self::$_defaultFieldsetElementRenderer = $renderer;
|
142 |
}
|
143 |
|
@@ -203,10 +198,7 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
203 |
* @param bool $after
|
204 |
* @return Mage_XmlConnect_Model_Simplexml_Form
|
205 |
*/
|
206 |
-
public function addElement(
|
207 |
-
Mage_XmlConnect_Model_Simplexml_Form_Element_Abstract $element,
|
208 |
-
$after = false
|
209 |
-
)
|
210 |
{
|
211 |
$this->checkElementId($element->getId());
|
212 |
parent::addElement($element, $after);
|
@@ -248,9 +240,7 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
248 |
public function checkElementId($elementId)
|
249 |
{
|
250 |
if ($this->_elementIdExists($elementId)) {
|
251 |
-
throw new Exception(
|
252 |
-
Mage::helper('xmlconnect')->__('Element with id %s already exists', $elementId)
|
253 |
-
);
|
254 |
}
|
255 |
return true;
|
256 |
}
|
@@ -310,7 +300,8 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
310 |
}
|
311 |
|
312 |
foreach ($values as $elementId => $value) {
|
313 |
-
|
|
|
314 |
$element->setValue($value);
|
315 |
}
|
316 |
}
|
@@ -392,9 +383,6 @@ class Mage_XmlConnect_Model_Simplexml_Form extends Mage_XmlConnect_Model_Simplex
|
|
392 |
if ($this->getUseContainer()) {
|
393 |
return $this->toXmlObject()->asNiceXml();
|
394 |
}
|
395 |
-
|
396 |
-
Mage::throwException(
|
397 |
-
Mage::helper('xmlconnect')->__('Container is not defined.')
|
398 |
-
);
|
399 |
}
|
400 |
}
|
68 |
{
|
69 |
parent::__construct($attributes);
|
70 |
$this->setType('form');
|
71 |
+
$this->_allElements = Mage::getModel('xmlconnect/simplexml_form_element_collection', $this);
|
72 |
}
|
73 |
|
74 |
/**
|
76 |
*
|
77 |
* @static $_defaultElementRenderer
|
78 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
79 |
+
* @return null
|
80 |
*/
|
81 |
public static function setElementRenderer(
|
82 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
83 |
+
) {
|
|
|
84 |
self::$_defaultElementRenderer = $renderer;
|
85 |
}
|
86 |
|
89 |
*
|
90 |
* @static $_defaultValidatorRenderer
|
91 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
92 |
+
* @return null
|
93 |
*/
|
94 |
public static function setValidatorRenderer(
|
95 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
96 |
+
) {
|
|
|
97 |
self::$_defaultValidatorRenderer = $renderer;
|
98 |
}
|
99 |
|
102 |
*
|
103 |
* @static $_defaultValidatorRuleRenderer
|
104 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
105 |
+
* @return null
|
106 |
*/
|
107 |
public static function setValidatorRuleRenderer(
|
108 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
109 |
+
) {
|
|
|
110 |
self::$_defaultValidatorRuleRenderer = $renderer;
|
111 |
}
|
112 |
|
115 |
*
|
116 |
* @static $_defaultFieldsetRenderer
|
117 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
118 |
+
* @return null
|
119 |
*/
|
120 |
public static function setFieldsetRenderer(
|
121 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
122 |
+
) {
|
|
|
123 |
self::$_defaultFieldsetRenderer = $renderer;
|
124 |
}
|
125 |
|
128 |
*
|
129 |
* @static $_defaultFieldsetElementRenderer
|
130 |
* @param Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
131 |
+
* @return null
|
132 |
*/
|
133 |
public static function setFieldsetElementRenderer(
|
134 |
Mage_XmlConnect_Model_Simplexml_Form_Element_Renderer_Interface $renderer
|
135 |
+
) {
|
|
|
136 |
self::$_defaultFieldsetElementRenderer = $renderer;
|
137 |
}
|
138 |
|
198 |
* @param bool $after
|
199 |
* @return Mage_XmlConnect_Model_Simplexml_Form
|
200 |
*/
|
201 |
+
public function addElement(Mage_XmlConnect_Model_Simplexml_Form_Element_Abstract $element, $after = false)
|
|
|
|
|
|
|
202 |
{
|
203 |
$this->checkElementId($element->getId());
|
204 |
parent::addElement($element, $after);
|
240 |
public function checkElementId($elementId)
|
241 |
{
|
242 |
if ($this->_elementIdExists($elementId)) {
|
243 |
+
throw new Exception(Mage::helper('xmlconnect')->__('Element with id %s already exists', $elementId));
|
|
|
|
|
244 |
}
|
245 |
return true;
|
246 |
}
|
300 |
}
|
301 |
|
302 |
foreach ($values as $elementId => $value) {
|
303 |
+
$element = $this->getElement($elementId);
|
304 |
+
if ($element) {
|
305 |
$element->setValue($value);
|
306 |
}
|
307 |
}
|
383 |
if ($this->getUseContainer()) {
|
384 |
return $this->toXmlObject()->asNiceXml();
|
385 |
}
|
386 |
+
Mage::throwException(Mage::helper('xmlconnect')->__('Container is not defined.'));
|
|
|
|
|
|
|
387 |
}
|
388 |
}
|
app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Abstract.php
CHANGED
@@ -101,10 +101,7 @@ class Mage_XmlConnect_Model_Simplexml_Form_Abstract extends Varien_Object
|
|
101 |
protected function _prepareXmlObject()
|
102 |
{
|
103 |
$this->setXmlObject(
|
104 |
-
Mage::getModel(
|
105 |
-
'xmlconnect/simplexml_element',
|
106 |
-
'<' . $this->_mainNode . '></' . $this->_mainNode . '>'
|
107 |
-
)
|
108 |
);
|
109 |
return $this;
|
110 |
}
|
@@ -185,7 +182,7 @@ class Mage_XmlConnect_Model_Simplexml_Form_Abstract extends Varien_Object
|
|
185 |
public function getElements()
|
186 |
{
|
187 |
if (empty($this->_elements)) {
|
188 |
-
$this->_elements =
|
189 |
}
|
190 |