softcubeinc - Version 1.1.2

Version Notes

-

Download this release

Release Info

Developer Oleg Lesov
Extension softcubeinc
Version 1.1.2
Comparing to
See all releases


Version 1.1.2

Files changed (25) hide show
  1. app/code/community/SoftCube/Integration/Block/Adminhtml/System/Config/Block.php +75 -0
  2. app/code/community/SoftCube/Integration/Block/Category.php +12 -0
  3. app/code/community/SoftCube/Integration/Block/Customer.php +9 -0
  4. app/code/community/SoftCube/Integration/Block/Js.php +14 -0
  5. app/code/community/SoftCube/Integration/Block/Product.php +69 -0
  6. app/code/community/SoftCube/Integration/Block/Success.php +24 -0
  7. app/code/community/SoftCube/Integration/Helper/Data.php +33 -0
  8. app/code/community/SoftCube/Integration/Model/Api.php +28 -0
  9. app/code/community/SoftCube/Integration/Model/Service/Abstract.php +129 -0
  10. app/code/community/SoftCube/Integration/Model/Service/Cart.php +29 -0
  11. app/code/community/SoftCube/Integration/Model/Service/Softcube.php +154 -0
  12. app/code/community/SoftCube/Integration/Model/Zip.php +73 -0
  13. app/code/community/SoftCube/Integration/controllers/Adminhtml/SoftcubeController.php +78 -0
  14. app/code/community/SoftCube/Integration/etc/adminhtml.xml +25 -0
  15. app/code/community/SoftCube/Integration/etc/config.xml +52 -0
  16. app/code/community/SoftCube/Integration/etc/system.xml +27 -0
  17. app/design/adminhtml/default/default/template/softcube/integration/config/block.phtml +186 -0
  18. app/design/frontend/base/default/layout/softcube/integration.xml +48 -0
  19. app/design/frontend/base/default/template/softcube/integration/category.phtml +4 -0
  20. app/design/frontend/base/default/template/softcube/integration/customer.phtml +4 -0
  21. app/design/frontend/base/default/template/softcube/integration/js.phtml +4 -0
  22. app/design/frontend/base/default/template/softcube/integration/product.phtml +6 -0
  23. app/design/frontend/base/default/template/softcube/integration/success.phtml +5 -0
  24. app/etc/modules/SoftCube_Integration.xml +9 -0
  25. package.xml +18 -0
app/code/community/SoftCube/Integration/Block/Adminhtml/System/Config/Block.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Block_Adminhtml_System_Config_Block extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('softcube/integration/config/block.phtml');
9
+ }
10
+
11
+ /**
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
16
+ {
17
+ return $this->_toHtml();
18
+ }
19
+
20
+ /**
21
+ * @return bool
22
+ */
23
+ public function isReadyToInstall()
24
+ {
25
+ return Mage::helper('softcube_integration')->validateBaseDir();
26
+ }
27
+
28
+ /**
29
+ * @return bool
30
+ */
31
+ public function isAlreadyInstalled()
32
+ {
33
+ return Mage::helper('softcube_integration')->isAlreadyInstalled();
34
+ }
35
+
36
+ /**
37
+ * @return string|null
38
+ */
39
+ public function getStoreKey()
40
+ {
41
+ return Mage::getStoreConfig(SoftCube_Integration_Model_Service_Softcube::XML_PATH_SOFTCUBE_STORE_KEY);
42
+ }
43
+
44
+ /**
45
+ * Retrieve URL for install action
46
+ *
47
+ * @return string
48
+ */
49
+ public function getInstallActionUrl()
50
+ {
51
+ return $this->getUrl('*/softcube/install');
52
+ }
53
+
54
+ /**
55
+ * Retrieve URL for reinstall action
56
+ *
57
+ * @return string
58
+ */
59
+ public function getReinstallActionUrl()
60
+ {
61
+ return $this->getUrl('*/softcube/reinstall');
62
+ }
63
+
64
+
65
+ /**
66
+ * Retrieve URL for install action
67
+ *
68
+ * @return string
69
+ */
70
+ public function getUpdateActionUrl()
71
+ {
72
+ return $this->getUrl('*/softcube/updateInfo');
73
+ }
74
+
75
+ }
app/code/community/SoftCube/Integration/Block/Category.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Block_Category extends Mage_Core_Block_Template
4
+ {
5
+ public function getCategoryId()
6
+ {
7
+ if ($category = Mage::registry('current_category')) {
8
+ return $category->getId();
9
+ }
10
+ return 0;
11
+ }
12
+ }
app/code/community/SoftCube/Integration/Block/Customer.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Block_Customer extends Mage_Core_Block_Template
4
+ {
5
+ public function getCustomerId()
6
+ {
7
+ return Mage::getSingleton('customer/session')->getCustomerId();
8
+ }
9
+ }
app/code/community/SoftCube/Integration/Block/Js.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Block_Js extends Mage_Core_Block_Template
4
+ {
5
+ const XML_PATH_SOFTCUBE_JS = 'softcube/general/js';
6
+
7
+ public function getJs()
8
+ {
9
+ if ($js = Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_JS)) {
10
+ return $js;
11
+ }
12
+ return '';
13
+ }
14
+ }
app/code/community/SoftCube/Integration/Block/Product.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Block_Product extends Mage_Core_Block_Template
4
+ {
5
+ /** @var Mage_Catalog_Model_Product */
6
+ protected $_product;
7
+
8
+ /** @var array */
9
+ private $_stockOptions = array(
10
+ 0 => 'OutOfStock',
11
+ 1 => 'InStock'
12
+ );
13
+
14
+ /** @var array */
15
+ protected $_allowedProductTypes = array(
16
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
17
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
18
+ Mage_Catalog_Model_Product_Type::TYPE_GROUPED,
19
+ );
20
+
21
+ public function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_product = Mage::registry('current_product');
25
+ }
26
+
27
+ /**
28
+ * @return int
29
+ */
30
+ public function getProductId()
31
+ {
32
+ if ($this->_product) {
33
+ return $this->_product->getId();
34
+ }
35
+ return 0;
36
+ }
37
+
38
+ /**
39
+ * @return mixed
40
+ */
41
+ public function getAvailability()
42
+ {
43
+ if ($this->_product) {
44
+ $isInStock = (int)$this->_product->isInStock();
45
+ return $this->__($this->_stockOptions[$isInStock]);
46
+ }
47
+ return $this->__($this->_stockOptions[0]);
48
+ }
49
+
50
+ /**
51
+ * @return string
52
+ */
53
+ public function getVariantsIds()
54
+ {
55
+ $product = $this->_product;
56
+ $productType = $product->getTypeId();
57
+
58
+ $ids = array();
59
+ if (in_array($productType, $this->_allowedProductTypes)) {
60
+ $groupedIds = $product->getTypeInstance(true)->getChildrenIds($this->_product->getId(), false);
61
+ foreach ($groupedIds as $value) {
62
+ $ids = array_merge($ids, $value);
63
+ }
64
+ return implode(',', $ids);
65
+ }
66
+
67
+ return '';
68
+ }
69
+ }
app/code/community/SoftCube/Integration/Block/Success.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Block_Success extends Mage_Core_Block_Template
4
+ {
5
+ public function getLastOrderId()
6
+ {
7
+ if ($orderId = Mage::getSingleton('checkout/session')->getLastOrderId()) {
8
+ return $orderId;
9
+ }
10
+
11
+ return 0;
12
+ }
13
+
14
+ public function getLastOrderIncrementId()
15
+ {
16
+ /** @var Mage_Sales_Model_Order $order */
17
+ $order = Mage::getModel('sales/order')->load($this->getLastOrderId());
18
+ if ($order->getId()) {
19
+ return $order->getIncrementId();
20
+ }
21
+
22
+ return 0;
23
+ }
24
+ }
app/code/community/SoftCube/Integration/Helper/Data.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ const SOFTCUBE_BRIDGE_FILE = '/bridge2cart/bridge.php';
7
+
8
+ /**
9
+ * Check is root magento directory is writable
10
+ * @return bool
11
+ */
12
+ public function validateBaseDir()
13
+ {
14
+ return is_writable(Mage::getBaseDir());
15
+ }
16
+
17
+ /**
18
+ * @return bool
19
+ */
20
+ public function isAlreadyInstalled()
21
+ {
22
+ if (Mage::getStoreConfig(SoftCube_Integration_Model_Service_Softcube::XML_PATH_SOFTCUBE_JS)) {
23
+ return true;
24
+ }
25
+
26
+ return false;
27
+ }
28
+
29
+ public function isBridgeDownloaded()
30
+ {
31
+ return is_readable(Mage::getBaseDir() . static::SOFTCUBE_BRIDGE_FILE);
32
+ }
33
+ }
app/code/community/SoftCube/Integration/Model/Api.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Model_Api extends Mage_Core_Model_Abstract
4
+ {
5
+ protected $_services = array();
6
+
7
+ public function getService($serviceName)
8
+ {
9
+ if (isset($this->_services[$serviceName])) {
10
+ return $this->_services[$serviceName];
11
+ }
12
+
13
+ try {
14
+
15
+ $serviceModel = Mage::getModel('softcube_integration/service_' . $serviceName);
16
+ if (!$serviceModel) {
17
+ Mage::throwException(Mage::helper('core/translate')->__('Cant\' retrieve service model'));
18
+ }
19
+ $this->_services[$serviceName] = $serviceModel;
20
+ return $this->_services[$serviceName];
21
+
22
+ } catch (Mage_Core_Exception $e) {
23
+ Mage::logException($e);
24
+ Mage::getModel('adminhtml/session')->addError(Mage::helper('core/translate')->__($e->getMessage()));
25
+ return $this;
26
+ }
27
+ }
28
+ }
app/code/community/SoftCube/Integration/Model/Service/Abstract.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Model_Service_Abstract extends Mage_Core_Model_Abstract
4
+ {
5
+ /**
6
+ * URL to API API2Cart
7
+ *
8
+ * @var string A2C_URL
9
+ */
10
+ const A2C_URL = 'https://api.api2cart.com/v1.0/';
11
+
12
+ const XML_PATH_SOFTCUBE_API_KEY = 'softcube/general/api_key';
13
+
14
+ const XML_PATH_SOFTCUBE_STORE_KEY = 'softcube/general/store_key';
15
+
16
+ const XML_PATH_SOFTCUBE_INFO_NAME = 'softcube/information/name';
17
+
18
+ const XML_PATH_SOFTCUBE_INFO_EMAIL = 'softcube/information/email';
19
+
20
+ const XML_PATH_SOFTCUBE_INFO_PHONE = 'softcube/information/phone';
21
+
22
+ const DEFAULT_RESPONSE_FORMAT = 'json';
23
+
24
+ const DEFAULT_FILE_FORMAT = 'file';
25
+
26
+ protected $_fileResultMethods = array(
27
+ 'bridge.download'
28
+ );
29
+
30
+ /**
31
+ * @var array $_params
32
+ */
33
+ protected $_params = array();
34
+
35
+ /** @var string */
36
+ protected $_serviceName;
37
+
38
+ public function __construct()
39
+ {
40
+ $this->_params['api_key'] = Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_API_KEY);
41
+ if ($storeKey = Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_STORE_KEY)) {
42
+ $this->_params['store_key'] = $storeKey;
43
+ }
44
+ }
45
+
46
+
47
+ /**
48
+ * Send request to API2Cart
49
+ *
50
+ * @param string $method Method's name
51
+ * @param array $params Method's params list
52
+ * @return stdClass
53
+ * @throws Exception
54
+ */
55
+ public function doRequest($method, $params = array(), $customUrl = null)
56
+ {
57
+ if (strpos($method, '.') === false) {
58
+ $method = $this->_serviceName . '.' . $method;
59
+ }
60
+
61
+ $params = array_merge($this->_params, $params);
62
+
63
+ $ch = curl_init();
64
+
65
+ $format = static::DEFAULT_RESPONSE_FORMAT;
66
+
67
+ if (in_array($method, $this->_fileResultMethods)) {
68
+ $format = static::DEFAULT_FILE_FORMAT;
69
+ }
70
+
71
+ if (!$customUrl) {
72
+ $url = self::A2C_URL . $method . '.' . $format . '?' . http_build_query($params);
73
+ } else {
74
+ $url = $customUrl;
75
+ }
76
+
77
+ curl_setopt($ch, CURLOPT_URL, $url);
78
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
79
+ curl_setopt($ch, CURLOPT_HEADER, false);
80
+ curl_setopt($ch, CURLOPT_TIMEOUT, 300);
81
+ curl_setopt($ch, CURLINFO_HEADER_OUT, true);
82
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
83
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
84
+ curl_setopt($ch, CURLOPT_USERAGENT,
85
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; " .
86
+ "rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
87
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
88
+ "Accept: */*",
89
+ ));
90
+
91
+ if ($format == static::DEFAULT_FILE_FORMAT) {
92
+ $response = curl_exec($ch);
93
+ } else {
94
+ $response = trim(curl_exec($ch));
95
+ }
96
+
97
+ if (curl_errno($ch) != CURLE_OK) {
98
+ Mage::throwException(Mage::helper('core/translate')->__(curl_error($ch)));
99
+ }
100
+ curl_close($ch);
101
+ if ($format != static::DEFAULT_FILE_FORMAT) {
102
+ return $this->validate($response);
103
+ } else {
104
+ return $response;
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Received response validation
110
+ *
111
+ * @param string $response Method's response
112
+ * @return stdClass
113
+ * @throws Exception
114
+ */
115
+ private function validate($response)
116
+ {
117
+ $result = json_decode($response);
118
+
119
+ if ($result === null) {
120
+ Mage::throwException(Mage::helper('core/translate')->__('Response is NULL'));
121
+ }
122
+
123
+ if ($result->return_code != 0) {
124
+ Mage::throwException(Mage::helper('core/translate')->__($result->return_message));
125
+ }
126
+
127
+ return $result->result;
128
+ }
129
+ }
app/code/community/SoftCube/Integration/Model/Service/Cart.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Model_Service_Cart extends SoftCube_Integration_Model_Service_Abstract
4
+ {
5
+ protected $_serviceName = 'cart';
6
+
7
+ public function registerStore()
8
+ {
9
+ if (isset($this->_params['store_key'])) {
10
+ return;
11
+ }
12
+
13
+ $result = $this->doRequest('bridge');
14
+ if ($result) {
15
+ $config = Mage::getModel('core/config');
16
+ $config->saveConfig(static::XML_PATH_SOFTCUBE_STORE_KEY, $result->store_key);
17
+ $config->cleanCache();
18
+ $this->_params['store_key'] = $result->store_key;
19
+ }
20
+
21
+ }
22
+
23
+ public function downloadBridge($bridgeUrl)
24
+ {
25
+ $file = $this->doRequest('bridge.download', array(), $bridgeUrl);
26
+ Mage::getModel('softcube_integration/zip')->extractString($file);
27
+ }
28
+
29
+ }
app/code/community/SoftCube/Integration/Model/Service/Softcube.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Model_Service_Softcube extends SoftCube_Integration_Model_Service_Abstract
4
+ {
5
+
6
+ const XML_PATH_SOFTCUBE_GUID = 'softcube/general/guid';
7
+
8
+ const XML_PATH_SOFTCUBE_JS = 'softcube/general/js';
9
+
10
+ const STORE_NAME = 'magento';
11
+
12
+ /** @var string */
13
+ protected $_endpointUrl = 'https://recommendapi.datasoftcube.com/staging/';
14
+
15
+ /** @var string */
16
+ protected $_guId = '';
17
+
18
+ /** @var string */
19
+ protected $_js = '';
20
+
21
+ /** @var string */
22
+ protected $_bridgeUrl;
23
+
24
+ /** @var string */
25
+ protected $_storeKey;
26
+
27
+ /** @var string */
28
+ protected $_softCubeApiKey = 'EEA11385AC6D4A6BB529ED7B62BD380F';
29
+
30
+ public function __construct()
31
+ {
32
+ $this->_guId = Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_GUID);
33
+ $this->_js = Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_JS);
34
+ }
35
+
36
+ public function getStoreKey()
37
+ {
38
+ if ($this->_storeKey) {
39
+ return $this->_storeKey;
40
+ }
41
+
42
+ $params = array(
43
+ 'api_key' => $this->_softCubeApiKey,
44
+ 'url' => $_SERVER['HTTP_HOST'],
45
+ 'store' => static::STORE_NAME,
46
+ );
47
+
48
+ $result = $this->doRequest('tenants', $params, 'PUT');
49
+
50
+ if (is_array(json_decode($result, true))) {
51
+ $result = json_decode($result, true);
52
+ $this->_storeKey = $result['store_key'];
53
+ $this->_bridgeUrl = $result['bridge_url'];
54
+ } else {
55
+ $this->_storeKey = $result;
56
+ }
57
+
58
+ $configModel = Mage::getModel('core/config');
59
+ $configModel->saveConfig(static::XML_PATH_SOFTCUBE_STORE_KEY, $this->_storeKey);
60
+ $configModel->cleanCache();
61
+
62
+ return $this->_storeKey;
63
+ }
64
+
65
+ public function updateInformation($customParams = null)
66
+ {
67
+ $params = array(
68
+ 'api_key' => $this->_softCubeApiKey,
69
+ 'guid' => $this->_storeKey ? $this->_storeKey : Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_STORE_KEY),
70
+ 'name' => $customParams['name'] ? $customParams['name'] : Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_INFO_NAME),
71
+ 'email' => $customParams['email'] ? $customParams['email'] : Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_INFO_EMAIL),
72
+ 'phone' => $customParams['phone'] ? $customParams['phone'] : Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_INFO_PHONE)
73
+ );
74
+
75
+ if ($customParams) {
76
+ $configModel = Mage::getModel('core/config');
77
+ $configModel->saveConfig(static::XML_PATH_SOFTCUBE_INFO_NAME, $params['name']);
78
+ $configModel->saveConfig(static::XML_PATH_SOFTCUBE_INFO_EMAIL, $params['email']);
79
+ $configModel->saveConfig(static::XML_PATH_SOFTCUBE_INFO_PHONE, $params['phone']);
80
+ $configModel->removeCache();
81
+ }
82
+
83
+ $this->doRequest('credentials/api2cart', $params, 'POST');
84
+
85
+ }
86
+
87
+ public function getBridgeUrl()
88
+ {
89
+ return $this->_bridgeUrl;
90
+ }
91
+
92
+ public function getJs()
93
+ {
94
+ if (!$this->_storeKey) {
95
+ $this->_storeKey = Mage::getStoreConfig(static::XML_PATH_SOFTCUBE_STORE_KEY);
96
+ if (!$this->_storeKey) {
97
+ $this->getStoreKey();
98
+ }
99
+ }
100
+
101
+ if ($this->_js) {
102
+ return $this->_js;
103
+ }
104
+
105
+ $params = array(
106
+ 'api_key' => $this->_softCubeApiKey
107
+ );
108
+
109
+ $this->_js = $this->doRequest('tenants/' . $this->_storeKey, $params);
110
+
111
+ $configModel = Mage::getModel('core/config');
112
+ $configModel->saveConfig(static::XML_PATH_SOFTCUBE_JS, $this->_js);
113
+ $configModel->cleanCache();
114
+
115
+ return $this->_js;
116
+ }
117
+
118
+ public function doRequest($method, $params, $httpMethod = 'GET')
119
+ {
120
+ $ch = curl_init();
121
+
122
+ $url = $this->_endpointUrl;
123
+ if ($method) {
124
+ $url .= '/' . $method;
125
+ }
126
+
127
+ curl_setopt($ch, CURLOPT_URL, $url);
128
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
129
+ curl_setopt($ch, CURLOPT_HEADER, false);
130
+ curl_setopt($ch, CURLOPT_TIMEOUT, 300);
131
+ curl_setopt($ch, CURLINFO_HEADER_OUT, true);
132
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
133
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
134
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpMethod);
135
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
136
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
137
+ 'Accept: application/json',
138
+ 'Content-Type: application/json',
139
+ ));
140
+
141
+ $response = trim(curl_exec($ch));
142
+
143
+ if (curl_errno($ch) != CURLE_OK) {
144
+ Mage::throwException(Mage::helper('core/translate')->__(curl_error($ch)));
145
+ }
146
+ curl_close($ch);
147
+
148
+ if (!$response) {
149
+ Mage::throwException(Mage::helper('core/translate')->__('Response is NULL'));
150
+ }
151
+
152
+ return $response;
153
+ }
154
+ }
app/code/community/SoftCube/Integration/Model/Zip.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Model_Zip extends Mage_Core_Model_Abstract
4
+ {
5
+ /** @var string */
6
+ protected $_string = '';
7
+
8
+ /** @var string */
9
+ protected $_tmpFileName = 'softcube-temp.zip';
10
+
11
+ /** @var string */
12
+ protected $_tmpFilePath = '';
13
+
14
+ /** @var array */
15
+ protected $_entitiesToExtract = array(
16
+ 'bridge2cart/',
17
+ 'bridge2cart/bridge.php',
18
+ 'bridge2cart/config.php',
19
+ );
20
+
21
+ public function extractString($string)
22
+ {
23
+ umask(0);
24
+ $this->_string = $string;
25
+ $this->_tmpFilePath = Mage::getBaseDir('var') . DIRECTORY_SEPARATOR . $this->_tmpFileName;
26
+
27
+ if (!$this->_writeToTempDir()) {
28
+ Mage::throwException(Mage::helper('core/translate')->__(sprintf('Can\'t write file to %s', $this->_tmpFilePath)));
29
+ }
30
+
31
+
32
+ if (!$this->_extractTmpFile()) {
33
+ Mage::throwException(Mage::helper('core/translate')->__(sprintf('Can\'t extract zip file %s', $this->_tmpFilePath)));
34
+ }
35
+
36
+ $this->_removeTmpFiles();
37
+
38
+ return true;
39
+ }
40
+
41
+ private function _writeToTempDir()
42
+ {
43
+ $fp = fopen($this->_tmpFilePath, 'wb');
44
+ $result = @fwrite($fp, $this->_string);
45
+ fclose($fp);
46
+ return $result;
47
+ }
48
+
49
+ private function _extractTmpFile()
50
+ {
51
+ $zip = new ZipArchive;
52
+ $result = $zip->open($this->_tmpFilePath);
53
+
54
+ if (!$result) {
55
+ return false;
56
+ }
57
+
58
+ $result = $zip->extractTo(Mage::getBaseDir() . '/', $this->_entitiesToExtract);
59
+
60
+ if (!$result) {
61
+ return false;
62
+ }
63
+
64
+ $zip->close();
65
+
66
+ return true;
67
+ }
68
+
69
+ private function _removeTmpFiles()
70
+ {
71
+ @unlink($this->_tmpFilePath);
72
+ }
73
+ }
app/code/community/SoftCube/Integration/controllers/Adminhtml/SoftcubeController.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SoftCube_Integration_Adminhtml_SoftcubeController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function installAction()
6
+ {
7
+ $session = Mage::getSingleton('adminhtml/session');
8
+ try {
9
+ /** @var SoftCube_Integration_Model_Service_Cart $cartService */
10
+ $cartService = Mage::getModel('softcube_integration/api')->getService('cart');
11
+ /** @var SoftCube_Integration_Model_Service_Softcube $softCubeService */
12
+ $softCubeService = Mage::getModel('softcube_integration/api')->getService('softcube');
13
+ $softCubeService->getStoreKey();
14
+
15
+ $bridgeUrl = $softCubeService->getBridgeUrl();
16
+ $isBridgeDownloaded = Mage::helper('softcube_integration')->isBridgeDownloaded();
17
+
18
+ if (!$isBridgeDownloaded && $bridgeUrl) {
19
+ $cartService->downloadBridge($bridgeUrl);
20
+ }
21
+
22
+ $post = $this->getRequest()->getPost();
23
+ if (empty($post)) {
24
+ $post = $this->getRequest()->getParams();
25
+ }
26
+
27
+ $softCubeService->updateInformation($post);
28
+
29
+ $softCubeService->getJs();
30
+
31
+ } catch (Mage_Core_Exception $e) {
32
+ $session->addError($this->__($e->getMessage()));
33
+ }
34
+
35
+ if (!isset($e)) {
36
+ $session->addSuccess($this->__('Store was successfully registered'));
37
+ }
38
+
39
+ Mage::getModel('core/config')->removeCache();
40
+ }
41
+
42
+ public function reinstallAction()
43
+ {
44
+ /** @var Mage_Core_Model_Config $configModel */
45
+ $configModel = Mage::getModel('core/config');
46
+
47
+ $pathToRemove = array(
48
+ SoftCube_Integration_Model_Service_Softcube::XML_PATH_SOFTCUBE_JS,
49
+ SoftCube_Integration_Model_Service_Softcube::XML_PATH_SOFTCUBE_GUID,
50
+ SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_STORE_KEY
51
+ );
52
+
53
+ foreach ($pathToRemove as $path) {
54
+ $configModel->deleteConfig($path);
55
+ }
56
+
57
+ $configModel->removeCache();
58
+ $this->_redirect('*/*/install', $this->getRequest()->getPost());
59
+ }
60
+
61
+ public function updateInfoAction()
62
+ {
63
+ $post = $this->getRequest()->getPost();
64
+ /** @var SoftCube_Integration_Model_Service_Softcube $softCubeService */
65
+ $softCubeService = Mage::getModel('softcube_integration/api')->getService('softcube');
66
+ $session = Mage::getSingleton('adminhtml/session');
67
+ try {
68
+ $softCubeService->updateInformation($post);
69
+ } catch (Mage_Core_Exception $e) {
70
+ $session->addError($this->__($e->getMessage()));
71
+ }
72
+
73
+ if (!isset($e)) {
74
+ $session->addSuccess($this->__('Information was successfully updated'));
75
+ }
76
+
77
+ }
78
+ }
app/code/community/SoftCube/Integration/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <softcube translate="title" module="softcube_integration">
8
+ <title>SoftCube Install action</title>
9
+ </softcube>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <softcube translate="title" module="softcube_integration">
15
+ <title>SoftCube Section</title>
16
+ </softcube>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/SoftCube/Integration/etc/config.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SoftCube_Integration>
5
+ <version>1.0.0</version>
6
+ </SoftCube_Integration>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <softcube_integration>
11
+ <class>SoftCube_Integration_Helper</class>
12
+ </softcube_integration>
13
+ </helpers>
14
+ <blocks>
15
+ <softcube_integration>
16
+ <class>SoftCube_Integration_Block</class>
17
+ </softcube_integration>
18
+ </blocks>
19
+ <models>
20
+ <softcube_integration>
21
+ <class>SoftCube_Integration_Model</class>
22
+ </softcube_integration>
23
+ </models>
24
+ </global>
25
+ <admin>
26
+ <routers>
27
+ <adminhtml>
28
+ <args>
29
+ <modules>
30
+ <SoftCube_Integration before="Mage_Adminhtml">SoftCube_Integration_Adminhtml</SoftCube_Integration>
31
+ </modules>
32
+ </args>
33
+ </adminhtml>
34
+ </routers>
35
+ </admin>
36
+ <frontend>
37
+ <layout>
38
+ <updates>
39
+ <softcube_integration>
40
+ <file>softcube/integration.xml</file>
41
+ </softcube_integration>
42
+ </updates>
43
+ </layout>
44
+ </frontend>
45
+ <default>
46
+ <softcube>
47
+ <general>
48
+ <api_key>bfc5c21c3210be3db8036ca3ffa765e1</api_key>
49
+ </general>
50
+ </softcube>
51
+ </default>
52
+ </config>
app/code/community/SoftCube/Integration/etc/system.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <softcube>
5
+ <label>SoftCube</label>
6
+ <sort_order>250</sort_order>
7
+ </softcube>
8
+ </tabs>
9
+ <sections>
10
+ <softcube translate="label" module="softcube_integration">
11
+ <label>Integration</label>
12
+ <tab>softcube</tab>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <groups>
17
+ <general translate="label">
18
+ <label>General</label>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>100</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <frontend_model>softcube_integration/adminhtml_system_config_block</frontend_model>
23
+ </general>
24
+ </groups>
25
+ </softcube>
26
+ </sections>
27
+ </config>
app/design/adminhtml/default/default/template/softcube/integration/config/block.phtml ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var $this SoftCube_Integration_Block_Adminhtml_System_Config_Block */ ?>
2
+ <div class="section-config active">
3
+ <div class="entry-edit-head collapseable">
4
+ <a id="softcube_general-head"
5
+ href="#"
6
+ onclick="Fieldset.toggleCollapse('softcube_general'); return false;"
7
+ class="open"><?php echo $this->__('General') ?></a>
8
+ </div>
9
+ <input id="softcube_general-state" name="config_state[softcube_general]" type="hidden" value="1">
10
+ <fieldset class="config collapseable" id="softcube_general">
11
+ <legend>General</legend>
12
+ <table cellspacing="0" class="form-list">
13
+ <colgroup>
14
+ <col width="1000"/>
15
+ </colgroup>
16
+ <tbody>
17
+ <tr id="row_softcube_general_test_connection">
18
+ <td class="label">
19
+ <?php if ($this->isReadyToInstall() && !$this->isAlreadyInstalled()): ?>
20
+ <div><b><?php echo $this->__('Your store ready to be configured. Please press "Install" button to proceed.') ?></b></div>
21
+ <table>
22
+ <tbody>
23
+ <tr id="row_softcube_information_name">
24
+ <td class="label"><label for="softcube_information_name">Name</label></td>
25
+ <td class="value"><input id="softcube_information_name"
26
+ name="groups[information][fields][name][value]"
27
+ value="<?php echo Mage::getStoreConfig(SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_INFO_NAME) ?>"
28
+ class="input-text required-entry" type="text">
29
+ </td>
30
+ <td class="scope-label">[STORE VIEW]</td>
31
+ <td class=""></td>
32
+ </tr>
33
+ <tr id="row_softcube_information_email">
34
+ <td class="label"><label for="softcube_information_email">E-mail</label></td>
35
+ <td class="value"><input id="softcube_information_email"
36
+ name="groups[information][fields][email][value]"
37
+ value="<?php echo Mage::getStoreConfig(SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_INFO_EMAIL) ?>"
38
+ class=" input-text required-entry validate-email" type="text">
39
+ </td>
40
+ <td class="scope-label">[STORE VIEW]</td>
41
+ <td class=""></td>
42
+ </tr>
43
+ <tr id="row_softcube_information_phone">
44
+ <td class="label"><label for="softcube_information_phone">Phone</label></td>
45
+ <td class="value"><input id="softcube_information_phone"
46
+ name="groups[information][fields][phone][value]"
47
+ value="<?php echo Mage::getStoreConfig(SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_INFO_PHONE) ?>"
48
+ class="input-text required-entry validate-phoneLax" type="text">
49
+ </td>
50
+ <td class="scope-label">[STORE VIEW]</td>
51
+ <td class=""></td>
52
+ </tr>
53
+ </tbody>
54
+ </table>
55
+ <div>
56
+ <button class="scalable" type="button"
57
+ onclick="installAction('<?php echo $this->getInstallActionUrl() ?>')">
58
+ <span><span><?php echo $this->__('Install') ?></span></span>
59
+ </button>
60
+ </div>
61
+ <?php else: ?>
62
+ <?php if (!$this->isAlreadyInstalled()): ?>
63
+ <div><?php echo $this->__('Your store does not meet requirements to proceed.') ?></div>
64
+ <div>
65
+ <span class="required">
66
+ <?php echo $this->__('Magento Should have permissions to write it its root folder. Please refresh this page when this issue will be solved.') ?>
67
+ </span>
68
+ </div>
69
+ <div>&nbsp;</div>
70
+ <div>
71
+ <button class="scalable disabled" type="button" disabled="disabled">
72
+ <span><span><?php echo $this->__('Install') ?></span></span>
73
+ </button>
74
+ </div>
75
+ <?php else: ?>
76
+ <div><b><?php echo $this->__('Your store already configured.'); ?></b></div>
77
+ <table>
78
+ <tbody>
79
+ <tr id="row_softcube_information_store_key">
80
+ <td class="label"><label
81
+ for="softcube_information_store_key"><?php echo $this->__('Store Key'); ?></label>
82
+ </td>
83
+ <td class="value"><?php echo $this->getStoreKey(); ?></td>
84
+ <td class="scope-label"></td>
85
+ <td class=""></td>
86
+ </tr>
87
+ <tr id="row_softcube_information_name">
88
+ <td class="label"><label for="softcube_information_name">Name</label></td>
89
+ <td class="value"><input id="softcube_information_name"
90
+ name="groups[information][fields][name][value]"
91
+ value="<?php echo Mage::getStoreConfig(SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_INFO_NAME) ?>"
92
+ class="input-text required-entry" type="text">
93
+ </td>
94
+ <td class="scope-label">[STORE VIEW]</td>
95
+ <td class=""></td>
96
+ </tr>
97
+ <tr id="row_softcube_information_email">
98
+ <td class="label"><label for="softcube_information_email">E-mail</label></td>
99
+ <td class="value"><input id="softcube_information_email"
100
+ name="groups[information][fields][email][value]"
101
+ value="<?php echo Mage::getStoreConfig(SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_INFO_EMAIL) ?>"
102
+ class="input-text required-entry validate-email" type="text">
103
+ </td>
104
+ <td class="scope-label">[STORE VIEW]</td>
105
+ <td class=""></td>
106
+ </tr>
107
+ <tr id="row_softcube_information_phone">
108
+ <td class="label"><label for="softcube_information_phone">Phone</label></td>
109
+ <td class="value"><input id="softcube_information_phone"
110
+ name="groups[information][fields][phone][value]"
111
+ value="<?php echo Mage::getStoreConfig(SoftCube_Integration_Model_Service_Abstract::XML_PATH_SOFTCUBE_INFO_PHONE) ?>"
112
+ class="input-text required-entry validate-phoneLax" type="text">
113
+ </td>
114
+ <td class="scope-label">[STORE VIEW]</td>
115
+ <td class=""></td>
116
+ </tr>
117
+ </tbody>
118
+ </table>
119
+ <div>&nbsp;</div>
120
+ <button class="scalable" type="button" onclick="updateInfo()">
121
+ <span><span>Update Info</span></span>
122
+ </button>
123
+ &nbsp;&nbsp;
124
+ <button class="scalable delete" type="button"
125
+ onclick="installAction('<?php echo $this->getReinstallActionUrl() ?>')">
126
+ <span><span><?php echo $this->__('Reinstall') ?></span></span>
127
+ </button>
128
+ <?php endif; ?>
129
+ <?php endif; ?>
130
+ </td>
131
+ </tr>
132
+ </tbody>
133
+ </table>
134
+ </fieldset>
135
+ </div>
136
+
137
+
138
+ <script type="text/javascript">
139
+ //<![CDATA[
140
+ function installAction(action) {
141
+
142
+ if (!configForm.validate()) {
143
+ return;
144
+ }
145
+
146
+ new Ajax.Request(action, {
147
+ parameters: {
148
+ isAjax: 'true',
149
+ form_key: FORM_KEY,
150
+ name: $('softcube_information_name').value,
151
+ email: $('softcube_information_email').value,
152
+ phone: $('softcube_information_phone').value
153
+ },
154
+ onSuccess: function () {
155
+ location.reload();
156
+ },
157
+ onFailure: function () {
158
+ location.reload();
159
+ }
160
+ });
161
+ }
162
+
163
+ function updateInfo() {
164
+
165
+ if (!configForm.validate()) {
166
+ return;
167
+ }
168
+
169
+ new Ajax.Request('<?php echo $this->getUpdateActionUrl() ?>', {
170
+ parameters: {
171
+ isAjax: 'true',
172
+ form_key: FORM_KEY,
173
+ name: $('softcube_information_name').value,
174
+ email: $('softcube_information_email').value,
175
+ phone: $('softcube_information_phone').value
176
+ },
177
+ onSuccess: function () {
178
+ location.reload();
179
+ },
180
+ onFailure: function () {
181
+ location.reload();
182
+ }
183
+ });
184
+ }
185
+ //]]>
186
+ </script>
app/design/frontend/base/default/layout/softcube/integration.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="after_body_start">
5
+ <block name="softcube.js" type="softcube_integration/js" template="softcube/integration/js.phtml"/>
6
+ </reference>
7
+ </default>
8
+ <catalog_product_view>
9
+ <reference name="before_body_end">
10
+ <block name="softcube.product" type="softcube_integration/product" template="softcube/integration/product.phtml"/>
11
+ </reference>
12
+ </catalog_product_view>
13
+ <catalog_category_default>
14
+ <reference name="before_body_end">
15
+ <block name="softcube.category" type="softcube_integration/category" template="softcube/integration/category.phtml"/>
16
+ </reference>
17
+ </catalog_category_default>
18
+ <catalog_category_view>
19
+ <reference name="before_body_end">
20
+ <block name="softcube.category" type="softcube_integration/category" template="softcube/integration/category.phtml"/>
21
+ </reference>
22
+ </catalog_category_view>
23
+ <checkout_onepage_success>
24
+ <reference name="before_body_end">
25
+ <block name="softcube.success" type="softcube_integration/success" template="softcube/integration/success.phtml"/>
26
+ </reference>
27
+ </checkout_onepage_success>
28
+ <checkout_multishipping_success>
29
+ <reference name="before_body_end">
30
+ <block name="softcube.success" type="softcube_integration/success" template="softcube/integration/success.phtml"/>
31
+ </reference>
32
+ </checkout_multishipping_success>
33
+ <paypal_standard_success>
34
+ <reference name="before_body_end">
35
+ <block name="softcube.success" type="softcube_integration/success" template="softcube/integration/success.phtml"/>
36
+ </reference>
37
+ </paypal_standard_success>
38
+ <moneybookers_processing_success>
39
+ <reference name="before_body_end">
40
+ <block name="softcube.success" type="softcube_integration/success" template="softcube/integration/success.phtml"/>
41
+ </reference>
42
+ </moneybookers_processing_success>
43
+ <customer_logged_in>
44
+ <reference name="before_body_end">
45
+ <block name="softcube.customer" type="softcube_integration/customer" template="softcube/integration/customer.phtml"/>
46
+ </reference>
47
+ </customer_logged_in>
48
+ </layout>
app/design/frontend/base/default/template/softcube/integration/category.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php /* @var $this SoftCube_Integration_Block_Category */ ?>
2
+ <div class="softcubecategory" style="display:none">
3
+ <span class="categoryid"><?php echo $this->getCategoryId(); ?></span>
4
+ </div>
app/design/frontend/base/default/template/softcube/integration/customer.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php /* @var $this SoftCube_Integration_Block_Customer */ ?>
2
+ <div class="softcubecustomer" style="display:none">
3
+ <span class="customerid"><?php echo $this->getCustomerId(); ?></span>
4
+ </div>
app/design/frontend/base/default/template/softcube/integration/js.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php /* @var $this SoftCube_Integration_Block_Js */ ?>
2
+ <?php if ($js = $this->getJs()): ?>
3
+ <?php echo $js; ?>
4
+ <?php endif; ?>
app/design/frontend/base/default/template/softcube/integration/product.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php /* @var $this SoftCube_Integration_Block_Product */ ?>
2
+ <div class="softcubeproduct" style="display:none">
3
+ <span class="productId"><?php echo $this->getProductId(); ?></span>
4
+ <span class="availability"><?php echo $this->getAvailability(); ?></span>
5
+ <span class="productVariantIds"><?php echo $this->getVariantsIds(); ?></span>
6
+ </div>
app/design/frontend/base/default/template/softcube/integration/success.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php /* @var $this SoftCube_Integration_Block_Success */ ?>
2
+ <div class="softcubesuccess " style="display:none">
3
+ <span class="orderid"><?php echo $this->getLastOrderId(); ?></span>
4
+ <span class="long_id"><?php echo $this->getLastOrderIncrementId(); ?></span>
5
+ </div>
app/etc/modules/SoftCube_Integration.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SoftCube_Integration>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </SoftCube_Integration>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>softcubeinc</name>
4
+ <version>1.1.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/OSL-3.0">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Integration Extension</summary>
10
+ <description>Extension add possibility to integrate with softcube</description>
11
+ <notes>-</notes>
12
+ <authors><author><name>Oleg Lesov</name><user>OlegLesov</user><email>oleg.lesov@softcube.com</email></author></authors>
13
+ <date>2015-04-07</date>
14
+ <time>13:07:43</time>
15
+ <contents><target name="magecommunity"><dir name="SoftCube"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Block.php" hash="94da6d3e10f7147d0b9c10c199a58494"/></dir></dir></dir><file name="Category.php" hash="df3322900f5d65276d36948aedfcbed1"/><file name="Customer.php" hash="85e97d6fa86f18537f44111edebd5af8"/><file name="Js.php" hash="0d6a0f0bc3c94892367b7c252e5ddec3"/><file name="Product.php" hash="6353db6ef94856c9febb73cee7fcdf72"/><file name="Success.php" hash="c439db1f6f495f9e89b4435fedb3b1ef"/></dir><dir name="Helper"><file name="Data.php" hash="25a150545db1856f68d4d4bd44014eef"/></dir><dir name="Model"><file name="Api.php" hash="6c4deb5dc25288363e37a2031fd87717"/><dir name="Service"><file name="Abstract.php" hash="a7308b726160d71af2cb3abc6c3c3191"/><file name="Cart.php" hash="4eeafa3e200d2b5d7ab4837249b309f6"/><file name="Softcube.php" hash="6dce51ea13ad3a21b001d0b3feca68a9"/></dir><file name="Zip.php" hash="0c990ef11b7210f4f9d490141809eef0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SoftcubeController.php" hash="c8b76e96c59b9f5876d6a44f4d54ddbd"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4340d7d7410caa337830fe85a9098f2d"/><file name="config.xml" hash="4628cc4070c5b7045f8816a0658d469e"/><file name="system.xml" hash="af79998b52fb59f7e4deb4ed87105cfa"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="softcube"><dir name="integration"><dir name="config"><file name="block.phtml" hash="07d62802d70031d6efcb70e839fdfc13"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="softcube"><file name="integration.xml" hash="3bba2fa49e73b4496a9c93c09ae672d7"/></dir></dir><dir name="template"><dir name="softcube"><dir name="integration"><file name="category.phtml" hash="e4d3f799d15f666d7911705979658006"/><file name="customer.phtml" hash="c7ae7c0fc03a1a1ebd51237ae151f3f4"/><file name="js.phtml" hash="0beded594a4b902aaa13cd23cb04c8ef"/><file name="product.phtml" hash="b89458cf89e964e1dfcec83fc62f8fa4"/><file name="success.phtml" hash="b11c0bd66f92f7ff7c682b2f9311e496"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SoftCube_Integration.xml" hash="801fd4c59f979af6cf46585467aa0b0b"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>5.6.0</max></php></required></dependencies>
18
+ </package>