Fruugo_Integration - Version 1.0.5

Version Notes

This update includes:

- Up to 5 images for a product in the products feed

- Added a configuration section for multiple stores with the same language to choose which store to use to export product description for that language in order to avoid duplicate product description of the same language

- Added options to choose product description and short description merge order

- Add product discount price when it is set

- Custom Fruugo shipping method for Fruugo orders

Download this release

Release Info

Developer inoutput.io
Extension Fruugo_Integration
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

Files changed (39) hide show
  1. app/code/community/Fruugo/Integration/.DS_Store +0 -0
  2. app/code/community/Fruugo/Integration/Block/.DS_Store +0 -0
  3. app/code/community/Fruugo/Integration/Block/Catalog/.DS_Store +0 -0
  4. app/code/community/Fruugo/Integration/Block/Catalog/Product/.DS_Store +0 -0
  5. app/code/community/Fruugo/Integration/Block/Languagestoremapping.php +68 -0
  6. app/code/community/Fruugo/Integration/Block/Sales/.DS_Store +0 -0
  7. app/code/community/Fruugo/Integration/Block/Sales/Order/.DS_Store +0 -0
  8. app/code/community/Fruugo/Integration/Block/Sales/Order/View/.DS_Store +0 -0
  9. app/code/community/Fruugo/Integration/Helper/.DS_Store +0 -0
  10. app/code/community/Fruugo/Integration/Helper/OrdersFeedProcessor.php +14 -3
  11. app/code/community/Fruugo/Integration/Helper/ProductsFeedGenerator.php +148 -57
  12. app/code/community/Fruugo/Integration/Model/.DS_Store +0 -0
  13. app/code/community/Fruugo/Integration/Model/Adminhtml/.DS_Store +0 -0
  14. app/code/community/Fruugo/Integration/Model/Adminhtml/System/.DS_Store +0 -0
  15. app/code/community/Fruugo/Integration/Model/Adminhtml/System/Config/.DS_Store +0 -0
  16. app/code/community/Fruugo/Integration/Model/Adminhtml/System/Config/Backend/.DS_Store +0 -0
  17. app/code/community/Fruugo/Integration/Model/Adminhtml/System/Config/Source/ProductDescriptionType.php +2 -1
  18. app/code/community/Fruugo/Integration/controllers/.DS_Store +0 -0
  19. app/code/community/Fruugo/Integration/data/.DS_Store +0 -0
  20. app/code/community/Fruugo/Integration/design/.DS_Store +0 -0
  21. app/code/community/Fruugo/Integration/design/adminhtml/.DS_Store +0 -0
  22. app/code/community/Fruugo/Integration/design/adminhtml/default/.DS_Store +0 -0
  23. app/code/community/Fruugo/Integration/design/adminhtml/default/default/.DS_Store +0 -0
  24. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/.DS_Store +0 -0
  25. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/.DS_Store +0 -0
  26. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/catalog/.DS_Store +0 -0
  27. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/catalog/product/.DS_Store +0 -0
  28. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/sales/.DS_Store +0 -0
  29. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/sales/order/.DS_Store +0 -0
  30. app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/sales/order/view/.DS_Store +0 -0
  31. app/code/community/Fruugo/Integration/etc/config.xml +1 -1
  32. app/code/community/Fruugo/Integration/etc/system.xml +10 -0
  33. app/design/adminhtml/default/default/template/integration/.DS_Store +0 -0
  34. app/design/adminhtml/default/default/template/integration/catalog/.DS_Store +0 -0
  35. app/design/adminhtml/default/default/template/integration/catalog/product/.DS_Store +0 -0
  36. app/design/adminhtml/default/default/template/integration/sales/.DS_Store +0 -0
  37. app/design/adminhtml/default/default/template/integration/sales/order/.DS_Store +0 -0
  38. app/design/adminhtml/default/default/template/integration/sales/order/view/.DS_Store +0 -0
  39. package.xml +16 -6
app/code/community/Fruugo/Integration/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Block/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Block/Catalog/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Block/Catalog/Product/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Block/Languagestoremapping.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Fruugo_Integration_Block_Languagestoremapping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ /**
6
+ * Returns html part of the setting
7
+ *
8
+ * @param Varien_Data_Form_Element_Abstract $element
9
+ * @return string
10
+ */
11
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
12
+ {
13
+ $storelangsSettings = Mage::getStoreConfig('integration_options/products_options/language_store');
14
+ $storelangsMapping = unserialize($storelangsSettings);
15
+ $this->setElement($element);
16
+
17
+ $html = '<div id="fruugo_integration_language_store_template" style="display:none">';
18
+ $html .= '</div>';
19
+
20
+ $html .= '<table class="grid" id="fruugo_integration_language_store_table">
21
+ <tbody>
22
+ <tr class="headings">
23
+ <th>Language</th>
24
+ <th>Default Store</th>
25
+ </tr>';
26
+
27
+ $stores = Mage::app()->getStores(false);
28
+ $localeCodes = array();
29
+
30
+ foreach ($stores as $store) {
31
+ if ($store->getCode() != 'fruugo') {
32
+ $localeCode = Mage::getStoreConfig('general/locale/code', $store->getId());
33
+ if (!in_array($localeCode, $localeCodes)) {
34
+ array_push($localeCodes, $localeCode);
35
+ }
36
+ }
37
+ }
38
+
39
+ $languageNames = Zend_Locale::getTranslationList('language', Mage::app()->getLocale()->getLocaleCode());
40
+
41
+ foreach ($localeCodes as $localeCode) {
42
+ $language = substr($localeCode, 0, strpos($localeCode, '_'));
43
+ $row = '<tr><td><label>'.$languageNames[$language].'</label></td><td><select name="'
44
+ .$this->getElement()->getName() . '['.$localeCode.']" id="'.$language.'">';
45
+ $row .= '<option value="">- Please choose a store -</option>';
46
+
47
+ foreach ($stores as $store) {
48
+ if ($store->getCode() != 'fruugo') {
49
+ $storeLocaleCode = Mage::getStoreConfig('general/locale/code', $store->getId());
50
+ if ($localeCode == $storeLocaleCode) {
51
+ if ($storelangsMapping[$localeCode] == $store->getCode()) {
52
+ $row .= '<option value="'.$store->getCode().'" selected>'.$store->getCode().'</option>';
53
+ } else {
54
+ $row .= '<option value="'.$store->getCode().'">'.$store->getCode().'</option>';
55
+ }
56
+
57
+ }
58
+ }
59
+ }
60
+ $row .= '</select></td></tr>';
61
+ $html .= $row;
62
+ }
63
+
64
+ $html .= '</tbody></table>';
65
+
66
+ return $html;
67
+ }
68
+ }
app/code/community/Fruugo/Integration/Block/Sales/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Block/Sales/Order/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Block/Sales/Order/View/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Helper/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Helper/OrdersFeedProcessor.php CHANGED
@@ -204,10 +204,21 @@ class Fruugo_Integration_OrdersFeedProcessor extends Mage_Core_Helper_Abstract
204
  $billingAddress = $quote->getBillingAddress()->addData($addressData);
205
  $shippingAddress = $quote->getShippingAddress()->addData($addressData);
206
 
207
- // set payment method
 
 
 
 
 
 
 
 
 
 
208
  $paymentMethod = Fruugo_Integration_Helper_Defines::FRUUGO_PAYMENT_METHOD;
209
- $shippingAddress->setCollectShippingRates(true)->collectShippingRates()
210
- ->setShippingMethod('flatrate_flatrate')->setPaymentMethod($paymentMethod);
 
211
  $quote->getPayment()->importData(array('method' => $paymentMethod));
212
 
213
  $quote->setFruugoOrderId($fruugoId);
204
  $billingAddress = $quote->getBillingAddress()->addData($addressData);
205
  $shippingAddress = $quote->getShippingAddress()->addData($addressData);
206
 
207
+ // Create custom shipping method and set payment method
208
+ $rate = Mage::getModel('sales/quote_address_rate');
209
+ $shippingCode = 'fruugo_shipping';
210
+ $rate->setCode($shippingCode)
211
+ ->setCarrier($shippingCode)
212
+ ->setCarrierTitle('Fruugo')
213
+ ->setMethod('fruugo_' . strtolower($orderArray['shippingMethod']))
214
+ ->setMethodTitle('Fruugo ' . $orderArray['shippingMethod'])
215
+ ->setPrice($orderArray['shippingCostInclVAT'])
216
+ ->setCost(0);
217
+
218
  $paymentMethod = Fruugo_Integration_Helper_Defines::FRUUGO_PAYMENT_METHOD;
219
+ $shippingAddress->addShippingRate($rate)
220
+ ->setShippingMethod($shippingCode)
221
+ ->setPaymentMethod($paymentMethod);
222
  $quote->getPayment()->importData(array('method' => $paymentMethod));
223
 
224
  $quote->setFruugoOrderId($fruugoId);
app/code/community/Fruugo/Integration/Helper/ProductsFeedGenerator.php CHANGED
@@ -48,21 +48,28 @@ class Fruugo_Integration_ProductsFeedGenerator extends Mage_Core_Helper_Abstract
48
  ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED) // only select enabled products
49
  ->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE); // only select simple products
50
 
 
 
 
 
51
  foreach ($products as $product) {
52
  $disabledOnFruugo = false;
53
  $productCountries = Mage::getModel('integration/countries')->load($product->getId(), 'product_id');
54
  if (isset($productCountries) && $productCountries->getFruugoCountries() == 'Disabled') {
55
  $disabledOnFruugo = true;
56
  }
57
- $imageUrl = $product->getImageUrl();
 
 
 
58
  if (!$disabledOnFruugo &&
59
  $product->getSku() !== null &&
60
  $product->getName() !== null &&
61
  $product->getDescription() !== null &&
62
  $product->getPrice() !== null &&
63
- !empty($imageUrl)) {
64
  $productXml = $productsXml->addChild('Product');
65
- $productXml = $this->_fillProductXml($productXml, $product);
66
  }
67
  }
68
 
@@ -71,17 +78,13 @@ class Fruugo_Integration_ProductsFeedGenerator extends Mage_Core_Helper_Abstract
71
  }
72
  }
73
 
74
- public function _fillProductXml($productXml, $product)
75
  {
76
  // M: Mandatory R: Recommended O: Optional
77
- $parentProduct = null;
78
-
79
- $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')
80
- ->getParentIdsByChild($product->getId());
81
 
82
  // ProductId *M
83
- if (isset($parentIds[0])) {
84
- $parentProduct = Mage::getModel('catalog/product')->load($parentIds[0]);
85
  $productXml->addChild('ProductId', $parentProduct->getId());
86
  } else {
87
  $productXml->addChild('ProductId', $product->getId());
@@ -125,9 +128,21 @@ class Fruugo_Integration_ProductsFeedGenerator extends Mage_Core_Helper_Abstract
125
  }
126
 
127
  // Imageurl1 *M
128
- $productXml->addChild('Imageurl1', htmlspecialchars(Mage::helper('catalog/image')->init($product, 'image')));
129
-
130
  // Imageurl2, Imageurl3, Imageurl4, Imageurl5 *R
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  // StockStatus & StockQuantity *M
133
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
@@ -152,53 +167,64 @@ class Fruugo_Integration_ProductsFeedGenerator extends Mage_Core_Helper_Abstract
152
  // Description Node
153
  $stores = Mage::app()->getStores(false);
154
 
 
155
  foreach ($stores as $store) {
156
  // store 'fruugo' is for Fruugo orders
157
  if ($store->getCode() != 'fruugo') {
158
- $product->setStoreId($store->getId())->load($product->getId());
159
 
160
  $localeCode = Mage::getStoreConfig('general/locale/code', $store->getId());
161
  $language = substr($localeCode, 0, strpos($localeCode, '_'));
162
 
163
- // Language *R
164
- $descriptionXml = $productXml->addChild('Description');
165
- $descriptionXml->addChild('Language', $language);
166
-
167
- $descriptionXml->addChild('Title', htmlspecialchars($product->getName()));
168
-
169
- // description
170
- $nestedDescriptionXml = $descriptionXml->addChild('Description');
171
- $descriptionType = Mage::getStoreConfig('integration_options/products_options/descrption_type');
172
-
173
- if ($descriptionType == 'long') {
174
- $this->_addCData($nestedDescriptionXml, $product->getDescription());
175
- } elseif ($descriptionType == 'short') {
176
- $this->_addCData($nestedDescriptionXml, $product->getShortDescription());
177
- } else {
178
- $this->_addCData($nestedDescriptionXml, $product->getDescription() . PHP_EOL . $product->getShortDescription());
179
- }
180
-
181
- // AttributeColor *R
182
- if ($product->getColor() !== null && $product->getAttributeText('color')) {
183
- $descriptionXml->addChild('AttributeColor', $product->getAttributeText('color'));
184
- }
185
-
186
- // AttributeSize *R
187
- if ($product->getShoeSize() !== null && $product->getAttributeText('shoe_size')) {
188
- $descriptionXml->addChild('AttributeSize', $product->getAttributeText('shoe_size'));
189
- } elseif ($product->getSize() !== null && $product->getAttributeText('size')) {
190
- $descriptionXml->addChild('AttributeSize', $product->getAttributeText('size'));
191
- }
192
-
193
- // optional attributes: Arrtibute1 - Attribute10 *O
194
- if ($product->getFit() !== null) {
195
- $descriptionXml->addChild('Attribute1', $product->getFit());
196
- }
197
- if ($product->getLength() !== null) {
198
- $descriptionXml->addChild('Attribute2', $product->getLength());
199
- }
200
- if ($product->getWidth() !== null) {
201
- $descriptionXml->addChild('Attribute3', $product->getWidth());
 
 
 
 
 
 
 
 
 
 
202
  }
203
  }
204
  }
@@ -224,23 +250,88 @@ class Fruugo_Integration_ProductsFeedGenerator extends Mage_Core_Helper_Abstract
224
  $priceXml->addChild('Country', $existingList);
225
  }
226
 
227
- $taxCalculation = Mage::getModel('tax/calculation');
228
- $request = $taxCalculation->getRateRequest(null, null, null, $store);
229
- $normalPriceExclTax = $product->getFinalPrice();
230
  $priceXml->addChild('NormalPriceWithoutVAT', number_format($normalPriceExclTax, 2, '.', ''));
231
 
 
 
 
232
  $taxClassId = $product->getTaxClassId();
233
  $percent = $taxCalculation->getRate($request->setProductClassId($taxClassId));
234
  $priceXml->addChild('VATRate', number_format($percent, 2, '.', ''));
235
 
236
- // DiscountPriceStartDate *O
237
- // DiscountPriceEndDate *O
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
  }
240
 
241
  return $productXml;
242
  }
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  private function _addCData($xml, $cdata_text)
245
  {
246
  $node = dom_import_simplexml($xml);
48
  ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED) // only select enabled products
49
  ->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE); // only select simple products
50
 
51
+ // Get store langauge map or use null if none
52
+ $storelangsSettings = Mage::getStoreConfig('integration_options/products_options/language_store');
53
+ $storelangsMapping = empty($storelangsSettings) ? null : unserialize($storelangsSettings);
54
+
55
  foreach ($products as $product) {
56
  $disabledOnFruugo = false;
57
  $productCountries = Mage::getModel('integration/countries')->load($product->getId(), 'product_id');
58
  if (isset($productCountries) && $productCountries->getFruugoCountries() == 'Disabled') {
59
  $disabledOnFruugo = true;
60
  }
61
+
62
+ $parentProduct = $this->_getParentProduct($product);
63
+ $images = $this->_getProductImages($product, $parentProduct);
64
+
65
  if (!$disabledOnFruugo &&
66
  $product->getSku() !== null &&
67
  $product->getName() !== null &&
68
  $product->getDescription() !== null &&
69
  $product->getPrice() !== null &&
70
+ count($images) > 0) {
71
  $productXml = $productsXml->addChild('Product');
72
+ $productXml = $this->_fillProductXml($productXml, $product, $storelangsMapping);
73
  }
74
  }
75
 
78
  }
79
  }
80
 
81
+ public function _fillProductXml($productXml, $product, $storelangsMapping)
82
  {
83
  // M: Mandatory R: Recommended O: Optional
84
+ $parentProduct = $this->_getParentProduct($product);
 
 
 
85
 
86
  // ProductId *M
87
+ if (isset($parentProduct)) {
 
88
  $productXml->addChild('ProductId', $parentProduct->getId());
89
  } else {
90
  $productXml->addChild('ProductId', $product->getId());
128
  }
129
 
130
  // Imageurl1 *M
 
 
131
  // Imageurl2, Imageurl3, Imageurl4, Imageurl5 *R
132
+ $images = $this->_getProductImages($product, $parentProduct);
133
+ $imageIndex = 0;
134
+
135
+ foreach ($images as $image) {
136
+ if ($imageIndex >= 5) {
137
+ break;
138
+ }
139
+
140
+ $imageUrl = $image->getUrl();
141
+ if (strpos($imageUrl, 'placeholder') !== true) {
142
+ $productXml->addChild('Imageurl'.($imageIndex + 1), $imageUrl);
143
+ $imageIndex++;
144
+ }
145
+ }
146
 
147
  // StockStatus & StockQuantity *M
148
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
167
  // Description Node
168
  $stores = Mage::app()->getStores(false);
169
 
170
+ $addedLanguages = array();
171
  foreach ($stores as $store) {
172
  // store 'fruugo' is for Fruugo orders
173
  if ($store->getCode() != 'fruugo') {
174
+ $product = $product->setStoreId($store->getId())->load($product->getId());
175
 
176
  $localeCode = Mage::getStoreConfig('general/locale/code', $store->getId());
177
  $language = substr($localeCode, 0, strpos($localeCode, '_'));
178
 
179
+ // Make sure no language is added more than once
180
+ if (!in_array($language, $addedLanguages)) {
181
+ // Add description when no store selected for language OR the store is selected for the langauge in storelangsMapping array
182
+ if ($storelangsMapping == null || $storelangsMapping[$localeCode] == "" || $storelangsMapping[$localeCode] == $store->getCode()) {
183
+ // Language *R
184
+ $descriptionXml = $productXml->addChild('Description');
185
+ $descriptionXml->addChild('Language', $language);
186
+
187
+ $descriptionXml->addChild('Title', htmlspecialchars($product->getName()));
188
+
189
+ // description
190
+ $nestedDescriptionXml = $descriptionXml->addChild('Description');
191
+ $descriptionType = Mage::getStoreConfig('integration_options/products_options/descrption_type');
192
+
193
+ if ($descriptionType == 'long') {
194
+ $this->_addCData($nestedDescriptionXml, $product->getDescription());
195
+ } elseif ($descriptionType == 'short') {
196
+ $this->_addCData($nestedDescriptionXml, $product->getShortDescription());
197
+ } elseif ($descriptionType == 'merge_short_first') {
198
+ $this->_addCData($nestedDescriptionXml, $product->getShortDescription() . PHP_EOL . $product->getDescription());
199
+ } else {
200
+ $this->_addCData($nestedDescriptionXml, $product->getDescription() . PHP_EOL . $product->getShortDescription());
201
+ }
202
+
203
+ // AttributeColor *R
204
+ if ($product->getColor() !== null && $product->getAttributeText('color')) {
205
+ $descriptionXml->addChild('AttributeColor', $product->getAttributeText('color'));
206
+ }
207
+
208
+ // AttributeSize *R
209
+ if ($product->getShoeSize() !== null && $product->getAttributeText('shoe_size')) {
210
+ $descriptionXml->addChild('AttributeSize', $product->getAttributeText('shoe_size'));
211
+ } elseif ($product->getSize() !== null && $product->getAttributeText('size')) {
212
+ $descriptionXml->addChild('AttributeSize', $product->getAttributeText('size'));
213
+ }
214
+
215
+ // optional attributes: Arrtibute1 - Attribute10 *O
216
+ if ($product->getFit() !== null) {
217
+ $descriptionXml->addChild('Attribute1', $product->getFit());
218
+ }
219
+ if ($product->getLength() !== null) {
220
+ $descriptionXml->addChild('Attribute2', $product->getLength());
221
+ }
222
+ if ($product->getWidth() !== null) {
223
+ $descriptionXml->addChild('Attribute3', $product->getWidth());
224
+ }
225
+
226
+ array_push($addedLanguages, $language);
227
+ }
228
  }
229
  }
230
  }
250
  $priceXml->addChild('Country', $existingList);
251
  }
252
 
253
+ // Normal price.
254
+ $taxHelper = Mage::helper('tax');
255
+ $normalPriceExclTax = $taxHelper->getPrice($product, $product->getPrice(), false);
256
  $priceXml->addChild('NormalPriceWithoutVAT', number_format($normalPriceExclTax, 2, '.', ''));
257
 
258
+ // VATRate.
259
+ $taxCalculation = Mage::getModel('tax/calculation');
260
+ $request = $taxCalculation->getRateRequest(null, null, null, $store);
261
  $taxClassId = $product->getTaxClassId();
262
  $percent = $taxCalculation->getRate($request->setProductClassId($taxClassId));
263
  $priceXml->addChild('VATRate', number_format($percent, 2, '.', ''));
264
 
265
+ // Discount price
266
+ $finalPriceExclTax = $taxHelper->getPrice($product, $product->getFinalPrice(), false);
267
+ $rulePriceExclTax = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product, $normalPriceExclTax);
268
+ $discountedPriceExclTax = null;
269
+
270
+ if ($rulePriceExclTax == null || $finalPriceExclTax < $rulePriceExclTax) {
271
+ $discountedPriceExclTax = $finalPriceExclTax;
272
+ } else {
273
+ $discountedPriceExclTax = $rulePriceExclTax;
274
+ }
275
+ if ($normalPriceExclTax > $discountedPriceExclTax) {
276
+ $priceXml->addChild('DiscountPriceWithoutVAT', number_format($discountedPriceExclTax, 2, '.', ''));
277
+ // DiscountPriceStartDate *O
278
+ if ($product->getSpecialFromDate()) {
279
+ $fromTime = strtotime($product->getSpecialFromDate());
280
+ $formatedFromTimeStr = date('Y-m-d',$fromTime);
281
+ $priceXml->addChild('DiscountPriceStartDate', $formatedFromTimeStr);
282
+ }
283
+
284
+ // DiscountPriceEndDate *O
285
+ if ($product->getSpecialToDate()) {
286
+ $toTime = strtotime($product->getSpecialToDate());
287
+ $fromatedToTimeStr = date('Y-m-d',$toTime);
288
+ $priceXml->addChild('DiscountPriceEndDate', $fromatedToTimeStr);
289
+ }
290
+ }
291
  }
292
  }
293
 
294
  return $productXml;
295
  }
296
 
297
+ private function _getProductImages($product, $parentProduct)
298
+ {
299
+ $productObj = $product->load($product->getId());
300
+ $images = array();
301
+ $skuImages = array_values($productObj->getMediaGalleryImages()->getItems());
302
+
303
+ if (!empty($skuImages)) {
304
+ foreach ($skuImages as $skuImage) {
305
+ array_push($images, $skuImage);
306
+ }
307
+ }
308
+
309
+ if (isset($parentProduct)) {
310
+ $parentImages = array_values($parentProduct->getMediaGalleryImages()->getItems());
311
+ if (!empty($parentImages)) {
312
+ foreach ($parentImages as $parentImage) {
313
+ array_push($images, $parentImage);
314
+ }
315
+ }
316
+ }
317
+
318
+ return $images;
319
+ }
320
+
321
+ private function _getParentProduct($product)
322
+ {
323
+ $parentProduct = null;
324
+
325
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')
326
+ ->getParentIdsByChild($product->getId());
327
+
328
+ if (isset($parentIds[0])) {
329
+ $parentProduct = Mage::getModel('catalog/product')->load($parentIds[0]);
330
+ }
331
+
332
+ return $parentProduct;
333
+ }
334
+
335
  private function _addCData($xml, $cdata_text)
336
  {
337
  $node = dom_import_simplexml($xml);
app/code/community/Fruugo/Integration/Model/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Model/Adminhtml/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Model/Adminhtml/System/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Model/Adminhtml/System/Config/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Model/Adminhtml/System/Config/Backend/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/Model/Adminhtml/System/Config/Source/ProductDescriptionType.php CHANGED
@@ -38,7 +38,8 @@ class Fruugo_Integration_Model_Adminhtml_System_Config_Source_ProductDescription
38
 
39
  array_push($descriptionTypes, array('value' => 'long', 'label' => 'Description only'));
40
  array_push($descriptionTypes, array('value' => 'short', 'label' => 'Short description only'));
41
- array_push($descriptionTypes, array('value' => 'merge', 'label' => 'Merge description and short description'));
 
42
 
43
  return $descriptionTypes;
44
  }
38
 
39
  array_push($descriptionTypes, array('value' => 'long', 'label' => 'Description only'));
40
  array_push($descriptionTypes, array('value' => 'short', 'label' => 'Short description only'));
41
+ array_push($descriptionTypes, array('value' => 'merge', 'label' => 'Merge description and short description (description at first)'));
42
+ array_push($descriptionTypes, array('value' => 'merge_short_first', 'label' => 'Merge short description and description (short description at first)'));
43
 
44
  return $descriptionTypes;
45
  }
app/code/community/Fruugo/Integration/controllers/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/data/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/catalog/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/catalog/product/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/sales/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/sales/order/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/design/adminhtml/default/default/template/integration/sales/order/view/.DS_Store ADDED
Binary file
app/code/community/Fruugo/Integration/etc/config.xml CHANGED
@@ -24,7 +24,7 @@
24
  <config>
25
  <modules>
26
  <Fruugo_Integration>
27
- <version>1.0.4</version> <!-- Version number of your module -->
28
  </Fruugo_Integration>
29
  </modules>
30
  <global>
24
  <config>
25
  <modules>
26
  <Fruugo_Integration>
27
+ <version>1.0.5</version> <!-- Version number of your module -->
28
  </Fruugo_Integration>
29
  </modules>
30
  <global>
app/code/community/Fruugo/Integration/etc/system.xml CHANGED
@@ -109,6 +109,16 @@
109
  <show_in_store>1</show_in_store>
110
  <comment>Refresh countries mulitple select list to restrict product display on Fruugo</comment>
111
  </refresh_countries>
 
 
 
 
 
 
 
 
 
 
112
  </fields>
113
  </products_options>
114
  <orders_options translate="label" module="integration">
109
  <show_in_store>1</show_in_store>
110
  <comment>Refresh countries mulitple select list to restrict product display on Fruugo</comment>
111
  </refresh_countries>
112
+ <language_store translate="label">
113
+ <label>Langage Store Mapping</label>
114
+ <frontend_model>Fruugo_Integration_Block_Languagestoremapping</frontend_model>
115
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
116
+ <sort_order>50</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <comment>Choose a default store for a language to export product description.</comment>
121
+ </language_store>
122
  </fields>
123
  </products_options>
124
  <orders_options translate="label" module="integration">
app/design/adminhtml/default/default/template/integration/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/integration/catalog/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/integration/catalog/product/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/integration/sales/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/integration/sales/order/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/integration/sales/order/view/.DS_Store ADDED
Binary file
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fruugo_Integration</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/">GNU</license>
7
  <channel>community</channel>
@@ -14,11 +14,21 @@ This plugin mainly performs two tasks:&#xD;
14
  - Generate products xml feed from Magento periodically on a specified frequency.&#xD;
15
  &#xD;
16
  - Read from Fruugo Rrders API periodically on a specified frequency, and notifies Magento order events to Fruugo Orders API.</description>
17
- <notes>- Refactored both products feed force download and datafeed to return attached file</notes>
 
 
 
 
 
 
 
 
 
 
18
  <authors><author><name>inoutput.io</name><user>inoutput</user><email>support@inoutput.io</email></author><author><name>fruugo.com</name><user>Fruugo</user><email>support@fruugo.com</email></author></authors>
19
- <date>2015-10-09</date>
20
- <time>00:06:24</time>
21
- <contents><target name="magecommunity"><dir name="Fruugo"><dir name="Integration"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Tab.php" hash="412d5a38c07f78fd56e3509809038008"/></dir></dir><file name="Refreshcountriesbutton.php" hash="5a7e3af708dd470725981ec187b2c07d"/><dir name="Sales"><dir name="Order"><dir name="View"><file name="Tabs.php" hash="d98faeeede3c06d5f28f8f9731438314"/></dir></dir></dir></dir><dir name="Helper"><file name="ConfigLoader.php" hash="f930d687b44fe0a3a9e70383e0500a7c"/><file name="Data.php" hash="866fe8e1ea50749218d6efcab8454f28"/><file name="Defines.php" hash="a97616fe105332db06292c68eabecdf1"/><file name="FruugoCountriesSeeder.php" hash="68949469a1b1ce6a605fccd132e9e3c0"/><file name="Logger.php" hash="ac482415c8c1bc6643c81779f3d580c7"/><file name="OrdersFeedProcessor.php" hash="9e78e9e84c14f54d137c1da3c7502166"/><file name="ProductsFeedGenerator.php" hash="925303775a6a70f68e9b3467b9a4861b"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="OrderCron.php" hash="8187697b999171b8940be7e5306a3bc7"/><file name="ProductCron.php" hash="a8bdd62ad14cdb85d9ef0ae2b85cecad"/></dir><dir name="Source"><file name="Hour.php" hash="fab1337425532af32cf8642b8b244930"/><file name="ProductDescriptionType.php" hash="578f3cec24605d376d4014cf1e38d8cd"/></dir></dir></dir></dir><file name="Countries.php" hash="a23378525c616fd87c5589933aec48c6"/><file name="CronJobObserver.php" hash="e8ddc80c37a3ef2b4ce025879f04e7c0"/><file name="Observer.php" hash="1e16ebea05d59b472cc9f279965cd17e"/><file name="Payment.php" hash="4e7d2d72e7662ea71c178d85c9b9bd6c"/><dir name="Resource"><dir name="Countries"><file name="Collection.php" hash="618a95f1535d4c63724a2f7eaebf6c2b"/></dir><file name="Countries.php" hash="dc3da7aec3c3472a4ccd73e2b2f255f0"/><dir name="Shipment"><file name="Collection.php" hash="66d038f890e36403f9ffb2e283e88daf"/></dir><file name="Shipment.php" hash="d8c13444ba5089cf606241f2c7c9a87d"/></dir><file name="Shipment.php" hash="23b1c0b4bc4e29cb137c9b3819723a63"/></dir><dir name="controllers"><file name="OrdersController.php" hash="a2d9d2f4c916c376f146cfccecb4110d"/><file name="PackinglistController.php" hash="d76ac40e81f51635a073fb20492883f8"/><file name="ProductsController.php" hash="7b120e3ef0152ddc40821ef082786db4"/><file name=".gitignore" hash="acd4f929fc2eebc0a25a1b7a06b4f56f"/></dir><dir name="data"><dir name="fruugo_attributes_setup"><file name="data-install-0.1.1.php" hash="73a6210fdb6c5a2edfa0222a6a239e9a"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="integration.xml" hash="3f173b27f9f483c00b33b713c0bad737"/></dir><dir name="template"><dir name="integration"><dir name="catalog"><dir name="product"><file name="fruugo-allowed-countries.phtml" hash="066098b4583e6bd3882c01645bd9ed1d"/></dir></dir><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="packinglist.phtml" hash="9ec64369d5c23043976b08573f3435dd"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="31cc0f7999569eb84c03c5165def1a1f"/><file name="system.xml" hash="23f4aed73b504d8b2d9dcca61af44fa6"/></dir><file name="fruugo_countries.json" hash="b4406193557bcce77104c2e669be65a5"/><dir name="sql"><dir name="fruugo_attributes_setup"><file name="install-0.1.1.php" hash="326629d7305e3c3b20aaf8d97de1f17b"/></dir></dir><file name=".gitignore" hash="f0cb20b35e2469e9e9617f658ed452a5"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="integration.xml" hash="3f173b27f9f483c00b33b713c0bad737"/></dir><dir name="template"><dir name="integration"><dir name="catalog"><dir name="product"><file name="fruugo-allowed-countries.phtml" hash="066098b4583e6bd3882c01645bd9ed1d"/></dir></dir><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="packinglist.phtml" hash="9ec64369d5c23043976b08573f3435dd"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fruugo_Integration.xml" hash="b01dcb5088d487517bd87af216d6d7c8"/></dir></target></contents>
22
  <compatible/>
23
- <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max/></package></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Fruugo_Integration</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/">GNU</license>
7
  <channel>community</channel>
14
  - Generate products xml feed from Magento periodically on a specified frequency.&#xD;
15
  &#xD;
16
  - Read from Fruugo Rrders API periodically on a specified frequency, and notifies Magento order events to Fruugo Orders API.</description>
17
+ <notes>This update includes:&#xD;
18
+ &#xD;
19
+ - Up to 5 images for a product in the products feed&#xD;
20
+ &#xD;
21
+ - Added a configuration section for multiple stores with the same language to choose which store to use to export product description for that language in order to avoid duplicate product description of the same language&#xD;
22
+ &#xD;
23
+ - Added options to choose product description and short description merge order&#xD;
24
+ &#xD;
25
+ - Add product discount price when it is set&#xD;
26
+ &#xD;
27
+ - Custom Fruugo shipping method for Fruugo orders</notes>
28
  <authors><author><name>inoutput.io</name><user>inoutput</user><email>support@inoutput.io</email></author><author><name>fruugo.com</name><user>Fruugo</user><email>support@fruugo.com</email></author></authors>
29
+ <date>2015-11-11</date>
30
+ <time>10:01:57</time>
31
+ <contents><target name="magecommunity"><dir name="Fruugo"><dir name="Integration"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Tab.php" hash="412d5a38c07f78fd56e3509809038008"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="c0c814fd19a01064c6737a7a33f53c0a"/></dir><file name="Languagestoremapping.php" hash="7852846c2428b4fc15434a1e78a37de7"/><file name="Refreshcountriesbutton.php" hash="5a7e3af708dd470725981ec187b2c07d"/><dir name="Sales"><dir name="Order"><dir name="View"><file name="Tabs.php" hash="d98faeeede3c06d5f28f8f9731438314"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="55b80dc008f359a78148ef0fc1722049"/></dir><file name=".DS_Store" hash="bbae86b9af10fdcbf50c8644074ed58c"/></dir><file name=".DS_Store" hash="26d674cc95490ff01df42facb067195e"/></dir><dir name="Helper"><file name="ConfigLoader.php" hash="f930d687b44fe0a3a9e70383e0500a7c"/><file name="Data.php" hash="866fe8e1ea50749218d6efcab8454f28"/><file name="Defines.php" hash="a97616fe105332db06292c68eabecdf1"/><file name="FruugoCountriesSeeder.php" hash="68949469a1b1ce6a605fccd132e9e3c0"/><file name="Logger.php" hash="ac482415c8c1bc6643c81779f3d580c7"/><file name="OrdersFeedProcessor.php" hash="c0969f7217b6e4eb1c875e00afc21227"/><file name="ProductsFeedGenerator.php" hash="7214dd26f546cbe722ed90060e81f3e2"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="OrderCron.php" hash="8187697b999171b8940be7e5306a3bc7"/><file name="ProductCron.php" hash="a8bdd62ad14cdb85d9ef0ae2b85cecad"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Source"><file name="Hour.php" hash="fab1337425532af32cf8642b8b244930"/><file name="ProductDescriptionType.php" hash="4a2810baeabe1a74b1b06b92cc2e4481"/></dir><file name=".DS_Store" hash="d20a4947c565c165a828059468e40615"/></dir><file name=".DS_Store" hash="9edeb8e2463be37d84dbbb69544fcf33"/></dir><file name=".DS_Store" hash="2429e61ffca453f96749fe4e336e1aa6"/></dir><file name="Countries.php" hash="a23378525c616fd87c5589933aec48c6"/><file name="CronJobObserver.php" hash="e8ddc80c37a3ef2b4ce025879f04e7c0"/><file name="Observer.php" hash="1e16ebea05d59b472cc9f279965cd17e"/><file name="Payment.php" hash="4e7d2d72e7662ea71c178d85c9b9bd6c"/><dir name="Resource"><dir name="Countries"><file name="Collection.php" hash="618a95f1535d4c63724a2f7eaebf6c2b"/></dir><file name="Countries.php" hash="dc3da7aec3c3472a4ccd73e2b2f255f0"/><dir name="Shipment"><file name="Collection.php" hash="66d038f890e36403f9ffb2e283e88daf"/></dir><file name="Shipment.php" hash="d8c13444ba5089cf606241f2c7c9a87d"/></dir><file name="Shipment.php" hash="23b1c0b4bc4e29cb137c9b3819723a63"/><file name=".DS_Store" hash="79784d7aed8dd8e37e943705186d586f"/></dir><dir name="controllers"><file name="OrdersController.php" hash="a2d9d2f4c916c376f146cfccecb4110d"/><file name="PackinglistController.php" hash="d76ac40e81f51635a073fb20492883f8"/><file name="ProductsController.php" hash="7b120e3ef0152ddc40821ef082786db4"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/><file name=".gitignore" hash="acd4f929fc2eebc0a25a1b7a06b4f56f"/></dir><dir name="data"><dir name="fruugo_attributes_setup"><file name="data-install-0.1.1.php" hash="73a6210fdb6c5a2edfa0222a6a239e9a"/></dir><file name=".DS_Store" hash="cd195b6eaf08907f8b960d088eb658ec"/></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="integration.xml" hash="3f173b27f9f483c00b33b713c0bad737"/></dir><dir name="template"><dir name="integration"><dir name="catalog"><dir name="product"><file name="fruugo-allowed-countries.phtml" hash="066098b4583e6bd3882c01645bd9ed1d"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="40954a645387438ecf1cfd83dd604862"/></dir><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="packinglist.phtml" hash="9ec64369d5c23043976b08573f3435dd"/></dir><file name=".DS_Store" hash="d26113bef03e4a93d3b16a9aacd87cfc"/></dir><file name=".DS_Store" hash="96bd4b45d72afef63db9e4ca6973ea7a"/></dir><file name=".DS_Store" hash="6ab1f047e942f2d939c7cccba9d7b5cf"/></dir><file name=".DS_Store" hash="5e3b5dca196bbd2c9702ade45af32abd"/></dir><file name=".DS_Store" hash="8140bb817e4002386b236a695bbe7526"/></dir><file name=".DS_Store" hash="0553606a64967b5a5e9465482611d59e"/></dir><file name=".DS_Store" hash="3e9bb37c55f91d8adc5fc6c5179e5981"/></dir><file name=".DS_Store" hash="3d0d0b6a6dd6a3990a86b24a0e6799f4"/></dir><file name=".DS_Store" hash="466e7eaa43e0d7602b4cf93b7e8e7c85"/></dir><dir name="etc"><file name="config.xml" hash="1deb80a937fd57e530c5ffb0a77ad727"/><file name="system.xml" hash="26af0cc51ddccb6b91aadf9ff68c32ee"/></dir><dir name="sql"><dir name="fruugo_attributes_setup"><file name="install-0.1.1.php" hash="326629d7305e3c3b20aaf8d97de1f17b"/></dir></dir><file name=".DS_Store" hash="ffc18567b95ae1fb2526dd57d74e8006"/><file name=".gitignore" hash="f0cb20b35e2469e9e9617f658ed452a5"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="integration.xml" hash="3f173b27f9f483c00b33b713c0bad737"/></dir><dir name="template"><dir name="integration"><dir name="catalog"><dir name="product"><file name="fruugo-allowed-countries.phtml" hash="066098b4583e6bd3882c01645bd9ed1d"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="40954a645387438ecf1cfd83dd604862"/></dir><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="packinglist.phtml" hash="9ec64369d5c23043976b08573f3435dd"/></dir><file name=".DS_Store" hash="d26113bef03e4a93d3b16a9aacd87cfc"/></dir><file name=".DS_Store" hash="96bd4b45d72afef63db9e4ca6973ea7a"/></dir><file name=".DS_Store" hash="6ab1f047e942f2d939c7cccba9d7b5cf"/></dir><file name=".DS_Store" hash="5e3b5dca196bbd2c9702ade45af32abd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fruugo_Integration.xml" hash="b01dcb5088d487517bd87af216d6d7c8"/></dir></target></contents>
32
  <compatible/>
33
+ <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.8</min><max/></package></required></dependencies>
34
  </package>