├── .gitignore ├── CHANGELOG.md ├── README.md ├── app ├── code │ └── community │ │ └── Oro │ │ └── Api │ │ ├── Helper │ │ └── Data.php │ │ ├── Model │ │ ├── Admin │ │ │ └── Redirectpolicy.php │ │ ├── Catalog │ │ │ └── Product │ │ │ │ └── Api │ │ │ │ └── V2.php │ │ ├── Customer │ │ │ ├── Address │ │ │ │ ├── Api.php │ │ │ │ └── Api │ │ │ │ │ └── V2.php │ │ │ ├── Api.php │ │ │ └── Api │ │ │ │ └── V2.php │ │ ├── Directory │ │ │ └── Region │ │ │ │ ├── Api.php │ │ │ │ └── Api │ │ │ │ └── V2.php │ │ ├── Newsletter │ │ │ └── Subscriber │ │ │ │ ├── Api.php │ │ │ │ └── Api │ │ │ │ └── V2.php │ │ ├── Observer.php │ │ ├── Observer │ │ │ ├── Crm │ │ │ │ └── Controller.php │ │ │ └── Sales │ │ │ │ └── Order.php │ │ ├── Ping.php │ │ ├── Ping │ │ │ └── V2.php │ │ ├── Report │ │ │ └── Product │ │ │ │ └── Viewed │ │ │ │ ├── Api.php │ │ │ │ └── Api │ │ │ │ └── V2.php │ │ ├── Resource │ │ │ ├── Reports │ │ │ │ └── Product │ │ │ │ │ └── Index │ │ │ │ │ └── Viewed │ │ │ │ │ └── Collection.php │ │ │ ├── Setup.php │ │ │ └── Wishlist │ │ │ │ ├── Status.php │ │ │ │ └── Status │ │ │ │ └── Collection.php │ │ ├── Sales │ │ │ ├── Order │ │ │ │ ├── Api.php │ │ │ │ └── Api │ │ │ │ │ └── V2.php │ │ │ └── Quote │ │ │ │ ├── Api.php │ │ │ │ ├── Api │ │ │ │ └── V2.php │ │ │ │ └── Item.php │ │ ├── Website │ │ │ ├── Api.php │ │ │ └── Api │ │ │ │ └── V2.php │ │ └── Wishlist │ │ │ ├── Api.php │ │ │ ├── Api │ │ │ └── V2.php │ │ │ ├── Item │ │ │ ├── Api.php │ │ │ └── Api │ │ │ │ └── V2.php │ │ │ ├── Observer.php │ │ │ ├── Status.php │ │ │ └── Status │ │ │ ├── Api.php │ │ │ └── Api │ │ │ └── V2.php │ │ ├── controllers │ │ └── Adminhtml │ │ │ └── Oro │ │ │ ├── GatewayController.php │ │ │ └── SalesController.php │ │ ├── etc │ │ ├── adminhtml.xml │ │ ├── api.xml │ │ ├── config.xml │ │ ├── system.xml │ │ ├── workflow.xml │ │ ├── wsdl.xml │ │ └── wsi.xml │ │ └── sql │ │ └── oro_api_setup │ │ ├── install-1.2.5.php │ │ └── upgrade-1.2.5.0-1.2.5.1.php ├── design │ └── adminhtml │ │ └── default │ │ └── default │ │ └── template │ │ └── oro │ │ └── api │ │ ├── check.phtml │ │ ├── login_styles.phtml │ │ ├── page.phtml │ │ └── script.phtml └── etc │ └── modules │ └── Oro_Api.xml ├── modman ├── skin └── adminhtml │ └── default │ └── default │ ├── images │ └── oro │ │ ├── add_button_icon_dark.png │ │ ├── apply_button_icon.png │ │ ├── error.png │ │ ├── grid_sort_asc.gif │ │ ├── grid_sort_desc.gif │ │ └── loader.gif │ └── oro_style.css └── var └── connect ├── Oro_Api-1.1.3.tgz ├── Oro_Api-1.1.4.1.tgz ├── Oro_Api-1.1.4.2.tgz ├── Oro_Api-1.1.4.3.tgz ├── Oro_Api-1.1.4.4.tgz ├── Oro_Api-1.1.4.tgz ├── Oro_Api-1.2.0.0.tgz ├── Oro_Api-1.2.1.0.tgz ├── Oro_Api-1.2.10.0.tgz ├── Oro_Api-1.2.11.0.tgz ├── Oro_Api-1.2.12.0.tgz ├── Oro_Api-1.2.13.0.tgz ├── Oro_Api-1.2.14.0.tgz ├── Oro_Api-1.2.15.0.tgz ├── Oro_Api-1.2.16.0.tgz ├── Oro_Api-1.2.17.0.tgz ├── Oro_Api-1.2.18.0.tgz ├── Oro_Api-1.2.19.0.tgz ├── Oro_Api-1.2.2.0.tgz ├── Oro_Api-1.2.3.0.tgz ├── Oro_Api-1.2.4.0.tgz ├── Oro_Api-1.2.5.0.tgz ├── Oro_Api-1.2.6.0.tgz ├── Oro_Api-1.2.7.0.tgz ├── Oro_Api-1.2.8.0.tgz ├── Oro_Api-1.2.9.0.tgz ├── Oro_Api.xml └── package.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | app/etc/local.xml 3 | downloader/.cache/* 4 | tests/config.sh 5 | var/log/* 6 | var/locks/* 7 | var/report/* 8 | var/cache/* 9 | var/export/* 10 | var/session/* 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog for 1.2.19 2 | 3 | - In the "sales_order.info" request, the value of the "entity_id" is now returned as the "increment_id" field (part of the status history data) 4 | 5 | ## Changelog for 1.2.17 6 | 7 | - made version compatible with OroCRM version 1.* 8 | - fixed: https://github.com/oroinc/magento-orocrm-bridge/issues/13 9 | 10 | ## Changelog for 1.2.16 11 | 12 | - fixed version on application config file 13 | 14 | ## Changelog for 1.2.15 15 | 16 | - Fixed bug with missing Gift Order Message during sync with OroCRM. 17 | 18 | ## Changelog for 1.2.14 19 | 20 | - Added new endpoint for getting Regions list 21 | 22 | ## Changelog for 1.1.4.4 23 | 24 | - Fixed issue on some environments with CE when class_exist is called on class from EE. 25 | 26 | ## Changelog for 1.1.4.3 27 | 28 | - Added possibility to see shopping cart management page in iframe using Oro_Api extension 29 | 30 | ## Changelog for 1.1.4.2 31 | 32 | - Removed "forgot password" link from login form in Oro-IFRAME 33 | 34 | ## Changelog for 1.1.4.1 35 | 36 | - Fix php notice during "shopping cart list" API call 37 | 38 | ## Changelog for 1.1.4 39 | 40 | - "Order form" styled with Oro-styles 41 | - Warning message for iframe if third-party cookies is denied by browser security policy 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OroCRM Bridge Magento Extension 2 | ============= 3 | 4 | The OroCRM Bridge extension improves on the Magento SOAP API v2 to expose additional shopping cart and customer data. These additional improvements allow companies to see: 5 | 6 | - List of active shopping carts 7 | - List of newsletter subscribers 8 | - List of viewed products 9 | - Customer wish list information 10 | - List of all regions 11 | 12 | The OroCRM Bridge is recommended for better integration between OroCRM and Magento. It can also be used for other integrations that require an API for the features listed. 13 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Helper/Data.php: -------------------------------------------------------------------------------- 1 | _getModuleName(); 29 | } 30 | 31 | /** 32 | * Parse filters and format them to be applicable for collection filtration 33 | * 34 | * @param null|object|array $filters 35 | * @param array $fieldsMap Map of field names in format: array('field_name_in_filter' => 'field_name_in_db') 36 | * @return array 37 | */ 38 | public function parseFilters($filters, $fieldsMap = null) 39 | { 40 | // if filters are used in SOAP they must be represented in array format to be used for collection filtration 41 | if (is_object($filters)) { 42 | $parsedFilters = array(); 43 | // parse simple filter 44 | if (isset($filters->filter) && is_array($filters->filter)) { 45 | foreach ($filters->filter as $field => $value) { 46 | if (is_object($value) && isset($value->key) && isset($value->value)) { 47 | $parsedFilters[$value->key] = $value->value; 48 | } else { 49 | $parsedFilters[$field] = $value; 50 | } 51 | } 52 | } 53 | // parse complex filter 54 | if (isset($filters->complex_filter) && is_array($filters->complex_filter)) { 55 | $parsedFilters += $this->_parseComplexFilter($filters->complex_filter); 56 | } 57 | 58 | $filters = $parsedFilters; 59 | } 60 | // make sure that method result is always array 61 | if (!is_array($filters)) { 62 | $filters = array(); 63 | } 64 | // apply fields mapping 65 | if (isset($fieldsMap) && is_array($fieldsMap)) { 66 | foreach ($filters as $field => $value) { 67 | if (isset($fieldsMap[$field])) { 68 | unset($filters[$field]); 69 | $field = $fieldsMap[$field]; 70 | $filters[$field] = $value; 71 | } 72 | } 73 | } 74 | return $filters; 75 | } 76 | 77 | /** 78 | * Parses complex filter, which may contain several nodes, e.g. when user want to fetch orders which were updated 79 | * between two dates. 80 | * 81 | * @param array $complexFilter 82 | * @return array 83 | */ 84 | protected function _parseComplexFilter($complexFilter) 85 | { 86 | $parsedFilters = array(); 87 | 88 | foreach ($complexFilter as $filter) { 89 | if (!isset($filter->key) || !isset($filter->value)) { 90 | continue; 91 | } 92 | 93 | list($fieldName, $condition) = array($filter->key, $filter->value); 94 | $conditionName = $condition->key; 95 | $conditionValue = $condition->value; 96 | $this->formatFilterConditionValue($conditionName, $conditionValue); 97 | 98 | if (array_key_exists($fieldName, $parsedFilters)) { 99 | $parsedFilters[$fieldName] += array($conditionName => $conditionValue); 100 | } else { 101 | $parsedFilters[$fieldName] = array($conditionName => $conditionValue); 102 | } 103 | } 104 | 105 | return $parsedFilters; 106 | } 107 | 108 | /** 109 | * Convert condition value from the string into the array 110 | * for the condition operators that require value to be an array. 111 | * Condition value is changed by reference 112 | * 113 | * @param string $conditionOperator 114 | * @param string $conditionValue 115 | */ 116 | public function formatFilterConditionValue($conditionOperator, &$conditionValue) 117 | { 118 | if (is_string($conditionOperator) && in_array($conditionOperator, array('in', 'nin', 'finset')) 119 | && is_string($conditionValue) 120 | ) { 121 | $delimiter = ','; 122 | $conditionValue = explode($delimiter, $conditionValue); 123 | } 124 | } 125 | 126 | /** 127 | * @param Varien_Data_Collection_Db $collection 128 | * @param \stdClass|null $pager 129 | * 130 | * @return boolean 131 | */ 132 | public function applyPager($collection, $pager) 133 | { 134 | if ($pager->pageSize && $pager->page) { 135 | $collection->setCurPage($pager->page); 136 | $collection->setPageSize($pager->pageSize); 137 | 138 | if ($collection->getCurPage() != $pager->page) { 139 | return false; 140 | } 141 | } 142 | 143 | return true; 144 | } 145 | 146 | /** 147 | * @return bool 148 | */ 149 | public function isOroRequest() 150 | { 151 | return (bool) Mage::registry('is-oro-request'); 152 | } 153 | 154 | /** 155 | * Get WSDL/WSI complexType attributes by complex type name. 156 | * 157 | * @param string $typeName 158 | * @return array 159 | */ 160 | public function getComplexTypeAttributes($typeName) 161 | { 162 | /** @var Mage_Api_Model_Wsdl_Config $wsdlModel */ 163 | $wsdlModel = Mage::getModel('api/wsdl_config'); 164 | $wsdlModel->init(); 165 | 166 | $elements = array(); 167 | if ($this->isComplianceWSI()) { 168 | $elements = $wsdlModel->getXpath( 169 | 'wsdl:types/xsd:schema/xsd:complexType[@name="' . $typeName . '"]/xsd:sequence/xsd:element' 170 | ); 171 | } else { 172 | $typeDefinition = $wsdlModel->getNode('types/schema/complexType@name="' . $typeName . '"/all'); 173 | if ($typeDefinition && $typeDefinition->children()->count() > 0) { 174 | $elements = $typeDefinition->children(); 175 | } 176 | } 177 | 178 | $exposedAttributes = array(); 179 | /** @var Mage_Api_Model_Wsdl_Config_Element $definitionNode */ 180 | foreach ($elements as $definitionNode) { 181 | $name = (string)$definitionNode->getAttribute('name'); 182 | $type = (string)$definitionNode->getAttribute('type'); 183 | $exposedAttributes[$name] = $type; 184 | } 185 | 186 | return $exposedAttributes; 187 | } 188 | 189 | /** 190 | * Get WSDL/WSI complexType scalar attributes by complex type name. 191 | * 192 | * @param string $typeName 193 | * @return array 194 | */ 195 | public function getComplexTypeScalarAttributes($typeName) 196 | { 197 | $scalarTypes = array('xsd:string', 'xsd:int', 'xsd:double', 'xsd:boolean', 'xsd:long'); 198 | 199 | $result = array(); 200 | $attributes = $this->getComplexTypeAttributes($typeName); 201 | foreach ($attributes as $typeName => $type) { 202 | if (in_array($type, $scalarTypes, true)) { 203 | $result[] = $typeName; 204 | } 205 | } 206 | 207 | return $result; 208 | } 209 | 210 | /** 211 | * Get entity attributes that are not not present in known attributes list. 212 | * 213 | * @param Varien_Object $entity 214 | * @param array $data 215 | * @param array $exclude 216 | * @param array $include 217 | * @return array 218 | */ 219 | public function getNotIncludedAttributes( 220 | Varien_Object $entity, 221 | array $data, 222 | array $exclude = array(), 223 | array $include = array() 224 | ) { 225 | if (!Mage::getStoreConfig(self::XPATH_ATTRIBUTES_ENABLED)) { 226 | return array(); 227 | } 228 | 229 | $entityData = $entity->__toArray(); 230 | $knownAttributes = array_diff(array_keys($entityData), $exclude); 231 | $attributesToExpose = array_merge($knownAttributes, $include); 232 | 233 | $attributes = array(); 234 | 235 | if (!empty($attributesToExpose)) { 236 | $attributes = array_intersect_key( 237 | array_merge($data, $entityData), 238 | array_combine($attributesToExpose, $attributesToExpose) 239 | ); 240 | } 241 | 242 | return $this->packAssoc($attributes); 243 | } 244 | 245 | /** 246 | * Pack associative array to format supported by API. 247 | * 248 | * @param array $data 249 | * @return array 250 | */ 251 | public function packAssoc(array $data) 252 | { 253 | $result = array(); 254 | foreach ($data as $key => $value) { 255 | $result[] = array( 256 | 'key' => $key, 257 | 'value' => $value 258 | ); 259 | } 260 | 261 | return $result; 262 | } 263 | 264 | /** 265 | * Get store/wibsite filter data as array from filter condition 266 | * 267 | * @param array $condition 268 | * @return array 269 | */ 270 | public function getDataFromFilterCondition($condition) 271 | { 272 | $result = array(); 273 | 274 | if (is_array($condition)) { 275 | if (isset($condition['eq'])) { 276 | $result = array($condition['eq']); 277 | } elseif (isset($condition['in'])) { 278 | $result = $condition['in']; 279 | } 280 | } 281 | 282 | return $result; 283 | } 284 | } 285 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Admin/Redirectpolicy.php: -------------------------------------------------------------------------------- 1 | getControllerModule() === 'Oro_Api_Adminhtml' 25 | && $request->getControllerName() === 'oro_gateway') { 26 | return $alternativeUrl; 27 | } 28 | return parent::getRedirectUrl($user, $request, $alternativeUrl); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Catalog/Product/Api/V2.php: -------------------------------------------------------------------------------- 1 | getCollection(); 32 | $collection->addStoreFilter($this->_getStoreId($store)); 33 | $collection->addAttributeToSelect(array('name', 'price', 'special_price')); 34 | 35 | /** @var $apiHelper Mage_Api_Helper_Data */ 36 | $apiHelper = Mage::helper('oro_api'); 37 | $filters = $apiHelper->parseFilters($filters, $this->_filtersMap); 38 | try { 39 | foreach ($filters as $field => $value) { 40 | $collection->addFieldToFilter($field, $value); 41 | } 42 | } catch (Mage_Core_Exception $e) { 43 | $this->_fault('filters_invalid', $e->getMessage()); 44 | } 45 | $result = array(); 46 | foreach ($collection as $product) { 47 | $result[] = array( 48 | 'product_id' => $product->getId(), 49 | 'sku' => $product->getSku(), 50 | 'name' => $product->getName(), 51 | 'set' => $product->getAttributeSetId(), 52 | 'type' => $product->getTypeId(), 53 | 'category_ids' => $product->getCategoryIds(), 54 | 'website_ids' => $product->getWebsiteIds(), 55 | 'price' => $product->getPrice(), 56 | 'special_price' => $product->getSpecialPrice(), 57 | ); 58 | } 59 | return $result; 60 | } 61 | } -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Customer/Address/Api.php: -------------------------------------------------------------------------------- 1 | 'entity_id' 23 | ); 24 | 25 | /** 26 | * @var Oro_Api_Helper_Data 27 | */ 28 | protected $_apiHelper; 29 | 30 | /** 31 | * @var array|null 32 | */ 33 | protected $_knownApiAttributes; 34 | 35 | public function __construct() 36 | { 37 | $this->_apiHelper = Mage::helper('oro_api'); 38 | } 39 | 40 | /** 41 | * Retrieve customer addresses list 42 | * 43 | * @param int $customerId 44 | * @return array 45 | */ 46 | public function items($customerId) 47 | { 48 | /* @var Mage_Customer_Model_Customer $customer */ 49 | $customer = Mage::getModel('customer/customer')->load($customerId); 50 | 51 | if (!$customer->getId()) { 52 | $this->_fault('not_exists'); 53 | } 54 | 55 | return $this->getAddressItems($customer); 56 | } 57 | 58 | /** 59 | * Retrieve address data 60 | * 61 | * @param int $addressId 62 | * @return array 63 | */ 64 | public function info($addressId) 65 | { 66 | /** @var Mage_Customer_Model_Address $address */ 67 | $address = Mage::getModel('customer/address')->load($addressId); 68 | 69 | if (!$address->getId()) { 70 | $this->_fault('address_not_exists'); 71 | } 72 | 73 | return $this->getAddressData($address); 74 | } 75 | 76 | /** 77 | * Retrieve customer addresses list 78 | * 79 | * @param Mage_Customer_Model_Customer $customer 80 | * @return array 81 | */ 82 | public function getAddressItems($customer) 83 | { 84 | $result = array(); 85 | /** @var Mage_Customer_Model_Address $address */ 86 | foreach ($customer->getAddresses() as $address) { 87 | $result[] = $this->getAddressData($address, $customer); 88 | } 89 | 90 | return $result; 91 | } 92 | 93 | /** 94 | * Get customer address data applicable for API response. 95 | * 96 | * @param Mage_Customer_Model_Address $address 97 | * @param Mage_Customer_Model_Customer|null $customer 98 | * @return array 99 | */ 100 | public function getAddressData($address, $customer = null) 101 | { 102 | if (!$customer) { 103 | $customer = $address->getCustomer(); 104 | } 105 | 106 | $data = $address->toArray(); 107 | $row = array(); 108 | 109 | foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) { 110 | $row[$attributeAlias] = isset($data[$attributeCode]) ? $data[$attributeCode] : null; 111 | } 112 | 113 | foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) { 114 | if (isset($data[$attributeCode])) { 115 | $row[$attributeCode] = $data[$attributeCode]; 116 | } 117 | } 118 | 119 | $row['attributes'] = $this->_apiHelper 120 | ->getNotIncludedAttributes($address, $row, $this->_getKnownApiAttributes()); 121 | $row['is_default_billing'] = $customer->getDefaultBilling() == $address->getId(); 122 | $row['is_default_shipping'] = $customer->getDefaultShipping() == $address->getId(); 123 | 124 | return $row; 125 | } 126 | 127 | /** 128 | * Get list of attributes exposed to API. 129 | * 130 | * @return array 131 | */ 132 | protected function _getKnownApiAttributes() 133 | { 134 | if (!$this->_knownApiAttributes) { 135 | $this->_knownApiAttributes = array_merge( 136 | $this->_apiHelper->getComplexTypeScalarAttributes('customerAddressEntityItem'), 137 | array('entity_id') 138 | ); 139 | } 140 | 141 | return $this->_knownApiAttributes; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Customer/Address/Api/V2.php: -------------------------------------------------------------------------------- 1 | 'entity_id' 23 | ); 24 | 25 | /** 26 | * Attributes must be processed with source 27 | * 28 | * @var array 29 | */ 30 | protected $_sourcedAttributes = array( 31 | 'gender' 32 | ); 33 | 34 | /** 35 | * @var Oro_Api_Helper_Data 36 | */ 37 | protected $_apiHelper; 38 | 39 | /** 40 | * @var array 41 | */ 42 | protected $_knownApiAttributes = array(); 43 | 44 | /** 45 | * @var Oro_Api_Model_Customer_Address_Api 46 | */ 47 | protected $_addressModel; 48 | 49 | public function __construct() 50 | { 51 | $this->_apiHelper = Mage::helper('oro_api'); 52 | $this->_addressModel = Mage::getModel('oro_api/customer_address_api'); 53 | } 54 | 55 | /** 56 | * Create new customer 57 | * 58 | * @param array $customerData 59 | * @return int 60 | */ 61 | public function create($customerData) 62 | { 63 | $customerData = $this->_prepareData($customerData); 64 | 65 | /** @var Mage_Customer_Model_Customer $customer */ 66 | $customer = Mage::getModel('customer/customer'); 67 | try { 68 | $customer->setData($customerData); 69 | $customer->save(); 70 | } catch (Mage_Core_Exception $e) { 71 | $this->_fault('data_invalid', $e->getMessage()); 72 | } 73 | 74 | return $customer->getId(); 75 | } 76 | 77 | /** 78 | * Update customer data 79 | * 80 | * @param int $customerId 81 | * @param array $customerData 82 | * @return boolean 83 | */ 84 | public function update($customerId, $customerData) 85 | { 86 | $customerData = $this->_prepareData($customerData); 87 | 88 | /** @var Mage_Customer_Model_Customer $customer */ 89 | $customer = Mage::getModel('customer/customer')->load($customerId); 90 | 91 | if (!$customer->getId()) { 92 | $this->_fault('not_exists'); 93 | } 94 | 95 | foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) { 96 | if (isset($customerData[$attributeCode])) { 97 | $customer->setData($attributeCode, $customerData[$attributeCode]); 98 | } 99 | } 100 | 101 | $customer->save(); 102 | 103 | if (!empty($customerData['password'])) { 104 | $customer->changePassword($customerData['password']); 105 | } 106 | 107 | return true; 108 | } 109 | 110 | /** 111 | * Retrieve customers data 112 | * 113 | * @param object|array $filters 114 | * @param \stdClass $pager 115 | * 116 | * @return array 117 | */ 118 | public function items($filters, $pager) 119 | { 120 | /** @var Mage_Customer_Model_Entity_Customer_Collection $collection */ 121 | $collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*'); 122 | 123 | $filters = $this->_apiHelper->parseFilters($filters, $this->_mapAttributes); 124 | try { 125 | foreach ($filters as $field => $value) { 126 | $collection->addFieldToFilter($field, $value); 127 | } 128 | } catch (Mage_Core_Exception $e) { 129 | $this->_fault('filters_invalid', $e->getMessage()); 130 | } 131 | 132 | $collection->setOrder('entity_id', Varien_Data_Collection_Db::SORT_ORDER_ASC); 133 | if (!$this->_apiHelper->applyPager($collection, $pager)) { 134 | // there's no such page, so no results for it 135 | return array(); 136 | } 137 | 138 | $result = array(); 139 | /** @var Mage_Customer_Model_Customer $customer */ 140 | foreach ($collection as $customer) { 141 | $row = $this->_getCustomerData($customer); 142 | 143 | $result[] = $row; 144 | } 145 | 146 | return $result; 147 | } 148 | 149 | /** 150 | * Retrieve customer data 151 | * 152 | * @param int $customerId 153 | * @param array $attributes 154 | * @return array 155 | */ 156 | public function info($customerId, array $attributes = null) 157 | { 158 | /** @var Mage_Customer_Model_Customer $customer */ 159 | $customer = Mage::getModel('customer/customer')->load($customerId); 160 | 161 | if (!$customer->getId()) { 162 | $this->_fault('not_exists'); 163 | } 164 | 165 | return $this->_getCustomerData($customer, $attributes); 166 | } 167 | 168 | /** 169 | * Get customer data applicable for API response. 170 | * 171 | * @param Mage_Customer_Model_Customer $customer 172 | * @param array $allowedAttributes 173 | * @return array 174 | * @throws Mage_Core_Exception 175 | */ 176 | protected function _getCustomerData($customer, array $allowedAttributes = null) 177 | { 178 | $row = array(); 179 | 180 | if (!is_null($allowedAttributes) && !is_array($allowedAttributes)) { 181 | $allowedAttributes = array($allowedAttributes); 182 | } 183 | 184 | foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) { 185 | $row[$attributeAlias] = $customer->getData($attributeCode); 186 | } 187 | 188 | foreach ($this->getAllowedAttributes($customer, $allowedAttributes) as $attributeCode => $attribute) { 189 | /** @var $attribute Mage_Customer_Model_Attribute */ 190 | $row[$attributeCode] = $customer->getData($attributeCode); 191 | if (in_array($attributeCode, $this->_sourcedAttributes)) { 192 | $attributeValue = $attribute->getSource()->getOptionText($customer->getData($attributeCode)); 193 | $row[$attributeCode] = !empty($attributeValue) ? $attributeValue : null; 194 | } 195 | } 196 | $row['addresses'] = $this->_addressModel->getAddressItems($customer); 197 | 198 | $attributes = $this->_apiHelper->getNotIncludedAttributes( 199 | $customer, 200 | $row, 201 | $this->_getKnownApiAttributes(), 202 | array('confirmation') 203 | ); 204 | if ($attributes) { 205 | $row['attributes'] = $attributes; 206 | } 207 | 208 | return $row; 209 | } 210 | 211 | /** 212 | * @param array|\stdClass $data 213 | * @return array 214 | */ 215 | protected function _prepareData($data) 216 | { 217 | $data = (array)$data; 218 | foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) { 219 | if (isset($data[$attributeAlias])) { 220 | $data[$attributeCode] = $data[$attributeAlias]; 221 | unset($data[$attributeAlias]); 222 | } 223 | } 224 | 225 | return $data; 226 | } 227 | 228 | /** 229 | * Get list of attributes exposed to API. 230 | * 231 | * @return array 232 | */ 233 | protected function _getKnownApiAttributes() 234 | { 235 | if (!$this->_knownApiAttributes) { 236 | $this->_knownApiAttributes = array_merge( 237 | $this->_apiHelper->getComplexTypeScalarAttributes('oroCustomerEntity'), 238 | array('entity_id', 'default_shipping', 'default_billing') 239 | ); 240 | } 241 | 242 | return $this->_knownApiAttributes; 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Customer/Api/V2.php: -------------------------------------------------------------------------------- 1 | _apiHelper = Mage::helper('oro_api'); 13 | } 14 | 15 | 16 | /** 17 | * Retrive list of regions 18 | * 19 | * @param object|array $filters 20 | * @param \stdClass $pager 21 | * 22 | * @return array 23 | */ 24 | public function items($filters, $pager) 25 | { 26 | /** @var Mage_Directory_Model_Resource_Region_Collection $collection */ 27 | $collection = Mage::getModel('directory/region')->getCollection(); 28 | 29 | $filters = $this->_apiHelper->parseFilters($filters); 30 | try { 31 | foreach ($filters as $field => $value) { 32 | $collection->addFieldToFilter($field, $value); 33 | } 34 | } catch (Mage_Core_Exception $e) { 35 | $this->_fault('filters_invalid', $e->getMessage()); 36 | } 37 | 38 | $collection->unshiftOrder('region_id', Varien_Data_Collection_Db::SORT_ORDER_ASC); 39 | if (!$this->_apiHelper->applyPager($collection, $pager)) { 40 | // there's no such page, so no results for it 41 | return array(); 42 | } 43 | 44 | $result = array(); 45 | /** @var Mage_Directory_Model_Region $region */ 46 | foreach ($collection as $region) { 47 | $result[] = array( 48 | 'region_id' => $region->getId(), 49 | 'code' => $region->getCode(), 50 | 'countryCode' => $region->getCountryId(), 51 | 'name' => $region->getName(), 52 | ); 53 | } 54 | 55 | return $result; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Directory/Region/Api/V2.php: -------------------------------------------------------------------------------- 1 | parseFilters($filters); 36 | try { 37 | foreach ($filters as $field => $value) { 38 | $collection->addFieldToFilter($field, $value); 39 | } 40 | } catch (Mage_Core_Exception $e) { 41 | $this->_fault('filters_invalid', $e->getMessage()); 42 | } 43 | $collection->setOrder('subscriber_id', Varien_Data_Collection_Db::SORT_ORDER_DESC); 44 | 45 | if ($apiHelper->applyPager($collection, $pager)) { 46 | $result = $collection->toArray(); 47 | 48 | if (array_key_exists('items', $result)) { 49 | return $result['items']; 50 | } 51 | } 52 | 53 | return array(); 54 | } 55 | 56 | /** 57 | * Create new newsletter subscriber. 58 | * 59 | * @param object|array $subscriberData 60 | * @return array 61 | */ 62 | public function create($subscriberData) 63 | { 64 | /** @var Mage_Newsletter_Model_Subscriber $subscriber */ 65 | $subscriber = Mage::getModel('newsletter/subscriber'); 66 | 67 | $subscriberData = (array)$subscriberData; 68 | if (empty($subscriberData['subscriber_confirm_code'])) { 69 | $subscriberData['subscriber_confirm_code'] = $subscriber->randomSequence(); 70 | } 71 | 72 | $hasCustomer = !empty($subscriberData['customer_id']); 73 | /** @var Mage_Customer_Model_Customer $customer */ 74 | $customer = null; 75 | if ($hasCustomer) { 76 | $customer = Mage::getModel('customer/customer')->load($subscriberData['customer_id']); 77 | if (!$customer->getId()) { 78 | $this->_fault('customer_not_found'); 79 | } 80 | 81 | $subscriber->loadByCustomer($customer); 82 | if ($subscriber->getId()) { 83 | $this->_fault('customer_already_subscribed'); 84 | } 85 | } 86 | if (!empty($subscriberData['subscriber_email'])) { 87 | $subscriber->loadByEmail($subscriberData['subscriber_email']); 88 | if ($subscriber->getId()) { 89 | if (!$subscriber->getCustomerId()) { 90 | $subscriber->setCustomerId($subscriberData['customer_id']); 91 | $subscriber->save(); 92 | } else { 93 | $this->_fault('email_already_subscribed'); 94 | } 95 | } 96 | } else { 97 | if ($customer && $customer->getEmail()) { 98 | $subscriberData['subscriber_email'] = $customer->getEmail(); 99 | } else { 100 | $this->_fault('email_is_empty'); 101 | } 102 | } 103 | 104 | // store_id can be 0 105 | if ($customer && $customer->getStore() 106 | && (!array_key_exists('store_id', $subscriberData) || strlen($subscriberData['store_id']) === 0) 107 | ) { 108 | $subscriberData['store_id'] = $customer->getStore()->getId(); 109 | } 110 | 111 | if (!$subscriber->getId()) { 112 | $this->_saveSubscriber($subscriber, $subscriberData); 113 | } 114 | 115 | // Send subscribe confirmation email if needed. 116 | $isConfirmNeed = Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG) == 1; 117 | if ($isConfirmNeed) { 118 | if ($subscriber->getStatus() === Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) { 119 | $subscriber->sendConfirmationSuccessEmail(); 120 | } elseif ($subscriber->getStatus() === Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) { 121 | $subscriber->sendConfirmationRequestEmail(); 122 | } 123 | } 124 | 125 | return $subscriber->toArray(); 126 | } 127 | 128 | /** 129 | * Update newsletter subscriber data 130 | * 131 | * @param int $subscriberId 132 | * @param object|array $subscriberData 133 | * @return array 134 | * @throws Mage_Api_Exception 135 | */ 136 | public function update($subscriberId, $subscriberData) 137 | { 138 | $subscriberData = (array)$subscriberData; 139 | 140 | /** @var Mage_Newsletter_Model_Subscriber $subscriber */ 141 | $subscriber = Mage::getModel('newsletter/subscriber') 142 | ->load($subscriberId); 143 | if (!$subscriber->getId()) { 144 | $this->_fault('not_exists'); 145 | } 146 | 147 | if (!empty($subscriberData['customer_id'])) { 148 | if ($subscriber->getCustomerId() && $subscriber->getCustomerId() != $subscriberData['customer_id']) { 149 | $this->_fault('subscriber_customer_change_forbidden'); 150 | } elseif (!$subscriber->getCustomerId()) { 151 | /** @var Mage_Customer_Model_Customer $customer */ 152 | $customer = Mage::getModel('customer/customer')->load($subscriberData['customer_id']); 153 | if (!$customer->getId()) { 154 | $this->_fault('customer_not_found'); 155 | } 156 | 157 | $subscriber->loadByCustomer($customer); 158 | if ($subscriber->getId() != $subscriberId) { 159 | $this->_fault('customer_already_subscribed'); 160 | } 161 | } 162 | } 163 | if (!empty($subscriberData['subscriber_email'])) { 164 | $subscriber->loadByEmail($subscriberData['subscriber_email']); 165 | if ($subscriber->getId() != $subscriberId) { 166 | $this->_fault('email_already_subscribed'); 167 | } 168 | } else { 169 | unset($subscriberData['subscriber_email']); 170 | } 171 | 172 | $this->_saveSubscriber($subscriber, $subscriberData); 173 | 174 | return $subscriber->toArray(); 175 | } 176 | 177 | /** 178 | * Subscribe by email. 179 | * 180 | * @param string $email 181 | * @return array 182 | * @throws Mage_Api_Exception 183 | */ 184 | public function subscribeEmail($email) 185 | { 186 | /** @var Mage_Newsletter_Model_Subscriber $subscriber */ 187 | $subscriber = Mage::getModel('newsletter/subscriber'); 188 | try { 189 | $subscriber->subscribe($email); 190 | } catch (Mage_Core_Exception $e) { 191 | $this->_fault('data_invalid', $e->getMessage()); 192 | } 193 | 194 | return $subscriber->toArray(); 195 | } 196 | 197 | /** 198 | * Unsubscribe newsletter subscriber. 199 | * 200 | * @param int $subscriberId 201 | * @return bool 202 | * @throws Mage_Api_Exception 203 | */ 204 | public function unsubscribe($subscriberId) 205 | { 206 | /** @var Mage_Newsletter_Model_Subscriber $subscriber */ 207 | $subscriber = Mage::getModel('newsletter/subscriber') 208 | ->load($subscriberId); 209 | 210 | if (!$subscriber->getId()) { 211 | $this->_fault('not_exists'); 212 | } 213 | 214 | try { 215 | $subscriber->unsubscribe(); 216 | } catch (Mage_Core_Exception $e) { 217 | $this->_fault('data_invalid', $e->getMessage()); 218 | } 219 | 220 | return true; 221 | } 222 | 223 | /** 224 | * @param Mage_Newsletter_Model_Subscriber $subscriber 225 | * @param array $data 226 | * @throws Exception 227 | * @throws Mage_Api_Exception 228 | */ 229 | protected function _saveSubscriber(Mage_Newsletter_Model_Subscriber $subscriber, array $data) 230 | { 231 | unset($data['subscriber_id']); 232 | foreach ($data as $key => $value) { 233 | $subscriber->setData($key, $value); 234 | } 235 | 236 | try { 237 | $subscriber->save(); 238 | } catch (Mage_Core_Exception $e) { 239 | $this->_fault('data_invalid', $e->getMessage()); 240 | } 241 | } 242 | } -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Newsletter/Subscriber/Api/V2.php: -------------------------------------------------------------------------------- 1 | getSubscriber(); 26 | $now = new \DateTime('now', new \DateTimeZone('UTC')); 27 | $subscriber['change_status_at'] = $now->format('Y-m-d H:i:s'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Observer/Crm/Controller.php: -------------------------------------------------------------------------------- 1 | getEvent()->getData('controller_action'); 30 | 31 | if (!preg_match('/^.+?\\/oro_gateway\\/clearSession/ui', $controller->getRequest()->getPathInfo())) { 32 | if (preg_match('/^.+?\\/oro_gateway\\/do$/ui', $controller->getRequest()->getOriginalPathInfo()) || $controller->getRequest()->getParam('is-oro-request') || $controller->getRequest()->getCookie('is-oro-request')) { 33 | $controller->setFlag('', 'is-oro-request', true); 34 | if (!Mage::registry('is-oro-request')) { 35 | Mage::register('is-oro-request', true); 36 | } 37 | } 38 | } 39 | } 40 | 41 | /** 42 | * @param Varien_Event_Observer $observer 43 | */ 44 | public function handleResponse(Varien_Event_Observer $observer) 45 | { 46 | /** @var Mage_Core_Controller_Front_Action $controller */ 47 | $controller = $observer->getEvent()->getData('controller_action'); 48 | $session = Mage::getSingleton('adminhtml/session'); 49 | if (Mage::helper('oro_api')->isOroRequest()) { 50 | if ($controller->getFullActionName() == $session->getData('oro_end_point')) { 51 | $messages = Mage::getSingleton('adminhtml/session')->getMessages(false); 52 | $quoteMessages = Mage::getSingleton('adminhtml/session_quote')->getMessages(false); 53 | $errors = array_merge($messages->getErrors(), $quoteMessages->getErrors()); 54 | 55 | // assume that if error messages exist then do no redirect to "success_url" 56 | if (empty($errors)) { 57 | $this->_setCookieValue(0); 58 | 59 | // clear all messages 60 | Mage::getSingleton('adminhtml/session')->getMessages(true); 61 | Mage::getSingleton('adminhtml/session_quote')->getMessages(true); 62 | 63 | $controller->getResponse()->clearHeader('Location'); 64 | $controller->getResponse()->clearBody(); 65 | $controller->getResponse()->appendBody( 66 | '' 69 | )->sendResponse(); 70 | return; 71 | } 72 | } 73 | 74 | $this->_setCookieValue(1); 75 | } 76 | } 77 | 78 | /** 79 | * @param Varien_Event_Observer $observer 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 | // Remove back button on Manage Shopping Cart of Customer if it's rendered in Oro Request. 91 | if (class_exists('Enterprise_Checkout_Block_Adminhtml_Manage', false) && 92 | ($manageBlock = $layout->getBlock('ID')) instanceof Enterprise_Checkout_Block_Adminhtml_Manage 93 | ) { 94 | $manageBlock->removeButton('back'); 95 | } 96 | 97 | if (($contentBlock = $layout->getBlock('content')) instanceof Mage_Adminhtml_Block_Sales_Order_Create) { 98 | $contentBlock->removeButton('reset'); 99 | 100 | // remove cart sidebar in case if we create order for active shopping cart 101 | // because it has no sense to duplicate items info in two blocks 102 | $sidebar = $layout->getBlock('sidebar'); 103 | /** @var $cartBlock Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Cart */ 104 | $cartBlock = $sidebar->getChild('cart'); 105 | if ($cartBlock && (bool)$cartBlock->getQuote()->getOrigData('is_active')) { 106 | $sidebar->unsetChild('cart'); 107 | } 108 | } 109 | 110 | /** @var Mage_Core_Block_Text $script */ 111 | $layout->createBlock('adminhtml/template', 'oro_script', array('template' => 'oro/api/script.phtml')); 112 | 113 | if (($loginForm = $layout->getBlock('form.additional.info')) instanceof Mage_Core_Block_Text_List) { 114 | $layout->createBlock( 115 | 'adminhtml/template', 116 | 'oro_login_styles', 117 | array('template' => 'oro/api/login_styles.phtml') 118 | ); 119 | $loginForm->insert('oro_login_styles'); 120 | } elseif ($layout->getBlock('head')) { 121 | $layout->getBlock('head')->addCss('oro_style.css'); 122 | } 123 | 124 | $this->_insertBlock('oro_script', $layout); 125 | 126 | if ($layout->getBlock('root') instanceof Mage_Core_Block_Template) { 127 | $layout->getBlock('root')->setTemplate('oro/api/page.phtml'); 128 | } 129 | } 130 | } 131 | 132 | /** 133 | * Insert block 134 | * 135 | * @param string $blockName 136 | * @param Mage_Core_Model_Layout $layout 137 | */ 138 | protected function _insertBlock($blockName, Mage_Core_Model_Layout $layout) 139 | { 140 | $destination = null; 141 | 142 | switch (true) { 143 | case $layout->getBlock('form.additional.info') instanceof Mage_Core_Block_Text_List: 144 | $destination = $layout->getBlock('form.additional.info'); 145 | break; 146 | case $layout->getBlock('before_body_end') instanceof Mage_Core_Block_Text_List: 147 | $destination = $layout->getBlock('before_body_end'); 148 | break; 149 | case $layout->getBlock('content') instanceof Mage_Core_Block_Text_List: 150 | $destination = $layout->getBlock('content'); 151 | break; 152 | default: 153 | $destination = null; 154 | break; 155 | } 156 | 157 | if ($destination) { 158 | $destination->insert($blockName); 159 | } 160 | } 161 | 162 | /** 163 | * Set oro cookie value 164 | * 165 | * @param mixed $value 166 | */ 167 | protected function _setCookieValue($value) 168 | { 169 | Mage::getSingleton('core/cookie')->set('is-oro-request', $value, null, null, null, null, false); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Observer/Sales/Order.php: -------------------------------------------------------------------------------- 1 | getQuote(); 30 | 31 | if (Mage::helper('oro_api')->isOroRequest() && (bool)$quote->getOrigData('is_active')) { 32 | $quote->setIsActive(false) 33 | ->save(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Ping.php: -------------------------------------------------------------------------------- 1 | isWebsiteScope(); 26 | 27 | return array( 28 | 'version' => (string)Mage::getConfig()->getNode('modules/Oro_Api/version'), 29 | 'mage_version' => Mage::getVersion(), 30 | 'admin_url' => Mage::getUrl('adminhtml'), 31 | 'customer_scope' => $customerScope, 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Ping/V2.php: -------------------------------------------------------------------------------- 1 | addIndexFilter(); 30 | /** @var $apiHelper Mage_Api_Helper_Data */ 31 | $apiHelper = Mage::helper('oro_api'); 32 | $filters = $apiHelper->parseFilters($filters); 33 | try { 34 | foreach ($filters as $field => $value) { 35 | $collection->addFieldToFilter($field, $value); 36 | } 37 | } catch (Mage_Core_Exception $e) { 38 | $this->_fault('filters_invalid', $e->getMessage()); 39 | } 40 | 41 | return $collection->load()->toArray(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Report/Product/Viewed/Api/V2.php: -------------------------------------------------------------------------------- 1 | getFlag('is_idx_table_joined')) { 24 | $this->joinTable( 25 | array('idx_table' => $this->_getTableName()), 26 | 'product_id=entity_id', 27 | '*', 28 | $this->_getWhereCondition() 29 | ); 30 | $this->setFlag('is_idx_table_joined', true); 31 | } 32 | return $this; 33 | } 34 | 35 | /** 36 | * Retrieve Where Condition to Index table 37 | * 38 | * @return array 39 | */ 40 | protected function _getWhereCondition() 41 | { 42 | return array(); 43 | } 44 | } -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Resource/Setup.php: -------------------------------------------------------------------------------- 1 | _init('oro_api/wishlist_status', 'wishlist_id'); 37 | } 38 | 39 | /** 40 | * Clean status logs 41 | * 42 | * @param Oro_Api_Model_Wishlist_Status $object 43 | * @return Oro_Api_Model_Resource_Wishlist_Status 44 | */ 45 | public function clean(Oro_Api_Model_Wishlist_Status $object) 46 | { 47 | $cleanTime = $object->getLogCleanTime(); 48 | $this->_cleanStatuses($cleanTime); 49 | 50 | return $this; 51 | } 52 | 53 | /** 54 | * Clean statuses table 55 | * 56 | * @param int $time 57 | * @return Oro_Api_Model_Resource_Wishlist_Status 58 | */ 59 | protected function _cleanStatuses($time) 60 | { 61 | $writeAdapter = $this->_getWriteAdapter(); 62 | $timeLimit = $this->formatDate(Mage::getModel('core/date')->gmtTimestamp() - $time); 63 | $condition = array('deleted_at < ?' => $timeLimit); 64 | 65 | // remove wishlist statuses from oro_api/wishlist_status 66 | try { 67 | $writeAdapter->delete($this->getTable('oro_api/wishlist_status'), $condition); 68 | } catch (Exception $e) { 69 | Mage::log($e->getMessage()); 70 | } 71 | 72 | return $this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Resource/Wishlist/Status/Collection.php: -------------------------------------------------------------------------------- 1 | _init('oro_api/wishlist_status'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Sales/Order/Api.php: -------------------------------------------------------------------------------- 1 | array('order_id' => 'entity_id'), 23 | 'order_address' => array('address_id' => 'entity_id'), 24 | 'global' => array() 25 | ); 26 | 27 | /** 28 | * @var Oro_Api_Helper_Data 29 | */ 30 | protected $_apiHelper; 31 | 32 | /** 33 | * @var array 34 | */ 35 | protected $_knownApiAttributes = array(); 36 | 37 | public function __construct() 38 | { 39 | $this->_apiHelper = Mage::helper('oro_api'); 40 | } 41 | 42 | /** 43 | * Retrieve list of orders. Filtration could be applied 44 | * 45 | * @param null|object|array $filters 46 | * @param null|\stdClass $pager 47 | * 48 | * @return array 49 | */ 50 | public function items($filters = null, $pager = null) 51 | { 52 | $orders = array(); 53 | $orderCollection = $this->getOrderCollection(); 54 | 55 | $filters = $this->_apiHelper->parseFilters($filters, $this->_attributesMap['order']); 56 | try { 57 | foreach ($filters as $field => $value) { 58 | $orderCollection->addFieldToFilter($field, $value); 59 | } 60 | } catch (Mage_Core_Exception $e) { 61 | $this->_fault('filters_invalid', $e->getMessage()); 62 | } 63 | 64 | $orderCollection->setOrder('entity_id', Varien_Data_Collection_Db::SORT_ORDER_ASC); 65 | if (!$this->_apiHelper->applyPager($orderCollection, $pager)) { 66 | // there's no such page, so no results for it 67 | return array(); 68 | } 69 | 70 | foreach ($orderCollection as $order) { 71 | $orders[] = $this->_getOrderData($order); 72 | } 73 | 74 | return $orders; 75 | } 76 | 77 | /** 78 | * Retrieve full order information 79 | * 80 | * @param string $orderIncrementId 81 | * @return array 82 | */ 83 | public function info($orderIncrementId) 84 | { 85 | /** @var Mage_Sales_Model_Order $order */ 86 | $order = Mage::getModel('sales/order'); 87 | $order->loadByIncrementId($orderIncrementId); 88 | 89 | if (!$order->getId()) { 90 | $this->_fault('not_exists'); 91 | } 92 | 93 | return $this->_getOrderData($order); 94 | } 95 | 96 | /** 97 | * @param Mage_Sales_Model_Order $order 98 | * @return array 99 | */ 100 | protected function _getOrderData($order) 101 | { 102 | /** @var array $orderData */ 103 | $orderData = $this->_getAttributes($order, 'order'); 104 | 105 | $attributes = $this->_apiHelper->getNotIncludedAttributes($order, $orderData, $this->getKnownApiAttributes()); 106 | if ($attributes) { 107 | $orderData['attributes'] = $attributes; 108 | } 109 | $orderData = array_merge($orderData, $this->_getOrderAdditionalInfo($order)); 110 | 111 | return $orderData; 112 | } 113 | 114 | /** 115 | * Retrieve detailed order information 116 | * 117 | * @param Mage_Sales_Model_Order $order 118 | * @return array 119 | */ 120 | protected function _getOrderAdditionalInfo($order) 121 | { 122 | if ($order->getGiftMessageId() > 0) { 123 | $orderGiftMessage = Mage::getSingleton('giftmessage/message')->load($order->getGiftMessageId()) 124 | ->getMessage(); 125 | } else { 126 | $orderGiftMessage = null; 127 | } 128 | 129 | $result = array(); 130 | $result['gift_message'] = $orderGiftMessage; 131 | $result['shipping_address'] = $this->_getAttributes($order->getShippingAddress(), 'order_address'); 132 | $result['billing_address'] = $this->_getAttributes($order->getBillingAddress(), 'order_address'); 133 | $result['items'] = array(); 134 | 135 | /** @var Mage_Sales_Model_Order_Item $item */ 136 | foreach ($order->getAllItems() as $item) { 137 | if ($item->getGiftMessageId() > 0) { 138 | $cartItemGiftMessage = Mage::getSingleton('giftmessage/message')->load($item->getGiftMessageId()) 139 | ->getMessage(); 140 | } else { 141 | $cartItemGiftMessage = null; 142 | } 143 | 144 | $cartItemInfo = $this->_getAttributes($item, 'order_item'); 145 | $cartItemInfo['gift_message'] = $cartItemGiftMessage; 146 | $result['items'][] = $cartItemInfo; 147 | } 148 | 149 | $result['payment'] = $this->_getAttributes($order->getPayment(), 'order_payment'); 150 | 151 | $result['status_history'] = array(); 152 | 153 | foreach ($order->getAllStatusHistory() as $history) { 154 | $historyAttributes = $this->_getAttributes($history, 'order_status_history'); 155 | // Force adding entity_id to history data for correct import 156 | $historyAttributes['increment_id'] = $history->getId(); 157 | $result['status_history'][] = $historyAttributes; 158 | } 159 | 160 | $result['coupon_code'] = $order->getCouponCode(); 161 | 162 | return $result; 163 | } 164 | 165 | /** 166 | * @return Mage_Sales_Model_Mysql4_Order_Collection 167 | */ 168 | protected function getOrderCollection() 169 | { 170 | //TODO: add full name logic 171 | $billingAliasName = 'billing_o_a'; 172 | $shippingAliasName = 'shipping_o_a'; 173 | 174 | /** @var $orderCollection Mage_Sales_Model_Mysql4_Order_Collection */ 175 | $orderCollection = Mage::getModel("sales/order")->getCollection(); 176 | 177 | $billingFirstnameField = "$billingAliasName.firstname"; 178 | $billingLastnameField = "$billingAliasName.lastname"; 179 | $shippingFirstnameField = "$shippingAliasName.firstname"; 180 | $shippingLastnameField = "$shippingAliasName.lastname"; 181 | 182 | $orderCollection->addAttributeToSelect('*') 183 | ->addAddressFields() 184 | ->addExpressionFieldToSelect( 185 | 'billing_firstname', 186 | "{{billing_firstname}}", 187 | array('billing_firstname' => $billingFirstnameField) 188 | ) 189 | ->addExpressionFieldToSelect( 190 | 'billing_lastname', 191 | "{{billing_lastname}}", 192 | array('billing_lastname' => $billingLastnameField) 193 | ) 194 | ->addExpressionFieldToSelect( 195 | 'shipping_firstname', 196 | "{{shipping_firstname}}", 197 | array('shipping_firstname' => $shippingFirstnameField) 198 | ) 199 | ->addExpressionFieldToSelect( 200 | 'shipping_lastname', 201 | "{{shipping_lastname}}", 202 | array('shipping_lastname' => $shippingLastnameField) 203 | ) 204 | ->addExpressionFieldToSelect( 205 | 'billing_name', 206 | "CONCAT({{billing_firstname}}, ' ', {{billing_lastname}})", 207 | array('billing_firstname' => $billingFirstnameField, 'billing_lastname' => $billingLastnameField) 208 | ) 209 | ->addExpressionFieldToSelect( 210 | 'shipping_name', 211 | 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})', 212 | array('shipping_firstname' => $shippingFirstnameField, 'shipping_lastname' => $shippingLastnameField) 213 | ); 214 | 215 | $orderCollection->join( 216 | array('store' => 'core/store'), 217 | 'main_table.store_id = store.store_id', 218 | array('website_id' => 'website_id') 219 | ); 220 | $orderCollection->addFilterToMap('store_id', 'main_table.store_id'); 221 | 222 | return $orderCollection; 223 | } 224 | 225 | /** 226 | * Get list of attributes exposed to API. 227 | * 228 | * @return array 229 | */ 230 | protected function getKnownApiAttributes() 231 | { 232 | if (!$this->_knownApiAttributes) { 233 | $this->_knownApiAttributes = array_merge( 234 | $this->_apiHelper->getComplexTypeScalarAttributes('salesOrderEntity'), 235 | array('entity_id') 236 | ); 237 | } 238 | 239 | return $this->_knownApiAttributes; 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Sales/Order/Api/V2.php: -------------------------------------------------------------------------------- 1 | _categoryCollection = Mage::getResourceModel('catalog/category_collection') 39 | ->addAttributeToSelect('name'); 40 | 41 | $this->_apiHelper = Mage::helper('oro_api'); 42 | } 43 | 44 | /** 45 | * Retrieve list of quotes. Filtration could be applied 46 | * 47 | * @param array|object $filters 48 | * @param \stdClass $pager 49 | * 50 | * @return array 51 | */ 52 | public function items($filters, $pager) 53 | { 54 | /** @var Mage_Sales_Model_Resource_Quote_Collection $quoteCollection */ 55 | $quoteCollection = Mage::getResourceModel('sales/quote_collection'); 56 | $filters = $this->_apiHelper->parseFilters($filters); 57 | try { 58 | foreach ($filters as $field => $value) { 59 | $quoteCollection->addFieldToFilter($field, $value); 60 | } 61 | } catch (Mage_Core_Exception $e) { 62 | $this->_fault('filters_invalid', $e->getMessage()); 63 | } 64 | 65 | $quoteCollection->setOrder('entity_id', Varien_Data_Collection_Db::SORT_ORDER_ASC); 66 | if (!$this->_apiHelper->applyPager($quoteCollection, $pager)) { 67 | // there's no such page, so no results for it 68 | return array(); 69 | } 70 | 71 | $this->_preparesGiftMessages($quoteCollection); 72 | 73 | $resultArray = array(); 74 | /** @var Mage_Sales_Model_Quote $quote */ 75 | foreach ($quoteCollection as $quote) { 76 | $row = $quote->__toArray(); 77 | $attributes = $this->_apiHelper->getNotIncludedAttributes($quote, $row, $this->_getKnownQuoteAttributes()); 78 | if ($attributes) { 79 | $row['attributes'] = $attributes; 80 | } 81 | $row = array_merge($row, $this->info($quote)); 82 | $resultArray[] = $row; 83 | } 84 | 85 | return $resultArray; 86 | } 87 | 88 | /** 89 | * Retrieve full information about quote 90 | * 91 | * @param Mage_Sales_Model_Quote $quote 92 | * @return array 93 | */ 94 | protected function info($quote) 95 | { 96 | $result = $this->_getAttributes($quote, 'quote'); 97 | $result['shipping_address'] = $this->_getAttributes($quote->getShippingAddress(), 'quote_address'); 98 | $result['billing_address'] = $this->_getAttributes($quote->getBillingAddress(), 'quote_address'); 99 | $result['items'] = array(); 100 | 101 | /** @var Mage_Sales_Model_Quote_Item $item */ 102 | foreach ($quote->getAllItems() as $item) { 103 | $quoteItem = $this->_getAttributes($item, 'quote_item'); 104 | $productAttributes = $this->_getProductAttributes($item); 105 | $quoteItem = array_merge($quoteItem, $productAttributes); 106 | 107 | $result['items'][] = $quoteItem; 108 | } 109 | 110 | $result['payment'] = $this->_getAttributes($quote->getPayment(), 'quote_payment'); 111 | if (isset($result['payment'], $result['payment']['additional_information']) 112 | && is_array($result['payment']['additional_information']) 113 | ) { 114 | $result['payment']['additional_information'] = serialize($result['payment']['additional_information']); 115 | } 116 | 117 | return $result; 118 | } 119 | 120 | /** 121 | * @param Mage_Sales_Model_Quote_Item $item 122 | * @return array 123 | */ 124 | protected function _getProductAttributes($item) 125 | { 126 | $result = array(); 127 | $product = $item->getProduct(); 128 | 129 | if ($product) { 130 | $productImage = $product->getData('image'); 131 | if ($productImage) { 132 | $result['product_image_url'] = Mage::getSingleton('catalog/product_media_config') 133 | ->getMediaUrl($productImage); 134 | } 135 | $result['product_url'] = $product->getProductUrl(false); 136 | 137 | $productCategoryIds = $product->getCategoryIds(); 138 | foreach ($productCategoryIds as $categoryId) { 139 | $category = $this->_categoryCollection->getItemById($categoryId); 140 | if ($category) { 141 | $result['categories'][] = array( 142 | 'name' => $category->getName() 143 | ); 144 | } 145 | } 146 | } 147 | 148 | return $result; 149 | } 150 | 151 | /** 152 | * Get list of attributes exposed to API. 153 | * 154 | * @return array 155 | */ 156 | protected function _getKnownQuoteAttributes() 157 | { 158 | if (!$this->_knownAttributes) { 159 | $this->_knownAttributes = array_merge( 160 | $this->_apiHelper->getComplexTypeScalarAttributes('salesQuoteEntity'), 161 | array('entity_id') 162 | ); 163 | } 164 | 165 | return $this->_knownAttributes; 166 | } 167 | 168 | /** 169 | * Set gift_message key to quote and quote item 170 | * 171 | * @param Mage_Sales_Model_Resource_Quote_Collection $quoteCollection 172 | */ 173 | protected function _preparesGiftMessages($quoteCollection) 174 | { 175 | $messageIds = array(); 176 | /* @var Mage_Sales_Model_Quote $quote */ 177 | foreach ($quoteCollection as $quote) { 178 | if ($quote->getGiftMessageId()) { 179 | $messageIds[] = $quote->getGiftMessageId(); 180 | } 181 | foreach ($quote->getAllItems() as $quoteItem) { 182 | if ($quoteItem->getGiftMessageId()) { 183 | $messageIds[] = $quoteItem->getGiftMessageId(); 184 | } 185 | } 186 | } 187 | 188 | if (!$messageIds) { 189 | return; 190 | } 191 | 192 | $messageIds = array_unique($messageIds); 193 | 194 | $giftCollection = Mage::getResourceModel('giftmessage/message_collection'); 195 | $giftCollection->addFieldToFilter('gift_message_id', array('in' => $messageIds)); 196 | 197 | /* @var Mage_Sales_Model_Quote $quote */ 198 | foreach ($quoteCollection as $quote) { 199 | if ($quote->getGiftMessageId()) { 200 | $quote->setGiftMessage($giftCollection->getItemById($quote->getGiftMessageId())->getMessage()); 201 | } 202 | foreach ($quote->getAllItems() as $quoteItem) { 203 | if ($quoteItem->getGiftMessageId()) { 204 | $quoteItem->setGiftMessage($giftCollection->getItemById($quoteItem->getGiftMessageId())->getMessage()); 205 | } 206 | } 207 | } 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Sales/Quote/Api/V2.php: -------------------------------------------------------------------------------- 1 | getProductId()) { 28 | return $this; 29 | } 30 | 31 | return parent::checkData(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Website/Api.php: -------------------------------------------------------------------------------- 1 | getWebsites(true); 29 | 30 | // Make result array 31 | $result = array(); 32 | foreach ($websites as $website) { 33 | $result[] = $website->toArray(); 34 | } 35 | 36 | return $result; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Website/Api/V2.php: -------------------------------------------------------------------------------- 1 | 'entity_id' 26 | ); 27 | 28 | /** 29 | * Store ids (website stores) 30 | * 31 | * @var array 32 | */ 33 | protected $storeIds = null; 34 | 35 | /** 36 | * @var Oro_Api_Helper_Data 37 | */ 38 | protected $apiHelper; 39 | 40 | /** 41 | * Constructor. 42 | */ 43 | public function __construct() 44 | { 45 | $this->apiHelper = Mage::helper('oro_api'); 46 | } 47 | 48 | /** 49 | * @param array|object $filters 50 | * @param \stdClass $pager 51 | * @return array 52 | */ 53 | public function items($filters, $pager = null) 54 | { 55 | /** @var Mage_Wishlist_Model_Resource_Wishlist_Collection $collection */ 56 | $collection = Mage::getResourceModel('wishlist/wishlist_collection'); 57 | $filters = $this->apiHelper->parseFilters($filters); 58 | try { 59 | foreach ($filters as $field => $value) { 60 | $collection->addFieldToFilter($field, $value); 61 | } 62 | } catch (Mage_Core_Exception $e) { 63 | $this->_fault('filters_invalid', $e->getMessage()); 64 | } 65 | 66 | if ($pager && !$this->apiHelper->applyPager($collection, $pager)) { 67 | // there's no such page, so no results for it 68 | return array(); 69 | } 70 | 71 | $arr = $collection->toArray(); 72 | 73 | return $arr['items']; 74 | } 75 | 76 | /** 77 | * Get wishlist with items info 78 | * 79 | * @param array|object $filters 80 | * @param null|\stdClass $pager 81 | * @return array 82 | * 83 | * @throws Mage_Api_Exception 84 | */ 85 | public function listWithItems($filters, $pager = null) 86 | { 87 | /** @var Mage_Wishlist_Model_Resource_Wishlist_Collection $collection */ 88 | $collection = Mage::getResourceModel('wishlist/wishlist_collection'); 89 | $filters = $this->apiHelper->parseFilters($filters, array('updated_at' => 'main_table.updated_at')); 90 | /* Prepare store/website filters for wishlist */ 91 | $filters = $this->prepareFilters($filters); 92 | 93 | try { 94 | foreach ($filters as $field => $value) { 95 | $collection->addFieldToFilter($field, $value); 96 | } 97 | // Load customer data 98 | $collection = $this->addCustomerData($collection); 99 | } catch (Mage_Core_Exception $e) { 100 | $this->_fault('filters_invalid', $e->getMessage()); 101 | } 102 | 103 | if ($pager && !$this->apiHelper->applyPager($collection, $pager)) { 104 | // there's no such page, so no results for it 105 | return array(); 106 | } 107 | 108 | $result = array(); 109 | foreach ($collection as $wishlist) { 110 | /** @var Mage_Wishlist_Model_Wishlist $wishlist */ 111 | $wishlistData = $this->info($wishlist); 112 | $result[] = $wishlistData; 113 | } 114 | 115 | return $result; 116 | } 117 | 118 | /** 119 | * Retrieve store ids 120 | * 121 | * @param null|integer $websiteId 122 | * @return array 123 | */ 124 | public function getStoreIds($websiteId = null) 125 | { 126 | $storeIds = array(); 127 | if ($websiteId) { 128 | $website = Mage::getModel('core/website')->load($websiteId); 129 | $storeIds = $website->getStoreIds(); 130 | } else { 131 | $stores = Mage::app()->getStores(); 132 | foreach ($stores as $store) { 133 | $storeIds[] = $store->getId(); 134 | } 135 | } 136 | return $storeIds; 137 | } 138 | 139 | /** 140 | * Add customer data to collection 141 | * 142 | * @param Mage_Wishlist_Model_Resource_Wishlist_Collection $collection 143 | * @return Mage_Wishlist_Model_Resource_Wishlist_Collection 144 | */ 145 | protected function addCustomerData($collection) 146 | { 147 | $customerTable = $collection->getTable('customer/entity'); 148 | $select = $collection->getSelect(); 149 | $select->joinLeft( 150 | array('customer' => $customerTable), 151 | 'main_table.customer_id = customer.entity_id', 152 | array( 153 | 'customer_email' => 'email', 154 | 'website_id' => 'website_id' 155 | ) 156 | ); 157 | 158 | return $collection; 159 | } 160 | 161 | /** 162 | * Retrieve full information about wishlist 163 | * 164 | * @param Mage_Wishlist_Model_Wishlist $wishlist 165 | * @return array 166 | */ 167 | protected function info($wishlist) 168 | { 169 | $result = $wishlist->toArray(); 170 | $result['items'] = array(); 171 | 172 | // Load wishlist items data 173 | /** @var Mage_Wishlist_Model_Resource_Item_Collection $collection */ 174 | $collection = Mage::getResourceModel('wishlist/item_collection') 175 | ->addWishlistFilter($wishlist) 176 | ->addStoreFilter($this->storeIds) 177 | ->setVisibilityFilter(); 178 | 179 | /** @var Mage_Wishlist_Model_Item $item */ 180 | foreach ($collection as $item) { 181 | $product = $item->getProduct(); 182 | if ($product) { 183 | $item->setSku($product->getSku()); 184 | $item->setProductName($product->getName()); 185 | $item->setWebsiteId(Mage::app()->getStore($item->getStoreId())->getWebsiteId()); 186 | } 187 | $wishlistItem = $item->toArray(); 188 | unset($wishlistItem['product']); 189 | $result['items'][] = $wishlistItem; 190 | } 191 | return $result; 192 | } 193 | 194 | /** 195 | * Prepare store/website filters for wishlist 196 | * 197 | * Exclude store fields from complex filter for wishlist if exists 198 | * Save store filter data to storeIds - used for filter wishlist items 199 | * Save website filter data to websiteIds - used for filter wishlists by customer's website 200 | * 201 | * If website filter exists in the incoming filter (from integration) and customer accounts shared globally 202 | * ignore sent filters, set all stores where customer can be presented to storeIds 203 | * 204 | * Example if complex filter: 205 | * 'website_id', 206 | * [ 207 | * 'key' => 'website_id', 208 | * 'value' => [ 209 | * 'key' => 'eq', 210 | * 'value' => '1' 211 | * ] 212 | * ] 213 | * 'store_id', 214 | * [ 215 | * 'key' => 'store_id', 216 | * 'value' => [ 217 | * 'key' => 'in', 218 | * 'value' => [1,2] 219 | * ] 220 | * ] 221 | * 222 | * @param array $filters 223 | * @return array 224 | */ 225 | protected function prepareFilters($filters) 226 | { 227 | if (Mage::getSingleton('customer/config_share')->isWebsiteScope()) { 228 | if (isset($filters['store_id'])) { 229 | $storeIds = $this->apiHelper->getDataFromFilterCondition($filters['store_id']); 230 | $this->storeIds = $storeIds; 231 | unset($filters['store_id']); 232 | } 233 | if (isset($filters['website_id'])) { 234 | $websiteIds = $this->apiHelper->getDataFromFilterCondition($filters['website_id']); 235 | if (!$this->storeIds) { 236 | foreach ($websiteIds as $websiteId) { 237 | $storeIds = $this->getStoreIds($websiteId); 238 | foreach ($storeIds as $id) { 239 | $this->storeIds[] = $id; 240 | } 241 | } 242 | } 243 | } 244 | } else { 245 | unset($filters['store_id']); 246 | unset($filters['website_id']); 247 | } 248 | 249 | if (!$this->storeIds) { 250 | $this->storeIds = $this->getStoreIds(); 251 | } 252 | 253 | return $filters; 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Wishlist/Api/V2.php: -------------------------------------------------------------------------------- 1 | parseFilters($filters); 32 | try { 33 | foreach ($filters as $field => $value) { 34 | $collection->addFieldToFilter($field, $value); 35 | } 36 | } catch (Mage_Core_Exception $e) { 37 | $this->_fault('filters_invalid', $e->getMessage()); 38 | } 39 | 40 | $arr = $collection->toArray(); 41 | 42 | return $arr['items']; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Wishlist/Item/Api/V2.php: -------------------------------------------------------------------------------- 1 | isModuleEnabled('Enterprise_Wishlist') && 33 | Mage::helper('enterprise_wishlist')->isMultipleEnabled()) { 34 | /** @var Mage_Wishlist_Model_Wishlist $wishlist */ 35 | $wishlist = $observer->getEvent()->getObject(); 36 | $wishlistId = $wishlist->getId(); 37 | if ($wishlistId) { 38 | try { 39 | $websiteId = $this->getWishlistOwnerWebsiteId($wishlist); 40 | /** @var Oro_Api_Model_Wishlist_Status $wishlistStatus */ 41 | $wishlistStatus = Mage::getModel('oro_api/wishlist_status') 42 | ->setWishlistId($wishlistId) 43 | ->setWebsiteId($websiteId) 44 | ->setDeletedAt(Mage::getSingleton('core/date')->gmtDate()); 45 | $wishlistStatus->save(); 46 | } catch (Exception $e) { 47 | Mage::log($e->getMessage()); 48 | } 49 | } 50 | } 51 | 52 | return $this; 53 | } 54 | 55 | /** 56 | * Retrieve wishlist owner website 57 | * 58 | * @param Mage_Wishlist_Model_Wishlist $wishlist 59 | * @return null 60 | */ 61 | public function getWishlistOwnerWebsiteId($wishlist) 62 | { 63 | $customerId = $wishlist->getCustomerId(); 64 | if ($customerId) { 65 | /** @var Mage_Customer_Model_Customer $owner */ 66 | $owner = Mage::getModel("customer/customer"); 67 | $owner->load($customerId); 68 | if ($owner->getId()) { 69 | return $owner->getWebsiteId(); 70 | } 71 | } 72 | 73 | return null; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Wishlist/Status.php: -------------------------------------------------------------------------------- 1 | _init('oro_api/wishlist_status'); 32 | } 33 | 34 | public function getLogCleanTime() 35 | { 36 | return Mage::getStoreConfig(self::XML_WISHLIST_STATUS_CLEAN_DAYS) * 60 * 60 * 24; 37 | } 38 | 39 | /** 40 | * Clean statuses 41 | * 42 | * @return Oro_Api_Model_Wishlist_Status 43 | */ 44 | public function clean() 45 | { 46 | $this->getResource()->clean($this); 47 | return $this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Wishlist/Status/Api.php: -------------------------------------------------------------------------------- 1 | apiHelper = Mage::helper('oro_api'); 35 | } 36 | 37 | /** 38 | * Get wishlist status list 39 | * 40 | * @param array|object $filters 41 | * @param null|\stdClass $pager 42 | * @return array 43 | * @throws Mage_Api_Exception 44 | */ 45 | public function items($filters, $pager = null) 46 | { 47 | /** @var Oro_Api_Model_Resource_Wishlist_Status_Collection $collection */ 48 | $collection = Mage::getResourceModel('oro_api/wishlist_status_collection'); 49 | $filters = $this->apiHelper->parseFilters($filters); 50 | try { 51 | foreach ($filters as $field => $value) { 52 | $collection->addFieldToFilter($field, $value); 53 | } 54 | } catch (Mage_Core_Exception $e) { 55 | $this->_fault('filters_invalid', $e->getMessage()); 56 | } 57 | 58 | if ($pager && !$this->apiHelper->applyPager($collection, $pager)) { 59 | // there's no such page, so no results for it 60 | return array(); 61 | } 62 | 63 | $result = array(); 64 | /** @var Oro_Api_Model_Wishlist_Status $status */ 65 | foreach ($collection as $status) { 66 | $result[] = $status->toArray(); 67 | } 68 | 69 | return $result; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/Model/Wishlist/Status/Api/V2.php: -------------------------------------------------------------------------------- 1 | getRequest(); 29 | $params = $request->getParams(); 30 | 31 | if (isset($params['route'])) { 32 | $route = $params['route']; 33 | unset($params['route']); 34 | $params['is-oro-request'] = true; 35 | 36 | $url = $this->getUrl('adminhtml/' . $route, array('_query' => $params)); 37 | 38 | $configFile = Mage::getConfig()->getModuleDir('etc',Mage::helper('oro_api')->getModuleName()) . DS . 'workflow.xml'; 39 | /** @var Mage_Catalog_Model_Config $config */ 40 | $config = Mage::getModel('core/config'); 41 | $config->loadFile($configFile); 42 | 43 | $workFlow = $request->getParam('workflow'); 44 | 45 | $endPoints = $config->getXpath("{$workFlow}/end_point_action"); 46 | if (count($endPoints)) { 47 | $endPoint = (string)array_shift($endPoints); 48 | 49 | Mage::getSingleton('adminhtml/session')->setData('oro_end_point', $endPoint); 50 | Mage::getSingleton('adminhtml/session')->setData('oro_success_url', $request->getParam('success_url')); 51 | Mage::getSingleton('adminhtml/session')->setData('oro_error_url', $request->getParam('error_url')); 52 | 53 | $this->_redirectUrl($url); 54 | 55 | } else { 56 | $this->getResponse()->setBody($this->__('Endpoint not found.')); 57 | } 58 | } else { 59 | $this->getResponse()->setBody($this->__('Please specify route name.')); 60 | } 61 | } 62 | 63 | /** 64 | * Gateway error 65 | */ 66 | public function errorAction() 67 | { 68 | $response = $this->getResponse(); 69 | 70 | $response->setBody($this->__('Gateway error.')); 71 | $response->setHttpResponseCode(400); 72 | } 73 | 74 | /** 75 | * {@inheritdoc} 76 | */ 77 | protected function _isAllowed() 78 | { 79 | return true; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/controllers/Adminhtml/Oro/SalesController.php: -------------------------------------------------------------------------------- 1 | clear(); 26 | 27 | $quoteId = $this->getRequest()->getParam('quote'); 28 | if (null !== $quoteId) { 29 | $quote = $this->_getQuoteById($quoteId); 30 | } 31 | 32 | $customerId = $this->getRequest()->getParam('customer'); 33 | if (null !== $customerId && $this->_checkCustomer($customerId)) { 34 | $session->setQuoteId(null); 35 | $session->setCustomerId((int)$customerId); 36 | } elseif (false !== $quote) { 37 | $customerId = (int)$quote->getCustomerId(); 38 | 39 | $session->setStoreId($quote->getStoreId()); 40 | $session->setQuoteId($quote->getId()); 41 | $session->setCustomerId($customerId); 42 | } else { 43 | return $this->_redirect('*/oro_gateway/error'); 44 | } 45 | 46 | return $this->_redirect('*/checkout/index', array('customer' => $customerId)); 47 | } 48 | 49 | public function newOrderAction() 50 | { 51 | $quote = false; 52 | $session = Mage::getSingleton('adminhtml/session_quote'); 53 | $session->clear(); 54 | 55 | $quoteId = $this->getRequest()->getParam('quote'); 56 | if (null !== $quoteId) { 57 | $quote = $this->_getQuoteById($quoteId); 58 | } 59 | 60 | $customerId = $this->getRequest()->getParam('customer'); 61 | if (null !== $customerId && $this->_checkCustomer($customerId)) { 62 | $session->setQuoteId(null); 63 | $session->setCustomerId((int)$customerId); 64 | } elseif (false !== $quote) { 65 | $customerId = (int)$quote->getCustomerId(); 66 | 67 | $session->setStoreId($quote->getStoreId()); 68 | $session->setQuoteId($quote->getId()); 69 | $session->setCustomerId($customerId); 70 | } else { 71 | return $this->_redirect('*/oro_gateway/error'); 72 | } 73 | 74 | return $this->_redirect('*/sales_order_create/index', array('customer_id' => $customerId)); 75 | } 76 | 77 | /** 78 | * Load customer's frontend quote by given ID 79 | * 80 | * @param int $quoteId 81 | * 82 | * @return bool|Mage_Sales_Model_Quote 83 | */ 84 | protected function _getQuoteById($quoteId) 85 | { 86 | /** @var Mage_Sales_Model_Quote $quote */ 87 | $quote = Mage::getModel('sales/quote'); 88 | $quote->loadByIdWithoutStore($quoteId); 89 | 90 | return $quote->getId() ? $quote : false; 91 | } 92 | 93 | /** 94 | * Checks whether customer exists 95 | * 96 | * @param int $customerId 97 | * 98 | * @return bool 99 | */ 100 | private function _checkCustomer($customerId) 101 | { 102 | $customer = Mage::getModel('customer/customer')->load($customerId); 103 | 104 | return (bool)$customer->getId(); 105 | } 106 | 107 | /** 108 | * {@inheritdoc} 109 | */ 110 | protected function _isAllowed() 111 | { 112 | return true; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/etc/adminhtml.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Oro Section 31 | 50 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/etc/api.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | oro_api/ping 25 | Oro extension ping 26 | oro 27 | 28 | 29 | Ping mage instance in order to check if extension available 30 | ping 31 | oro/ping 32 | 33 | 34 | 35 | 36 | oro_api/sales_quote_api 37 | Quote Information 38 | oro 39 | 40 | 41 | Get quote list by filters 42 | items 43 | oro/quote 44 | 45 | 46 | 47 | 48 | oro_api/sales_order_api 49 | Order Information 50 | oro 51 | 52 | 53 | Get order list by filters 54 | items 55 | oro/order 56 | 57 | 58 | Retrieve order information 59 | info 60 | oro/order 61 | 62 | 63 | 64 | 65 | 100 66 | Requested order not exists. 67 | 68 | 69 | 101 70 | Invalid filters given. Details in error message. 71 | 72 | 73 | 74 | 75 | oro_api/customer_api 76 | Customer List Information 77 | oro/customer 78 | 79 | 80 | Get customer list by filters 81 | items 82 | oro/customer/info 83 | 84 | 85 | Create customer 86 | create 87 | oro/customer/create 88 | 89 | 90 | Update customer data 91 | update 92 | oro/customer/update 93 | 94 | 95 | Retrieve customer data 96 | info 97 | oro/customer/info 98 | 99 | 100 | 101 | 102 | 100 103 | Invalid customer data. Details in error message. 104 | 105 | 106 | 101 107 | Invalid filters specified. Details in error message. 108 | 109 | 110 | 102 111 | Customer not exists. 112 | 113 | 114 | 103 115 | Customer address not exists. 116 | 117 | 118 | 119 | 120 | oro_api/customer_address_api 121 | Customer Address List Information 122 | oro/customer 123 | 124 | 125 | Retrieve customer addresses 126 | items 127 | oro/customer/address 128 | 129 | 130 | Retrieve customer address data 131 | info 132 | oro/customer/address 133 | 134 | 135 | 136 | 137 | 102 138 | Customer not exists. 139 | 140 | 141 | 103 142 | Customer address not exists. 143 | 144 | 145 | 146 | 147 | oro_api/wishlist_api 148 | Wishlist 149 | oro 150 | 151 | 152 | Get wishlist collection by filters 153 | items 154 | oro/wishlist 155 | 156 | 157 | 158 | 159 | oro_api/wishlist_item_api 160 | Wishlist Item 161 | oro 162 | 163 | 164 | Get wishlist item collection by filters 165 | items 166 | oro/wishlist_item 167 | 168 | 169 | 170 | 171 | oro_api/wishlist_api 172 | Oro Wishlist API 173 | oro 174 | 175 | 176 | Get wishlist with items by filters 177 | listWithItems 178 | oro/wishlist 179 | 180 | 181 | 182 | 183 | 100 184 | Invalid filters given. Details in error message. 185 | 186 | 187 | 188 | 189 | oro_api/wishlist_status_api 190 | Wishlist Status Information 191 | oro 192 | 193 | 194 | Get wishlist status by filters 195 | items 196 | oro/wishlist 197 | 198 | 199 | 200 | 201 | 100 202 | Invalid filters given. Details in error message. 203 | 204 | 205 | 206 | 207 | oro_api/report_product_viewed_api 208 | Report Product Viewed 209 | oro 210 | 211 | 212 | Viewed product collection by filters 213 | items 214 | oro/report_product_viewed 215 | 216 | 217 | 218 | 219 | oro_api/newsletter_subscriber_api 220 | Newsletter Subscriber 221 | oro/newsletter_subscriber 222 | 223 | 224 | Subscribers collection 225 | items 226 | oro/newsletter_subscriber/list 227 | 228 | 229 | Create newsletter subscriber 230 | oro/newsletter_subscriber/create 231 | 232 | 233 | Update newsletter subscriber data 234 | oro/newsletter_subscriber/update 235 | 236 | 237 | Newsletter subscriber - Subscribe email 238 | oro/newsletter_subscriber/subscribe_email 239 | 240 | 241 | Unsubscribe Newsletter subscriber 242 | oro/newsletter_subscriber/unsubscribe 243 | 244 | 245 | 246 | 247 | 100 248 | Invalid newsletter subscriber data. Details in error message. 249 | 250 | 251 | 101 252 | Invalid filters specified. Details in error message. 253 | 254 | 255 | 102 256 | Newsletter subscriber not exists. 257 | 258 | 259 | 103 260 | Email already subscribed. 261 | 262 | 263 | 104 264 | Customer already subscribed. 265 | 266 | 267 | 105 268 | Newsletter subscriber email is required. 269 | 270 | 271 | 106 272 | Customer not found. 273 | 274 | 275 | 107 276 | Newsletter subscribe Customer change is forbidden. 277 | 278 | 279 | 280 | 281 | oro_api/website_api 282 | Website API 283 | oro 284 | 285 | 286 | Retrieve websites list 287 | items 288 | oro/website 289 | 290 | 291 | 292 | 293 | oro_api/directory_region_api 294 | Region List Information 295 | oro 296 | 297 | 298 | Get list of all regions 299 | items 300 | directory/region 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | list 309 | 310 | 311 | list 312 | 313 | 314 | list 315 | 316 | 317 | list 318 | 319 | 320 | list 321 | 322 | 323 | list 324 | 325 | 326 | ping 327 | 328 | 329 | list 330 | 331 | 332 | list 333 | 334 | 335 | list 336 | 337 | 338 | list 339 | 340 | 341 | list 342 | 343 | 344 | 345 | 346 | 347 | 348 | Oro 349 | 350 | Oro Ping 351 | 352 | 353 | Quote List 354 | 355 | 356 | Order Info 357 | 358 | 359 | Customer 360 | 361 | Customer Info 362 | 363 | 364 | Customer Create 365 | 366 | 367 | Customer Update 368 | 369 |
370 | Customer Address 371 |
372 |
373 | 374 | Wishlist Info 375 | 376 | 377 | Wishlist Item Info 378 | 379 | 380 | Wishlist with Items Info 381 | 382 | 383 | Wishlist Status Info 384 | 385 | 386 | Report Product Viewed 387 | 388 | 389 | Newsletter Subscriber 390 | 391 | Newsletter Subscriber List 392 | 393 | 394 | Newsletter Subscriber Create 395 | 396 | 397 | Newsletter Subscriber Update 398 | 399 | 400 | Newsletter Subscriber Unsubscribe 401 | 402 | 403 | Newsletter Subscriber Subscribe Email 404 | 405 | 406 | 407 | Website List 408 | 409 | 410 | Region List 411 | 412 |
413 |
414 |
415 | 416 | 417 | oro 418 | oroQuote 419 | oroOrder 420 | oroWebsite 421 | oroRegion 422 | oroCustomer 423 | oroCustomerAddress 424 | wishlist 425 | wishlistItem 426 | oroWishlist 427 | oroWishlistStatus 428 | reportProductViewed 429 | newsletterSubscriber 430 | 431 | 432 |
433 |
434 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 1.2.19 24 | 25 | 26 | 27 | 28 | 29 | Oro_Api_Model 30 | oro_api_resource 31 | 32 | 33 | Oro_Api_Model_Resource 34 | 35 | 36 | oro_wishlist_status
37 |
38 |
39 |
40 | 41 | 42 | Oro_Api_Model_Catalog_Product_Api_V2 43 | 44 | 45 | 46 | 47 | Oro_Api_Model_Sales_Quote_Item 48 | 49 | 50 | 51 | 52 | Oro_Api_Model_Admin_Redirectpolicy 53 | 54 | 55 |
56 | 57 | 58 | Oro_Api_Helper 59 | 60 | 61 | 62 | 63 | 64 | Oro_Api 65 | Oro_Api_Model_Resource_Setup 66 | 67 | 68 | core_setup 69 | 70 | 71 | 72 | 73 | core_read 74 | 75 | 76 | 77 | 78 | core_write 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | oro_api/observer 87 | beforeNewsletterSubscriberSave 88 | 89 | 90 | 91 | 92 | 93 | 94 | oro_api/wishlist_observer 95 | registerWishlistChange 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | Oro_Api_Adminhtml 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | singleton 127 | oro_api/observer_crm_controller 128 | handleRequest 129 | 130 | 131 | 132 | 133 | 134 | 135 | singleton 136 | oro_api/observer_crm_controller 137 | handleResponse 138 | 139 | 140 | 141 | 142 | 143 | 144 | singleton 145 | oro_api/observer_crm_controller 146 | handleRenderLayout 147 | 148 | 149 | 150 | 151 | 152 | 153 | singleton 154 | oro_api/observer_sales_order 155 | onSubmitAllAfter 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 30 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 15 0 1 * * 173 | 174 | 175 | oro_api/wishlist_status::clean 176 | 177 | 178 | 179 | 180 |
181 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/etc/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | customer 25 | text 26 | 600 27 | 1 28 | 1 29 | 1 30 | 31 | 32 | 33 | text 34 | 20 35 | 1 36 | 0 37 | 0 38 | 39 | 40 | 41 | select 42 | adminhtml/system_config_source_yesno 43 | 10 44 | 1 45 | 0 46 | 0 47 | 48 | 49 | 50 | Used in case of Magento Enterprise Multiple Wishlist enabled to clean Wishlist deletion logs. 51 | text 52 | 20 53 | 1 54 | 0 55 | 0 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/etc/workflow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | adminhtml_sales_order_create_save 5 | 6 | 7 | adminhtml_sales_order_create_save 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/code/community/Oro/Api/sql/oro_api_setup/install-1.2.5.php: -------------------------------------------------------------------------------- 1 | startSetup(); 23 | 24 | /** 25 | * Create table 'oro_api/wishlist_status' 26 | */ 27 | $table = $installer->getConnection() 28 | ->newTable($installer->getTable('oro_api/wishlist_status')) 29 | ->addColumn('wishlist_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( 30 | 'unsigned' => true, 31 | 'nullable' => false, 32 | 'primary' => true, 33 | ), 'Wishlist ID') 34 | ->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array( 35 | 'unsigned' => true, 36 | ), 'Website Id') 37 | ->addColumn('deleted_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array( 38 | ), 'Wishlist Deletion Time') 39 | ->setComment('Wishlist Deletion Status Table'); 40 | $installer->getConnection()->createTable($table); 41 | 42 | $installer->endSetup(); 43 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/oro/api/check.phtml: -------------------------------------------------------------------------------- 1 | 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 | 29 | 30 | 33 | 58 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/oro/api/login_styles.phtml: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/oro/api/page.phtml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | getChildHtml('head') ?> 18 | 19 | 20 | getBodyClass() ? ' class="' . $this->getBodyClass() . '"' : ''; ?>> 21 | getChildHtml('notification_window'); ?> 22 |
23 | getChildHtml('global_notices') ?> 24 |
25 |
26 | getChildHtml('left')): ?> 27 | 28 |
29 |
30 | getChildHtml('left') ?> 31 |
32 |
33 |
34 |
getMessagesBlock()->getGroupedHtml() ?>
35 | getChildHtml('content') ?> 36 |
37 |
38 |
39 | 40 | 41 |
getMessagesBlock()->getGroupedHtml() ?>
42 | getChildHtml('content') ?> 43 | 44 |
45 |
46 |
47 | getChildHtml('js') ?> 48 | getChildHtml('profiler') ?> 49 | 57 | 58 | getChildHtml('before_body_end') ?> 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/oro/api/script.phtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | -------------------------------------------------------------------------------- /app/etc/modules/Oro_Api.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | true 24 | community 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | app/etc/modules/Oro_Api.xml app/etc/modules/Oro_Api.xml 2 | app/code/community/Oro/Api app/code/community/Oro/Api 3 | app/design/adminhtml/default/default/template/oro/api app/design/adminhtml/default/default/template/oro/api 4 | skin/adminhtml/default/default/images/oro skin/adminhtml/default/default/images/oro 5 | skin/adminhtml/default/default/oro_style.css skin/adminhtml/default/default/oro_style.css 6 | -------------------------------------------------------------------------------- /skin/adminhtml/default/default/images/oro/add_button_icon_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/skin/adminhtml/default/default/images/oro/add_button_icon_dark.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/images/oro/apply_button_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/skin/adminhtml/default/default/images/oro/apply_button_icon.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/images/oro/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/skin/adminhtml/default/default/images/oro/error.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/images/oro/grid_sort_asc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/skin/adminhtml/default/default/images/oro/grid_sort_asc.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/images/oro/grid_sort_desc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/skin/adminhtml/default/default/images/oro/grid_sort_desc.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/images/oro/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/skin/adminhtml/default/default/images/oro/loader.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/oro_style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica, Arial, sans-serif; 3 | } 4 | 5 | .notice { 6 | color: #c30b25; 7 | } 8 | 9 | a, a:hover { 10 | color: #006acc; 11 | text-decoration: underline; 12 | font-size: 1.1em; 13 | } 14 | 15 | button:hover, .form-button:hover { 16 | background: #f3f3f3 linear-gradient(#f3f3f3, #f6f6f6) 0 0 repeat-x; 17 | } 18 | 19 | button, .form-button { 20 | background: #f3f3f3 linear-gradient(#f3f3f3, #f6f6f6) 0 0 repeat-x; 21 | border: 1px solid #969696; 22 | box-shadow: none; 23 | box-sizing: border-box; 24 | cursor: pointer; 25 | display: inline-block; 26 | font-size: 11px; 27 | font-weight: bold; 28 | height: 22px; 29 | line-height: 20px; 30 | margin-bottom: 0px; 31 | padding: 0 12px 0 12px; 32 | text-align: center; 33 | text-decoration: none solid rgb(255, 255, 255); 34 | vertical-align: middle; 35 | visibility: visible; 36 | color: #666666; 37 | } 38 | 39 | button.add span { 40 | background-image: url('./images/oro/add_button_icon_dark.png'); 41 | } 42 | 43 | button.save span { 44 | background-image: url('./images/oro/apply_button_icon.png'); 45 | } 46 | 47 | button.save { 48 | background-color: rgb(113, 192, 24); 49 | background-image: linear-gradient(rgb(130, 206, 32), rgb(87, 172, 11)); 50 | background-repeat: repeat-x; 51 | border-bottom-color: rgb(38, 117, 7); 52 | border-bottom-style: solid; 53 | border-bottom-width: 1px; 54 | border-image-outset: 0px; 55 | border-image-repeat: stretch; 56 | border-image-slice: 100%; 57 | border-image-source: none; 58 | border-image-width: 1; 59 | border-left-color: rgb(59, 141, 28); 60 | border-left-style: solid; 61 | border-left-width: 1px; 62 | border-right-color: rgb(59, 141, 28); 63 | border-right-style: solid; 64 | border-right-width: 1px; 65 | border-top-color: rgb(73, 152, 43); 66 | border-top-style: solid; 67 | border-top-width: 1px; 68 | color: rgb(255, 255, 255); 69 | position: relative; 70 | text-shadow: rgb(59, 141, 28) 0px 1px 0px; 71 | } 72 | 73 | dl.accordion dt, .entry-edit .entry-edit-head, .create-order-sidebar-block .head { 74 | border-bottom: 1px solid #000; 75 | background-color: #47505a; 76 | background-color: #404952; 77 | background-image: -moz-linear-gradient(top, #47505a, #363e47); 78 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#47505a), to(#363e47)); 79 | background-image: -webkit-linear-gradient(top, #47505a, #363e47); 80 | background-image: -o-linear-gradient(top, #47505a, #363e47); 81 | background-image: linear-gradient(to bottom, #47505a, #363e47); 82 | background-repeat: repeat-x; 83 | color: #ffffff; 84 | } 85 | 86 | .entry-edit .entry-edit-head h4 { 87 | color: #ffffff; 88 | font-weight: normal; 89 | } 90 | 91 | .content-header h3 { 92 | color: #444444; 93 | font-weight: normal; 94 | } 95 | 96 | .create-order-sidebar-block .head h5 { 97 | color: #ffffff; 98 | font-weight: normal; 99 | margin-top: 3px; 100 | } 101 | 102 | .entry-edit .entry-edit-head h4 { 103 | font-size: 1.1em; 104 | line-height: 16px; 105 | margin-top: 5px; 106 | font-weight: normal; 107 | } 108 | 109 | .giftmessage-order-create .entire-order, 110 | .giftmessage-order-create .each-order-item { 111 | height: auto; 112 | background-color: #fff; 113 | } 114 | .giftmessage-order-create .entire-order .entry-edit, 115 | .giftmessage-order-create .each-order-item .scroll { 116 | height: auto; 117 | } 118 | .giftmessage-order-create .form-list td.label { 119 | width: 184px; 120 | } 121 | .giftmessage-order-create .form-list td.label label { 122 | width: 92px; 123 | } 124 | .giftmessage-order-create .form-list tr:last-of-type td.value:after { 125 | content: ''; 126 | display: block; 127 | min-width: 137px; 128 | } 129 | .giftmessage-order-create .form-list td.value textarea { 130 | height: 8em; 131 | } 132 | 133 | .grid tr.headings { 134 | background: #ececec; 135 | } 136 | 137 | .grid tr.headings th.no-link, .grid tr.headings th span.sort-title { 138 | text-transform: uppercase; 139 | } 140 | 141 | .grid tr.headings th span.nobr { 142 | color: #2d444f; 143 | } 144 | 145 | .grid table td { 146 | background-color: #fff; 147 | } 148 | 149 | .grid tr.filter { 150 | background: #f6f6f6; 151 | } 152 | 153 | .grid table tfoot tr td { 154 | background: #ececec; 155 | } 156 | 157 | .grid tr.headings th a.sort-arrow-desc span.sort-title { 158 | background-image: url('./images/oro/grid_sort_desc.gif'); 159 | } 160 | 161 | .grid tr.headings th a.sort-arrow-asc span.sort-title { 162 | background-image: url('./images/oro/grid_sort_asc.gif'); 163 | } 164 | 165 | .grid tr.headings th a.sort-arrow-desc, .grid tr.headings th a.sort-arrow-asc { 166 | background: none; 167 | border-bottom: 0; 168 | border-right: 0; 169 | } 170 | 171 | .grid tr.headings th a, .grid tr.headings th a:hover { 172 | color: #2d444f; 173 | } 174 | 175 | .order-save-in-address-book { 176 | background: #f9f9f9; 177 | } 178 | 179 | .switcher { 180 | background: none repeat scroll 0 0 #ffffff; 181 | } 182 | 183 | .box, .entry-edit fieldset, .entry-edit .fieldset { 184 | background: #fff; 185 | } 186 | 187 | .order-choose-address { 188 | background: #f6f6f6; 189 | } 190 | 191 | .sub-btn-set { 192 | background: #fff; 193 | } 194 | 195 | .create-order-sidebar-container { 196 | background: #fff; 197 | } 198 | 199 | .login-container { 200 | background: none; 201 | } 202 | 203 | .login-form { 204 | border: 1px solid #d4d4d4; 205 | border-bottom: none; 206 | background: none; 207 | -webkit-border-top-left-radius: 5px; 208 | -webkit-border-top-right-radius: 5px; 209 | -moz-border-radius-topleft: 5px; 210 | -moz-border-radius-topright: 5px; 211 | border-top-left-radius: 5px; 212 | border-top-right-radius: 5px; 213 | } 214 | 215 | .login-form label { 216 | font: 14px/22px Helvetica, Arial, sans-serif; 217 | color: #5b636d; 218 | } 219 | 220 | .login-form input.input-text { 221 | font: 14px/16px Helvetica, Arial, sans-serif; 222 | height: 16px; 223 | } 224 | 225 | .login-form .form-buttons a.left { 226 | /* forgot password link */ 227 | display: none; 228 | } 229 | 230 | .login-container .legal { 231 | display: none; 232 | } 233 | 234 | .order-totals { 235 | background: none; 236 | border: 1px solid #d6d6d6 !important; 237 | } 238 | 239 | .content-header-floating { 240 | display: none; 241 | position: fixed; 242 | left: 0; 243 | top: 0; 244 | width: 100%; 245 | border-bottom: none; 246 | z-index: 100; 247 | background: #444444; 248 | color: #ffffff; 249 | opacity: .85; 250 | } 251 | 252 | .content-header-floating .content-header { 253 | padding: 10px 20px; 254 | } 255 | 256 | .content-header-floating .content-header h3 { 257 | color: #ffffff; 258 | } 259 | 260 | #order-header h3 { 261 | padding-left: 0; 262 | margin-left: 0; 263 | background: none; 264 | } 265 | 266 | #loading-mask { 267 | background: none; 268 | opacity: 1; 269 | } 270 | 271 | #loading-mask .loading-wrapper { 272 | background: #000; 273 | opacity: .3; 274 | position: absolute; 275 | top: 0; 276 | left: 0; 277 | right: 0; 278 | bottom: 0; 279 | z-index: 999; 280 | } 281 | 282 | #loading-mask .loading-frame { 283 | position: fixed; 284 | top: 45%; 285 | left: 50%; 286 | width: 180px; 287 | z-index: 9999; 288 | } 289 | 290 | #loading-mask .loading-frame .box { 291 | margin: 20px 0; 292 | background: #fff; 293 | font-size: 14px; 294 | font-weight: bold; 295 | line-height: 24px; 296 | min-height: 20px; 297 | padding: 19px; 298 | border: 1px solid #e6e6e6; 299 | -webkit-border-radius: 4px; 300 | -moz-border-radius: 4px; 301 | border-radius: 4px; 302 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); 303 | -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); 304 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); 305 | } 306 | 307 | #loading-mask .loading-frame .box .loading-content { 308 | opacity: 1; 309 | background: #ffffff url('./images/oro/loader.gif') no-repeat center left; 310 | padding-left: 35px; 311 | text-align: left; 312 | color: #000; 313 | } 314 | -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.1.3.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.1.3.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.1.4.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.1.4.1.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.1.4.2.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.1.4.2.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.1.4.3.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.1.4.3.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.1.4.4.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.1.4.4.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.1.4.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.1.4.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.0.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.0.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.1.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.1.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.10.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.10.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.11.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.11.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.12.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.12.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.13.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.13.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.14.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.14.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.15.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.15.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.16.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.16.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.17.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.17.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.18.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.18.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.19.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.19.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.2.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.2.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.3.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.3.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.4.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.4.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.5.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.6.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.6.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.7.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.7.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.8.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.8.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api-1.2.9.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oroinc/magento-orocrm-bridge/6e28deaa00c9bd901740e7c7f6815b8ae4063ea7/var/connect/Oro_Api-1.2.9.0.tgz -------------------------------------------------------------------------------- /var/connect/Oro_Api.xml: -------------------------------------------------------------------------------- 1 | <_> 2 | rs1kCNxAW0m8GMez 3 | Oro_Api 4 | community 5 | 6 | 2 7 | 8 | OroCRM Bridge 9 | OroCRM Bridge extension adds a couple of improvements to Magento SOAP API v2 in order to expose more shopping cart and customer data. 10 | Open Software License (OSL 3.0) 11 | http://opensource.org/licenses/osl-3.0.php 12 | 1.2.19.0 13 | stable 14 | OroCRM Bridge extension adds a couple of improvements to Magento SOAP API v2 in order to expose more shopping cart and customer data. 15 | 16 | 17 | Oro, Inc 18 | 19 | 20 | orocrm 21 | 22 | 23 | info@orocrm.com 24 | 25 | 26 | 5.2.13 27 | 5.6.99 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Core 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | magelocal 61 | magecommunity 62 | mageetc 63 | magedesign 64 | mageskin 65 | mageskin 66 | 67 | 68 | 69 | Oro/Api 70 | modules/Oro_Api.xml 71 | adminhtml/default/default/template/oro/ 72 | adminhtml/default/default/images/oro/ 73 | adminhtml/default/default/oro_style.css 74 | 75 | 76 | file 77 | dir 78 | file 79 | dir 80 | dir 81 | file 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 1 101 | 200 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /var/connect/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Oro_Api 4 | 1.2.19.0 5 | stable 6 | Open Software License (OSL 3.0) 7 | community 8 | 9 | OroCRM Bridge 10 | OroCRM Bridge extension adds a couple of improvements to Magento SOAP API v2 in order to expose more shopping cart and customer data. 11 | OroCRM Bridge extension adds a couple of improvements to Magento SOAP API v2 in order to expose more shopping cart and customer data. 12 | Oro, Incorocrminfo@orocrm.com 13 | 2017-11-14 14 | 15 | 16 | 17 | 5.2.135.6.99 18 | 19 | --------------------------------------------------------------------------------