Version Notes
Social Media Marketing Tool for Online Sellers
Download this release
Release Info
Developer | Mento |
Extension | mento |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- Mento-Installation.pdf +0 -0
- app/code/local/Mento/Social/Block/Adminhtml/Promotion.php +5 -0
- app/code/local/Mento/Social/Helper/Data.php +101 -0
- app/code/local/Mento/Social/Model/Product/Api.php +38 -0
- app/code/local/Mento/Social/controllers/Adminhtml/PromotionController.php +106 -0
- app/code/local/Mento/Social/etc/config.xml +100 -0
- app/code/local/Mento/Social/sql/social_setup/mysql4-install-0.1.0.php +16 -0
- app/design/adminhtml/default/default/layout/mento.xml +8 -0
- app/design/adminhtml/default/default/template/mento/promotion.phtml +52 -0
- app/etc/modules/Mento_Social.xml +14 -0
- package.xml +18 -0
Mento-Installation.pdf
ADDED
Binary file
|
app/code/local/Mento/Social/Block/Adminhtml/Promotion.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mento_Social_Block_Adminhtml_Promotion extends Mage_Adminhtml_Block_Template {
|
4 |
+
|
5 |
+
}
|
app/code/local/Mento/Social/Helper/Data.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mento_Social_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
public function checkRole() {
|
6 |
+
$objApiRole = Mage::getSingleton('api/roles');
|
7 |
+
$roleNames = $objApiRole->getCollection();
|
8 |
+
$roleNames->getSelect()->where('role_name=?','Mento');
|
9 |
+
$api_role_data = $roleNames->getData();
|
10 |
+
$theRoleExist = false;
|
11 |
+
if(!empty($api_role_data))
|
12 |
+
{
|
13 |
+
$theRoleExist = true;
|
14 |
+
}
|
15 |
+
|
16 |
+
return $theRoleExist;
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
public function checkUser() {
|
22 |
+
$user = Mage::getSingleton('api/user');
|
23 |
+
$apiUsernames = $user->getCollection();
|
24 |
+
$apiUsernames->getSelect()->where('username=?','Mento_Api_User');
|
25 |
+
$api_user_data = $apiUsernames->getData();
|
26 |
+
|
27 |
+
$theUserExist = false;
|
28 |
+
if(!empty($api_user_data))
|
29 |
+
{
|
30 |
+
$theUserExist = true;
|
31 |
+
}
|
32 |
+
|
33 |
+
return $theUserExist;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function deleteUser() {
|
37 |
+
$user = Mage::getSingleton('api/user');
|
38 |
+
$apiUsernames = $user->getCollection();
|
39 |
+
$apiUsernames->getSelect()->where('username=?','Mento_Api_User');
|
40 |
+
$api_user_data = $apiUsernames->getData();
|
41 |
+
|
42 |
+
if(!empty($api_user_data))
|
43 |
+
{
|
44 |
+
$user->setId($api_user_data[0]['user_id'])->delete();
|
45 |
+
}
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
public function validAPI() {
|
50 |
+
|
51 |
+
|
52 |
+
$theRoleExist = $this->checkRole();
|
53 |
+
|
54 |
+
$theUserExist = $this->checkUser();
|
55 |
+
|
56 |
+
if ( $theRoleExist and $theUserExist) {
|
57 |
+
return true;
|
58 |
+
} else {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
public function validtoken() {
|
64 |
+
$resource = Mage::getSingleton('core/resource');
|
65 |
+
$readConnection = $resource->getConnection('core_read');
|
66 |
+
$query = "SELECT mento_value FROM mento WHERE mento_id = '1' ";
|
67 |
+
$token = $readConnection->fetchOne($query);
|
68 |
+
|
69 |
+
if(strlen($token)==0) {
|
70 |
+
return false;
|
71 |
+
} else {
|
72 |
+
$ch = curl_init();
|
73 |
+
$url = "https://panel.mento.io/oauth/ping?access_token=".$token;
|
74 |
+
|
75 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
76 |
+
curl_setopt_array($ch, array(CURLOPT_RETURNTRANSFER => TRUE));
|
77 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
78 |
+
$responce = curl_exec($ch);
|
79 |
+
curl_close($ch);
|
80 |
+
|
81 |
+
$json = json_decode($responce,true);
|
82 |
+
|
83 |
+
if( $json['error'] == 1 )
|
84 |
+
{
|
85 |
+
return false;
|
86 |
+
} else {
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
public function gettoken() {
|
93 |
+
$resource = Mage::getSingleton('core/resource');
|
94 |
+
$readConnection = $resource->getConnection('core_read');
|
95 |
+
$query = "SELECT mento_value FROM mento WHERE mento_id = '1' ";
|
96 |
+
$token = $readConnection->fetchOne($query);
|
97 |
+
|
98 |
+
return $token;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
app/code/local/Mento/Social/Model/Product/Api.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mento_Social_Model_Product_Api extends Mage_Catalog_Model_Product_Api {
|
3 |
+
|
4 |
+
|
5 |
+
public function info($productId, $store = null, $attributes = null, $identifierType = null){
|
6 |
+
$product = $this->_getProduct($productId, $store, $identifierType);
|
7 |
+
$result = parent::info($productId, $store = null, $attributes = null, $identifierType = null);
|
8 |
+
//add a new element in here called product_url. You can even wrap it in some condition to see if the product is assigned to the current website or if the product is enabled or visible. ($product->getWebsiteIds(), $product->getStatus(), $product->getVisibility()).
|
9 |
+
|
10 |
+
$result['product_url'] = $product->getUrlInStore($store);
|
11 |
+
|
12 |
+
|
13 |
+
$gallery = $product->getTypeInstance(true)->getSetAttributes($product);
|
14 |
+
|
15 |
+
|
16 |
+
$galleryData = $product->getData('media_gallery');
|
17 |
+
|
18 |
+
$images = array();
|
19 |
+
if (!isset($galleryData['images']) || !is_array($galleryData['images'])) {
|
20 |
+
$images = array();
|
21 |
+
}
|
22 |
+
|
23 |
+
foreach ($galleryData['images'] as &$image) {
|
24 |
+
$images[] = array(
|
25 |
+
'file' => $image['file'],
|
26 |
+
'label' => $image['label'],
|
27 |
+
'position' => $image['position'],
|
28 |
+
'url' => Mage::getSingleton('catalog/product_media_config')->getMediaUrl($image['file'])
|
29 |
+
);
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
$result['gallery'] = $images;
|
34 |
+
return $result;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
}
|
app/code/local/Mento/Social/controllers/Adminhtml/PromotionController.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mento_Social_Adminhtml_PromotionController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('social');
|
9 |
+
|
10 |
+
$this->_title($this->__("Mento"));
|
11 |
+
|
12 |
+
//$fileContent = "Test";
|
13 |
+
//$block = $this->getLayout()->createBlock('core/text', 'socialpilot-block')->setText($fileContent);
|
14 |
+
//$this->_addContent($block);
|
15 |
+
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function apiroleAction() {
|
20 |
+
|
21 |
+
$theRoleExist = Mage::helper('social')->checkRole();
|
22 |
+
if(!$theRoleExist)
|
23 |
+
{
|
24 |
+
$role = Mage::getSingleton('api/roles')->setName('Mento')->setPid(false)->setRoleType('G')->save();
|
25 |
+
Mage::getSingleton("api/rules")->setRoleId($role->getId())->setResources(array('all'))->saveRel();
|
26 |
+
}
|
27 |
+
|
28 |
+
$objApiRole = Mage::getSingleton('api/roles');
|
29 |
+
$roleNames = $objApiRole->getCollection();
|
30 |
+
$roleNames->getSelect()->where('role_name=?','Mento');
|
31 |
+
$api_role_data = $roleNames->getData();
|
32 |
+
|
33 |
+
|
34 |
+
Mage::helper('social')->deleteUser();
|
35 |
+
|
36 |
+
$apiKey = uniqid();
|
37 |
+
$user = Mage::getSingleton('api/user');
|
38 |
+
$user->setData(array(
|
39 |
+
'username' => 'Mento_Api_User', 'firstname' => 'Mento', 'lastname' => 'Module', 'email' => 'support@mento.io',
|
40 |
+
'api_key' => $apiKey, 'api_key_confirmation' => $apiKey, 'is_active' => 1, 'user_roles' => '', 'assigned_user_role' => '',
|
41 |
+
'role_name' => '', 'roles' => array($api_role_data[0]['role_id'])
|
42 |
+
));
|
43 |
+
$user->save()->load($user->getId());
|
44 |
+
|
45 |
+
$user->setRoleIds(array($api_role_data[0]['role_id']))
|
46 |
+
->setRoleUserId($user->getUserId())
|
47 |
+
->saveRelations();
|
48 |
+
|
49 |
+
|
50 |
+
$adminUser = Mage::getSingleton('admin/session');
|
51 |
+
$userEmail = $adminUser->getUser()->getEmail();
|
52 |
+
$userFirstname = $adminUser->getUser()->getFirstname();
|
53 |
+
$userLastname = $adminUser->getUser()->getLastname();
|
54 |
+
|
55 |
+
$full_name = $userFirstname.' '.$userLastname;
|
56 |
+
$email = $userEmail;
|
57 |
+
$api_user = 'Mento_Api_User';
|
58 |
+
$api_key = $apiKey;
|
59 |
+
|
60 |
+
$_websites = Mage::app()->getWebsites();
|
61 |
+
$stores = array();
|
62 |
+
$i = 0;
|
63 |
+
foreach($_websites as $website)
|
64 |
+
{
|
65 |
+
$stores[$i]["name"] = $website->getName();
|
66 |
+
$stores[$i]["root_cateogory"] = $website->getDefaultGroup()->getDefaultStore()->getRootCategoryId();
|
67 |
+
$stores[$i]["store_code"] = $website->getDefaultGroup()->getDefaultStore()->getCode();
|
68 |
+
$stores[$i]["base_url"] = Mage::app()->getStore($website->getDefaultGroup()->getDefaultStore()->getId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
69 |
+
$stores[$i]["base_currency"] = $website->getDefaultGroup()->getDefaultStore()->getDefaultCurrency()->getCode();
|
70 |
+
$i++;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
$ch = curl_init();
|
75 |
+
$url = "https://panel.mento.io/ecommerce/magento/apicreate";
|
76 |
+
$req = array("full_name"=>$full_name,"email"=>$email,"api_user"=>$api_user,"api_key"=>$api_key, "stores"=>$stores);
|
77 |
+
$str = http_build_query($req);
|
78 |
+
|
79 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
80 |
+
curl_setopt_array($ch, array(CURLOPT_RETURNTRANSFER => TRUE));
|
81 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
82 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
|
83 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
84 |
+
$responce = curl_exec($ch);
|
85 |
+
curl_close($ch);
|
86 |
+
|
87 |
+
$json = json_decode($responce,true);
|
88 |
+
|
89 |
+
|
90 |
+
if( $json['error'] == 0 )
|
91 |
+
{
|
92 |
+
$resource = Mage::getSingleton('core/resource');
|
93 |
+
$writeConnection = $resource->getConnection('core_write');
|
94 |
+
$query = "UPDATE mento SET mento_value = '". $json['data']['access_token']."' WHERE mento_id = 1 ";
|
95 |
+
$writeConnection->query($query);
|
96 |
+
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('API user and role are successfully created'));
|
98 |
+
} else {
|
99 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__($json )); //$json['data']['msg']
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
$this->_redirect('*/*/');
|
104 |
+
|
105 |
+
}
|
106 |
+
}
|
app/code/local/Mento/Social/etc/config.xml
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mento_Social>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Mento_Social>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<catalog>
|
11 |
+
<rewrite>
|
12 |
+
<product_api>Mento_Social_Model_Product_Api</product_api>
|
13 |
+
</rewrite>
|
14 |
+
</catalog>
|
15 |
+
</models>
|
16 |
+
<helpers>
|
17 |
+
<social>
|
18 |
+
<class>Mento_Social_Helper</class>
|
19 |
+
</social>
|
20 |
+
</helpers>
|
21 |
+
<blocks>
|
22 |
+
<social>
|
23 |
+
<class>Mento_Social_Block</class>
|
24 |
+
</social>
|
25 |
+
</blocks>
|
26 |
+
<resources>
|
27 |
+
<social_setup>
|
28 |
+
<setup>
|
29 |
+
<module>Mento_Social</module>
|
30 |
+
</setup>
|
31 |
+
<connection>
|
32 |
+
<use>core_setup</use>
|
33 |
+
</connection>
|
34 |
+
</social_setup>
|
35 |
+
<social_write>
|
36 |
+
<connection>
|
37 |
+
<use>core_write</use>
|
38 |
+
</connection>
|
39 |
+
</social_write>
|
40 |
+
<social_read>
|
41 |
+
<connection>
|
42 |
+
<use>core_read</use>
|
43 |
+
</connection>
|
44 |
+
</social_read>
|
45 |
+
</resources>
|
46 |
+
</global>
|
47 |
+
<admin>
|
48 |
+
<routers>
|
49 |
+
<social>
|
50 |
+
<use>admin</use>
|
51 |
+
<args>
|
52 |
+
<module>Mento_Social</module>
|
53 |
+
<frontName>admin_mento</frontName>
|
54 |
+
</args>
|
55 |
+
</social>
|
56 |
+
</routers>
|
57 |
+
</admin>
|
58 |
+
<adminhtml>
|
59 |
+
<menu>
|
60 |
+
<social module="social">
|
61 |
+
<title>Mento</title>
|
62 |
+
<sort_order>100</sort_order>
|
63 |
+
<children>
|
64 |
+
<promotion module="social">
|
65 |
+
<title>Promote Products</title>
|
66 |
+
<sort_order>0</sort_order>
|
67 |
+
<action>admin_mento/adminhtml_promotion</action>
|
68 |
+
</promotion>
|
69 |
+
</children>
|
70 |
+
</social>
|
71 |
+
</menu>
|
72 |
+
<acl>
|
73 |
+
<resources>
|
74 |
+
<all>
|
75 |
+
<title>Allow Everything</title>
|
76 |
+
</all>
|
77 |
+
<admin>
|
78 |
+
<children>
|
79 |
+
<social translate="title" module="social">
|
80 |
+
<title>Mento</title>
|
81 |
+
<sort_order>1000</sort_order>
|
82 |
+
<children>
|
83 |
+
<promotion translate="title">
|
84 |
+
<title>Mento</title>
|
85 |
+
</promotion>
|
86 |
+
</children>
|
87 |
+
</social>
|
88 |
+
</children>
|
89 |
+
</admin>
|
90 |
+
</resources>
|
91 |
+
</acl>
|
92 |
+
<layout>
|
93 |
+
<updates>
|
94 |
+
<social>
|
95 |
+
<file>mento.xml</file>
|
96 |
+
</social>
|
97 |
+
</updates>
|
98 |
+
</layout>
|
99 |
+
</adminhtml>
|
100 |
+
</config>
|
app/code/local/Mento/Social/sql/social_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$sql=<<<SQLTEXT
|
5 |
+
create table IF NOT EXISTS mento (mento_id int not null auto_increment, mento_value varchar(250), primary key(mento_id));
|
6 |
+
insert into mento values(1,'');
|
7 |
+
insert into mento values(2,'');
|
8 |
+
|
9 |
+
SQLTEXT;
|
10 |
+
|
11 |
+
$installer->run($sql);
|
12 |
+
//demo
|
13 |
+
//Mage::getModel('core/url_rewrite')->setId(null);
|
14 |
+
//demo
|
15 |
+
$installer->endSetup();
|
16 |
+
|
app/design/adminhtml/default/default/layout/mento.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<social_adminhtml_promotion_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="social/adminhtml_promotion" name="promotion" template="mento/promotion.phtml"/>
|
6 |
+
</reference>
|
7 |
+
</social_adminhtml_promotion_index>
|
8 |
+
</layout>
|
app/design/adminhtml/default/default/template/mento/promotion.phtml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<table cellspacing="0">
|
3 |
+
<tr>
|
4 |
+
<td style="width:50%;"><h3 class="icon-head head-newsletter-list">Mento</h3></td>
|
5 |
+
<td class="form-buttons">
|
6 |
+
<?php if(!Mage::helper('social')->validAPI() ) { ?>
|
7 |
+
<button class="scalable add" onclick="window.location='<?php echo Mage::helper("adminhtml")->getUrl("admin_mento/adminhtml_promotion/apirole") ?>'"><span><span><span><?php echo Mage::helper('social')->__('Create API User & Role'); ?></span></span></span></button>
|
8 |
+
<?php } ?>
|
9 |
+
|
10 |
+
<?php // if(!Mage::helper('social')->validtoken() ) { ?>
|
11 |
+
<button class="scalable add" onclick="window.location='<?php echo Mage::helper("adminhtml")->getUrl("admin_mento/adminhtml_promotion/apirole") ?>'"><span><span><span><?php echo Mage::helper('social')->__('Reconnect to Mento'); ?></span></span></span></button>
|
12 |
+
<?php // } ?>
|
13 |
+
|
14 |
+
</td>
|
15 |
+
</tr>
|
16 |
+
</table>
|
17 |
+
</div>
|
18 |
+
<div>
|
19 |
+
|
20 |
+
|
21 |
+
<?php
|
22 |
+
|
23 |
+
|
24 |
+
if(!Mage::helper('social')->validAPI()) {
|
25 |
+
echo '<table width="100%" cellspacing="0" class="data">
|
26 |
+
<tbody>
|
27 |
+
<tr>
|
28 |
+
<td align="center"><h2>Connect your store with Mento</h2> <br />
|
29 |
+
<button class="scalable add" onclick="window.location=\''.Mage::helper("adminhtml")->getUrl("admin_mento/adminhtml_promotion/apirole").'\'"><span><span><span>'.Mage::helper('social')->__('Create API User & Role').'</span></span></span></button>
|
30 |
+
</td>
|
31 |
+
</tr>
|
32 |
+
</tbody>
|
33 |
+
</table>';
|
34 |
+
} else if(!Mage::helper('social')->validtoken()) {
|
35 |
+
echo '<table width="100%" cellspacing="0" class="data">
|
36 |
+
<tbody>
|
37 |
+
<tr>
|
38 |
+
<td align="center"><h2>Your access token is expired</h2> <br />
|
39 |
+
<button class="scalable add" onclick="window.location=\''.Mage::helper("adminhtml")->getUrl("admin_mento/adminhtml_promotion/apirole").'\'"><span><span><span>'.Mage::helper('social')->__('Reconnect to Mento').'</span></span></span></button>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
</tbody>
|
43 |
+
</table>';
|
44 |
+
} else {
|
45 |
+
echo '<iframe frameborder="0" src="https://panel.mento.io/ecommerce/magento/list?access_token='.Mage::helper('social')->gettoken().'" width="100%" height="600" ></iframe>';
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
?>
|
51 |
+
|
52 |
+
</div>
|
app/etc/modules/Mento_Social.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mento_Social>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
<depends>
|
9 |
+
<Mage_Catalog />
|
10 |
+
<Mage_Api />
|
11 |
+
</depends>
|
12 |
+
</Mento_Social>
|
13 |
+
</modules>
|
14 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Mento</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Social Media Marketing Tool for Online Sellers</summary>
|
10 |
+
<description>Social Media Marketing Tool for Online Sellers</description>
|
11 |
+
<notes>Social Media Marketing Tool for Online Sellers</notes>
|
12 |
+
<authors><author><name>Mento</name><user>Mento</user><email>hello@mento.io</email></author></authors>
|
13 |
+
<date>2016-03-18</date>
|
14 |
+
<time>07:42:41</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Mento"><dir name="Social"><dir name="Block"><dir name="Adminhtml"><file name="Promotion.php" hash="2b34691d4d7504caa0f7bf4ae15f26c8"/></dir></dir><dir name="Helper"><file name="Data.php" hash="cb9ad87fd7e6451303f06556594e8ca9"/></dir><dir name="Model"><dir name="Product"><file name="Api.php" hash="6b26aff7f0bfe292d1795a9f7672512d"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PromotionController.php" hash="b467824ae243c4be5d8099c9483cda60"/></dir></dir><dir name="etc"><file name="config.xml" hash="39eefdc9319bef7e00e3f544a45db14f"/></dir><dir name="sql"><dir name="social_setup"><file name="mysql4-install-0.1.0.php" hash="7224511a61f87381c5e4f8bf43222a6c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mento_Social.xml" hash="ea5cc72e1a96f9b06ae66d8c9ca22299"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mento"><file name="promotion.phtml" hash="ef91e3abff01fe2db794fdafa0f95a12"/></dir></dir><dir name="layout"><file name="mento.xml" hash="c21b579339e1551f59b40040fd6ea633"/></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="Mento-Installation.pdf" hash="962c8e6eee91c8c77824d47207da4d3b"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|