LetsSyncroLLC_Oct8ne - Version 1.1.6

Version Notes

Notes

Download this release

Release Info

Developer Oct8ne
Extension LetsSyncroLLC_Oct8ne
Version 1.1.6
Comparing to
See all releases


Code changes from version 1.1.5 to 1.1.6

app/code/community/LetsSyncroLLC/Oct8ne/Block/Accountconfig.php CHANGED
@@ -223,6 +223,12 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
223
 
224
  if($letssyncro_enabled == '1' && ($letssyncro_licenseid == '' || strlen($letssyncro_licenseid) != 32))
225
  return false;
 
 
 
 
 
 
226
 
227
  return $letssyncromodel->setEnabled($letssyncro_enabled);
228
  }
@@ -317,7 +323,7 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
317
  return $response;
318
  }
319
 
320
- public function createXML_Logon($letssyncro_useremail, $letssyncro_password)
321
  {
322
  $DOM = new DOMDocument('1.0','UTF-8');
323
  $XML = $DOM->createElement('User');
@@ -333,6 +339,9 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
333
  // $currency = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
334
  $platform = $DOM->createElement('Platform', 'MAGENTO');
335
  $domain = $DOM->createElement('UrlDomain', str_replace("index.php/", "", Mage::getBaseUrl()));
 
 
 
336
 
337
  $XML->appendChild($baseurl);
338
  $XML->appendChild($checkouturl);
@@ -341,8 +350,13 @@ class LetsSyncroLLC_Oct8ne_Block_Accountconfig extends Mage_Core_Block_Template
341
  $XML->appendChild($loginurl);
342
  $XML->appendChild($Pass);
343
  $XML->appendChild($platform);
344
- $XML->appendChild($domain);
 
 
345
 
 
 
 
346
  return $DOM->saveXML($DOM->documentElement);
347
  }
348
 
223
 
224
  if($letssyncro_enabled == '1' && ($letssyncro_licenseid == '' || strlen($letssyncro_licenseid) != 32))
225
  return false;
226
+
227
+ $letssyncro_useremail = $letssyncrooptions['email'];
228
+ $letssyncro_password = $letssyncrooptions['password'];
229
+
230
+ $xmlData = $this->createXML_Logon($letssyncro_useremail, $letssyncro_password, $letssyncro_enabled ? 1: 0);
231
+ $this->sendRequest($xmlData, 'logon', $letssyncrooptions['urlapi']);
232
 
233
  return $letssyncromodel->setEnabled($letssyncro_enabled);
234
  }
323
  return $response;
324
  }
325
 
326
+ public function createXML_Logon($letssyncro_useremail, $letssyncro_password, $status_platform = null)
327
  {
328
  $DOM = new DOMDocument('1.0','UTF-8');
329
  $XML = $DOM->createElement('User');
339
  // $currency = $DOM->createElement('CheckoutUrl', Mage::helper('checkout/url')->getCheckoutUrl());
340
  $platform = $DOM->createElement('Platform', 'MAGENTO');
341
  $domain = $DOM->createElement('UrlDomain', str_replace("index.php/", "", Mage::getBaseUrl()));
342
+
343
+ if(!is_null($status_platform))
344
+ $StatusPlatform = $DOM->createElement('StatusPlatform', $status_platform);
345
 
346
  $XML->appendChild($baseurl);
347
  $XML->appendChild($checkouturl);
350
  $XML->appendChild($loginurl);
351
  $XML->appendChild($Pass);
352
  $XML->appendChild($platform);
353
+
354
+ if(!is_null($status_platform))
355
+ $XML->appendChild($StatusPlatform);
356
 
357
+
358
+ $XML->appendChild($domain);
359
+
360
  return $DOM->saveXML($DOM->documentElement);
361
  }
362
 
app/code/community/LetsSyncroLLC/Oct8ne/Helper/Data.php CHANGED
@@ -14,7 +14,9 @@
14
  $gallery_data = $product->getData( 'media_gallery' );
15
  foreach( $gallery_data['images'] as $image )
16
  $v[] = array(
17
- 'url' => Mage::getBaseUrl('media').'catalog/product'.$image['file']
 
 
18
  );
19
 
20
  return $v;
@@ -108,7 +110,7 @@
108
  $cat = Mage::getModel('catalog/category')->load($category_id) ;
109
  //get all products in this category
110
  foreach ($cat->getProductCollection() as $product){
111
- if(!in_array($product->getId(), $productIds)){
112
  $productIds[$product->getId()] = $product->getId();
113
  $productsInfo[] = self::getProductInfo($product->getId());
114
  }
14
  $gallery_data = $product->getData( 'media_gallery' );
15
  foreach( $gallery_data['images'] as $image )
16
  $v[] = array(
17
+ // 'url' => Mage::getBaseUrl('media').'catalog/product'.$image['file']
18
+ // 'url' => Mage::getUrl('oct8ne/frame/image', array('file' => 'catalog/product'.$image['file']))
19
+ 'url' => Mage::getUrl('oct8ne/frame/image') . '?file=' . 'catalog/product'.$image['file']
20
  );
21
 
22
  return $v;
110
  $cat = Mage::getModel('catalog/category')->load($category_id) ;
111
  //get all products in this category
112
  foreach ($cat->getProductCollection() as $product){
113
+ if(!in_array($product->getId(), $productIds) && $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED){
114
  $productIds[$product->getId()] = $product->getId();
115
  $productsInfo[] = self::getProductInfo($product->getId());
116
  }
app/code/community/LetsSyncroLLC/Oct8ne/controllers/FrameController.php CHANGED
@@ -676,4 +676,70 @@ class LetsSyncroLLC_Oct8ne_FrameController extends Mage_Core_Controller_Front_Ac
676
  $this->loadLayout();
677
  $this->renderLayout();
678
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
679
  };
676
  $this->loadLayout();
677
  $this->renderLayout();
678
  }
679
+
680
+
681
+
682
+ protected function resizeImg($fileName, $width, $height = null)
683
+ {
684
+ $folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
685
+ $imageURL = $folderURL . $fileName;
686
+
687
+ $basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . $fileName;
688
+ $newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "resized" . DS . $width . DS . $fileName;
689
+ //if width empty then return original size image's URL
690
+ if ($width != '') {
691
+ //if image has already resized then just return URL
692
+ if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
693
+ $imageObj = new Varien_Image($basePath);
694
+ if($imageObj->getOriginalWidth() <= $width)
695
+ return $basePath;
696
+ $imageObj->constrainOnly(TRUE);
697
+ $imageObj->keepAspectRatio(FALSE);
698
+ $imageObj->keepFrame(FALSE);
699
+ $imageObj->resize($width, $height);
700
+ $imageObj->save($newPath);
701
+ }
702
+ $resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "resized" . DS . $fileName;
703
+ } else {
704
+ $resizedURL = $imageURL;
705
+ }
706
+ return $newPath; // $resizedURL;
707
+ }
708
+
709
+ public function imageAction()
710
+ {
711
+ $base = Mage::getBaseDir('media');
712
+ $file = $this->getRequest()->getParam('file', null);
713
+ $width = $this->getRequest()->getParam('width', null);
714
+
715
+ if($width == null)
716
+ $newfile = "$base/$file";
717
+ else
718
+ $newfile = $this->resizeImg($file, $width);
719
+
720
+ $mime_types = array(
721
+ 'png' => 'image/png',
722
+ 'jpe' => 'image/jpeg',
723
+ 'jpeg' => 'image/jpeg',
724
+ 'jpg' => 'image/jpeg',
725
+ 'gif' => 'image/gif',
726
+ 'bmp' => 'image/bmp',
727
+ 'ico' => 'image/vnd.microsoft.icon',
728
+ 'tiff' => 'image/tiff',
729
+ 'tif' => 'image/tiff',
730
+ 'svg' => 'image/svg+xml',
731
+ 'svgz' => 'image/svg+xml',
732
+ );
733
+ $path_parts = pathinfo($newfile);
734
+ $mime = $mime_types[strtolower($path_parts['extension'])];
735
+
736
+ $this->getResponse()->clearHeaders();
737
+ $this->getResponse()->setHeader('Content-Type', $mime, true);
738
+ $this->getResponse()->setHeader('Cache-Control', 'max-age: 300', true);
739
+ $this->getResponse()->setHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + 86400), true);
740
+ $this->getResponse()->setHeader('Pragma', 'cache', true);
741
+ $this->getResponse()->setHeader('Age', '0', true);
742
+
743
+ $this->getResponse()->setBody(file_get_contents($newfile));
744
+ }
745
  };
app/code/community/LetsSyncroLLC/Oct8ne/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <LetsSyncroLLC_Oct8ne>
5
- <version>1.1.5</version>
6
  </LetsSyncroLLC_Oct8ne>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <LetsSyncroLLC_Oct8ne>
5
+ <version>1.1.6</version>
6
  </LetsSyncroLLC_Oct8ne>
7
  </modules>
8
  <global>
app/etc/modules/LetsSyncroLLC_Oct8ne.xml CHANGED
@@ -4,7 +4,7 @@
4
  <LetsSyncroLLC_Oct8ne>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- <version>1.1.5</version>
8
  <depends>
9
  <Mage_Eav/>
10
  <Mage_Dataflow/>
4
  <LetsSyncroLLC_Oct8ne>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <version>1.1.6</version>
8
  <depends>
9
  <Mage_Eav/>
10
  <Mage_Dataflow/>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LetsSyncroLLC_Oct8ne</name>
4
- <version>1.1.5</version>
5
  <stability>stable</stability>
6
  <license>license</license>
7
  <channel>community</channel>
@@ -10,8 +10,8 @@
10
  <description>Oct8ne extension description</description>
11
  <notes>Notes</notes>
12
  <authors><author><name>Oct8ne</name><user>Oct8ne</user><email>xavier.gonzalez@oct8ne.com</email></author></authors>
13
- <date>2014-03-21</date>
14
- <time>10:39:11</time>
15
  <contents>
16
  <target name="magecommunity">
17
  <dir name="LetsSyncroLLC">
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LetsSyncroLLC_Oct8ne</name>
4
+ <version>1.1.6</version>
5
  <stability>stable</stability>
6
  <license>license</license>
7
  <channel>community</channel>
10
  <description>Oct8ne extension description</description>
11
  <notes>Notes</notes>
12
  <authors><author><name>Oct8ne</name><user>Oct8ne</user><email>xavier.gonzalez@oct8ne.com</email></author></authors>
13
+ <date>2014-05-15</date>
14
+ <time>16:34:43</time>
15
  <contents>
16
  <target name="magecommunity">
17
  <dir name="LetsSyncroLLC">