Version Notes
Stable release
Download this release
Release Info
Developer | Itembase |
Extension | Itembase |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.1.0
- app/code/community/Itembase/Plugin/Block/Plugin.php +163 -0
- app/code/community/Itembase/Plugin/Plugin.php +0 -94
- app/code/community/Itembase/Plugin/controllers/Adminhtml/ItembaseController.php +1 -0
- app/code/community/Itembase/Plugin/etc/config.xml +7 -11
- app/code/community/Itembase/Plugin/plugindata.php +1 -1
- app/design/frontend/base/default/layout/itembase.xml +13 -0
- app/design/frontend/base/default/template/itembase/checkout_success.phtml +7 -6
- app/design/frontend/base/default/template/itembase/product_success.phtml +22 -0
- package.xml +4 -4
app/code/community/Itembase/Plugin/Block/Plugin.php
CHANGED
@@ -1,4 +1,167 @@
|
|
1 |
<?php
|
2 |
class Itembase_Plugin_Block_Plugin extends Mage_Core_Block_Template
|
3 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
1 |
<?php
|
2 |
class Itembase_Plugin_Block_Plugin extends Mage_Core_Block_Template
|
3 |
{
|
4 |
+
public function checkoutPlugin() {
|
5 |
+
$order = Mage::getModel('sales/order');
|
6 |
+
$order->load($this->lastOrderId);
|
7 |
+
|
8 |
+
eval('function itembaseErrorHandler($errno, $errstr, $errfile, $errline) {
|
9 |
+
'.((bool)Mage::getStoreConfig('itembase_section/itembase_group/debug') ? 'echo "
|
10 |
+
<!--ITEMBASE
|
11 |
+
".print_r(array($errno, $errstr, $errfile, $errline), true)."ITEMBASE-->
|
12 |
+
";' : '').'
|
13 |
+
return true;
|
14 |
+
}');
|
15 |
+
set_error_handler('itembaseErrorHandler', E_ALL);
|
16 |
+
|
17 |
+
try {
|
18 |
+
include('Itembase/Plugin/plugindata.php');
|
19 |
+
include('Itembase/Plugin/oauth.php');
|
20 |
+
|
21 |
+
$responseArray = json_decode(authenticateClient(Mage::getStoreConfig('itembase_section/itembase_group/api_key'), Mage::getStoreConfig('itembase_section/itembase_group/secret')), true);
|
22 |
+
if(!isset($responseArray['access_token'])) {
|
23 |
+
itembaseErrorHandler(0, 'no access_token for '.Mage::getStoreConfig('itembase_section/itembase_group/api_key').' '.substr(Mage::getStoreConfig('itembase_section/itembase_group/secret'), 0, 4).'... '.ITEMBASE_SERVER_OAUTH.' '.print_r($responseArray, true), __FILE__, __LINE__ - 1);
|
24 |
+
$responseArray['access_token'] = 'null';
|
25 |
+
}
|
26 |
+
|
27 |
+
$allProducts = array();
|
28 |
+
foreach ($order->getAllItems() as $item) {
|
29 |
+
$product = $item->getProduct();
|
30 |
+
$category = null;
|
31 |
+
if (is_array($categoryIds = $product->getCategoryIds())) {
|
32 |
+
$category = Mage::getModel('catalog/category');
|
33 |
+
$category->load($categoryIds[0]);
|
34 |
+
}
|
35 |
+
|
36 |
+
$allProducts [] = array(
|
37 |
+
'id' => $product->getId(),
|
38 |
+
'category' => $category ? $category->getName() : '',
|
39 |
+
'name' => $product->getName(),
|
40 |
+
'quantity' => $item->getQtyOrdered(),
|
41 |
+
'price' => $item->getPriceInclTax(),
|
42 |
+
'ean' => '',
|
43 |
+
'isbn' => '',
|
44 |
+
'asin' => '',
|
45 |
+
'description' => $product->getDescription(),
|
46 |
+
'pic_thumb' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'thumbnail')->__toString(),
|
47 |
+
'pic_medium' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'small_image')->__toString(),
|
48 |
+
'pic_large' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'image')->__toString(),
|
49 |
+
'url' => $product->getProductUrl(),
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
$dataForItembase = array(
|
54 |
+
'access_token' => $responseArray['access_token'],
|
55 |
+
'email' => $order->getCustomerEmail(),
|
56 |
+
'firstname' => $order->getCustomerFirstname(),
|
57 |
+
'lastname' => $order->getCustomerLastname(),
|
58 |
+
'street' => implode(' ', $order->getBillingAddress()->getStreet()),
|
59 |
+
'zip' => $order->getBillingAddress()->getPostcode(),
|
60 |
+
'city' => $order->getBillingAddress()->getCity(),
|
61 |
+
'country' => Mage::getModel('directory/country')->load($order->getBillingAddress()->getCountryId())->getIso2Code(),
|
62 |
+
'phone' => $order->getBillingAddress()->getTelephone(),
|
63 |
+
'lang' => substr(Mage::app()->getLocale()->getDefaultLocale(), 0 , 2),
|
64 |
+
'purchase_date' => $order->getCreatedAt(),
|
65 |
+
'currency' => $order->getOrderCurrencyCode(),
|
66 |
+
'total' => $order->getGrandTotal(),
|
67 |
+
'order_number' => $order->getId(),
|
68 |
+
'customer_id' => $order->getCustomerId(),
|
69 |
+
'shipping_cost' => $order->getShippingAmount(),
|
70 |
+
'shipping_method' => $order->getShippingDescription(),
|
71 |
+
'shop_name' => Mage::app()->getStore()->getName(),
|
72 |
+
'products' => $allProducts,
|
73 |
+
);
|
74 |
+
|
75 |
+
utf8EncodeRecursive($dataForItembase);
|
76 |
+
if(is_callable('json_last_error')) {
|
77 |
+
json_encode($dataForItembase);
|
78 |
+
if(json_last_error() != JSON_ERROR_NONE) itembaseErrorHandler(0, 'json_encode error '.json_last_error(), __FILE__, __LINE__ - 1);
|
79 |
+
}
|
80 |
+
|
81 |
+
$this->ibdata = $dataForItembase;
|
82 |
+
$this->ibembedserver = ITEMBASE_SERVER_EMBED;
|
83 |
+
$this->ibhostserver = ITEMBASE_SERVER_HOST;
|
84 |
+
$this->ibpluginversion = ITEMBASE_PLUGIN_VERSION;
|
85 |
+
} catch(Exception $e) {
|
86 |
+
itembaseErrorHandler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
|
87 |
+
}
|
88 |
+
|
89 |
+
restore_error_handler();
|
90 |
+
}
|
91 |
+
|
92 |
+
public function productPlugin() {
|
93 |
+
eval('function itembaseErrorHandler($errno, $errstr, $errfile, $errline) {
|
94 |
+
'.((bool)Mage::getStoreConfig('itembase_section/itembase_group/debug') ? 'echo "
|
95 |
+
<!--ITEMBASE
|
96 |
+
".print_r(array($errno, $errstr, $errfile, $errline), true)."ITEMBASE-->
|
97 |
+
";' : '').'
|
98 |
+
return true;
|
99 |
+
}');
|
100 |
+
set_error_handler('itembaseErrorHandler', E_ALL);
|
101 |
+
|
102 |
+
try {
|
103 |
+
include('Itembase/Plugin/plugindata.php');
|
104 |
+
include('Itembase/Plugin/oauth.php');
|
105 |
+
|
106 |
+
$responseArray = json_decode(authenticateClient(Mage::getStoreConfig('itembase_section/itembase_group/api_key'), Mage::getStoreConfig('itembase_section/itembase_group/secret')), true);
|
107 |
+
if(!isset($responseArray['access_token'])) {
|
108 |
+
itembaseErrorHandler(0, 'no access_token for '.Mage::getStoreConfig('itembase_section/itembase_group/api_key').' '.substr(Mage::getStoreConfig('itembase_section/itembase_group/secret'), 0, 4).'... '.ITEMBASE_SERVER_OAUTH.' '.print_r($responseArray, true), __FILE__, __LINE__ - 1);
|
109 |
+
$responseArray['access_token'] = 'null';
|
110 |
+
}
|
111 |
+
|
112 |
+
$product = Mage::registry('current_product');
|
113 |
+
if (!$product instanceof Mage_Catalog_Model_Product) {
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
$category = null;
|
117 |
+
if (is_array($categoryIds = $product->getCategoryIds())) {
|
118 |
+
$category = Mage::getModel('catalog/category');
|
119 |
+
$category->load($categoryIds[0]);
|
120 |
+
}
|
121 |
+
$currentProduct = array(
|
122 |
+
'id' => $product->getId(),
|
123 |
+
'category' => $category ? $category->getName() : '',
|
124 |
+
'name' => $product->getName(),
|
125 |
+
'price' => $product->getPrice(),
|
126 |
+
'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
|
127 |
+
'ean' => '',
|
128 |
+
'isbn' => '',
|
129 |
+
'asin' => '',
|
130 |
+
'description' => $product->getDescription(),
|
131 |
+
'pic_thumb' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'thumbnail')->__toString(),
|
132 |
+
'pic_medium' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'small_image')->__toString(),
|
133 |
+
'pic_large' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'image')->__toString(),
|
134 |
+
'url' => $product->getProductUrl(),
|
135 |
+
);
|
136 |
+
$productData = array(
|
137 |
+
'access_token' => $responseArray['access_token'],
|
138 |
+
'lang' => substr(Mage::app()->getLocale()->getDefaultLocale(), 0 , 2),
|
139 |
+
'product' => $currentProduct,
|
140 |
+
);
|
141 |
+
utf8EncodeRecursive($productData);
|
142 |
+
if(is_callable('json_last_error')) {
|
143 |
+
json_encode($productData);
|
144 |
+
if(json_last_error() != JSON_ERROR_NONE) itembaseErrorHandler(0, 'json_encode error '.json_last_error(), __FILE__, __LINE__ - 1);
|
145 |
+
}
|
146 |
+
|
147 |
+
$this->ibaccesstoken = $responseArray['access_token'];
|
148 |
+
$this->iblang = substr(Mage::app()->getLocale()->getDefaultLocale(), 0 , 2);
|
149 |
+
$this->ibproductdata = $productData;
|
150 |
+
$this->ibembedserver = ITEMBASE_SERVER_EMBED;
|
151 |
+
$this->ibpluginversion = ITEMBASE_PLUGIN_VERSION;
|
152 |
+
} catch(Exception $e) {
|
153 |
+
itembaseErrorHandler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
|
154 |
+
}
|
155 |
+
|
156 |
+
restore_error_handler();
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Save last order id for checkout plugin
|
161 |
+
*/
|
162 |
+
protected function _beforeToHtml()
|
163 |
+
{
|
164 |
+
$this->lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
165 |
+
return parent::_beforeToHtml();
|
166 |
+
}
|
167 |
}
|
app/code/community/Itembase/Plugin/Plugin.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Itembase_Plugin_Plugin
|
4 |
-
{
|
5 |
-
public function displayPlugin(Varien_Event_Observer $observer)
|
6 |
-
{
|
7 |
-
$observerData = $observer->getData();
|
8 |
-
$order = Mage::getModel('sales/order');
|
9 |
-
$order->load(is_array($observerData['order_ids']) ? $observerData['order_ids'][0] : $observerData['order_ids']);
|
10 |
-
|
11 |
-
eval('function itembaseErrorHandler($errno, $errstr, $errfile, $errline) {
|
12 |
-
'.((bool)Mage::getStoreConfig('itembase_section/itembase_group/debug') ? 'echo "
|
13 |
-
<!--ITEMBASE
|
14 |
-
".print_r(array($errno, $errstr, $errfile, $errline), true)."ITEMBASE-->
|
15 |
-
";' : '').'
|
16 |
-
return true;
|
17 |
-
}');
|
18 |
-
set_error_handler('itembaseErrorHandler', E_ALL);
|
19 |
-
|
20 |
-
try {
|
21 |
-
include('Itembase/Plugin/plugindata.php');
|
22 |
-
include('Itembase/Plugin/oauth.php');
|
23 |
-
|
24 |
-
$responseArray = json_decode(authenticateClient(Mage::getStoreConfig('itembase_section/itembase_group/api_key'), Mage::getStoreConfig('itembase_section/itembase_group/secret')), true);
|
25 |
-
if(!isset($responseArray['access_token'])) itembaseErrorHandler(0, 'no access_token for '.Mage::getStoreConfig('itembase_section/itembase_group/api_key').' '.substr(Mage::getStoreConfig('itembase_section/itembase_group/secret'), 0, 4).'... '.ITEMBASE_SERVER_OAUTH.' '.print_r($responseArray, true), __FILE__, __LINE__ - 1);
|
26 |
-
|
27 |
-
$allProducts = array();
|
28 |
-
foreach ($order->getAllItems() as $item) {
|
29 |
-
$product = $item->getProduct();
|
30 |
-
$category = null;
|
31 |
-
if (is_array($categoryIds = $product->getCategoryIds())) {
|
32 |
-
$category = Mage::getModel('catalog/category');
|
33 |
-
$category->load($categoryIds[0]);
|
34 |
-
}
|
35 |
-
|
36 |
-
$allProducts [] = array(
|
37 |
-
'id' => $product->getId(),
|
38 |
-
'category' => $category ? $category->getName() : '',
|
39 |
-
'name' => $product->getName(),
|
40 |
-
'quantity' => $item->getQtyOrdered(),
|
41 |
-
'price' => $item->getPriceInclTax(),
|
42 |
-
'ean' => '',
|
43 |
-
'isbn' => '',
|
44 |
-
'asin' => '',
|
45 |
-
'description' => $product->getDescription(),
|
46 |
-
'pic_thumb' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'thumbnail')->__toString(),
|
47 |
-
'pic_medium' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'small_image')->__toString(),
|
48 |
-
'pic_large' => Mage::app()->getLayout()->helper('catalog/image')->init($product, 'image')->__toString(),
|
49 |
-
'url' => $product->getProductUrl(),
|
50 |
-
);
|
51 |
-
}
|
52 |
-
|
53 |
-
$dataForItembase = array(
|
54 |
-
'access_token' => $responseArray['access_token'],
|
55 |
-
'email' => $order->getCustomerEmail(),
|
56 |
-
'firstname' => $order->getCustomerFirstname(),
|
57 |
-
'lastname' => $order->getCustomerLastname(),
|
58 |
-
'street' => implode(' ', $order->getBillingAddress()->getStreet()),
|
59 |
-
'zip' => $order->getBillingAddress()->getPostcode(),
|
60 |
-
'city' => $order->getBillingAddress()->getCity(),
|
61 |
-
'country' => Mage::getModel('directory/country')->load($order->getBillingAddress()->getCountryId())->getIso2Code(),
|
62 |
-
'phone' => $order->getBillingAddress()->getTelephone(),
|
63 |
-
'lang' => substr(Mage::app()->getLocale()->getDefaultLocale(), 0 , 2),
|
64 |
-
'purchase_date' => $order->getCreatedAt(),
|
65 |
-
'currency' => $order->getOrderCurrencyCode(),
|
66 |
-
'total' => $order->getGrandTotal(),
|
67 |
-
'order_number' => $order->getId(),
|
68 |
-
'customer_id' => $order->getCustomerId(),
|
69 |
-
'shipping_cost' => $order->getShippingAmount(),
|
70 |
-
'shipping_method' => $order->getShippingDescription(),
|
71 |
-
'shop_name' => Mage::app()->getStore()->getName(),
|
72 |
-
'products' => $allProducts,
|
73 |
-
);
|
74 |
-
|
75 |
-
utf8EncodeRecursive($dataForItembase);
|
76 |
-
if(is_callable('json_last_error')) {
|
77 |
-
json_encode($dataForItembase);
|
78 |
-
if(json_last_error() != JSON_ERROR_NONE) itembaseErrorHandler(0, 'json_encode error '.json_last_error(), __FILE__, __LINE__ - 1);
|
79 |
-
}
|
80 |
-
|
81 |
-
$block = Mage::app()->getLayout()->createBlock('itembase/plugin')
|
82 |
-
->setTemplate('itembase/checkout_success.phtml')
|
83 |
-
->assign('ibdata', $dataForItembase)
|
84 |
-
->assign('ibembedserver', ITEMBASE_SERVER_EMBED)
|
85 |
-
->assign('ibhostserver', ITEMBASE_SERVER_HOST)
|
86 |
-
->assign('ibpluginversion', ITEMBASE_PLUGIN_VERSION);
|
87 |
-
Mage::app()->getLayout()->getBlock('content')->append($block);
|
88 |
-
} catch(Exception $e) {
|
89 |
-
itembaseErrorHandler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
|
90 |
-
}
|
91 |
-
|
92 |
-
restore_error_handler();
|
93 |
-
}
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Itembase/Plugin/controllers/Adminhtml/ItembaseController.php
CHANGED
@@ -142,6 +142,7 @@ class Itembase_Plugin_Adminhtml_ItembaseController extends Mage_Adminhtml_Contro
|
|
142 |
<input type="hidden" name="shops['.$shop['shop_id'].'][country]" value="'.$shop['country'].'" />
|
143 |
<input type="hidden" name="shops['.$shop['shop_id'].'][telephone]" value="'.$shop['telephone'].'" />
|
144 |
<input type="hidden" name="shops['.$shop['shop_id'].'][fax]" value="'.$shop['fax'].'" />
|
|
|
145 |
</div>';
|
146 |
}
|
147 |
$registrationHtml .= '
|
142 |
<input type="hidden" name="shops['.$shop['shop_id'].'][country]" value="'.$shop['country'].'" />
|
143 |
<input type="hidden" name="shops['.$shop['shop_id'].'][telephone]" value="'.$shop['telephone'].'" />
|
144 |
<input type="hidden" name="shops['.$shop['shop_id'].'][fax]" value="'.$shop['fax'].'" />
|
145 |
+
<input type="hidden" name="shops['.$shop['shop_id'].'][email]" value="'.$shop['email'].'" />
|
146 |
</div>';
|
147 |
}
|
148 |
$registrationHtml .= '
|
app/code/community/Itembase/Plugin/etc/config.xml
CHANGED
@@ -11,17 +11,6 @@
|
|
11 |
<class>Itembase_Plugin_Block</class>
|
12 |
</itembase>
|
13 |
</blocks>
|
14 |
-
<events>
|
15 |
-
<checkout_onepage_controller_success_action>
|
16 |
-
<observers>
|
17 |
-
<itembase_plugin_observer>
|
18 |
-
<type>singleton</type>
|
19 |
-
<class>Itembase_Plugin_Plugin</class>
|
20 |
-
<method>displayPlugin</method>
|
21 |
-
</itembase_plugin_observer>
|
22 |
-
</observers>
|
23 |
-
</checkout_onepage_controller_success_action>
|
24 |
-
</events>
|
25 |
<helpers>
|
26 |
<itembase_plugin>
|
27 |
<class>Mage_Core_Helper</class>
|
@@ -38,6 +27,13 @@
|
|
38 |
</args>
|
39 |
</itembase>
|
40 |
</routers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
</frontend>
|
42 |
<admin>
|
43 |
<routers>
|
11 |
<class>Itembase_Plugin_Block</class>
|
12 |
</itembase>
|
13 |
</blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<helpers>
|
15 |
<itembase_plugin>
|
16 |
<class>Mage_Core_Helper</class>
|
27 |
</args>
|
28 |
</itembase>
|
29 |
</routers>
|
30 |
+
<layout>
|
31 |
+
<updates>
|
32 |
+
<itembase_plugin>
|
33 |
+
<file>itembase.xml</file>
|
34 |
+
</itembase_plugin>
|
35 |
+
</updates>
|
36 |
+
</layout>
|
37 |
</frontend>
|
38 |
<admin>
|
39 |
<routers>
|
app/code/community/Itembase/Plugin/plugindata.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Please do not change any of these values unless you know what you do!
|
6 |
**/
|
7 |
|
8 |
-
define('ITEMBASE_PLUGIN_VERSION', '2.
|
9 |
define('ITEMBASE_SERVER_OAUTH', 'https://auth-m2.itembase.com/oauth/v2/token');
|
10 |
define('ITEMBASE_SERVER_EMBED', 'https://deliver-static-d1.itembase.com');
|
11 |
define('ITEMBASE_SERVER_HOST', 'https://www.itembase.com');
|
5 |
* Please do not change any of these values unless you know what you do!
|
6 |
**/
|
7 |
|
8 |
+
define('ITEMBASE_PLUGIN_VERSION', '2.1');
|
9 |
define('ITEMBASE_SERVER_OAUTH', 'https://auth-m2.itembase.com/oauth/v2/token');
|
10 |
define('ITEMBASE_SERVER_EMBED', 'https://deliver-static-d1.itembase.com');
|
11 |
define('ITEMBASE_SERVER_HOST', 'https://www.itembase.com');
|
app/design/frontend/base/default/layout/itembase.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<checkout_onepage_success>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="itembase/plugin" name="itembase" template="itembase/checkout_success.phtml" />
|
6 |
+
</reference>
|
7 |
+
</checkout_onepage_success>
|
8 |
+
<catalog_product_view>
|
9 |
+
<reference name="content">
|
10 |
+
<block type="itembase/plugin" name="itembase" template="itembase/product_success.phtml" />
|
11 |
+
</reference>
|
12 |
+
</catalog_product_view>
|
13 |
+
</layout>
|
app/design/frontend/base/default/template/itembase/checkout_success.phtml
CHANGED
@@ -1,19 +1,20 @@
|
|
|
|
1 |
<script type="text/javascript" src="https://d3jaattgax33fv.cloudfront.net/js/jqplugin.js"></script>
|
2 |
<script type="text/javascript" charset="utf-8">
|
3 |
var $itembase_jq = jQuery;
|
4 |
|
5 |
$itembase_jq(document).ready(function($itembase_jq) {
|
6 |
|
7 |
-
var ibEmbedHost = "<?php echo $ibembedserver ?>";
|
8 |
-
var ibHost = "<?php echo $ibhostserver ?>";
|
9 |
-
var ibData = <?php echo json_encode($ibdata) ?>;
|
10 |
|
11 |
// Method to add click funcitonality
|
12 |
function addClickListener() {
|
13 |
$itembase_jq('#itembasecontainer .js-trackButton').click(function(event) {
|
14 |
if (!$itembase_jq(this).hasClass('disabled')) {
|
15 |
if ($itembase_jq('#itembase_data').length==0) {
|
16 |
-
$itembase_jq('#itembasecontainer').append('<form id="itembaseform" method="post" action="'+ibHost+'/api/add_to_my_collection" target="_blank"><textarea id="itembase_data" name="data"><?php echo addslashes(json_encode($ibdata)) ?></textarea><input type="submit" value="" cols="1" rows="1" style="width=1px;height:1px;visibility:hidden;" /></form>');
|
17 |
};
|
18 |
document.getElementById('itembaseform').submit();
|
19 |
$itembase_jq('#itembase_data').hide();
|
@@ -83,10 +84,10 @@ $itembase_jq(document).ready(function($itembase_jq) {
|
|
83 |
// Method to load plugin data with JSONP
|
84 |
function refreshPluginData() {
|
85 |
$itembase_jq.ajax({
|
86 |
-
data: {pluginVersion: '<?php echo $ibpluginversion ?>'},
|
87 |
dataType: 'jsonp',
|
88 |
jsonp: 'ib_callback',
|
89 |
-
url: ibEmbedHost + '/embed/confirm/<?php echo $ibdata[
|
90 |
success: function (data) {
|
91 |
renderPlugin(data.response);
|
92 |
sendOrderData();
|
1 |
+
<?php $this->checkoutPlugin() ?>
|
2 |
<script type="text/javascript" src="https://d3jaattgax33fv.cloudfront.net/js/jqplugin.js"></script>
|
3 |
<script type="text/javascript" charset="utf-8">
|
4 |
var $itembase_jq = jQuery;
|
5 |
|
6 |
$itembase_jq(document).ready(function($itembase_jq) {
|
7 |
|
8 |
+
var ibEmbedHost = "<?php echo $this->ibembedserver ?>";
|
9 |
+
var ibHost = "<?php echo $this->ibhostserver ?>";
|
10 |
+
var ibData = <?php echo json_encode($this->ibdata) ?>;
|
11 |
|
12 |
// Method to add click funcitonality
|
13 |
function addClickListener() {
|
14 |
$itembase_jq('#itembasecontainer .js-trackButton').click(function(event) {
|
15 |
if (!$itembase_jq(this).hasClass('disabled')) {
|
16 |
if ($itembase_jq('#itembase_data').length==0) {
|
17 |
+
$itembase_jq('#itembasecontainer').append('<form id="itembaseform" method="post" action="'+ibHost+'/api/add_to_my_collection" target="_blank"><textarea id="itembase_data" name="data"><?php echo addslashes(json_encode($this->ibdata)) ?></textarea><input type="submit" value="" cols="1" rows="1" style="width=1px;height:1px;visibility:hidden;" /></form>');
|
18 |
};
|
19 |
document.getElementById('itembaseform').submit();
|
20 |
$itembase_jq('#itembase_data').hide();
|
84 |
// Method to load plugin data with JSONP
|
85 |
function refreshPluginData() {
|
86 |
$itembase_jq.ajax({
|
87 |
+
data: {pluginVersion: '<?php echo $this->ibpluginversion ?>'},
|
88 |
dataType: 'jsonp',
|
89 |
jsonp: 'ib_callback',
|
90 |
+
url: ibEmbedHost + '/embed/confirm/<?php echo $this->ibdata['access_token'] ?>/<?php echo $this->ibdata['lang'] ?>',
|
91 |
success: function (data) {
|
92 |
renderPlugin(data.response);
|
93 |
sendOrderData();
|
app/design/frontend/base/default/template/itembase/product_success.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $this->productPlugin() ?>
|
2 |
+
<script type="text/javascript" src="https://d3jaattgax33fv.cloudfront.net/js/jqplugin.js"></script>
|
3 |
+
<script type="text/javascript" charset="utf-8">
|
4 |
+
var $itembaseJq = jQuery;
|
5 |
+
var $itembaseProductData = '<?php echo addslashes(json_encode($this->ibproductdata)) ?>';
|
6 |
+
|
7 |
+
$itembaseJq(document).ready(function($itembaseJq) {
|
8 |
+
$itembaseJq('.product-collateral').append('<div id="itembasecontainer"></div>');
|
9 |
+
$itembaseJq.ajax({
|
10 |
+
data: {pluginVersion: '<?php echo $this->ibpluginversion ?>', productId: '<?php echo $this->ibproductdata['product']['id'] ?>'},
|
11 |
+
dataType: 'jsonp',
|
12 |
+
jsonp: 'ib_callback',
|
13 |
+
url: '<?php echo $this->ibembedserver ?>/embed/product/<?php echo $this->ibaccesstoken ?>/<?php echo $this->iblang ?>',
|
14 |
+
success: function (data) {
|
15 |
+
$itembaseJq('#itembasecontainer').html('');
|
16 |
+
$itembaseJq('#itembasecontainer').append(data.response);
|
17 |
+
}
|
18 |
+
});
|
19 |
+
});
|
20 |
+
|
21 |
+
jQuery.noConflict(true);
|
22 |
+
</script>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Itembase</name>
|
4 |
-
<version>2.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Itembase plugin</description>
|
11 |
<notes>Stable release</notes>
|
12 |
<authors><author><name>Itembase</name><user>itembase</user><email>kg@itembase.biz</email></author></authors>
|
13 |
-
<date>2013-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Itembase"><dir name="Plugin"><dir name="Block"><file name="Plugin.php" hash="
|
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>Itembase</name>
|
4 |
+
<version>2.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Itembase plugin</description>
|
11 |
<notes>Stable release</notes>
|
12 |
<authors><author><name>Itembase</name><user>itembase</user><email>kg@itembase.biz</email></author></authors>
|
13 |
+
<date>2013-08-08</date>
|
14 |
+
<time>08:08:13</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Itembase"><dir name="Plugin"><dir name="Block"><file name="Plugin.php" hash="179da63d7f6b02ec59ae21381e4d7da8"/><file name="Registrationlabel.php" hash="da1c9830449a1af6602b813ef2e8745b"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ItembaseController.php" hash="b447663fb4320d0dd6d4fa6e088d17a6"/></dir><file name="IndexController.php" hash="ab00d97f209a41b9dc4b95a20e539089"/></dir><dir name="etc"><file name="config.xml" hash="c5ac71a71221ae0b05b99967a94ac706"/><file name="system.xml" hash="b6c0852bc0d958b0e9c2aa1113476940"/></dir><file name="oauth.php" hash="e3a6b961c2ca1e2bc6a70a6a6ecb56b3"/><file name="plugindata.php" hash="c1fb7781e1389c29d50be0c4600c6e46"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Itembase_Plugin.xml" hash="31903842e872b0c72d24f6ee6b7fd390"/></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Itembase_Plugin.csv" hash="fbcbb04e8ffb2b64e5d438628466f065"/></dir><dir name="en_US"><file name="Itembase_Plugin.csv" hash="0fead96374795d4b8e13b793b8186337"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="itembase"><file name="checkout_success.phtml" hash="d6a2e9455214f392dba944683f013624"/><file name="product_success.phtml" hash="66f90a200a29bd896466d4441655567b"/></dir></dir><dir name="layout"><file name="itembase.xml" hash="f18a531f63067b04883b9f91fbeacd90"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|