BikeExchange_DE - Version 2.0.0

Version Notes

rewritten api_resource_customer to support guest's email address

Download this release

Release Info

Developer Hagen Schwaß
Extension BikeExchange_DE
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.6 to 2.0.0

app/code/community/Bikeexchange/Produktexport/Model/Api/Resource/Customer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // src/app/code/community/Bikeexchange/Produktexport/Model/Api/Resource/Customer.php
3
+ /**
4
+ * Class Bikeexchange_Produktexport_Model_Api_Resource_Customer
5
+ */
6
+ class Bikeexchange_Produktexport_Model_Api_Resource_Customer
7
+ extends Mage_Checkout_Model_Api_Resource_Customer
8
+ {
9
+ /**
10
+ * FIX guest order email blank.
11
+ *
12
+ * Mage using billing address email as customer email on guest orders.
13
+ *
14
+ * see http://magento.stackexchange.com/questions/90380/magento-customer-email-missing-in-guest-checkout-when-using-soap-api
15
+ *
16
+ * @param Mage_Sales_Model_Quote $quote
17
+ *
18
+ * @return $this
19
+ */
20
+ protected function _prepareGuestQuote(Mage_Sales_Model_Quote $quote)
21
+ {
22
+ $quote->setCustomerId(null)
23
+ // ORIG: email always empty ->setCustomerEmail($quote->getBillingAddress()->getEmail())
24
+ //->setCustomerEmail('mail@test.de')//$quote->getCustomerEmail()) // fix
25
+ ->setCustomerIsGuest(true)
26
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
27
+ return $this;
28
+ }
29
+ }
app/code/community/Bikeexchange/Produktexport/Model/Catalog/Product/Api.php CHANGED
@@ -57,9 +57,12 @@ class Bikeexchange_Produktexport_Model_Catalog_Product_Api extends Mage_Catalog_
57
  );
58
  foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute)
59
  {
60
- if (in_array(strtolower($attribute->getAttributeCode()), $this->possiblebarcodefields) && !empty($product->getData($attribute->getAttributeCode())))
 
 
 
61
  {
62
- $item['barcode'] = $product->getData($attribute->getAttributeCode());
63
  }
64
  }
65
  $result[] = $item;
@@ -105,31 +108,34 @@ class Bikeexchange_Produktexport_Model_Catalog_Product_Api extends Mage_Catalog_
105
  $item['attributes'] = '';
106
  foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute)
107
  {
108
- $item['attributes'] .= $attribute->getAttributeCode().';';
109
- if (in_array(strtolower($attribute->getAttributeCode()), $this->possiblebarcodefields))
 
 
 
110
  {
111
- if (!empty($product->getData($attribute->getAttributeCode())))
112
  {
113
- $item['barcode'] = $product->getData($attribute->getAttributeCode());
114
  }
115
  else {
116
  $item['barcode'] = 'empty';
117
  }
118
  }
119
- else if (in_array(strtolower($attribute->getAttributeCode()), $this->possiblebrandfields))
120
  {
121
- if (!empty($product->getData($attribute->getAttributeCode())))
122
  {
123
- $item['brand'] = $product->getData($attribute->getAttributeCode())
124
- .'-'.$product->getAttributeText($attribute->getAttributeCode());
125
  }
126
  else {
127
  $item['brand'] = 'empty';
128
  }
129
  }
130
- else if (in_array(strtolower($attribute->getAttributeCode()), $this->possiblecolorfields))
131
  {
132
- if (!empty($product->getData($attribute->getAttributeCode())))
133
  {
134
  $item['color'] = $product->getData($attribute->getAttributeCode())
135
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
@@ -138,9 +144,9 @@ class Bikeexchange_Produktexport_Model_Catalog_Product_Api extends Mage_Catalog_
138
  $item['color'] = 'empty';
139
  }
140
  }
141
- else if (in_array(strtolower($attribute->getAttributeCode()), $this->possiblesizefields))
142
  {
143
- if (!empty($product->getData($attribute->getAttributeCode())))
144
  {
145
  $item['size'] = $product->getData($attribute->getAttributeCode())
146
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
@@ -149,9 +155,9 @@ class Bikeexchange_Produktexport_Model_Catalog_Product_Api extends Mage_Catalog_
149
  $item['size'] = 'empty';
150
  }
151
  }
152
- else if (in_array(strtolower($attribute->getAttributeCode()), $this->possiblegenderfields))
153
  {
154
- if (!empty($product->getData($attribute->getAttributeCode())))
155
  {
156
  $item['gender'] = $product->getData($attribute->getAttributeCode())
157
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
@@ -160,9 +166,9 @@ class Bikeexchange_Produktexport_Model_Catalog_Product_Api extends Mage_Catalog_
160
  $item['gender'] = 'empty';
161
  }
162
  }
163
- else if (in_array(strtolower($attribute->getAttributeCode()), $this->possibleyearfields))
164
  {
165
- if (!empty($product->getData($attribute->getAttributeCode())))
166
  {
167
  $item['year'] = $product->getData($attribute->getAttributeCode())
168
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
57
  );
58
  foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute)
59
  {
60
+ $attributecode = $attribute->getAttributeCode();
61
+ $attributecodelower = strtolower($attributecode);
62
+ $productdata = $product->getData($attributecode);
63
+ if (in_array($attributecodelower, $this->possiblebarcodefields) && !empty($productdata))
64
  {
65
+ $item['barcode'] = $product->getData($attributecode);
66
  }
67
  }
68
  $result[] = $item;
108
  $item['attributes'] = '';
109
  foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute)
110
  {
111
+ $attributecode = $attribute->getAttributeCode();
112
+ $item['attributes'] .= $attributecode.';';
113
+ $attributecodelower = strtolower($attributecode);
114
+ $productdata = $product->getData($attributecode);
115
+ if (in_array($attributecodelower, $this->possiblebarcodefields))
116
  {
117
+ if (!empty($productdata))
118
  {
119
+ $item['barcode'] = $product->getData($attributecode);
120
  }
121
  else {
122
  $item['barcode'] = 'empty';
123
  }
124
  }
125
+ else if (in_array($attributecodelower, $this->possiblebrandfields))
126
  {
127
+ if (!empty($productdata))
128
  {
129
+ $item['brand'] = $product->getData($attributecode)
130
+ .'-'.$product->getAttributeText($attributecode);
131
  }
132
  else {
133
  $item['brand'] = 'empty';
134
  }
135
  }
136
+ else if (in_array($attributecodelower, $this->possiblecolorfields))
137
  {
138
+ if (!empty($productdata))
139
  {
140
  $item['color'] = $product->getData($attribute->getAttributeCode())
141
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
144
  $item['color'] = 'empty';
145
  }
146
  }
147
+ else if (in_array($attributecodelower, $this->possiblesizefields))
148
  {
149
+ if (!empty($productdata))
150
  {
151
  $item['size'] = $product->getData($attribute->getAttributeCode())
152
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
155
  $item['size'] = 'empty';
156
  }
157
  }
158
+ else if (in_array($attributecodelower, $this->possiblegenderfields))
159
  {
160
+ if (!empty($productdata))
161
  {
162
  $item['gender'] = $product->getData($attribute->getAttributeCode())
163
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
166
  $item['gender'] = 'empty';
167
  }
168
  }
169
+ else if (in_array($attributecodelower, $this->possibleyearfields))
170
  {
171
+ if (!empty($productdata))
172
  {
173
  $item['year'] = $product->getData($attribute->getAttributeCode())
174
  .'-'.$product->getAttributeText($attribute->getAttributeCode());
app/code/community/Bikeexchange/Produktexport/etc/config.xml CHANGED
@@ -1,7 +1,7 @@
1
  <config>
2
  <modules>
3
  <Bikeexchange_Produktexport>
4
- <version>1.0.6</version>
5
  </Bikeexchange_Produktexport>
6
  </modules>
7
  <global>
@@ -9,6 +9,11 @@
9
  <produktexport>
10
  <class>Bikeexchange_Produktexport_Model</class>
11
  </produktexport>
 
 
 
 
 
12
  </models>
13
  <helpers>
14
  <produktexport>
1
  <config>
2
  <modules>
3
  <Bikeexchange_Produktexport>
4
+ <version>2.0.0</version>
5
  </Bikeexchange_Produktexport>
6
  </modules>
7
  <global>
9
  <produktexport>
10
  <class>Bikeexchange_Produktexport_Model</class>
11
  </produktexport>
12
+ <checkout>
13
+ <rewrite>
14
+ <api_resource_customer>Bikeexchange_Produktexport_Model_Api_Resource_Customer</api_resource_customer>
15
+ </rewrite>
16
+ </checkout>
17
  </models>
18
  <helpers>
19
  <produktexport>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BikeExchange_DE</name>
4
- <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Automating a BikeExchange DE account from the Magento Shop's admin panel.</summary>
10
  <description>In order to automate a BikeExchange account two SOAP v2 functions are added. One provides stock and price information for frequent usage. The other provides product data for creating adverts on the marketplace.</description>
11
- <notes>Supported PHP 5.3.8</notes>
12
  <authors><author><name>Hagen Schwa&#xDF;</name><user>hagens</user><email>bikeexchange@hagenschwass.name</email></author></authors>
13
- <date>2017-05-15</date>
14
- <time>09:06:04</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Bikeexchange_Produktexport.xml" hash="fea0bff88a09bd200e810f7b6b38a888"/></dir></target><target name="magecommunity"><dir name="Bikeexchange"><dir name="Produktexport"><dir name="Helper"><file name="Data.php" hash="6a59185f3a1ecbe68cb845b6525f997d"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="8af7de3830297ee52215de8271de4efe"/></dir><file name="Api.php" hash="bae24392d4a692df5ad5ef5fb661940a"/></dir></dir></dir><dir name="etc"><file name="api.xml" hash="e82ea342aeadaf59d0e96cc3424ab1ae"/><file name="config.xml" hash="b81e6b1df96020fd19501d0931d7d536"/><file name="wsi.xml" hash="c36fb04bea9f0a51162578f8a9aaf431"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.6.9</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9.3.2</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BikeExchange_DE</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Automating a BikeExchange DE account from the Magento Shop's admin panel.</summary>
10
  <description>In order to automate a BikeExchange account two SOAP v2 functions are added. One provides stock and price information for frequent usage. The other provides product data for creating adverts on the marketplace.</description>
11
+ <notes>rewritten api_resource_customer to support guest's email address</notes>
12
  <authors><author><name>Hagen Schwa&#xDF;</name><user>hagens</user><email>bikeexchange@hagenschwass.name</email></author></authors>
13
+ <date>2017-07-21</date>
14
+ <time>11:19:36</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Bikeexchange_Produktexport.xml" hash="fea0bff88a09bd200e810f7b6b38a888"/></dir></target><target name="magecommunity"><dir name="Bikeexchange"><dir name="Produktexport"><dir name="Helper"><file name="Data.php" hash="6a59185f3a1ecbe68cb845b6525f997d"/></dir><dir name="Model"><dir name="Api"><dir name="Resource"><file name="Customer.php" hash="53e46e1f43f7b61a26b6df3fed51d500"/></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="8af7de3830297ee52215de8271de4efe"/></dir><file name="Api.php" hash="f124150a1c8821c2c36ccfcaff96eb04"/></dir></dir></dir><dir name="etc"><file name="api.xml" hash="e82ea342aeadaf59d0e96cc3424ab1ae"/><file name="config.xml" hash="651c68c92dde7dd467b0fbe82aa1a8e8"/><file name="wsi.xml" hash="c36fb04bea9f0a51162578f8a9aaf431"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.6.9</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9.3.2</max></package></required></dependencies>
18
  </package>