NewHavenSoftware_CMSAPI - Version 9.0.1.10

Version Notes

9.0.1.10 11/12/2013

Updated support for size and color products. This update is required for any size and/or color products. Also in this version is a fix for blank screens or errors when attempting to configure roles.

9.0.1.9 10/14/2013

In the V2 API changed the salesOrderInfo item.product_options from serialized php to json text for configurable product attribute information used during order download into CMS.

9.0.1.8 09/18/2013

Added cmsapiGiftMessageInfo to the V2 api that will return an object with to,from, and message values. See the NewHaven Software Magento Setup Guide for more information about the message template plug-in option.

Download this release

Release Info

Developer Jason Morrison
Extension NewHavenSoftware_CMSAPI
Version 9.0.1.10
Comparing to
See all releases


Code changes from version 9.0.1.9 to 9.0.1.10

app/code/community/NewHavenSoftware/CMSAPI/Helper/Data.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  class NewHavenSoftware_CMSAPI_Helper_Data extends Mage_Core_Helper_Abstract {
3
-
4
- }
5
- ?>
 
1
  <?php
2
  class NewHavenSoftware_CMSAPI_Helper_Data extends Mage_Core_Helper_Abstract {
3
+ function _helperTest() {
4
+ Return true;
5
+ }
6
+ }
app/code/community/NewHavenSoftware/CMSAPI/Model/Catalog/Product/Api/V2.php CHANGED
@@ -1,147 +1,142 @@
1
  <?php
2
  class NewHavenSoftware_CMSAPI_Model_Catalog_Product_Api_V2 extends Mage_Catalog_Model_Product_Api_V2 {
3
- /**
4
- * Set additional data before product saved
5
- *
6
- * @param Mage_Catalog_Model_Product $product
7
- * @param array $productData
8
- * @return object
9
- */
10
-
11
- protected function _prepareDataForSave ($product, $productData)
12
- {
13
- if (property_exists($productData, 'website_ids') && is_array($productData->website_ids)) {
14
- $product->setWebsiteIds($productData->website_ids);
15
- }
16
 
17
- if (property_exists($productData, 'additional_attributes')) {
18
- if (property_exists($productData->additional_attributes, 'single_data')) {
19
- foreach ($productData->additional_attributes->single_data as $_attribute) {
20
- $_attrCode = $_attribute->key;
21
- $productData->$_attrCode = $_attribute->value;
22
- }
23
- }
24
- if (property_exists($productData->additional_attributes, 'multi_data')) {
25
- foreach ($productData->additional_attributes->multi_data as $_attribute) {
26
- $_attrCode = $_attribute->key;
27
- $productData->$_attrCode = $_attribute->value;
28
- }
29
- }
30
- unset($productData->additional_attributes);
31
- }
32
 
33
- foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
34
- $_attrCode = $attribute->getAttributeCode();
35
-
36
- //Unset data if object attribute has no value in current store
37
- if (Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID !== (int) $product->getStoreId()
38
- && !$product->getExistsStoreValueFlag($_attrCode)
39
- && !$attribute->isScopeGlobal()
40
- ) {
41
- $product->setData($_attrCode, false);
42
- }
 
43
 
44
- if ($this->_isAllowedAttribute($attribute) && (isset($productData->$_attrCode))) {
45
- $product->setData(
46
- $_attrCode,
47
- $productData->$_attrCode
48
- );
49
  }
 
50
  }
51
-
52
- if (property_exists($productData, 'categories') && is_array($productData->categories)) {
53
- $product->setCategoryIds($productData->categories);
54
  }
55
-
56
- if (property_exists($productData, 'websites') && is_array($productData->websites)) {
57
- foreach ($productData->websites as &$website) {
58
- if (is_string($website)) {
59
- try {
60
- $website = Mage::app()->getWebsite($website)->getId();
61
- } catch (Exception $e) { }
62
- }
 
 
 
 
 
 
 
63
  }
64
- $product->setWebsiteIds($productData->websites);
65
  }
66
 
67
- if (Mage::app()->isSingleStoreMode()) {
68
- $product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
 
 
 
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- if (property_exists($productData, 'stock_data')) {
72
- $_stockData = array();
73
- foreach ($productData->stock_data as $key => $value) {
74
- $_stockData[$key] = $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
- $product->setStockData($_stockData);
77
- }
78
 
79
- if (property_exists($productData, 'tier_price')) {
80
- $tierPrices = Mage::getModel('catalog/product_attribute_tierprice_api_V2')
81
- ->prepareTierPrices($product, $productData->tier_price);
82
- $product->setData(Mage_Catalog_Model_Product_Attribute_Tierprice_Api_V2::ATTRIBUTE_CODE, $tierPrices);
 
 
 
 
 
 
83
  }
84
-
85
- /*
86
- * Check for configurable products array passed through API Call
87
- * http://www.stephenrhoades.com/?p=338 Had to significantly modify it
88
- */
89
- //Mage::log("configurable_attributes exists?");
90
- //Mage::log(property_exists($productData, 'configurable_products'));
91
- if(property_exists($productData, 'configurable_products') && is_array($productData->configurable_products)) {
92
- //Mage::log($productData->configurable_products);
93
- $_configurableProductsData = array();
94
- foreach ($productData->configurable_products as $key => $value) {
95
- $_configurableProductsData[$value->key] = $value->value;
96
- }
97
- //Mage::log($_configurableProductsData);
98
- $product->setConfigurableProductsData($_configurableProductsData);
99
  }
100
-
101
- //Mage::log(property_exists($productData, 'configurable_attributes'));
102
- if(property_exists($productData, 'configurable_attributes') && is_array($productData->configurable_attributes)) {
103
- //Mage::log("configurable_attributes");
104
- //Mage::log($productData->configurable_attributes);
105
- $_configurableAttributesData = array();
106
- $_valuesData = array();
107
- $_dataData = array();
108
- $_vvData = array();
109
- $_attributesCurrent;
110
- foreach($productData->configurable_attributes as $key => $data) {
111
- //Mage::log($key);
112
- //Mage::log($data);
113
- foreach($data->values as $valueKey => $valueData) {
114
- foreach($valueData->value[0] as $vvKey => $vvData) {
115
- $_vvData[$vvKey] = $vvData;
116
  }
117
- $_valuesData[$valueData->key] = $_vvData;
118
- }
119
- if ($data->id == 0) {
120
- $data->id = null;
121
- }
122
- $data->values = $_valuesData;
123
- //Check to see if these values exist, otherwise try and populate from existing values
124
- $data->label = (!empty($data->label)) ? $data->label : $product->getResource()->getAttribute($data->attribute_code)->getStoreLabel();
125
- $data->frontend_label = (!empty($data->frontend_label)) ? $data->frontend_label : $product->getResource()->getAttribute($data->attribute_code)->getFrontendLabel();
126
- foreach($data as $dataKey => $dataValue) {
127
- $_dataData[$dataKey] = $dataValue;
128
  }
129
- $_configurableAttributesData[$key] = $_dataData;
130
-
131
- /* need to check here if the attribute is already assigned to the product
132
- * Basically the sync needs to happen here, CMS will just send a current list each time
133
- * but Magento doesn't include dupe detection
134
- */
135
- $_attributesCurrent = $product->getConfigurableAttributesAsArray($product);
136
- Mage::log($_configurableAttributesData);
137
- Mage::log($_attributesCurrent);
138
  }
139
- //Mage::log("finished array");
140
- //Mage::log($_configurableAttributesData);
141
-
142
- $product->setConfigurableAttributesData($_configurableAttributesData);
143
- $product->setCanSaveConfigurableAttributes(1);
144
  }
 
 
 
145
  }
146
- }
147
- ?>
 
1
  <?php
2
  class NewHavenSoftware_CMSAPI_Model_Catalog_Product_Api_V2 extends Mage_Catalog_Model_Product_Api_V2 {
3
+ /**
4
+ * Set additional data before product saved
5
+ *
6
+ * @param Mage_Catalog_Model_Product $product
7
+ * @param array $productData
8
+ * @return object
9
+ */
 
 
 
 
 
 
10
 
11
+ protected function _prepareDataForSave ($product, $productData)
12
+ {
13
+ parent::_prepareDataForSave($product, $productData);
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ /*
16
+ * Check for configurable products array passed through API Call
17
+ * http://www.stephenrhoades.com/?p=338 Had to significantly modify it
18
+ */
19
+
20
+ $_typeInstance = $product->getTypeInstance();
21
+ if(property_exists($productData, 'configurable_products') && is_array($productData->configurable_products)) {
22
+ if(count($productData->configurable_products) > 0) { // only process if we have something to process
23
+ $_attributeIDs = array();
24
+ $_configurableProductsData = array();
25
+ $_existingProducts = array();
26
 
27
+ foreach ($productData->configurable_products as $value) {
28
+ foreach ($value->value as $attribute ) {
29
+ if(!in_array($attribute->attribute_id,$_attributeIDs)) {
30
+ $_attributeIDs[] = $attribute->attribute_id;
 
31
  }
32
+ }
33
  }
34
+ if($_typeInstance instanceof Mage_Catalog_Model_Product_Type_Configurable) {
35
+ $_simpleProducts = $_typeInstance->getUsedProducts($_attributeIDs);
 
36
  }
37
+ if(isset($_simpleProducts)) {
38
+ foreach ($_simpleProducts as $key => $value) {
39
+ $_existingProducts[$value->entity_id] = array();
40
+ $_index = 0;
41
+ $_configurableAttributes = $_typeInstance->getConfigurableAttributesAsArray($product);
42
+ foreach($_configurableAttributes as $attr) {
43
+ foreach($attr["values"] as $attrValue){
44
+ $_existingProducts[$value->entity_id][$_index] = new stdClass();
45
+ $_existingProducts[$value->entity_id][$_index]->attribute_id = $attr["attribute_id"];
46
+ $_existingProducts[$value->entity_id][$_index]->label = $attrValue["label"];
47
+ $_existingProducts[$value->entity_id][$_index]->value_index = $attrValue["value_index"];
48
+ $_existingProducts[$value->entity_id][$_index]->is_percent = $attrValue["is_percent"];
49
+ $_existingProducts[$value->entity_id][$_index]->pricing_value = $attrValue["pricing_value"];
50
+ $_index++;
51
+ }
52
  }
53
+ }
54
  }
55
 
56
+ foreach ($productData->configurable_products as $key => $value) {
57
+ if(array_key_exists($value->key,$_existingProducts)) {
58
+ unset($_existingProducts[$value->key]); //clear the existing array of known values
59
+ }
60
+ $_configurableProductsData[$value->key] = $value->value;
61
  }
62
+ // add the existing values
63
+ foreach($_existingProducts as $key => $value) {
64
+ $_configurableProductsData[$key] = $value;
65
+ }
66
+ // so we don't overwrite
67
+ if(count($_configurableProductsData) == 0) {
68
+ $_configurableProductsData = null;
69
+ }
70
+
71
+ $product->setConfigurableProductsData($_configurableProductsData);
72
+ }
73
+ }
74
 
75
+ if(property_exists($productData, 'configurable_attributes') && is_array($productData->configurable_attributes)) {
76
+ if(count($productData->configurable_attributes) > 0) { // only process if we have something to process
77
+ $_configurableAttributesData = array();
78
+ $_dataData = array();
79
+ foreach($productData->configurable_attributes as $key => $data) {
80
+ $_valuesData = array();
81
+ foreach($data->values as $valueData) {
82
+ $_vvData = array();
83
+ foreach($valueData->value as $vvKey => $vvData) {
84
+ if($vvData->attribute_id == $data->attribute_id) {
85
+ foreach($vvData as $objectKey => $objectValue) {
86
+ $_vvData[$objectKey] = $objectValue;
87
+ }
88
+ //$_valuesData[$vvKey] = $_vvData;
89
+ if (!in_array($_vvData, $_valuesData)) {
90
+ $_valuesData[] = $_vvData;
91
+ }
92
+ }
93
  }
94
+ }
95
+ $data->values = $_valuesData;
96
 
97
+ if ($data->id == 0) {
98
+ $data->id = null;
99
+ }
100
+ //Check to see if these values exist, otherwise try and populate from existing values
101
+ $data->label = (!empty($data->label)) ? $data->label : $product->getResource()->getAttribute($data->attribute_code)->getStoreLabel();
102
+ $data->frontend_label = (!empty($data->frontend_label)) ? $data->frontend_label : $product->getResource()->getAttribute($data->attribute_code)->getFrontendLabel();
103
+ foreach($data as $dataKey => $dataValue) {
104
+ $_dataData[$dataKey] = $dataValue;
105
+ }
106
+ $_configurableAttributesData[$key] = $_dataData;
107
  }
108
+
109
+ // process the existing values and fill in the blanks
110
+ if($_typeInstance instanceof Mage_Catalog_Model_Product_Type_Configurable) {
111
+ $_ExistingAttributes = $_typeInstance->getConfigurableAttributesAsArray($product);
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
+ if(isset($_ExistingAttributes)) {
114
+ //$_existingAttributes = $_typeInstance->getConfigurableAttributesAsArray($product);
115
+ foreach($_ExistingAttributes as $eAttr) { //existing attributes
116
+ foreach($_configurableAttributesData as $key => $cmsAttr) { //attributes from cms
117
+ if($eAttr["attribute_id"] == $cmsAttr["attribute_id"]){
118
+ // we have a matching attribute
119
+ $_configurableAttributesData[$key]["id"] = $eAttr["id"];
120
+ $_configurableAttributesData[$key]["position"] = $eAttr["position"];
121
+ foreach($eAttr["values"] as $eKey => $eOption) {
122
+ foreach($cmsAttr["values"] as $cmsKey => $cmsOption) {
123
+ if($eOption["value_index"] == $cmsOption["value_index"]){
124
+ // we have a matching value_index - fill in product_super_attribute_id and use_default
125
+ $_configurableAttributesData[$key]["values"][$cmsKey]["product_super_attribute_id"] =
126
+ $eOption["product_super_attribute_id"];
127
+ $_configurableAttributesData[$key]["values"][$cmsKey]["use_default_value"] =
128
+ $eOption["use_default_value"];
129
  }
130
+ }
 
 
 
 
 
 
 
 
 
 
131
  }
132
+ }
 
 
 
 
 
 
 
 
133
  }
134
+ }
 
 
 
 
135
  }
136
+ $product->setConfigurableAttributesData($_configurableAttributesData);
137
+ $product->setCanSaveConfigurableAttributes(1);
138
+ }
139
  }
140
+ Mage::app()->cleanCache();
141
+ }
142
+ }
app/code/community/NewHavenSoftware/CMSAPI/Model/Check/Api/V2.php CHANGED
@@ -3,5 +3,7 @@ class NewHavenSoftware_CMSAPI_Model_Check_Api_V2 extends Mage_Api_Model_Resource
3
  public function isNHS() {
4
  return TRUE;
5
  }
 
 
 
6
  }
7
- ?>
3
  public function isNHS() {
4
  return TRUE;
5
  }
6
+ public function getExtensionVersion() {
7
+ return (string) Mage::getConfig()->getNode()->modules->NewHavenSoftware_CMSAPI->version;
8
+ }
9
  }
 
app/code/community/NewHavenSoftware/CMSAPI/Model/Custom/Api/V2.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  class NewHavenSoftware_CMSAPI_Model_Custom_Api_V2 extends Mage_Api_Model_Resource_Abstract {
3
- public function CustomFields($orderIncrementId) {
4
  try {
5
 
6
  /**
@@ -13,40 +13,51 @@ class NewHavenSoftware_CMSAPI_Model_Custom_Api_V2 extends Mage_Api_Model_Resourc
13
 
14
  $results = '';
15
  //The path is always in the section/group/field
16
- $customFields = Mage::getStoreConfig('cmsapi/config/customfields');
17
  // comma separated list of section.fields for instance
18
  // ad_code,customer_number
19
- $fields = explode(',', $customFields);
 
 
 
 
 
20
  $object = Mage::getModel('sales/order')
21
  ->getCollection()
22
- ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
23
  ->addAttributeToFilter('increment_id', $orderIncrementId)
24
  ->getFirstItem();
25
  foreach ($fields as $field) {
26
- if (strpos($field,'=') !== false) {
27
- // we have a global assignment use this value
28
- $results .= $field . ',';
29
- } else {
30
- if (md5($field) == '59e0b38e37da9ccacccbed1029498761') {
31
- $results .= $field . "=((sales/order)) " . print_r($object,true) . ',';
32
- continue; //skip to next field
 
 
 
 
 
33
  }
34
- $objectValue = $this->getCustomFieldValue($object,$field,$orderIncrementId);
35
- $results .= $this->getFieldName($field) . "=" . $objectValue . ',';
36
  }
37
  }
38
 
39
- $results = rtrim($results, ', \t\n\r\0\x0B'); //Clean up the last comma and any spaces
 
 
40
 
41
- if ($results == '') {
42
- return 'test=value,more=values';
43
- } else {
44
- return $results;
45
- }
46
  } catch (Exception $e) {
47
  return "error=" . $e->getMessage();
48
  }
49
  }
 
 
 
 
 
 
 
50
 
51
  private function getCustomFieldValue($obj,$field,$orderIncID,$delim = '/') {
52
  $result = '';
1
  <?php
2
  class NewHavenSoftware_CMSAPI_Model_Custom_Api_V2 extends Mage_Api_Model_Resource_Abstract {
3
+ public function CustomFields($orderIncrementId,$storeId) {
4
  try {
5
 
6
  /**
13
 
14
  $results = '';
15
  //The path is always in the section/group/field
16
+ $customFields = Mage::getStoreConfig('cmsapi/config/customfields',$storeId);
17
  // comma separated list of section.fields for instance
18
  // ad_code,customer_number
19
+ $lines = explode("\n",$customFields); // we now support multiple lines for clearer display
20
+ $csv = '';
21
+ foreach($lines as $line) {
22
+ $csv .= trim($line,", \t\n\r\0\x0B") . ",";
23
+ }
24
+ $fields = explode(',', $csv);
25
  $object = Mage::getModel('sales/order')
26
  ->getCollection()
 
27
  ->addAttributeToFilter('increment_id', $orderIncrementId)
28
  ->getFirstItem();
29
  foreach ($fields as $field) {
30
+ $field = trim($field);
31
+ if($field <> "") {
32
+ if (strpos($field,'=') !== false) {
33
+ // we have a global assignment use this value
34
+ $results .= $field . ',';
35
+ } else {
36
+ if (md5($field) == '59e0b38e37da9ccacccbed1029498761') {
37
+ $results .= $field . "=((sales/order)) " . print_r($object,true) . ',';
38
+ continue; //skip to next field
39
+ }
40
+ $objectValue = $this->getCustomFieldValue($object,$field,$orderIncrementId);
41
+ $results .= $this->getFieldName($field) . "=" . $objectValue . ',';
42
  }
 
 
43
  }
44
  }
45
 
46
+ $results = rtrim($results, ", \t\n\r\0\x0B"); //Clean up the last comma and any spaces
47
+
48
+ return $results;
49
 
 
 
 
 
 
50
  } catch (Exception $e) {
51
  return "error=" . $e->getMessage();
52
  }
53
  }
54
+ public function getPaymentInfo($paymentId,$process) {
55
+ $_payment = Mage::getModel('sales/order_payment')->load($paymentId);
56
+ if ($_payment->cc_number_enc <> '' && $process === true) {
57
+ $_payment->cc_number_enc = Mage::helper('core')->decrypt($_payment->cc_number_enc);
58
+ }
59
+ return $_payment->cc_number_enc;
60
+ }
61
 
62
  private function getCustomFieldValue($obj,$field,$orderIncID,$delim = '/') {
63
  $result = '';
app/code/community/NewHavenSoftware/CMSAPI/Model/Gift/Api/V2.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- class NewHavenSoftware_CMSAPI_Model_GiftMessage_Api_V2 extends Mage_Api_Model_Resource_Abstract {
3
- public function GetGiftMessage($giftMessageId) {
4
- $message = Mage::getModel('giftmessage/message');
5
- if(!is_null($giftMessageId)) {
6
- $message->load((int)$giftMessageId);
7
- }
8
- return $message;
9
- }
10
- }
11
- ?>
 
 
 
 
 
 
 
 
 
 
 
app/code/community/NewHavenSoftware/CMSAPI/etc/api.xml CHANGED
@@ -2,40 +2,53 @@
2
  <config>
3
  <api>
4
  <resources>
5
- <cmsapi_check>
6
  <model>cmsapi/check_api</model>
7
- <title>NewHaven Software Check API</title>
8
- <acl>cmsapi_data</acl>
9
  <methods>
10
- <nhsInstalled translate="title" module="newhavensoftware_cmsapi">
11
  <title>Is the NHS extension installed?</title>
 
12
  <method>isNHS</method>
13
  </nhsInstalled>
 
 
 
 
 
14
  </methods>
15
  </cmsapi_check>
16
- <cmsapi_custom>
17
  <model>cmsapi/custom_api</model>
18
  <title>NewHaven Software Custom API</title>
19
- <acl>cmsapi_data</acl>
20
  <methods>
21
- <fields translate="title" module="newhavensoftware_cmsapi">
22
  <title>This will return the custom fields and values in comma delimited form</title>
 
23
  <method>CustomFields</method>
24
  </fields>
 
 
 
 
 
25
  </methods>
26
  </cmsapi_custom>
27
- <cmsapi_gift_message>
28
  <model>cmsapi/gift_message_api</model>
29
  <title>NewHaven Software GiftMessage API</title>
30
- <acl>cmsapi_data</acl>
31
  <methods>
32
- <info translate="title" module="newhavensoftware_cmsapi">
33
  <title>This will return the Gift Message entity given the ID</title>
 
34
  <method>GetGiftMessage</method>
35
  </info>
36
  </methods>
37
  </cmsapi_gift_message>
38
- <cmsapi_sales_order>
39
  <model>cmsapi/sales_order_api</model>
40
  <acl>sales/order</acl>
41
  <title>Order API</title>
@@ -46,7 +59,7 @@
46
  </info>
47
  </methods>
48
  </cmsapi_sales_order>
49
- <cmsapi_catalog_product>
50
  <model>cmsapi/catalog_product_api</model>
51
  <acl>catalog/product</acl>
52
  <title>Product API</title>
@@ -92,17 +105,31 @@
92
  <resources_function_prefix>
93
  <cmsapi_check>cmsapiCheck</cmsapi_check>
94
  <cmsapi_custom>cmsapiCustom</cmsapi_custom>
95
- <cmsapi_catalog_product>cmsapiCatalogProduct</cmsapi_catalog_product>
96
- <cmsapi_sales_order>cmsapiSalesOrder</cmsapi_sales_order>
97
  <cmsapi_gift_message>cmsapiGiftMessage</cmsapi_gift_message>
98
  </resources_function_prefix>
99
  </v2>
100
  <acl>
101
  <resources>
102
- <cmsapi_data translate="title" module="newhavensoftware_cmsapi">
103
- <title>CMSAPI data</title>
104
- <sort_order>3</sort_order>
105
- </cmsapi_data>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  </resources>
107
  </acl>
108
  </api>
2
  <config>
3
  <api>
4
  <resources>
5
+ <cmsapi_check translate="title" module="cmsapi">
6
  <model>cmsapi/check_api</model>
7
+ <title>NewHaven Software CMS API</title>
8
+ <acl>cmsapi</acl>
9
  <methods>
10
+ <nhsInstalled translate="title" module="cmsapi">
11
  <title>Is the NHS extension installed?</title>
12
+ <acl>cmsapi/nhsInstalled</acl>
13
  <method>isNHS</method>
14
  </nhsInstalled>
15
+ <version translate="title" module="cmsapi">
16
+ <title>Return the extension version</title>
17
+ <acl>cmsapi/version</acl>
18
+ <method>getExtensionVersion</method>
19
+ </version>
20
  </methods>
21
  </cmsapi_check>
22
+ <cmsapi_custom translate="title" module="cmsapi">
23
  <model>cmsapi/custom_api</model>
24
  <title>NewHaven Software Custom API</title>
25
+ <acl>cmsapi</acl>
26
  <methods>
27
+ <fields translate="title" module="cmsapi">
28
  <title>This will return the custom fields and values in comma delimited form</title>
29
+ <acl>cmsapi/fields</acl>
30
  <method>CustomFields</method>
31
  </fields>
32
+ <payment>
33
+ <title>Given a payment id will return payment info</title>
34
+ <acl>cmsapi/payment</acl>
35
+ <method>getPaymentInfo</method>
36
+ </payment>
37
  </methods>
38
  </cmsapi_custom>
39
+ <cmsapi_gift_message translate="title" module="cmsapi">
40
  <model>cmsapi/gift_message_api</model>
41
  <title>NewHaven Software GiftMessage API</title>
42
+ <acl>cmsapi</acl>
43
  <methods>
44
+ <info translate="title" module="cmsapi">
45
  <title>This will return the Gift Message entity given the ID</title>
46
+ <acl>cmsapi/info</acl>
47
  <method>GetGiftMessage</method>
48
  </info>
49
  </methods>
50
  </cmsapi_gift_message>
51
+ <cmsapi_sales_order translate="title" module="cmsapi">
52
  <model>cmsapi/sales_order_api</model>
53
  <acl>sales/order</acl>
54
  <title>Order API</title>
59
  </info>
60
  </methods>
61
  </cmsapi_sales_order>
62
+ <cmsapi_catalog_product translate="title" module="cmsapi">
63
  <model>cmsapi/catalog_product_api</model>
64
  <acl>catalog/product</acl>
65
  <title>Product API</title>
105
  <resources_function_prefix>
106
  <cmsapi_check>cmsapiCheck</cmsapi_check>
107
  <cmsapi_custom>cmsapiCustom</cmsapi_custom>
108
+ <!--<cmsapi_catalog_product>cmsapiCatalogProduct</cmsapi_catalog_product>
109
+ <cmsapi_sales_order>cmsapiSalesOrder</cmsapi_sales_order>-->
110
  <cmsapi_gift_message>cmsapiGiftMessage</cmsapi_gift_message>
111
  </resources_function_prefix>
112
  </v2>
113
  <acl>
114
  <resources>
115
+ <cmsapi translate="title" module="cmsapi">
116
+ <title>NewHaven Software CMS API Methods</title>
117
+ <nhsInstalled translate="title" module="cmsapi">
118
+ <title>Is NHS Installed</title>
119
+ </nhsInstalled>
120
+ <version translate="title" module="cmsapi">
121
+ <title>Extension Version</title>
122
+ </version>
123
+ <fields translate="title" module="cmsapi">
124
+ <title>Custom Fields</title>
125
+ </fields>
126
+ <payment>
127
+ <title>Extended Payment Info</title>
128
+ </payment>
129
+ <info translate="title" module="cmsapi">
130
+ <title>Extended Gift Message Data</title>
131
+ </info>
132
+ </cmsapi>
133
  </resources>
134
  </acl>
135
  </api>
app/code/community/NewHavenSoftware/CMSAPI/etc/config.xml CHANGED
@@ -1,31 +1,52 @@
1
  <?xml version="1.0"?>
2
 
3
  <config>
4
- <modules>
5
- <NewHavenSoftware_CMSAPI>
6
- <version>9.0.1.9</version>
7
- </NewHavenSoftware_CMSAPI>
8
- </modules>
9
- <global>
10
- <models>
11
- <cmsapi>
12
- <class>NewHavenSoftware_CMSAPI_Model</class>
13
- </cmsapi>
14
- <catalog>
15
- <rewrite>
16
- <product_api_v2>NewHavenSoftware_CMSAPI_Model_Catalog_Product_Api_V2</product_api_v2>
17
- </rewrite>
18
- </catalog>
19
- <sales>
20
- <rewrite>
21
- <order_api_v2>NewHavenSoftware_CMSAPI_Model_Sales_Order_Api_V2</order_api_v2>
22
- </rewrite>
23
- </sales>
24
- </models>
25
- <helpers>
26
- <cmsapi>
27
- <class>NewHavenSoftware_CMSAPI_Helper</class>
28
- </cmsapi>
29
- </helpers>
30
- </global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </config>
1
  <?xml version="1.0"?>
2
 
3
  <config>
4
+ <modules>
5
+ <NewHavenSoftware_CMSAPI>
6
+ <version>9.0.1.10</version>
7
+ </NewHavenSoftware_CMSAPI>
8
+ </modules>
9
+ <adminhtml>
10
+ <acl>
11
+ <resources>
12
+ <admin>
13
+ <children>
14
+ <system>
15
+ <children>
16
+ <config>
17
+ <children>
18
+ <cmsapi>
19
+ <title>NewHaven Software Settings</title>
20
+ </cmsapi>
21
+ </children>
22
+ </config>
23
+ </children>
24
+ </system>
25
+ </children>
26
+ </admin>
27
+ </resources>
28
+ </acl>
29
+ </adminhtml>
30
+ <global>
31
+ <models>
32
+ <cmsapi>
33
+ <class>NewHavenSoftware_CMSAPI_Model</class>
34
+ </cmsapi>
35
+ <catalog>
36
+ <rewrite>
37
+ <product_api_v2>NewHavenSoftware_CMSAPI_Model_Catalog_Product_Api_V2</product_api_v2>
38
+ </rewrite>
39
+ </catalog>
40
+ <sales>
41
+ <rewrite>
42
+ <order_api_v2>NewHavenSoftware_CMSAPI_Model_Sales_Order_Api_V2</order_api_v2>
43
+ </rewrite>
44
+ </sales>
45
+ </models>
46
+ <helpers>
47
+ <cmsapi>
48
+ <class>NewHavenSoftware_CMSAPI_Helper</class>
49
+ </cmsapi>
50
+ </helpers>
51
+ </global>
52
  </config>
app/code/community/NewHavenSoftware/CMSAPI/etc/system.xml CHANGED
@@ -1,6 +1,6 @@
1
  <config> <!-- see http://www.magentocommerce.com/wiki/5_-_modules_and_development/admin/xml_structure_for_admin_configurations -->
2
  <sections>
3
- <cmsapi translate="label" module="api">
4
  <label>NewHaven Software Settings</label>
5
  <tab>service</tab>
6
  <frontend_type>text</frontend_type>
@@ -19,8 +19,8 @@
19
  <fields>
20
  <customfields translate="label">
21
  <label>Custom Fields</label>
22
- <frontend_type>text</frontend_type>
23
- <comment>A comma delimited list of custom fields</comment>
24
  <sort_order>1</sort_order>
25
  <show_in_default>1</show_in_default>
26
  <show_in_website>1</show_in_website>
1
  <config> <!-- see http://www.magentocommerce.com/wiki/5_-_modules_and_development/admin/xml_structure_for_admin_configurations -->
2
  <sections>
3
+ <cmsapi translate="label" module="cmsapi">
4
  <label>NewHaven Software Settings</label>
5
  <tab>service</tab>
6
  <frontend_type>text</frontend_type>
19
  <fields>
20
  <customfields translate="label">
21
  <label>Custom Fields</label>
22
+ <frontend_type>textarea</frontend_type>
23
+ <comment>A comma delimited list of custom fields or one field per line</comment>
24
  <sort_order>1</sort_order>
25
  <show_in_default>1</show_in_default>
26
  <show_in_website>1</show_in_website>
app/code/community/NewHavenSoftware/CMSAPI/etc/wsdl.xml CHANGED
@@ -71,10 +71,19 @@ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}" xmlns:ns0="urn:
71
  <message name="cmsapiCustomFieldsRequest">
72
  <part name="sessionId" type="xsd:string"/>
73
  <part name="orderIncrementId" type="xsd:string"/>
 
74
  </message>
75
  <message name="cmsapiCustomFieldsResponse">
76
  <part name="result" type="xsd:string"/>
77
  </message>
 
 
 
 
 
 
 
 
78
  <message name="cmsapiGiftMessageInfoRequest">
79
  <part name="sessionId" type="xsd:string"/>
80
  <part name="giftMessageId" type="xsd:string"/>
@@ -88,17 +97,33 @@ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}" xmlns:ns0="urn:
88
  <message name="cmsapiChecknhsInstalledResponse">
89
  <part name="result" type="xsd:boolean"/>
90
  </message>
 
 
 
 
 
 
91
  <portType name="{{var wsdl.handler}}PortType">
92
  <operation name="cmsapiChecknhsInstalled">
93
  <documentation>Is the NHS extension installed?</documentation>
94
  <input name="cmsapiChecknhsInstalledRequest" message="typens:cmsapiChecknhsInstalledRequest"/>
95
  <output name="cmsapiChecknhsInstalledResponse" message="typens:cmsapiChecknhsInstalledResponse"/>
96
  </operation>
 
 
 
 
 
97
  <operation name="cmsapiCustomFields">
98
  <documentation>This will return the custom fields and values in comma delimited form</documentation>
99
  <input name="cmsapiCustomFieldsRequest" message="typens:cmsapiCustomFieldsRequest"/>
100
  <output name="cmsapiCustomFieldsResponse" message="typens:cmsapiCustomFieldsResponse"/>
101
  </operation>
 
 
 
 
 
102
  <operation name="cmsapiGiftMessageInfo">
103
  <documentation>This will return the Gift Message entity given the ID</documentation>
104
  <input name="cmsapiGiftMessageInfoRequest" message="typens:cmsapiGiftMessageInfoRequest"/>
@@ -116,6 +141,15 @@ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}" xmlns:ns0="urn:
116
  <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
117
  </output>
118
  </operation>
 
 
 
 
 
 
 
 
 
119
  <operation name="cmsapiCustomFields">
120
  <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
121
  <input>
@@ -125,6 +159,15 @@ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}" xmlns:ns0="urn:
125
  <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
126
  </output>
127
  </operation>
 
 
 
 
 
 
 
 
 
128
  <operation name="cmsapiGiftMessageInfo">
129
  <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
130
  <input>
71
  <message name="cmsapiCustomFieldsRequest">
72
  <part name="sessionId" type="xsd:string"/>
73
  <part name="orderIncrementId" type="xsd:string"/>
74
+ <part name="storeId" type="xsd:string"/>
75
  </message>
76
  <message name="cmsapiCustomFieldsResponse">
77
  <part name="result" type="xsd:string"/>
78
  </message>
79
+ <message name="cmsapiCustomPaymentRequest">
80
+ <part name="sessionId" type="xsd:string"/>
81
+ <part name="paymentId" type="xsd:string"/>
82
+ <part name="process" type="xsd:boolean"/>
83
+ </message>
84
+ <message name="cmsapiCustomPaymentResponse">
85
+ <part name="result" type="xsd:string"/>
86
+ </message>
87
  <message name="cmsapiGiftMessageInfoRequest">
88
  <part name="sessionId" type="xsd:string"/>
89
  <part name="giftMessageId" type="xsd:string"/>
97
  <message name="cmsapiChecknhsInstalledResponse">
98
  <part name="result" type="xsd:boolean"/>
99
  </message>
100
+ <message name="cmsapiCheckVersionRequest">
101
+ <part name="sessionId" type="xsd:string"/>
102
+ </message>
103
+ <message name="cmsapiCheckVersionResponse">
104
+ <part name="result" type="xsd:string"/>
105
+ </message>
106
  <portType name="{{var wsdl.handler}}PortType">
107
  <operation name="cmsapiChecknhsInstalled">
108
  <documentation>Is the NHS extension installed?</documentation>
109
  <input name="cmsapiChecknhsInstalledRequest" message="typens:cmsapiChecknhsInstalledRequest"/>
110
  <output name="cmsapiChecknhsInstalledResponse" message="typens:cmsapiChecknhsInstalledResponse"/>
111
  </operation>
112
+ <operation name="cmsapiCheckVersion">
113
+ <documentation>Extension Version</documentation>
114
+ <input name="cmsapiCheckVersionRequest" message="typens:cmsapiCheckVersionRequest"/>
115
+ <output name="cmsapiCheckVersionResponse" message="typens:cmsapiCheckVersionResponse"/>
116
+ </operation>
117
  <operation name="cmsapiCustomFields">
118
  <documentation>This will return the custom fields and values in comma delimited form</documentation>
119
  <input name="cmsapiCustomFieldsRequest" message="typens:cmsapiCustomFieldsRequest"/>
120
  <output name="cmsapiCustomFieldsResponse" message="typens:cmsapiCustomFieldsResponse"/>
121
  </operation>
122
+ <operation name="cmsapiCustomPayment">
123
+ <documentation>This will return a custom payment entity</documentation>
124
+ <input name="cmsapiCustomPaymentRequest" message="typens:cmsapiCustomPaymentRequest"/>
125
+ <output name="cmsapiCustomPaymentResponse" message="typens:cmsapiCustomPaymentResponse"/>
126
+ </operation>
127
  <operation name="cmsapiGiftMessageInfo">
128
  <documentation>This will return the Gift Message entity given the ID</documentation>
129
  <input name="cmsapiGiftMessageInfoRequest" message="typens:cmsapiGiftMessageInfoRequest"/>
141
  <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
142
  </output>
143
  </operation>
144
+ <operation name="cmsapiCheckVersion">
145
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
146
+ <input>
147
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
148
+ </input>
149
+ <output>
150
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
151
+ </output>
152
+ </operation>
153
  <operation name="cmsapiCustomFields">
154
  <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
155
  <input>
159
  <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
160
  </output>
161
  </operation>
162
+ <operation name="cmsapiCustomPayment">
163
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
164
+ <input>
165
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
166
+ </input>
167
+ <output>
168
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
169
+ </output>
170
+ </operation>
171
  <operation name="cmsapiGiftMessageInfo">
172
  <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
173
  <input>
app/etc/modules/NewHavenSoftware_CMSAPI.xml CHANGED
@@ -24,9 +24,6 @@
24
  <NewHavenSoftware_CMSAPI>
25
  <active>true</active>
26
  <codePool>community</codePool>
27
- <depends>
28
- <Mage_Api />
29
- </depends>
30
  </NewHavenSoftware_CMSAPI>
31
  </modules>
32
  </config>
24
  <NewHavenSoftware_CMSAPI>
25
  <active>true</active>
26
  <codePool>community</codePool>
 
 
 
27
  </NewHavenSoftware_CMSAPI>
28
  </modules>
29
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NewHavenSoftware_CMSAPI</name>
4
- <version>9.0.1.9</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -18,19 +18,18 @@ Adds the following to the v2 API:&#xD;
18
  &lt;/ol&gt;&#xD;
19
  &#xD;
20
  This extension is recommended for integration with the CMS eCMS module.&lt;br /&gt;&lt;br /&gt;</description>
21
- <notes>&lt;strong&gt;9.0.1.9&lt;/strong&gt; 10/14/2013&lt;br /&gt;&#xD;
 
 
 
22
  In the V2 API changed the salesOrderInfo item.product_options from serialized php to json text for configurable product attribute information used during order download into CMS.&lt;br /&gt;&lt;br /&gt;&#xD;
23
  &#xD;
24
  &lt;strong&gt;9.0.1.8&lt;/strong&gt; 09/18/2013&lt;br /&gt;&#xD;
25
- Added cmsapiGiftMessageInfo to the V2 api that will return an object with to,from, and message values. See the NewHaven Software Magento Setup Guide for more information about the message template plug-in option.&lt;br /&gt;&lt;br /&gt;&#xD;
26
- &#xD;
27
- &lt;strong&gt;9.0.1.7&lt;/strong&gt;&lt;br /&gt;&#xD;
28
- The first Amasty Order Attributes implementation was not working properly. In this release added more flexible support for custom fields. You can now define a custom field with this syntax: CLASS_API/path/fieldName. For Amasty this would be: Amasty_Orderattr_Model_Sales_Order_Api/custom/fieldName the limitation here is the class must have an info method that accepts the order increment ID as the parameter. Also the field names all need to be unique. &lt;br /&gt;&lt;br /&gt;&#xD;
29
- </notes>
30
- <authors><author><name>Jason Morrison</name><user>jmorrison</user><email>jmorrison@newhavensoftware.com</email></author></authors>
31
- <date>2013-10-14</date>
32
- <time>19:48:15</time>
33
- <contents><target name="magecommunity"><dir name="NewHavenSoftware"><dir name="CMSAPI"><dir name="Helper"><file name="Data.php" hash="ab4082fe27f7c6732a7f857fc326ec99"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="aad926da6a10b2c2de3c28abac0eaf52"/></dir></dir></dir><dir name="Check"><dir name="Api"><file name="V2.php" hash="c27fcf391dcf5ad7e0c86de44fd14e7c"/></dir></dir><dir name="Custom"><dir name="Api"><file name="V2.php" hash="6e720e7e3704257a045905a1f639eaa5"/></dir></dir><dir name="Gift"><dir name="Api"><file name="V2.php" hash="bf989c37e7277dd55b50e378e15cd19a"/></dir><dir name="Message"><dir name="Api"><file name="V2.php" hash="0a5ffdd3fc3760b311970169858d5475"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Api"><file name="V2.php" hash="03443ab449fb867f4a5bb08877bea5d6"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ba4c36dbd3d346c3561fb5822d5fd3b4"/><file name="api.xml" hash="1fa0bb1db0aa578270f5bc210e66daac"/><file name="config.xml" hash="cdbcd30695f2536cd40633348d9d1d14"/><file name="system.xml" hash="ab6f7ba6be148634383f9e3a8f63e2cd"/><file name="wsdl.xml" hash="93ea17ae19287afccf46543c1ac01a30"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NewHavenSoftware_CMSAPI.xml" hash="f858d97574f528dc237ad32e0e96ae73"/></dir></target></contents>
34
  <compatible/>
35
- <dependencies><required><php><min>5.2.0</min><max>5.5.3</max></php></required></dependencies>
36
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NewHavenSoftware_CMSAPI</name>
4
+ <version>9.0.1.10</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
18
  &lt;/ol&gt;&#xD;
19
  &#xD;
20
  This extension is recommended for integration with the CMS eCMS module.&lt;br /&gt;&lt;br /&gt;</description>
21
+ <notes>&lt;strong&gt;9.0.1.10&lt;/strong&gt; 11/12/2013&lt;br /&gt;&#xD;
22
+ Updated support for size and color products. This update is required for any size and/or color products. Also in this version is a fix for blank screens or errors when attempting to configure roles. &lt;br /&gt;&lt;br /&gt;&#xD;
23
+ &#xD;
24
+ &lt;strong&gt;9.0.1.9&lt;/strong&gt; 10/14/2013&lt;br /&gt;&#xD;
25
  In the V2 API changed the salesOrderInfo item.product_options from serialized php to json text for configurable product attribute information used during order download into CMS.&lt;br /&gt;&lt;br /&gt;&#xD;
26
  &#xD;
27
  &lt;strong&gt;9.0.1.8&lt;/strong&gt; 09/18/2013&lt;br /&gt;&#xD;
28
+ Added cmsapiGiftMessageInfo to the V2 api that will return an object with to,from, and message values. See the NewHaven Software Magento Setup Guide for more information about the message template plug-in option.&lt;br /&gt;&lt;br /&gt;</notes>
29
+ <authors><author><name>Jason Morrison</name><user>nhsjason</user><email>jmorrison@newhavensoftware.com</email></author></authors>
30
+ <date>2013-11-25</date>
31
+ <time>17:26:20</time>
32
+ <contents><target name="magecommunity"><dir name="NewHavenSoftware"><dir name="CMSAPI"><dir name="Helper"><file name="Data.php" hash="d2b766dc9b2531da8a84213dcec33776"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="383a8db3afa315ad1170941ef4615362"/></dir></dir></dir><dir name="Check"><dir name="Api"><file name="V2.php" hash="f589ff6d45ee96855afe53461092813e"/></dir></dir><dir name="Custom"><dir name="Api"><file name="V2.php" hash="ab68dd0819bb8f116b3bb0f491a99b52"/></dir></dir><dir name="Gift"><dir name="Message"><dir name="Api"><file name="V2.php" hash="0a5ffdd3fc3760b311970169858d5475"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Api"><file name="V2.php" hash="03443ab449fb867f4a5bb08877bea5d6"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ba4c36dbd3d346c3561fb5822d5fd3b4"/><file name="api.xml" hash="d60a74b7cefdcdcc5ac51f425dc5ce14"/><file name="config.xml" hash="97335fca11b00414fb9a04950e313914"/><file name="system.xml" hash="3e71dda77aa28dd02afc40816ecd908e"/><file name="wsdl.xml" hash="d0bc71bbdae1de15040a367396313d70"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NewHavenSoftware_CMSAPI.xml" hash="4c5fe5d61b389c00a8e54970a29017a0"/></dir></target></contents>
 
 
 
 
33
  <compatible/>
34
+ <dependencies><required><php><min>5.1.0</min><max>5.5.4</max></php></required></dependencies>
35
  </package>