Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Magmodules committed May 30, 2017
0 parents commit e3c2d26
Show file tree
Hide file tree
Showing 22 changed files with 757 additions and 0 deletions.
Empty file added .gitignore
Empty file.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Ekomi Rich Snippets for Magento® 1

Show your ratings from Ekomi on your homepage and use them for the Rich Snippets so the Rich Snippets will be shown in the most popular search engines.

## Development by Magmodules

We are a Dutch Magento® Only Agency dedicated to the development of extensions for Magento® 1 and Magento® 2. All our extensions are coded by our own team and our support team is always there to help you out.

## Links

[Visit Magmodules.eu](https://www.magmodules.eu/)

[Terms and Conditions](https://www.magmodules.eu/terms.html)

[Contact Us](https://www.magmodules.eu/contact-us.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magmodules.eu so we can send you a copy immediately.
*
* @category Magmodules
* @package Magmodules_Ekomisnippets
* @author Magmodules <info@magmodules.eu>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Magmodules_Ekomisnippets_Block_Adminhtml_System_Config_Form_Field_Heading
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
{

/**
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$useContainerId = $element->getData('use_container_id');
return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
$element->getHtmlId(), $element->getLabel()
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magmodules.eu so we can send you a copy immediately.
*
* @category Magmodules
* @package Magmodules_Ekomisnippets
* @author Magmodules <info@magmodules.eu>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Magmodules_Ekomisnippets_Block_Adminhtml_System_Config_Form_Field_Version
extends Mage_Adminhtml_Block_System_Config_Form_Field
{

/**
* @param Varien_Data_Form_Element_Abstract $element
*
* @return mixed
*/
public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
return Mage::getConfig()->getNode()->modules->Magmodules_Ekomisnippets->version;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magmodules.eu so we can send you a copy immediately.
*
* @category Magmodules
* @package Magmodules_Ekomisnippets
* @author Magmodules <info@magmodules.eu>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Magmodules_Ekomisnippets_Block_Adminhtml_Widget_Info_Info
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {

/**
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$magento_version = Mage::getVersion();
$module_version = Mage::getConfig()->getNode()->modules->Magmodules_Ekomisnippets->version;
$logo_link = '//www.magmodules.eu/logo/kiyohsnippets/' . $module_version . '/' . $magento_version . '/logo.png';

$html = '<div style="background:url(\'' . $logo_link . '\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
<h4>About Magmodules.eu</h4>
<p>We are a Magento only E-commerce Agency located in the Netherlands.<br>
<br />
<table width="500px" border="0">
<tr>
<td width="58%">View more extensions from us:</td>
<td width="42%"><a href="http://www.magentocommerce.com/magento-connect/developer/Magmodules" target="_blank">Magento Connect</a></td>
</tr>
<tr>
<td>Send us an E-mail:
<td><a href="mailto:info@magmodules.eu">info@magmodules.eu</a></td>
</tr>
<tr>
<td height="30">Visit our website:</td>
<td><a href="http://www.magmodules.eu" target="_blank">www.magmodules.eu</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="30"><strong>Need help?</strong></td>
<td><strong><a href="http://www.magmodules.eu/help/ekomi-rich-snippets" target="_blank">Online manual</a></strong></td>
</tr>
</table>
</div>';
return $html;
}

}
66 changes: 66 additions & 0 deletions app/code/local/Magmodules/Ekomisnippets/Block/Snippets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magmodules.eu so we can send you a copy immediately.
*
* @category Magmodules
* @package Magmodules_Ekomisnippets
* @author Magmodules <info@magmodules.eu>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Magmodules_Ekomisnippets_Block_Snippets extends Mage_Core_Block_Template
{

/**
* @return mixed
*/
public function getSnapshopRequest()
{
return $this->helper('ekomisnippets')->getSnapshopRequest();
}

/**
* @return mixed
*/
public function getEkomiLink()
{
return $this->helper('ekomisnippets')->getEkomiLink();
}

/**
* @param $rating
*
* @return mixed
*/
public function getEkomiStars($rating)
{
return $this->helper('ekomisnippets')->getEkomiStars($rating);
}

/**
*
*/
protected function _construct()
{
parent::_construct();
$this->addData(array(
'cache_lifetime' => 7200,
'cache_tags' => array(Mage_Cms_Model_Block::CACHE_TAG, 'ekomisnippets_block'),
'cache_key' => 'ekomisnippets-snippets-block',
));
if (Mage::getStoreConfig('ekomisnippets/api/enabled')) {
$this->setTemplate('magmodules/ekomisnippets/block.phtml');
}
}

}
75 changes: 75 additions & 0 deletions app/code/local/Magmodules/Ekomisnippets/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magmodules.eu so we can send you a copy immediately.
*
* @category Magmodules
* @package Magmodules_Ekomisnippets
* @author Magmodules <info@magmodules.eu>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Magmodules_Ekomisnippets_Helper_Data extends Mage_Core_Helper_Abstract
{

/**
* @return bool
*/
function getSnapshopRequest()
{
$ekomiApiId = Mage::getStoreConfig('ekomisnippets/api/api_id');
$ekomiApiKey = Mage::getStoreConfig('ekomisnippets/api/api_key');
$ekomiVersion = 'cust-1.0.0';

if ($ekomiApiId && $ekomiApiKey) {
$api = 'http://api.ekomi.de/v2/wsdl';
$client = new SoapClient($api, array('exceptions' => 0));
$sendSnapshotRequest = $client->getSnapshot($ekomiApiId . '|' . $ekomiApiKey, $ekomiVersion);
$ret = unserialize(utf8_decode($sendSnapshotRequest));
if ($ret['done']) {
$snippets = $ret['info'];
if ($snippets['fb_count'] > 0) {
return $snippets;
}
}
}
return false;
}

/**
* @return bool|string
*/
function getEkomiLink()
{
if (Mage::getStoreConfig('ekomisnippets/api/show_link')) {
$ekomiLink = Mage::getStoreConfig('ekomisnippets/api/ekomi_link');
return Mage::helper('ekomisnippets')->__('customer reviews on') . ' <a href="' . $ekomiLink . '" target="_blank">Ekomi</a>';
} else {
return false;
}
}

/**
* @param $rating
*
* @return string
*/
function getEkomiStars($rating)
{
$perc = round(($rating * 20), 0);
$html = '<div class="rating-box">';
$html .= ' <div class="rating" style="width:' . $perc . '%"></div>';
$html .= '</div>';
return $html;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magmodules.eu so we can send you a copy immediately.
*
* @category Magmodules
* @package Magmodules_Ekomisnippets
* @author Magmodules <info@magmodules.eu>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Magmodules_Ekomisnippets_Model_System_Config_Flushcache extends Mage_Core_Model_Config_Data {

/**
*
*/
protected function _afterSave() {
Mage::app()->cleanCache('ekomisnippets_block');
}

}
40 changes: 40 additions & 0 deletions app/code/local/Magmodules/Ekomisnippets/etc/adminhtml.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<!--
~ Magmodules.eu - http://www.magmodules.eu
~
~ NOTICE OF LICENSE
~ This source file is subject to the Open Software License (OSL 3.0)
~ that is bundled with this package in the file LICENSE.txt.
~ It is also available through the world-wide-web at this URL:
~ http://opensource.org/licenses/osl-3.0.php
~ If you did not receive a copy of the license and are unable to
~ obtain it through the world-wide-web, please send an email
~ to info@magmodules.eu so we can send you a copy immediately.
~
~ @category Magmodules
~ @package Magmodules_Ekomisnippets
~ @author Magmodules <info@magmodules.eu>
~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
-->
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<ekomisnippets translate="title" module="ekomisnippets">
<title>Ekomi Rich Snippets</title>
</ekomisnippets>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
Loading

0 comments on commit e3c2d26

Please sign in to comment.