Cohesionet_ShopConnect - Version 1.0.6

Version Notes

Support 1.5.0.0 & later

Download this release

Release Info

Developer Ying Qi
Extension Cohesionet_ShopConnect
Version 1.0.6
Comparing to
See all releases


Version 1.0.6

app/code/community/Cohesionet/ShopConnect/Block/Embed.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_ShopConnect
23
+ * @copyright Copyright (c) 2015 Cohesionet LLC (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Cohesionet embed script block.
29
+ * Adds JavaScript to the document HEAD that takes care of the meta-data gathering
30
+ * and displaying of recommended products.
31
+ *
32
+ * @category Cohesionet
33
+ * @package Cohesionet_ShopConnect
34
+ * @author Cohesionet LLC
35
+ */
36
+ class Cohesionet_ShopConnect_Block_Embed extends Mage_Core_Block_Template
37
+ {
38
+ /**
39
+ * Render JavaScript that handles the data gathering and displaying of recommended products
40
+ * if the module is enabled for the current store.
41
+ *
42
+ * @return string
43
+ */
44
+ protected function _toHtml()
45
+ {
46
+ if (!Mage::helper('cohesionet_shopConnect')->isModuleEnabled()) {
47
+ return '';
48
+ }
49
+ return parent::_toHtml();
50
+ }
51
+ }
app/code/community/Cohesionet/ShopConnect/Block/Product.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_ShopConnect
23
+ * @copyright Copyright (c) 2015 Cohesionet (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product shopConnect block.
29
+ * Adds meta-data to the HTML document for the currently viewed product.
30
+ *
31
+ * @category Cohesionet
32
+ * @package Cohesionet_ShopConnect
33
+ * @author Cohesionet
34
+ */
35
+ class Cohesionet_ShopConnect_Block_Product extends Mage_Catalog_Block_Product_Abstract
36
+ {
37
+ /**
38
+ * Product "in stock" shopConnect string.
39
+ */
40
+ const PRODUCT_IN_STOCK = 'InStock';
41
+
42
+ /**
43
+ * Product "out of stock" shopConnect string.
44
+ */
45
+ const PRODUCT_OUT_OF_STOCK = 'OutOfStock';
46
+
47
+ /**
48
+ * Render product info as hidden meta data if the module is enabled for the current store.
49
+ * If it is a "bundle" product with fixed price type, then do not render. These are not supported due to their
50
+ * child products not having prices available.
51
+ *
52
+ * @return string
53
+ */
54
+ protected function _toHtml()
55
+ {
56
+ $product = $this->getProduct();
57
+ if (!Mage::helper('cohesionet_shopConnect')->isModuleEnabled()
58
+ || ($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE
59
+ && (int)$product->getPriceType() === Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED)
60
+ ) {
61
+ return '';
62
+ }
63
+
64
+ return parent::_toHtml();
65
+ }
66
+
67
+ /**
68
+ * Return shopConnect data for the product availability.
69
+ *
70
+ * @param Mage_Catalog_Model_Product $product
71
+ *
72
+ * @return string
73
+ */
74
+ public function getProductAvailability($product)
75
+ {
76
+ if ($product instanceof Mage_Catalog_Model_Product && $product->isAvailable()) {
77
+ return self::PRODUCT_IN_STOCK;
78
+ } else {
79
+ return self::PRODUCT_OUT_OF_STOCK;
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Return array of categories for the product.
85
+ * The items in the array are strings combined of the complete category path to the products own category.
86
+ *
87
+ * Structure:
88
+ * array (
89
+ * /Electronics/Computers
90
+ * )
91
+ *
92
+ * @param Mage_Catalog_Model_Product $product
93
+ *
94
+ * @return array
95
+ */
96
+ public function getProductCategories($product)
97
+ {
98
+ $data = array();
99
+
100
+ if ($product instanceof Mage_Catalog_Model_Product) {
101
+ $categoryCollection = $product->getCategoryCollection();
102
+ foreach ($categoryCollection as $category) {
103
+ $categoryString = Mage::helper('cohesionet_shopConnect')->buildCategoryString($category);
104
+ if (!empty($categoryString)) {
105
+ $data[] = $categoryString;
106
+ }
107
+ }
108
+ }
109
+
110
+ return $data;
111
+ }
112
+ }
app/code/community/Cohesionet/ShopConnect/Helper/Data.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_ShopConnect
23
+ * @copyright Copyright (c) 2014 Cohesionet (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Helper class for common operations.
29
+ *
30
+ * @category Cohesionet
31
+ * @package Cohesionet_ShopConnect
32
+ * @author Cohesionet Solutions Ltd
33
+ */
34
+ class Cohesionet_ShopConnect_Helper_Data extends Mage_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * Path to store config cohesionet module enabled state.
38
+ */
39
+ const XML_PATH_ENABLED = 'cohesionet_shopConnect/settings/enabled';
40
+
41
+ /**
42
+ * Path to store config cohesionet service account name.
43
+ */
44
+ const XML_PATH_ACCOUNT = 'cohesionet_shopConnect/settings/account';
45
+
46
+
47
+ /**
48
+ * Check if module exists and enabled in global config.
49
+ * Also checks if the module is enabled for the current store and if the needed criteria has been provided for the
50
+ * module to work.
51
+ *
52
+ * @param string $moduleName the full module name, example Mage_Core
53
+ *
54
+ * @return boolean
55
+ */
56
+ public function isModuleEnabled($moduleName = null)
57
+ {
58
+ if (!parent::isModuleEnabled($moduleName)
59
+ || !$this->getEnabled()
60
+ || !$this->getAccount()
61
+ ) {
62
+ return false;
63
+ }
64
+
65
+ return true;
66
+ }
67
+ /**
68
+ * Formats date into Cohesionet format, i.e. Y-m-d.
69
+ *
70
+ * @param string $date
71
+ *
72
+ * @return string
73
+ */
74
+ public function getFormattedDate($date)
75
+ {
76
+ return date('Y-m-d', strtotime($date));
77
+ }
78
+
79
+ /**
80
+ * Return if the module is enabled.
81
+ *
82
+ * @param mixed $store
83
+ *
84
+ * @return boolean
85
+ */
86
+ public function getEnabled($store = null)
87
+ {
88
+ return Mage::getStoreConfig(self::XML_PATH_ENABLED, $store);
89
+ }
90
+
91
+ /**
92
+ *
93
+ * @param mixed $store
94
+ *
95
+ * @return string
96
+ */
97
+ public function getAccount($store = null)
98
+ {
99
+ return Mage::getStoreConfig(self::XML_PATH_ACCOUNT, $store);
100
+ }
101
+
102
+ }
app/code/community/Cohesionet/ShopConnect/Helper/Price.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_ShopConnect
23
+ * @copyright Copyright (c) 2013 Cohesionet Solutions Ltd (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Helper class for common price operations.
29
+ *
30
+ * @category Cohesionet
31
+ * @package Cohesionet_ShopConnect
32
+ * @author Cohesionet
33
+ */
34
+ class Cohesionet_ShopConnect_Helper_Price extends Mage_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * Formats price into Cohesionet format, e.g. 1000.99.
38
+ *
39
+ * @param string|int|float $price
40
+ *
41
+ * @return string
42
+ */
43
+ public function getFormattedPrice($price)
44
+ {
45
+ return number_format($price, 2, '.', '');
46
+ }
47
+
48
+ /**
49
+ * Gets the unit price for a product model.
50
+ *
51
+ * @param Mage_Catalog_Model_Product $product
52
+ *
53
+ * @return float
54
+ */
55
+ public function getProductPrice($product)
56
+ {
57
+ return $this->_getProductPrice($product);
58
+ }
59
+
60
+ /**
61
+ * Get the final price for a product model.
62
+ *
63
+ * @param Mage_Catalog_Model_Product $product
64
+ *
65
+ * @return float
66
+ */
67
+ public function getProductFinalPrice($product)
68
+ {
69
+ return $this->_getProductPrice($product, true);
70
+ }
71
+
72
+ /**
73
+ * Get unit/final price for a product model.
74
+ *
75
+ * @param Mage_Catalog_Model_Product $product
76
+ * @param bool $finalPrice
77
+ *
78
+ * @return float
79
+ */
80
+ protected function _getProductPrice($product, $finalPrice = false)
81
+ {
82
+ $price = 0;
83
+
84
+ switch ($product->getTypeId()) {
85
+ case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
86
+ // Get the bundle product "from" price.
87
+ $price = $product->getPriceModel()->getTotalPrices($product, 'min', true);
88
+ break;
89
+
90
+ case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
91
+ // Get the grouped product "starting at" price.
92
+ /** @var $tmpProduct Mage_Catalog_Model_Product */
93
+ $tmpProduct = Mage::getModel('catalog/product')
94
+ ->getCollection()
95
+ ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
96
+ ->addAttributeToFilter('entity_id', $product->getId())
97
+ ->setPage(1, 1)
98
+ ->addMinimalPrice()
99
+ ->addTaxPercents()
100
+ ->load()
101
+ ->getFirstItem();
102
+ if ($tmpProduct) {
103
+ $price = $tmpProduct->getMinimalPrice();
104
+ }
105
+ break;
106
+
107
+ default:
108
+ if ($finalPrice) {
109
+ $price = $product->getFinalPrice();
110
+ } else {
111
+ $price = $product->getPrice();
112
+ }
113
+ break;
114
+ }
115
+
116
+ return (float)$price;
117
+ }
118
+ }
app/code/community/Cohesionet/ShopConnect/Model/Config/Account.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_shopConnect
23
+ * @copyright Copyright (c) 2015 Cohesionet(http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Config data model for the cohesionet account setting.
29
+ *
30
+ * @category Cohesionet
31
+ * @package Cohesionet_shopConnect
32
+ * @author Cohesionet
33
+ */
34
+ class Cohesionet_shopConnect_Model_Config_Account extends Mage_Core_Model_Config_Data
35
+ {
36
+ /**
37
+ * Save object data.
38
+ * Validates that the account is set.
39
+ *
40
+ * @return Cohesionet_shopConnect_Model_Config_Account
41
+ */
42
+ public function save()
43
+ {
44
+ $account = $this->getValue();
45
+ if (empty($account)) {
46
+ Mage::throwException(Mage::helper('cohesionet_shopConnect')->__('Cohesionet account is required.'));
47
+ }
48
+
49
+ return parent::save();
50
+ }
51
+ }
app/code/community/Cohesionet/ShopConnect/Model/Config/Enabled.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_ShopConnect
23
+ * @copyright Copyright (c) 2015 Cohesionet LLC (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Config data model for the enabled setting.
29
+ *
30
+ * @category Cohesionet
31
+ * @package Cohesionet_ShopConnect
32
+ * @author Cohesionet Solutions Ltd
33
+ */
34
+ class Cohesionet_ShopConnect_Model_Config_Enabled extends Mage_Core_Model_Config_Data
35
+ {
36
+
37
+ }
app/code/community/Cohesionet/ShopConnect/Model/Resource/Setup.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Cohesionet
22
+ * @package Cohesionet_ShopConnect
23
+ * @copyright Copyright (c) 2015 Cohesionet LLC(http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Cohesionet ShopConnect Resource Setup Model.
29
+ *
30
+ * @category Cohesionet
31
+ * @package Cohesionet_ShopConnect
32
+ * @author Cohesionet
33
+ */
34
+ class Cohesionet_ShopConnect_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
35
+ {
36
+ /**
37
+ * Get all root categories used by all stores.
38
+ * Note that root categories defined but not used, are not included.
39
+ *
40
+ * @return Mage_Catalog_Model_Category[]
41
+ */
42
+ public function getAllRootCategories()
43
+ {
44
+ $categories = array();
45
+
46
+ /** @var $stores Mage_Core_Model_Store[] */
47
+ $stores = Mage::app()->getStores();
48
+
49
+ foreach ($stores as $store) {
50
+ $id = $store->getRootCategoryId();
51
+ if (!isset($categories[$id])) {
52
+ $categories[$id] = Mage::getModel('catalog/category')->load($id);
53
+ }
54
+ }
55
+
56
+ return $categories;
57
+ }
58
+ }
app/code/community/Cohesionet/ShopConnect/etc/adminhtml.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Cohesionet
23
+ * @package Cohesionet_ShopConnect
24
+ * @copyright Copyright (c) 2014 Cohesionet (http://www.cohesionet.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <acl>
30
+ <resources>
31
+ <admin>
32
+ <children>
33
+ <system>
34
+ <children>
35
+ <config>
36
+ <children>
37
+ <cohesionet_shopConnect translate="title">
38
+ <title>Cohesionet - Buddy Shopping</title>
39
+ </cohesionet_shopConnect>
40
+ </children>
41
+ </config>
42
+ </children>
43
+ </system>
44
+ </children>
45
+ </admin>
46
+ </resources>
47
+ </acl>
48
+ </config>
app/code/community/Cohesionet/ShopConnect/etc/config.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Cohesionet
23
+ * @package Cohesionet_ShopConnect
24
+ * @copyright Copyright (c) 2013 Cohesionet (http://www.cohesionet.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Cohesionet_ShopConnect>
31
+ <version>1.0.6</version>
32
+ </Cohesionet_ShopConnect>
33
+ </modules>
34
+ <global>
35
+ <resources>
36
+ <shopConnect_setup>
37
+ <setup>
38
+ <module>Cohesionet_ShopConnect</module>
39
+ <class>Cohesionet_ShopConnect_Model_Resource_Setup</class>
40
+ </setup>
41
+ </shopConnect_setup>
42
+ </resources>
43
+ <blocks>
44
+ <cohesionet_shopConnect>
45
+ <class>Cohesionet_ShopConnect_Block</class>
46
+ </cohesionet_shopConnect>
47
+ </blocks>
48
+ <helpers>
49
+ <cohesionet_shopConnect>
50
+ <class>Cohesionet_ShopConnect_Helper</class>
51
+ </cohesionet_shopConnect>
52
+ </helpers>
53
+ <models>
54
+ <cohesionet_shopConnect>
55
+ <class>Cohesionet_ShopConnect_Model</class>
56
+ </cohesionet_shopConnect>
57
+ </models>
58
+ </global>
59
+ <frontend>
60
+ <layout>
61
+ <updates>
62
+ <cohesionet_shopConnect>
63
+ <file>cohesionet.xml</file>
64
+ </cohesionet_shopConnect>
65
+ </updates>
66
+ </layout>
67
+ </frontend>
68
+ <default>
69
+ <cohesionet_shopConnect>
70
+ <settings>
71
+ <host_name>www.cohesionet.com</host_name>
72
+ <protocol>https</protocol>
73
+ </settings>
74
+ </cohesionet_shopConnect>
75
+ </default>
76
+ </config>
app/code/community/Cohesionet/ShopConnect/etc/system.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Cohesionet
23
+ * @package Cohesionet_ShopConnect
24
+ * @copyright Copyright (c) 2014 Cohesionet (http://www.cohesionet.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <sections>
30
+ <cohesionet_shopConnect translate="label">
31
+ <label>Buddy Shopping</label>
32
+ <tab>customer</tab>
33
+ <sort_order>500</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ <groups>
38
+ <settings translate="label">
39
+ <label>General settings</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <expanded>1</expanded>
46
+ <fields>
47
+ <enabled translate="label">
48
+ <label>Enabled</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ <backend_model>cohesionet_shopConnect/config_enabled</backend_model>
52
+ <sort_order>10</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </enabled>
57
+ <account translate="label">
58
+ <label>Account ID</label>
59
+ <comment><![CDATA[If you do not have an store account ID, please click <a href='https://www.cohesionet.com/web/?co_componentID=co.comp_storePageID&co_register=true&co_hostID=magento' target="_blank"> registration </a> to register your store and get your store account ID,
60
+ <p>If you already registered your store, following the following steps to find your store account ID
61
+ <ul> <li>Click <a href="https://www.cohesionet.com" target="_blank">Cohesionet Buddy Shopping Home</a></li> <li>Use your store adminstrator account login</li> <li>Click the top-left corner button</li> <li>Switch to seller</li> <li>Click your store name </li> <li>In the store management menu, click store setting. You should be able to find your store accountID</li><ul></p>
62
+ ]]></comment>
63
+ <frontend_type>text</frontend_type>
64
+ <backend_model>cohesionet_shopConnect/config_account</backend_model>
65
+ <sort_order>30</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ <validate>required-entry</validate>
70
+ </account>
71
+ </fields>
72
+ </settings>
73
+ </groups>
74
+ </cohesionet_shopConnect>
75
+ </sections>
76
+ </config>
app/design/frontend/base/default/layout/cohesionet.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Cohesionet
23
+ * @package Cohesionet_ShopConnect
24
+ * @copyright Copyright (c) 2014 Cohesionet (http://www.cohesionet.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <layout version="1.0.0">
29
+
30
+ <!-- Store wide blocks -->
31
+ <default>
32
+ <!-- Adds Cohesionet embed script to head -->
33
+ <reference name="head">
34
+ <block type="cohesionet_shopConnect/embed" name="cohesionet.embed" template="cohesionet/embed.phtml"/>
35
+ </reference>
36
+ </default>
37
+
38
+ <!-- Tag product -->
39
+ <catalog_product_view>
40
+ <reference name="after_body_start">
41
+ <block type="cohesionet_shopConnect/product" name="cohesionet.product" template="cohesionet/product.phtml"/>
42
+ </reference>
43
+ </catalog_product_view>
44
+
45
+ </layout>
app/design/frontend/base/default/template/cohesionet/embed.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2015 Cohesionet LLC (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ /**
30
+ * @var $this Cohesionet_ShopConnect_Block_Embed
31
+ * @var $cohesionetHelper Cohesionet_ShopConnect_Helper_Data
32
+ */
33
+ $cohesionetHelper = Mage::helper('cohesionet_shopConnect');
34
+
35
+ $protocol = Mage::getStoreConfig('cohesionet_shopConnect/settings/protocol');
36
+
37
+ $hostName = Mage::getStoreConfig('cohesionet_shopConnect/settings/host_name');
38
+ ?>
39
+ <!-- Cohesionet ShopConnect Script -->
40
+ <script type="text/javascript" async="" src='<?php echo $protocol ?>://<?php echo $hostName ?>/web/loadAddOn?co_hoststoreid=<?php echo $cohesionetHelper->getAccount()?>'> </script>
41
+
app/design/frontend/base/default/template/cohesionet/product.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2015 Cohesionet LLC (http://www.cohesionet.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ /**
30
+ * @var $this Cohesionet_ShopConnect_Block_Product
31
+ * @var $cohesionetHelper Cohesionet_ShopConnect_Helper_Data
32
+ * @var $cohesionetPriceHelper Cohesionet_ShopConnect_Helper_Price
33
+ */
34
+ $product = $this->getProduct();
35
+ $cohesionetHelper = Mage::helper('cohesionet_shopConnect');
36
+ $cohesionetPriceHelper = Mage::helper('cohesionet_shopConnect/price');
37
+ ?>
38
+
39
+ <!-- Cohesionet Product ShopConnect -->
40
+
41
+ <span style="display:none" co-data-type="item" co-id-type="url"
42
+ <?php if($product->getImage() == 'no_selection') { ?>
43
+ co-data-image=<?php echo $product->getImageUrl()?>
44
+ <?php } else { ?>
45
+ co-data-image=<?php echo $product->getMediaConfig()->getMediaUrl($product->getImage())?>
46
+ <?php } ?>
47
+ co-data-price=<?php echo number_format($product->getPrice(), 2) ?>
48
+ co-data-discount=<?php echo number_format($product->getFinalPrice(), 2) ?>
49
+
50
+ <?php $specialPriceFromDate = $product->getSpecialFromDate(); if ($specialPriceFromDate) { ?>
51
+ co-data-discount-start=<?php echo strtotime( $specialPriceFromDate) ?>
52
+ <?php } ?>
53
+
54
+ <?php $specialPriceToDate = $product->getSpecialToDate(); if ($specialPriceToDate) { ?>
55
+ co-data-discount-end=<?php echo strtotime( $specialPriceToDate) ?>
56
+ <?php } ?>
57
+
58
+ co-data-id=<?php echo $product->getProductUrl()?>>
59
+ </span>
60
+
app/etc/modules/Cohesionet_ShopConnect.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Cohesionet
23
+ * @package Cohesionet_ShopConnect
24
+ * @copyright Copyright (c) 2015 Cohesionet LLC (http://www.cohesionet.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Cohesionet_ShopConnect>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Cohesionet_ShopConnect>
34
+ </modules>
35
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Cohesionet_ShopConnect</name>
4
+ <version>1.0.6</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Buddy Shopping</summary>
10
+ <description>eCommerce widgets that connect people for shopping together and offer built-in sales support, instant and effective</description>
11
+ <notes>Support 1.5.0.0 &amp; later</notes>
12
+ <authors><author><name>Ying Qi</name><user>cohesionet</user><email>contact@cohesionet.com</email></author></authors>
13
+ <date>2015-06-24</date>
14
+ <time>02:08:18</time>
15
+ <contents><target name="magecommunity"><dir name="."><dir name="Cohesionet"><dir name="ShopConnect"><dir name="Block"><file name="Embed.php" hash="40d25533f9d57f0b7bf0d2212ad0ffe3"/><file name="Product.php" hash="9c6253bf07f085f3fb1b1460e06ce457"/></dir><dir name="Helper"><file name="Data.php" hash="638f3b7ce41fcf43b0677f78c444e53c"/><file name="Price.php" hash="248bbaf520cea1422be2a62db0f58ab4"/></dir><dir name="Model"><dir name="Config"><file name="Account.php" hash="b5fcad8eb15dd55e1f368ea79e09219d"/><file name="Enabled.php" hash="291e6fcd5ff732ccf4aa81c67e21ad88"/></dir><dir name="Resource"><file name="Setup.php" hash="9c6c731829d315ce9dccf3c751305338"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="809096c21e4905db78af80ff8e445d9b"/><file name="config.xml" hash="efbfc350e057a9c27bc38d957e7c79e5"/><file name="system.xml" hash="e8ad596896a002a473b2c255e68c1bbe"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="."><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cohesionet"><file name="embed.phtml" hash="b4cd850b7c216df34e2c7f48d143565b"/><file name="product.phtml" hash="3db15b0a6f1fb72068eb1cf4de31be4d"/></dir></dir><dir name="layout"><file name="cohesionet.xml" hash="881184e52fc97ef62e80d1e68f1b91bd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="."><dir name="modules"><file name="Cohesionet_ShopConnect.xml" hash="a1bde50148d25ce029733dc3695a9be2"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>4.4.8</min><max>5.6.9</max></php></required></dependencies>
18
+ </package>