Version Notes
security fix, extended functionality
Download this release
Release Info
Developer | Magento Core Team |
Extension | Svitla_IBoughtIt |
Version | 0.1.2 |
Comparing to | |
See all releases |
Code changes from version 0.1.1 to 0.1.2
app/code/community/Svitla/Iboughtit/Block/Script.php
CHANGED
@@ -35,16 +35,20 @@ class Svitla_Iboughtit_Block_Script extends Mage_Core_Block_Template {
|
|
35 |
$aResult['ssFrame_height']=Mage::helper('iboughtit')->getHeight();
|
36 |
$aResult['auto_popup']=Mage::helper('iboughtit')->isPopup();
|
37 |
$aResult['sandbox']=Mage::helper('iboughtit')->isUseSandbox();
|
38 |
-
|
39 |
-
//$
|
40 |
foreach ($order->getAllVisibleItems() as $key=>$item) {
|
41 |
$productId = $item->getProductId();
|
42 |
$product = Mage::getModel('catalog/product')->load($productId);
|
43 |
$categoryIds = $product->getCategoryIds();
|
44 |
$productCategory = $this->fetchCategories($categoryIds);
|
45 |
-
|
46 |
$aResult['items'][$key]['prod_id']=$productId;
|
47 |
$aResult['items'][$key]['prod_category']=$productCategory;
|
|
|
|
|
|
|
|
|
48 |
$aResult['items'][$key]['prod_price']=sprintf("%.2f", $product->getPrice());
|
49 |
$aResult['items'][$key]['prod_currency']=Mage::app()->getStore()->getCurrentCurrencyCode();
|
50 |
$aResult['items'][$key]['prod_title']=$this->escapeHtml($product->getName());
|
@@ -54,11 +58,15 @@ class Svitla_Iboughtit_Block_Script extends Mage_Core_Block_Template {
|
|
54 |
}
|
55 |
if(is_array($aResult) && count($aResult)>0){
|
56 |
$sParams=json_encode($aResult);
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
-
$res.='<iframe name="iboughtit" id="iboughtit" src="http://furiouspro.com/IboughtIt/share?params='.$sParams.'"></iframe>';
|
60 |
//Mage::log($sParams);
|
61 |
-
|
62 |
return $res;
|
63 |
}
|
64 |
|
@@ -67,7 +75,6 @@ class Svitla_Iboughtit_Block_Script extends Mage_Core_Block_Template {
|
|
67 |
}
|
68 |
|
69 |
private function fetchCategories($categories){
|
70 |
-
|
71 |
$productCategory = '';
|
72 |
if(count($categories) > 0){
|
73 |
foreach($categories as $categoryId) {
|
@@ -79,4 +86,5 @@ class Svitla_Iboughtit_Block_Script extends Mage_Core_Block_Template {
|
|
79 |
return $productCategory;
|
80 |
}
|
81 |
|
|
|
82 |
}
|
35 |
$aResult['ssFrame_height']=Mage::helper('iboughtit')->getHeight();
|
36 |
$aResult['auto_popup']=Mage::helper('iboughtit')->isPopup();
|
37 |
$aResult['sandbox']=Mage::helper('iboughtit')->isUseSandbox();
|
38 |
+
//$itemsQty = count($order->getAllVisibleItems());
|
39 |
+
//$aResult['prod_count']=$itemsQty;
|
40 |
foreach ($order->getAllVisibleItems() as $key=>$item) {
|
41 |
$productId = $item->getProductId();
|
42 |
$product = Mage::getModel('catalog/product')->load($productId);
|
43 |
$categoryIds = $product->getCategoryIds();
|
44 |
$productCategory = $this->fetchCategories($categoryIds);
|
45 |
+
|
46 |
$aResult['items'][$key]['prod_id']=$productId;
|
47 |
$aResult['items'][$key]['prod_category']=$productCategory;
|
48 |
+
|
49 |
+
$aResult['items'][$key]['category_id']=(is_array($categoryIds) && count($categoryIds)>0) ? implode(',', $categoryIds) : '';
|
50 |
+
$aResult['items'][$key]['category_title']=$productCategory;
|
51 |
+
$aResult['items'][$key]['prod_count']=sprintf("%.0f", $item->getQtyOrdered());
|
52 |
$aResult['items'][$key]['prod_price']=sprintf("%.2f", $product->getPrice());
|
53 |
$aResult['items'][$key]['prod_currency']=Mage::app()->getStore()->getCurrentCurrencyCode();
|
54 |
$aResult['items'][$key]['prod_title']=$this->escapeHtml($product->getName());
|
58 |
}
|
59 |
if(is_array($aResult) && count($aResult)>0){
|
60 |
$sParams=json_encode($aResult);
|
61 |
+
//$sParams=Mage::getModel('core/url')->escape($sParams);
|
62 |
+
$response=Mage::Helper('iboughtit')->getHash($sParams);
|
63 |
+
if($response){
|
64 |
+
$aResponse=json_decode($response);
|
65 |
+
$res.='<iframe name="iboughtit" id="iboughtit" src="http://i-bought-it.com/widget/?id='.$aResponse->id.'&hash='.$aResponse->hash.'&partnerid='.$this->escapeHtml(Mage::helper('iboughtit')->getAccountId()).'"></iframe>';
|
66 |
+
}
|
67 |
}
|
|
|
68 |
//Mage::log($sParams);
|
69 |
+
Mage::log($res);
|
70 |
return $res;
|
71 |
}
|
72 |
|
75 |
}
|
76 |
|
77 |
private function fetchCategories($categories){
|
|
|
78 |
$productCategory = '';
|
79 |
if(count($categories) > 0){
|
80 |
foreach($categories as $categoryId) {
|
86 |
return $productCategory;
|
87 |
}
|
88 |
|
89 |
+
|
90 |
}
|
app/code/community/Svitla/Iboughtit/Helper/Data.php
CHANGED
@@ -64,4 +64,42 @@ class Svitla_Iboughtit_Helper_Data extends Mage_Catalog_Helper_Data {
|
|
64 |
return $this->getConfig()->getAnchorCssClass();
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
64 |
return $this->getConfig()->getAnchorCssClass();
|
65 |
}
|
66 |
|
67 |
+
public function getHash($sParams){
|
68 |
+
if(!isset($sParams)){
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
try{
|
72 |
+
$request = "http://i-bought-it.com/widget/reg?";
|
73 |
+
$sFields=http_build_query(array('data' => $sParams));
|
74 |
+
$session = curl_init($request);
|
75 |
+
|
76 |
+
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
|
77 |
+
//curl_setopt($session, CURLOPT_HEADER, 1);
|
78 |
+
curl_setopt($session, CURLOPT_POST, 1);
|
79 |
+
curl_setopt($session, CURLOPT_POSTFIELDS, $sFields);
|
80 |
+
//curl_setopt($session, CURLOPT_POSTFIELDS, $sParams);
|
81 |
+
//curl_setopt($session, CURLOPT_VERBOSE, 0);
|
82 |
+
//curl_setopt($session, CURLINFO_HEADER_OUT, 0);
|
83 |
+
|
84 |
+
$response = curl_exec($session);
|
85 |
+
if($response === false){
|
86 |
+
throw new Exception(curl_error($session));
|
87 |
+
}
|
88 |
+
curl_close($session);
|
89 |
+
|
90 |
+
if(!json_decode($response)){
|
91 |
+
throw new Exception("Wrong remote server response: " . ": " . $response);
|
92 |
+
Mage::getSingleton('core/session')->addError("Wrong remote server response");
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
else{
|
96 |
+
return $response;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
catch(Exception $e){
|
100 |
+
Mage::log($e->getMessage());
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
}
|
app/code/community/Svitla/Iboughtit/etc/config.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Svitla_Iboughtit>
|
6 |
-
<version>0.1.
|
7 |
</Svitla_Iboughtit>
|
8 |
</modules>
|
9 |
<global>
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Svitla_Iboughtit>
|
6 |
+
<version>0.1.2</version>
|
7 |
</Svitla_Iboughtit>
|
8 |
</modules>
|
9 |
<global>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Svitla_IBoughtIt</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Extension to recommend goods over social networks</summary>
|
10 |
<description>Extension to recommend goods over social networks</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Svitla</name><user>auto-converted</user><email>okhokhliuk@svitla.com</email></author></authors>
|
13 |
-
<date>2012-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Svitla"><dir name="Iboughtit"><dir name="Block"><file name="Email.php" hash="e7e795b17873abea52b0c6156cb593d5"/><file name="Iboughtit.php" hash="bb8f4f72f0e88546f961230ddc8c385b"/><file name="Script.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Svitla_IBoughtIt</name>
|
4 |
+
<version>0.1.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Extension to recommend goods over social networks</summary>
|
10 |
<description>Extension to recommend goods over social networks</description>
|
11 |
+
<notes>security fix, extended functionality</notes>
|
12 |
<authors><author><name>Svitla</name><user>auto-converted</user><email>okhokhliuk@svitla.com</email></author></authors>
|
13 |
+
<date>2012-07-16</date>
|
14 |
+
<time>12:14:00</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Svitla"><dir name="Iboughtit"><dir name="Block"><file name="Email.php" hash="e7e795b17873abea52b0c6156cb593d5"/><file name="Iboughtit.php" hash="bb8f4f72f0e88546f961230ddc8c385b"/><file name="Script.php" hash="8c876592d9d32cc24afbfae6e8a92569"/><file name="Social.php" hash="fb546910c18fc4f808b6c0cb24157d23"/></dir><dir name="Helper"><file name="Data.php" hash="5e207bdd390bb6739b091ae967a91cd5"/></dir><dir name="Model"><file name="Iboughtit.php" hash="88ca3383b67908168a717ebc3781f635"/><file name="Status.php" hash="7f7e065cb80e95c5344731957f160d10"/></dir><dir name="etc"><file name="config.xml" hash="f3fa1b40b1edc8321481b76cbeb3684b"/><file name="system.xml" hash="dc77118758c06e679586fab81947e6ec"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Svitla_Iboughtit.xml" hash="cb2ee7f8f58fb73c60f85ddf977a5f41"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="iboughtit"><file name="items.phtml" hash="9cb99903e94603bb162fcdcbab09af84"/><file name="social.phtml" hash="6ee40c4b5d1a41b98a0a1f8e9bad67d1"/></dir></dir><dir name="layout"><file name="iboughtit.xml" hash="04ae3aa0fe3bd8a4421006ca7b2b0a98"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|