Trendyr_Trendyrshare - Version 1.0.2

Version Notes

Tendyr module repackaged with createButton() features.

Download this release

Release Info

Developer Steve Barbera
Extension Trendyr_Trendyrshare
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.2

app/code/local/Trendyr/Trendyrshare/Block/Template.php CHANGED
@@ -2,7 +2,7 @@
2
  class Trendyr_Trendyrshare_Block_Template extends Mage_Core_Block_Template
3
  {
4
  public function fetchView($fileName)
5
- {
6
  //ignores file name, just uses a simple include with template name
7
  $path = Mage::getModuleDir('', 'Trendyr_Trendyrshare').'/templates';
8
  $file = pathinfo($fileName);
@@ -10,4 +10,6 @@
10
  $path = $path.'/'.$file;
11
  include($path);
12
  }
13
- }
 
 
2
  class Trendyr_Trendyrshare_Block_Template extends Mage_Core_Block_Template
3
  {
4
  public function fetchView($fileName)
5
+ {
6
  //ignores file name, just uses a simple include with template name
7
  $path = Mage::getModuleDir('', 'Trendyr_Trendyrshare').'/templates';
8
  $file = pathinfo($fileName);
10
  $path = $path.'/'.$file;
11
  include($path);
12
  }
13
+ }
14
+
15
+
app/code/local/Trendyr/Trendyrshare/Model/Trendyrshare.php CHANGED
@@ -8,6 +8,7 @@ class Trendyr_Trendyrshare_Model_Trendyrshare extends Varien_Object{
8
  {
9
 
10
 
 
11
  //if there's not a merch key, shut it down.
12
  if(!$merchant_public_key = self::get_merch_key()){return false;}
13
 
@@ -25,13 +26,20 @@ class Trendyr_Trendyrshare_Model_Trendyrshare extends Varien_Object{
25
  private function trendyr_curl($trendyr_product_data, $social_key = null)
26
  {
27
 
28
-
29
- $trendyr_url = 'http://sandbox.trendyr.com'; //dev url
30
-
 
 
 
 
 
 
 
31
  //is there a social key? make a url choice based on that.
32
  $social_key ?
33
- $url = $trendyr_url.'/transaction/update/'.$social_key :
34
- $url = $trendyr_url.'/transaction/create';
35
 
36
  $trendyr_product_data_string = http_build_query($trendyr_product_data);
37
 
8
  {
9
 
10
 
11
+
12
  //if there's not a merch key, shut it down.
13
  if(!$merchant_public_key = self::get_merch_key()){return false;}
14
 
26
  private function trendyr_curl($trendyr_product_data, $social_key = null)
27
  {
28
 
29
+ //grab the URL from the db
30
+ $resource = Mage::getSingleton('core/resource');
31
+ $read_connection = $resource->getConnection('core_read');
32
+ $table_name = $resource->getTableName('trendyrshare');
33
+ $q = "SELECT * from $table_name";
34
+ $r = $read_connection->fetchAll($q);
35
+
36
+ $api_url = pathinfo($r[0]['jsmode']);
37
+ $api_url = $api_url['dirname'];
38
+
39
  //is there a social key? make a url choice based on that.
40
  $social_key ?
41
+ $url = $api_url.'/transaction/update/'.$social_key :
42
+ $url = $api_url.'/transaction/create';
43
 
44
  $trendyr_product_data_string = http_build_query($trendyr_product_data);
45
 
app/code/local/Trendyr/Trendyrshare/controllers/IndexController.php CHANGED
@@ -5,12 +5,10 @@ class Trendyr_Trendyrshare_IndexController extends Mage_Adminhtml_Controller_Act
5
 
6
  public function indexAction()
7
  {
8
-
9
  $this->loadLayout();
10
- $block = $this->getLayout()->createBlock('trendyrshare/template')
11
- ->setTemplate('form_block_action.phtml');
12
-
13
- $this->_addContent($block);
14
  $this->renderLayout();
15
 
16
 
5
 
6
  public function indexAction()
7
  {
 
8
  $this->loadLayout();
9
+ //$this->_initCssBlock();
10
+
11
+ $this->_addContent($this->getLayout()->createBlock('trendyrshare/template')->setTemplate('form_block_action.phtml'));
 
12
  $this->renderLayout();
13
 
14
 
app/code/local/Trendyr/Trendyrshare/sql/trendyrshare_setup/mysql4-install-1.0.php CHANGED
@@ -9,17 +9,17 @@
9
  DROP TABLE IF EXISTS {$this->getTable('trendyrshare')};
10
 
11
  CREATE TABLE {$this->getTable('trendyrshare')} (
12
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
13
- `jsmode` varcar(255) NOT NULL default '',
14
- `tcopy` text,
15
- `merchantkey` varchar(255) NOT NULL default '',
16
- PRIMARY KEY (`id`)
17
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
-
19
  ");
 
20
 
21
  $installer->run("INSERT INTO {$this->getTable('trendyrshare')} (merchantkey) VALUES ('');");
22
- $installer->run("INSERT INTO {$this->getTable('trendyrshare')} (jsmode) VALUES ('https://api.trendyr.com/trendyr.js');");
23
 
24
  $installer->run("
25
 
9
  DROP TABLE IF EXISTS {$this->getTable('trendyrshare')};
10
 
11
  CREATE TABLE {$this->getTable('trendyrshare')} (
12
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
13
+ `merchantkey` varchar(255) NOT NULL DEFAULT '',
14
+ `jsmode` varchar(255) DEFAULT NULL,
15
+ `tcopy` text,
16
+ PRIMARY KEY (`id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
18
  ");
19
+
20
 
21
  $installer->run("INSERT INTO {$this->getTable('trendyrshare')} (merchantkey) VALUES ('');");
22
+ $installer->run("UPDATE {$this->getTable('trendyrshare')} set jsmode='https://api.trendyr.com/trendyr.js' WHERE id=1;");
23
 
24
  $installer->run("
25
 
app/code/local/Trendyr/Trendyrshare/templates/form_block_action.phtml CHANGED
@@ -29,7 +29,7 @@ if($_POST['update'] == 1)
29
 
30
  if($_POST['jsmode'])
31
  {
32
-
33
  $jsmode = $_POST['jsmode'];
34
  $q = "UPDATE $table_name SET jsmode='$jsmode' WHERE id=1";
35
  $write_connection->query($q);
29
 
30
  if($_POST['jsmode'])
31
  {
32
+ echo 'fired jsmode';
33
  $jsmode = $_POST['jsmode'];
34
  $q = "UPDATE $table_name SET jsmode='$jsmode' WHERE id=1";
35
  $write_connection->query($q);
app/code/local/Trendyr/Trendyrshare/templates/resources/trendyr.js DELETED
File without changes
app/code/local/Trendyr/Trendyrshare/templates/resources/trendyr_background.png DELETED
Binary file
app/code/local/Trendyr/Trendyrshare/templates/resources/trendyr_fish.png DELETED
Binary file
app/design/frontend/default/default/template/trendyrshare/on_success.phtml CHANGED
@@ -1,14 +1,17 @@
1
  <?php if($_SESSION['trendyr']) : ?>
2
  <?php
3
- $resource = Mage::getSingleton('core/resource');
4
- $read_connection = $resource->getConnection('core_read');
5
- $table_name = $resource->getTableName('trendyrshare');
6
- $q = "SELECT * from $table_name";
7
- $r = $read_connection->fetchAll($q);
8
- $jsmode = $r[0]['jsmode'];
 
 
 
9
 
10
  ?>
11
- <script type="text/javascript" src="<?=$jsmode?>"></script>
12
  <script>
13
  var trendyr = new Trendyr('<?=$_SESSION['trendyr']['transaction_social_key']?>');
14
  trendyr.transactionComplete();
1
  <?php if($_SESSION['trendyr']) : ?>
2
  <?php
3
+
4
+ $resource = Mage::getSingleton('core/resource');
5
+ $read_connection = $resource->getConnection('core_read');
6
+ $table_name = $resource->getTableName('trendyrshare');
7
+ $q = "SELECT * from $table_name";
8
+ $r = $read_connection->fetchAll($q);
9
+ $jsmode = $r[0]['jsmode'];
10
+ $url = $jsmode;
11
+
12
 
13
  ?>
14
+ <script type="text/javascript" src="<?=$url?>"></script>
15
  <script>
16
  var trendyr = new Trendyr('<?=$_SESSION['trendyr']['transaction_social_key']?>');
17
  trendyr.transactionComplete();
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Trendyr_Trendyrshare</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">APACHE V2</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This extension allows a checkout to use the Trendyr service.</summary>
10
- <description>This extension allows a checkout to use the Trendyr service.</description>
11
- <notes>This is tested to run with the default checkout setup.</notes>
12
- <authors><author><name>Trendyr</name><user>trendyr</user><email>info@trendyr.com</email></author></authors>
13
- <date>2012-08-07</date>
14
- <time>15:13:42</time>
15
- <contents><target name="magelocal"><dir name="Trendyr"><dir name="Trendyrshare"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Total.php" hash="411a319e2b492a22544bef8809802b7a"/></dir></dir><file name="Template.php" hash="ab50f42f19119b08b0a29559bf13e115"/></dir><dir name="Helper"><file name="Data.php" hash="5ff36855d52b16de7cf6ac9c29469c3e"/></dir><dir name="Model"><file name="Observer.php" hash="21afccea7c98498c73a8cc708b239755"/><dir name="Sales"><dir name="Order"><dir name="Total"><dir name="Creditmemo"><file name="Trendyr.php" hash="46790941ddf158f1a34a180e35a8205a"/></dir><dir name="Invoice"><file name="Trendyr.php" hash="2a313d89b5ee0ccc004153555b70aac9"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Trendyrshare.php" hash="4914701d5fa568a1267b738836c3cca6"/></dir></dir></dir></dir><file name="Trendyrshare.php" hash="46f13f65280452f31d03ffea760d032c"/></dir><dir name="controllers"><file name="IndexController.php" hash="db00d66bd927109405c922694e8a2218"/></dir><dir name="etc"><file name="config.xml" hash="14229c1257a637cc7c0846de73b811c5"/></dir><dir name="sql"><dir name="trendyrshare_setup"><file name="mysql4-install-1.0.php" hash="6838031d37e0fac933c27a6378f7e99f"/></dir></dir><dir name="templates"><file name="form_block_action.phtml" hash="915b9844a6488c83ac5f46e4ec4c04a6"/><dir name="resources"><file name="trendyr.js" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="trendyr_background.png" hash="c7d74d45f01e20bafc11e8d16fa0ce87"/><file name="trendyr_fish.png" hash="fab6eefa84f91e0af3e9d86904bdaa3e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="trendyrshare.xml" hash="0b8577cc69cf51735414180da439df24"/></dir><dir name="template"><dir name="trendyrshare"><file name="cart_trendyr_button.phtml" hash="1338073a019aa8d07bdff1a5970bb582"/><file name="on_success.phtml" hash="94f5e49d2ac1234a8574a23e33fceb1a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Trendyr_Trendyrshare.xml" hash="8ba423b88e654a90e0b9fb4a695aa7f9"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Trendyr_Trendyrshare</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/apachepl.php">ASL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Trendyr module allows sharing of products on social networks for a discount</summary>
10
+ <description>Trendyr module allows sharing of products on social networks for a discount</description>
11
+ <notes>Tendyr module repackaged with createButton() features.</notes>
12
+ <authors><author><name>Steve Barbera</name><user>Trendyr</user><email>info@trendyr.com</email></author></authors>
13
+ <date>2012-08-16</date>
14
+ <time>15:31:39</time>
15
+ <contents><target name="magelocal"><dir name="Trendyr"><dir name="Trendyrshare"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Total.php" hash="411a319e2b492a22544bef8809802b7a"/></dir></dir><file name="Template.php" hash="92d8091e27a0c02f34115ae94faa00db"/></dir><dir name="Helper"><file name="Data.php" hash="5ff36855d52b16de7cf6ac9c29469c3e"/></dir><dir name="Model"><file name="Observer.php" hash="21afccea7c98498c73a8cc708b239755"/><dir name="Sales"><dir name="Order"><dir name="Total"><dir name="Creditmemo"><file name="Trendyr.php" hash="46790941ddf158f1a34a180e35a8205a"/></dir><dir name="Invoice"><file name="Trendyr.php" hash="2a313d89b5ee0ccc004153555b70aac9"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Trendyrshare.php" hash="4914701d5fa568a1267b738836c3cca6"/></dir></dir></dir></dir><file name="Trendyrshare.php" hash="013dd61cb622d2247b2e7dcddea4be46"/></dir><dir name="controllers"><file name="IndexController.php" hash="868c96c7b48becda2b4803f11595e9e7"/></dir><dir name="etc"><file name="config.xml" hash="14229c1257a637cc7c0846de73b811c5"/></dir><dir name="sql"><dir name="trendyrshare_setup"><file name="mysql4-install-1.0.php" hash="008622ca2016ec58ef38458ca8f3de32"/></dir></dir><dir name="templates"><file name="form_block_action.phtml" hash="a6ec2f3c540fa0cb128dd65dc8a0b70f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="trendyrshare.xml" hash="0b8577cc69cf51735414180da439df24"/></dir><dir name="template"><dir name="trendyrshare"><file name="cart_trendyr_button.phtml" hash="1338073a019aa8d07bdff1a5970bb582"/><file name="on_success.phtml" hash="3d5173afa1f42c1147879e035fb57769"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Trendyr_Trendyrshare.xml" hash="8ba423b88e654a90e0b9fb4a695aa7f9"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.17</min><max>5.3.15</max></php></required></dependencies>
18
  </package>