Version Notes
OroCRM Bridge extension adds a couple of improvements to Magento SOAP API v2 in order to expose more shopping cart and customer data.
Download this release
Release Info
| Developer | Oro, Inc |
| Extension | Oro_Api |
| Version | 1.1.4.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.3 to 1.1.4.1
- app/code/community/Oro/Api/Model/Observer/Crm/Controller.php +46 -20
- app/code/community/Oro/Api/Model/Sales/Quote/Api.php +9 -4
- app/code/community/Oro/Api/etc/config.xml +1 -1
- app/design/adminhtml/default/default/template/oro/api/check.phtml +57 -0
- app/design/adminhtml/default/default/template/oro/api/login_styles.phtml +10 -0
- app/design/adminhtml/default/default/template/oro/api/page.phtml +6 -1
- app/design/adminhtml/default/default/template/oro/api/script.phtml +2 -2
- package.xml +4 -4
- skin/adminhtml/default/default/images/oro/add_button_icon_dark.png +0 -0
- skin/adminhtml/default/default/images/oro/apply_button_icon.png +0 -0
- skin/adminhtml/default/default/images/oro/error.png +0 -0
- skin/adminhtml/default/default/images/oro/grid_sort_asc.gif +0 -0
- skin/adminhtml/default/default/images/oro/grid_sort_desc.gif +0 -0
- skin/adminhtml/default/default/images/oro/loader.gif +0 -0
- skin/adminhtml/default/default/oro_style.css +284 -0
app/code/community/Oro/Api/Model/Observer/Crm/Controller.php
CHANGED
|
@@ -80,9 +80,13 @@ class Oro_Api_Model_Observer_Crm_Controller
|
|
| 80 |
*/
|
| 81 |
public function handleRenderLayout(Varien_Event_Observer $observer)
|
| 82 |
{
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
| 85 |
|
|
|
|
| 86 |
if (($contentBlock = $layout->getBlock('content')) instanceof Mage_Adminhtml_Block_Sales_Order_Create) {
|
| 87 |
$contentBlock->removeButton('reset');
|
| 88 |
|
|
@@ -99,26 +103,18 @@ class Oro_Api_Model_Observer_Crm_Controller
|
|
| 99 |
/** @var Mage_Core_Block_Text $script */
|
| 100 |
$layout->createBlock('adminhtml/template', 'oro_script', array('template' => 'oro/api/script.phtml'));
|
| 101 |
|
| 102 |
-
$
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
case $layout->getBlock('content') instanceof Mage_Core_Block_Text_List:
|
| 112 |
-
$destination = $layout->getBlock('content');
|
| 113 |
-
break;
|
| 114 |
-
default:
|
| 115 |
-
$destination = null;
|
| 116 |
-
break;
|
| 117 |
}
|
| 118 |
|
| 119 |
-
|
| 120 |
-
$destination->insert('oro_script');
|
| 121 |
-
}
|
| 122 |
|
| 123 |
if ($layout->getBlock('root') instanceof Mage_Core_Block_Template) {
|
| 124 |
$layout->getBlock('root')->setTemplate('oro/api/page.phtml');
|
|
@@ -126,6 +122,36 @@ class Oro_Api_Model_Observer_Crm_Controller
|
|
| 126 |
}
|
| 127 |
}
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
/**
|
| 130 |
* Set oro cookie value
|
| 131 |
*
|
| 80 |
*/
|
| 81 |
public function handleRenderLayout(Varien_Event_Observer $observer)
|
| 82 |
{
|
| 83 |
+
$layout = Mage::app()->getLayout();
|
| 84 |
+
|
| 85 |
+
//add check cookies script
|
| 86 |
+
$layout->createBlock('adminhtml/template', 'oro_check_script', array('template' => 'oro/api/check.phtml'));
|
| 87 |
+
$this->_insertBlock('oro_check_script', $layout);
|
| 88 |
|
| 89 |
+
if (Mage::helper('oro_api')->isOroRequest()) {
|
| 90 |
if (($contentBlock = $layout->getBlock('content')) instanceof Mage_Adminhtml_Block_Sales_Order_Create) {
|
| 91 |
$contentBlock->removeButton('reset');
|
| 92 |
|
| 103 |
/** @var Mage_Core_Block_Text $script */
|
| 104 |
$layout->createBlock('adminhtml/template', 'oro_script', array('template' => 'oro/api/script.phtml'));
|
| 105 |
|
| 106 |
+
if (($loginForm = $layout->getBlock('form.additional.info')) instanceof Mage_Core_Block_Text_List) {
|
| 107 |
+
$layout->createBlock(
|
| 108 |
+
'adminhtml/template',
|
| 109 |
+
'oro_login_styles',
|
| 110 |
+
array('template' => 'oro/api/login_styles.phtml')
|
| 111 |
+
);
|
| 112 |
+
$loginForm->insert('oro_login_styles');
|
| 113 |
+
} elseif ($layout->getBlock('head')) {
|
| 114 |
+
$layout->getBlock('head')->addCss('oro_style.css');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
}
|
| 116 |
|
| 117 |
+
$this->_insertBlock('oro_script', $layout);
|
|
|
|
|
|
|
| 118 |
|
| 119 |
if ($layout->getBlock('root') instanceof Mage_Core_Block_Template) {
|
| 120 |
$layout->getBlock('root')->setTemplate('oro/api/page.phtml');
|
| 122 |
}
|
| 123 |
}
|
| 124 |
|
| 125 |
+
/**
|
| 126 |
+
* Insert block
|
| 127 |
+
*
|
| 128 |
+
* @param string $blockName
|
| 129 |
+
* @param Mage_Core_Model_Layout $layout
|
| 130 |
+
*/
|
| 131 |
+
protected function _insertBlock($blockName, Mage_Core_Model_Layout $layout)
|
| 132 |
+
{
|
| 133 |
+
$destination = null;
|
| 134 |
+
|
| 135 |
+
switch (true) {
|
| 136 |
+
case $layout->getBlock('form.additional.info') instanceof Mage_Core_Block_Text_List:
|
| 137 |
+
$destination = $layout->getBlock('form.additional.info');
|
| 138 |
+
break;
|
| 139 |
+
case $layout->getBlock('before_body_end') instanceof Mage_Core_Block_Text_List:
|
| 140 |
+
$destination = $layout->getBlock('before_body_end');
|
| 141 |
+
break;
|
| 142 |
+
case $layout->getBlock('content') instanceof Mage_Core_Block_Text_List:
|
| 143 |
+
$destination = $layout->getBlock('content');
|
| 144 |
+
break;
|
| 145 |
+
default:
|
| 146 |
+
$destination = null;
|
| 147 |
+
break;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
if ($destination) {
|
| 151 |
+
$destination->insert($blockName);
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
/**
|
| 156 |
* Set oro cookie value
|
| 157 |
*
|
app/code/community/Oro/Api/Model/Sales/Quote/Api.php
CHANGED
|
@@ -32,7 +32,7 @@ class Oro_Api_Model_Sales_Quote_Api
|
|
| 32 |
/** @var $apiHelper Oro_Api_Helper_Data */
|
| 33 |
$apiHelper = Mage::helper('oro_api');
|
| 34 |
|
| 35 |
-
$filters = $apiHelper->parseFilters($filters
|
| 36 |
try {
|
| 37 |
foreach ($filters as $field => $value) {
|
| 38 |
$quoteCollection->addFieldToFilter($field, $value);
|
|
@@ -69,10 +69,10 @@ class Oro_Api_Model_Sales_Quote_Api
|
|
| 69 |
);
|
| 70 |
}
|
| 71 |
|
| 72 |
-
$result
|
| 73 |
$result['shipping_address'] = $this->_getAttributes($quote->getShippingAddress(), 'quote_address');
|
| 74 |
-
$result['billing_address']
|
| 75 |
-
$result['items']
|
| 76 |
|
| 77 |
foreach ($quote->getAllItems() as $item) {
|
| 78 |
if ($item->getGiftMessageId() > 0) {
|
|
@@ -85,6 +85,11 @@ class Oro_Api_Model_Sales_Quote_Api
|
|
| 85 |
}
|
| 86 |
|
| 87 |
$result['payment'] = $this->_getAttributes($quote->getPayment(), 'quote_payment');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
return $result;
|
| 90 |
}
|
| 32 |
/** @var $apiHelper Oro_Api_Helper_Data */
|
| 33 |
$apiHelper = Mage::helper('oro_api');
|
| 34 |
|
| 35 |
+
$filters = $apiHelper->parseFilters($filters);
|
| 36 |
try {
|
| 37 |
foreach ($filters as $field => $value) {
|
| 38 |
$quoteCollection->addFieldToFilter($field, $value);
|
| 69 |
);
|
| 70 |
}
|
| 71 |
|
| 72 |
+
$result = $this->_getAttributes($quote, 'quote');
|
| 73 |
$result['shipping_address'] = $this->_getAttributes($quote->getShippingAddress(), 'quote_address');
|
| 74 |
+
$result['billing_address'] = $this->_getAttributes($quote->getBillingAddress(), 'quote_address');
|
| 75 |
+
$result['items'] = array();
|
| 76 |
|
| 77 |
foreach ($quote->getAllItems() as $item) {
|
| 78 |
if ($item->getGiftMessageId() > 0) {
|
| 85 |
}
|
| 86 |
|
| 87 |
$result['payment'] = $this->_getAttributes($quote->getPayment(), 'quote_payment');
|
| 88 |
+
if (isset($result['payment'], $result['payment']['additional_information'])
|
| 89 |
+
&& is_array($result['payment']['additional_information'])
|
| 90 |
+
) {
|
| 91 |
+
$result['payment']['additional_information'] = serialize($result['payment']['additional_information']);
|
| 92 |
+
}
|
| 93 |
|
| 94 |
return $result;
|
| 95 |
}
|
app/code/community/Oro/Api/etc/config.xml
CHANGED
|
@@ -20,7 +20,7 @@
|
|
| 20 |
<config>
|
| 21 |
<modules>
|
| 22 |
<Oro_Api>
|
| 23 |
-
<version>1.1.
|
| 24 |
</Oro_Api>
|
| 25 |
</modules>
|
| 26 |
<global>
|
| 20 |
<config>
|
| 21 |
<modules>
|
| 22 |
<Oro_Api>
|
| 23 |
+
<version>1.1.4</version>
|
| 24 |
</Oro_Api>
|
| 25 |
</modules>
|
| 26 |
<global>
|
app/design/adminhtml/default/default/template/oro/api/check.phtml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$badCookiesMessage = Mage::helper('oro_api')->
|
| 3 |
+
__(
|
| 4 |
+
"In order for this feature to work properly your browser must accept third-party cookies.".
|
| 5 |
+
" Please enable third-party cookies in your browser settings"
|
| 6 |
+
);
|
| 7 |
+
?>
|
| 8 |
+
<script type="text/html" id="errorPage">
|
| 9 |
+
<style type="text/css">
|
| 10 |
+
.error-container {
|
| 11 |
+
margin: 170px auto;
|
| 12 |
+
padding-left: 32px;
|
| 13 |
+
width: 350px;
|
| 14 |
+
background-color: #ededed;
|
| 15 |
+
border-radius: 6px;
|
| 16 |
+
}
|
| 17 |
+
.text-container{
|
| 18 |
+
padding: 35px;
|
| 19 |
+
text-align: left;
|
| 20 |
+
background: url(<?php echo $this->getSkinUrl('images/oro/error.png') ?>) left no-repeat;
|
| 21 |
+
}
|
| 22 |
+
</style>
|
| 23 |
+
<div class="error-container">
|
| 24 |
+
<div class="text-container">
|
| 25 |
+
<?php echo $badCookiesMessage; ?>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
</script>
|
| 29 |
+
<script type="text/javascript" src="<?php echo Mage::getBaseUrl('js') ?>mage/cookies.js"></script>
|
| 30 |
+
<?php /** @var $cookie Mage_Core_Model_Cookie */
|
| 31 |
+
$cookie = Mage::getSingleton('core/cookie');
|
| 32 |
+
?>
|
| 33 |
+
<script type="text/javascript">
|
| 34 |
+
//<![CDATA[
|
| 35 |
+
//check if we can set cookies in iframe
|
| 36 |
+
if (window.self != window.top) {
|
| 37 |
+
var cookieName = 'isCookiesEnabled';
|
| 38 |
+
window.Mage.Cookies.set(
|
| 39 |
+
cookieName,
|
| 40 |
+
1,
|
| 41 |
+
null,
|
| 42 |
+
'<?php echo $cookie->getPath();?>',
|
| 43 |
+
'<?php echo $cookie->getDomain();?>'
|
| 44 |
+
);
|
| 45 |
+
if (!window.Mage.Cookies.get(cookieName)) {
|
| 46 |
+
document.body.innerHTML = document.getElementById('errorPage').innerHTML;
|
| 47 |
+
}
|
| 48 |
+
window.Mage.Cookies.set(
|
| 49 |
+
cookieName,
|
| 50 |
+
0,
|
| 51 |
+
new Date(1980, 1, 1),
|
| 52 |
+
'<?php echo $cookie->getPath();?>',
|
| 53 |
+
'<?php echo $cookie->getDomain();?>'
|
| 54 |
+
);
|
| 55 |
+
}
|
| 56 |
+
//]]>
|
| 57 |
+
</script>
|
app/design/adminhtml/default/default/template/oro/api/login_styles.phtml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script>
|
| 2 |
+
//<![CDATA[
|
| 3 |
+
var head = document.head || document.getElementsByTagName('head')[0],
|
| 4 |
+
style = document.createElement('link');
|
| 5 |
+
style.type = 'text/css';
|
| 6 |
+
style.rel = 'stylesheet';
|
| 7 |
+
style.href = '<?php echo $this->getSkinUrl('oro_style.css') ?>';
|
| 8 |
+
head.appendChild(style);
|
| 9 |
+
//]]>
|
| 10 |
+
</script>
|
app/design/adminhtml/default/default/template/oro/api/page.phtml
CHANGED
|
@@ -47,7 +47,12 @@
|
|
| 47 |
<?php echo $this->getChildHtml('js') ?>
|
| 48 |
<?php echo $this->getChildHtml('profiler') ?>
|
| 49 |
<div id="loading-mask" style="display:none">
|
| 50 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
</div>
|
| 52 |
|
| 53 |
<?php echo $this->getChildHtml('before_body_end') ?>
|
| 47 |
<?php echo $this->getChildHtml('js') ?>
|
| 48 |
<?php echo $this->getChildHtml('profiler') ?>
|
| 49 |
<div id="loading-mask" style="display:none">
|
| 50 |
+
<div class="loading-wrapper"></div>
|
| 51 |
+
<div class="loading-frame">
|
| 52 |
+
<div class="box">
|
| 53 |
+
<div class="loading-content"><?php echo Mage::helper('adminhtml')->__('Loading...') ?></div>
|
| 54 |
+
</div>
|
| 55 |
+
</div>
|
| 56 |
</div>
|
| 57 |
|
| 58 |
<?php echo $this->getChildHtml('before_body_end') ?>
|
app/design/adminhtml/default/default/template/oro/api/script.phtml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<script type="text/javascript" src="<?php echo Mage::getBaseUrl('js') ?>mage/cookies.js"></script>
|
| 2 |
-
<?php /** @var $cookie Mage_Core_Model_Cookie */
|
| 3 |
-
$cookie = Mage::getSingleton('core/cookie'); ?>
|
| 4 |
<script type="text/javascript">
|
| 5 |
//<