Version Notes
Social Media Marketing Tool for Online Sellers
Download this release
Release Info
Developer | Mento |
Extension | mento |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.2.0
- app/code/local/Mento/Social/.DS_Store +0 -0
- app/code/local/Mento/Social/._.DS_Store +0 -0
- app/code/local/Mento/Social/Helper/Data.php +1 -1
- app/code/local/Mento/Social/Model/.DS_Store +0 -0
- app/code/local/Mento/Social/Model/._.DS_Store +0 -0
- app/code/local/Mento/Social/Model/Store/Api.php +81 -0
- app/code/local/Mento/Social/controllers/Adminhtml/PromotionController.php +2 -1
- app/code/local/Mento/Social/etc/api.xml +33 -0
- app/code/local/Mento/Social/etc/config.xml +7 -1
- app/code/local/Mento/Social/sql/.DS_Store +0 -0
- app/code/local/Mento/Social/sql/._.DS_Store +0 -0
- app/design/adminhtml/default/default/template/mento/promotion.phtml +57 -51
- package.xml +5 -5
app/code/local/Mento/Social/.DS_Store
ADDED
Binary file
|
app/code/local/Mento/Social/._.DS_Store
ADDED
Binary file
|
app/code/local/Mento/Social/Helper/Data.php
CHANGED
@@ -70,7 +70,7 @@ class Mento_Social_Helper_Data extends Mage_Core_Helper_Abstract
|
|
70 |
return false;
|
71 |
} else {
|
72 |
$ch = curl_init();
|
73 |
-
$url = "https://
|
74 |
|
75 |
curl_setopt($ch, CURLOPT_URL, $url);
|
76 |
curl_setopt_array($ch, array(CURLOPT_RETURNTRANSFER => TRUE));
|
70 |
return false;
|
71 |
} else {
|
72 |
$ch = curl_init();
|
73 |
+
$url = "https://staging.mento.io/oauth/ping?access_token=".$token;
|
74 |
|
75 |
curl_setopt($ch, CURLOPT_URL, $url);
|
76 |
curl_setopt_array($ch, array(CURLOPT_RETURNTRANSFER => TRUE));
|
app/code/local/Mento/Social/Model/.DS_Store
ADDED
Binary file
|
app/code/local/Mento/Social/Model/._.DS_Store
ADDED
Binary file
|
app/code/local/Mento/Social/Model/Store/Api.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mento_Social_Model_Store_Api extends Mage_Core_Model_Store_Api {
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
public function getweb()
|
7 |
+
{
|
8 |
+
$_websites = Mage::app()->getWebsites();
|
9 |
+
$stores = array();
|
10 |
+
$i = 0;
|
11 |
+
foreach($_websites as $website)
|
12 |
+
{
|
13 |
+
$stores[$i]["name"] = $website->getName();
|
14 |
+
$stores[$i]["root_cateogory"] = $website->getDefaultGroup()->getDefaultStore()->getRootCategoryId();
|
15 |
+
$stores[$i]["store_code"] = $website->getDefaultGroup()->getDefaultStore()->getCode();
|
16 |
+
$stores[$i]["base_url"] = Mage::app()->getStore($website->getDefaultGroup()->getDefaultStore()->getId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
17 |
+
$stores[$i]["base_currency"] = $website->getDefaultGroup()->getDefaultStore()->getDefaultCurrency()->getCode();
|
18 |
+
$i++;
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
return $stores;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function items()
|
26 |
+
{
|
27 |
+
// Retrieve stores
|
28 |
+
$stores = Mage::app()->getStores();
|
29 |
+
|
30 |
+
// Make result array
|
31 |
+
$result = array();
|
32 |
+
foreach ($stores as $store) {
|
33 |
+
$result[] = array(
|
34 |
+
'store_id' => $store->getId(),
|
35 |
+
'code' => $store->getCode(),
|
36 |
+
'jimit' => "jimit",
|
37 |
+
'website_id' => $store->getWebsiteId(),
|
38 |
+
'group_id' => $store->getGroupId(),
|
39 |
+
'name' => $store->getName(),
|
40 |
+
'sort_order' => $store->getSortOrder(),
|
41 |
+
'is_active' => $store->getIsActive()
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
return $result;
|
46 |
+
}
|
47 |
+
/*
|
48 |
+
public function info($productId, $store = null, $attributes = null, $identifierType = null){
|
49 |
+
$product = $this->_getProduct($productId, $store, $identifierType);
|
50 |
+
$result = parent::info($productId, $store = null, $attributes = null, $identifierType = null);
|
51 |
+
//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()).
|
52 |
+
|
53 |
+
$result['product_url'] = $product->getUrlInStore($store);
|
54 |
+
|
55 |
+
|
56 |
+
$gallery = $product->getTypeInstance(true)->getSetAttributes($product);
|
57 |
+
|
58 |
+
|
59 |
+
$galleryData = $product->getData('media_gallery');
|
60 |
+
|
61 |
+
$images = array();
|
62 |
+
if (!isset($galleryData['images']) || !is_array($galleryData['images'])) {
|
63 |
+
$images = array();
|
64 |
+
}
|
65 |
+
|
66 |
+
foreach ($galleryData['images'] as &$image) {
|
67 |
+
$images[] = array(
|
68 |
+
'file' => $image['file'],
|
69 |
+
'label' => $image['label'],
|
70 |
+
'position' => $image['position'],
|
71 |
+
'url' => Mage::getSingleton('catalog/product_media_config')->getMediaUrl($image['file'])
|
72 |
+
);
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
$result['gallery'] = $images;
|
77 |
+
return $result;
|
78 |
+
}
|
79 |
+
*/
|
80 |
+
|
81 |
+
}
|
app/code/local/Mento/Social/controllers/Adminhtml/PromotionController.php
CHANGED
@@ -72,7 +72,7 @@ class Mento_Social_Adminhtml_PromotionController extends Mage_Adminhtml_Controll
|
|
72 |
|
73 |
|
74 |
$ch = curl_init();
|
75 |
-
$url = "https://
|
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 |
|
@@ -82,6 +82,7 @@ class Mento_Social_Adminhtml_PromotionController extends Mage_Adminhtml_Controll
|
|
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);
|
72 |
|
73 |
|
74 |
$ch = curl_init();
|
75 |
+
$url = "https://staging.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 |
|
82 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
|
83 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
84 |
$responce = curl_exec($ch);
|
85 |
+
|
86 |
curl_close($ch);
|
87 |
|
88 |
$json = json_decode($responce,true);
|
app/code/local/Mento/Social/etc/api.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<api>
|
3 |
+
<resources>
|
4 |
+
<core_store translate="title" module="core">
|
5 |
+
<title>Store API</title>
|
6 |
+
<model>core/store_api</model>
|
7 |
+
<acl>core/store</acl>
|
8 |
+
<methods>
|
9 |
+
<getweb translate="title" module="core">
|
10 |
+
<title>Retrieve website list</title>
|
11 |
+
<method>getweb</method>
|
12 |
+
<acl>core/store/getweb</acl>
|
13 |
+
</getweb>
|
14 |
+
</methods>
|
15 |
+
<faults module="core_store">
|
16 |
+
</faults>
|
17 |
+
</core_store>
|
18 |
+
</resources>
|
19 |
+
<acl>
|
20 |
+
<resources>
|
21 |
+
<core translate="title" module="core">
|
22 |
+
<store translate="title" module="core">
|
23 |
+
<title>Core</title>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<getweb translate="title" module="core">
|
26 |
+
<title>Website List</title>
|
27 |
+
</getweb>
|
28 |
+
</store>
|
29 |
+
</core>
|
30 |
+
</resources>
|
31 |
+
</acl>
|
32 |
+
</api>
|
33 |
+
</config>
|
app/code/local/Mento/Social/etc/config.xml
CHANGED
@@ -4,7 +4,8 @@
|
|
4 |
<Mento_Social>
|
5 |
<version>0.1.0</version>
|
6 |
</Mento_Social>
|
7 |
-
</modules>
|
|
|
8 |
<global>
|
9 |
<models>
|
10 |
<catalog>
|
@@ -12,6 +13,11 @@
|
|
12 |
<product_api>Mento_Social_Model_Product_Api</product_api>
|
13 |
</rewrite>
|
14 |
</catalog>
|
|
|
|
|
|
|
|
|
|
|
15 |
</models>
|
16 |
<helpers>
|
17 |
<social>
|
4 |
<Mento_Social>
|
5 |
<version>0.1.0</version>
|
6 |
</Mento_Social>
|
7 |
+
</modules>
|
8 |
+
|
9 |
<global>
|
10 |
<models>
|
11 |
<catalog>
|
13 |
<product_api>Mento_Social_Model_Product_Api</product_api>
|
14 |
</rewrite>
|
15 |
</catalog>
|
16 |
+
<core>
|
17 |
+
<rewrite>
|
18 |
+
<store_api>Mento_Social_Model_Store_Api</store_api>
|
19 |
+
</rewrite>
|
20 |
+
</core>
|
21 |
</models>
|
22 |
<helpers>
|
23 |
<social>
|
app/code/local/Mento/Social/sql/.DS_Store
ADDED
Binary file
|
app/code/local/Mento/Social/sql/._.DS_Store
ADDED
Binary file
|
app/design/adminhtml/default/default/template/mento/promotion.phtml
CHANGED
@@ -1,52 +1,58 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
<?php
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</div>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
echo '<iframe frameborder="0" src="https://staging.mento.io/login?from=magento" width="100%" height="600" ></iframe>';
|
4 |
+
exit;
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div class="content-header">
|
8 |
+
<table cellspacing="0">
|
9 |
+
<tr>
|
10 |
+
<td style="width:50%;"><h3 class="icon-head head-newsletter-list">Mento</h3></td>
|
11 |
+
<td class="form-buttons">
|
12 |
+
<?php if(!Mage::helper('social')->validAPI() ) { ?>
|
13 |
+
<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>
|
14 |
+
<?php } ?>
|
15 |
+
|
16 |
+
<?php // if(!Mage::helper('social')->validtoken() ) { ?>
|
17 |
+
<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>
|
18 |
+
<?php // } ?>
|
19 |
+
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
</table>
|
23 |
+
</div>
|
24 |
+
<div>
|
25 |
+
|
26 |
+
|
27 |
+
<?php
|
28 |
+
|
29 |
+
|
30 |
+
if(!Mage::helper('social')->validAPI()) {
|
31 |
+
echo '<table width="100%" cellspacing="0" class="data">
|
32 |
+
<tbody>
|
33 |
+
<tr>
|
34 |
+
<td align="center"><h2>Connect your store with Mento</h2> <br />
|
35 |
+
<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>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
</tbody>
|
39 |
+
</table>';
|
40 |
+
} else if(!Mage::helper('social')->validtoken()) {
|
41 |
+
echo '<table width="100%" cellspacing="0" class="data">
|
42 |
+
<tbody>
|
43 |
+
<tr>
|
44 |
+
<td align="center"><h2>Your access token is expired</h2> <br />
|
45 |
+
<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>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>';
|
50 |
+
} else {
|
51 |
+
echo '<iframe frameborder="0" src="https://staging.mento.io/ecommerce/magento/list?access_token='.Mage::helper('social')->gettoken().'" width="100%" height="600" ></iframe>';
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
?>
|
57 |
+
|
58 |
</div>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mento</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
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>
|
14 |
-
<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="
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.2.0</min><max>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mento</name>
|
4 |
+
<version>1.2.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>
|
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>2017-01-13</date>
|
14 |
+
<time>13:36:51</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="0ee74ed013894983e59ab6d9dd27d003"/></dir><dir name="Model"><dir name="Product"><file name="Api.php" hash="6b26aff7f0bfe292d1795a9f7672512d"/></dir><dir name="Store"><file name="Api.php" hash="c1c6007f96bcd11d564f0586f0f3710f"/></dir><file name=".DS_Store" hash="36995b1ecc24f8969950f968014821fb"/><file name="._.DS_Store" hash="ec4a2c5ec6529cb5f55c76c0b28d7b9c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PromotionController.php" hash="06cb8935bf51fdbe94094585c6467e99"/></dir></dir><dir name="etc"><file name="api.xml" hash="591ca13cf078c94e05e3ef86283f8253"/><file name="config.xml" hash="269a2e8d526764738e0550193394fb2b"/></dir><dir name="sql"><dir name="social_setup"><file name="mysql4-install-0.1.0.php" hash="7224511a61f87381c5e4f8bf43222a6c"/></dir><file name=".DS_Store" hash="a03a2e0e829bc9124384b148a1f893c0"/><file name="._.DS_Store" hash="8086728f82867c728eb0da0b2405a589"/></dir><file name=".DS_Store" hash="490f003acf0ffd30c66a7eeb0aeb5cb4"/><file name="._.DS_Store" hash="ed258f97796f3053420a59c3565ce097"/></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="ba2fa2d5c7b702ac8205a4a7e0fe6f79"/></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>7.0.0</max></php></required></dependencies>
|
18 |
</package>
|