AvailPointofSale - Version 1.0.0

Version Notes

This extension is compatible with the following Magento versions:
• Magento Community Edition 1.6 and 1.7
• Magento Enterprise Edition 1.9, 1.10, 1.11 and 1.12

Download this release

Release Info

Developer Smile
Extension AvailPointofSale
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (42) hide show
  1. app/code/community/Avail/Pointofsale/Block/Config/Form/Field/Button.php +32 -0
  2. app/code/community/Avail/Pointofsale/Block/Config/Form/Field/GenerateButton.php +31 -0
  3. app/code/community/Avail/Pointofsale/Block/Data.php +31 -0
  4. app/code/community/Avail/Pointofsale/Block/Data/Banner.php +28 -0
  5. app/code/community/Avail/Pointofsale/Block/Data/Banner/Cart.php +35 -0
  6. app/code/community/Avail/Pointofsale/Block/Data/Banner/Category.php +86 -0
  7. app/code/community/Avail/Pointofsale/Block/Data/Banner/Precart.php +55 -0
  8. app/code/community/Avail/Pointofsale/Block/Data/Banner/Product.php +52 -0
  9. app/code/community/Avail/Pointofsale/Block/Data/Banner/Search.php +36 -0
  10. app/code/community/Avail/Pointofsale/Block/Head.php +35 -0
  11. app/code/community/Avail/Pointofsale/Block/Select/Attributes.php +270 -0
  12. app/code/community/Avail/Pointofsale/Helper/Data.php +173 -0
  13. app/code/community/Avail/Pointofsale/Model/Config/Backend/Serialized/Array.php +32 -0
  14. app/code/community/Avail/Pointofsale/Model/Installer.php +345 -0
  15. app/code/community/Avail/Pointofsale/Model/Jsonrpc.php +188 -0
  16. app/code/community/Avail/Pointofsale/Model/Observer.php +140 -0
  17. app/code/community/Avail/Pointofsale/controllers/GenerateController.php +30 -0
  18. app/code/community/Avail/Pointofsale/etc/adminhtml.xml +36 -0
  19. app/code/community/Avail/Pointofsale/etc/config.xml +124 -0
  20. app/code/community/Avail/Pointofsale/etc/system.xml +173 -0
  21. app/design/adminhtml/default/default/template/pointofsale/select/attributes/array.phtml +177 -0
  22. app/design/frontend/base/default/layout/pointofsale.xml +49 -0
  23. app/design/frontend/base/default/template/pointofsale/data.phtml +61 -0
  24. app/etc/modules/Avail_Pointofsale.xml +19 -0
  25. availdataexporter/availdataexporter.bat +3 -0
  26. availdataexporter/availdataexporter.sh +4 -0
  27. availdataexporter/bin/availdataexporter.jar +0 -0
  28. availdataexporter/exampleupload.conf +85 -0
  29. availdataexporter/lib/commons-codec-1.3.jar +0 -0
  30. availdataexporter/lib/commons-httpclient-3.1.jar +0 -0
  31. availdataexporter/lib/commons-logging-1.1.1.jar +0 -0
  32. availdataexporter/lib/jtds-1.2.2.jar +0 -0
  33. availdataexporter/lib/log4j-1.2.15.jar +0 -0
  34. availdataexporter/lib/ms_sql_1.1.1501.jar +0 -0
  35. availdataexporter/lib/mysql_5.1.6.jar +0 -0
  36. availdataexporter/lib/oracle_10.2.0.4.jar +0 -0
  37. availdataexporter/lib/sunjce_provider.jar +0 -0
  38. availdataexporter/log/log4j.properties +55 -0
  39. availdataexporter/pointofsale.sh +28 -0
  40. availdataexporter/readme.txt +49 -0
  41. js/avail/cookie.js +64 -0
  42. package.xml +23 -0
app/code/community/Avail/Pointofsale/Block/Config/Form/Field/Button.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Config_Form_Field_Button extends Avail_Pointofsale_Block_Select_Attributes
11
+ {
12
+ /**
13
+ * Internal constructor
14
+ */
15
+ public function __construct()
16
+ {
17
+ $this->addColumn('attributes', array(
18
+ 'label' => Mage::helper('pointofsale')->__('Attributes'),
19
+ 'style' => 'width:120px',
20
+ ));
21
+
22
+ $this->addColumn('stores', array(
23
+ 'label' => Mage::helper('pointofsale')->__('Stores'),
24
+ 'style' => 'width:120px',
25
+ ));
26
+
27
+ $this->_addAfter = false;
28
+ $this->_addButtonLabel = Mage::helper('pointofsale')->__('Add Assoctiation');
29
+
30
+ parent::__construct();
31
+ }
32
+ }
app/code/community/Avail/Pointofsale/Block/Config/Form/Field/GenerateButton.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Config_Form_Field_GenerateButton extends Mage_Adminhtml_Block_System_Config_Form_Field
11
+ {
12
+ /**
13
+ * Return the scalable button for generating the configuration files
14
+ *
15
+ * @return string $html
16
+ */
17
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
18
+ {
19
+ $this->setElement($element);
20
+ $url = $url = $this->getUrl('pointofsale/generate/index');
21
+
22
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
23
+ ->setType('button')
24
+ ->setClass('scalable')
25
+ ->setLabel('Generate Now !')
26
+ ->setOnClick("setLocation('$url')")
27
+ ->toHtml();
28
+
29
+ return $html;
30
+ }
31
+ }
app/code/community/Avail/Pointofsale/Block/Data.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data extends Mage_Core_Block_Template
11
+ {
12
+ /**
13
+ * Return if the debug mode is allowed or not
14
+ *
15
+ * @return bool
16
+ */
17
+ public function isDebugMode()
18
+ {
19
+ return Mage::helper('pointofsale')->isDebugMode();
20
+ }
21
+
22
+ /**
23
+ * Return if there's a default configuration
24
+ *
25
+ * @return bool
26
+ */
27
+ public function isConfigured()
28
+ {
29
+ return Mage::helper('pointofsale')->isConfigured();
30
+ }
31
+ }
app/code/community/Avail/Pointofsale/Block/Data/Banner.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2012 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data_Banner extends Mage_Core_Block_Template
11
+ {
12
+ /**
13
+ * Path to the banner name in sys configuration
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_xmlPathToBanner = '';
18
+
19
+ /**
20
+ * Retrieve the banner name from system configuration
21
+ *
22
+ * @return string
23
+ */
24
+ public function getBannerName()
25
+ {
26
+ return Mage::getStoreConfig($this->_xmlPathToBanner);
27
+ }
28
+ }
app/code/community/Avail/Pointofsale/Block/Data/Banner/Cart.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data_Banner_Cart extends Avail_Pointofsale_Block_Data_Banner
11
+ {
12
+ /**
13
+ * Path to the banner name in sys configuration
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_xmlPathToBanner = 'pointofsale/template/cart';
18
+
19
+ /**
20
+ * Return the Avail cart banner
21
+ *
22
+ * @return bool
23
+ */
24
+ protected function _toHtml()
25
+ {
26
+ $html = '';
27
+ $bannerName = $this->getBannerName();
28
+
29
+ if (!empty($bannerName)) {
30
+ $html = '<div data-id="avail" data-banner="' . $bannerName . '" ></div>';
31
+ }
32
+
33
+ return $html;
34
+ }
35
+ }
app/code/community/Avail/Pointofsale/Block/Data/Banner/Category.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data_Banner_Category extends Avail_Pointofsale_Block_Data_Banner
11
+ {
12
+ /**
13
+ * Path to the banner name in sys configuration
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_xmlPathToBanner = 'pointofsale/template/category';
18
+
19
+ /**
20
+ * store the given category
21
+ */
22
+ protected $_category;
23
+
24
+ /**
25
+ * Internal constructor
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_category = Mage::registry('current_category');
30
+ parent::_construct();
31
+ }
32
+
33
+ /**
34
+ * Retrieve the dynamic parameter for the avail banner
35
+ *
36
+ * @return string String
37
+ */
38
+ protected function _getDynamicParamter()
39
+ {
40
+ $dynParam = '';
41
+ $categoryId = $this->_getCategoryId();
42
+
43
+ if (!is_null($categoryId)) {
44
+ $dynParam = 'append orcat in subtemplate ALL with ' . $categoryId;
45
+ }
46
+
47
+ return $dynParam;
48
+ }
49
+
50
+ /**
51
+ * Retrieve the current category id either from the registry or from filters
52
+ *
53
+ * @return int
54
+ */
55
+ protected function _getCategoryId()
56
+ {
57
+ $categoryId = null;
58
+ $categoryFilter = $this->getRequest()->getParam('cat');
59
+
60
+ if (is_numeric($categoryFilter)) {
61
+ $categoryId = $categoryFilter;
62
+ } elseif ($this->_category && $this->_category->getId()) {
63
+ $categoryId = $this->_category->getId();
64
+ }
65
+
66
+ return $categoryId;
67
+ }
68
+
69
+ /**
70
+ * Return the Avail category banner
71
+ *
72
+ * @return string
73
+ */
74
+ protected function _toHtml()
75
+ {
76
+ $html = '';
77
+ $bannerName = $this->getBannerName();
78
+ $dynParam = $this->_getDynamicParamter();
79
+
80
+ if (!empty($bannerName)) {
81
+ $html = '<div data-id="avail" data-banner="' . $bannerName . '" data-dynpara="' . $dynParam . '"></div>';
82
+ }
83
+
84
+ return $html;
85
+ }
86
+ }
app/code/community/Avail/Pointofsale/Block/Data/Banner/Precart.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data_Banner_Precart extends Avail_Pointofsale_Block_Data_Banner
11
+ {
12
+ /**
13
+ * Path to the banner name in sys configuration
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_xmlPathToBanner = 'pointofsale/template/precart';
18
+
19
+ /**
20
+ * Retrieve Last Added to Cart Product Id
21
+ *
22
+ * @return int $porductId
23
+ */
24
+ protected function _getLastAddedToCartProductId()
25
+ {
26
+ $productId = '';
27
+ $quote = $this->helper('checkout')->getQuote();
28
+ $items = $quote->getAllVisibleItems();
29
+ $lastItem = array_pop($items);
30
+
31
+ if ($lastItem && $lastItem->getProductId()) {
32
+ $productId = $lastItem->getProductId();
33
+ }
34
+
35
+ return $productId;
36
+ }
37
+
38
+ /**
39
+ * Return the Avail cart banner
40
+ *
41
+ * @return bool
42
+ */
43
+ protected function _toHtml()
44
+ {
45
+ $html = '';
46
+ $bannerName = $this->getBannerName();
47
+ $lastAddedToCartProductId = $this->_getLastAddedToCartProductId();
48
+
49
+ if (!empty($bannerName)) {
50
+ $html = '<div data-id="avail" data-banner="' . $bannerName . '" data-productid="' . $lastAddedToCartProductId . '"></div>';
51
+ }
52
+
53
+ return $html;
54
+ }
55
+ }
app/code/community/Avail/Pointofsale/Block/Data/Banner/Product.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data_Banner_Product extends Avail_Pointofsale_Block_Data_Banner
11
+ {
12
+ /**
13
+ * Path to the banner name in sys configuration
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_xmlPathToBanner = 'pointofsale/template/product';
18
+
19
+ /**
20
+ * Retrieve Product Id
21
+ *
22
+ * @return int $porductId
23
+ */
24
+ protected function _getProductId()
25
+ {
26
+ $productId = '';
27
+ $product = Mage::registry('product');
28
+
29
+ if ($product && $product->getId()) {
30
+ $productId = $product->getId();
31
+ }
32
+
33
+ return $productId;
34
+ }
35
+
36
+ /**
37
+ * Test if the category is allowed to be feched
38
+ *
39
+ * @return string
40
+ */
41
+ protected function _toHtml()
42
+ {
43
+ $html = '';
44
+ $bannerName = $this->getBannerName();
45
+
46
+ if (!empty($bannerName)) {
47
+ $html = '<div data-id="avail" data-banner="' . $bannerName . '" data-productid="' . $this->_getProductId() . '"></div>';
48
+ }
49
+
50
+ return $html;
51
+ }
52
+ }
app/code/community/Avail/Pointofsale/Block/Data/Banner/Search.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2012 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Data_Banner_Search extends Avail_Pointofsale_Block_Data_Banner
11
+ {
12
+ /**
13
+ * Path to the banner name in sys configuration
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_xmlPathToBanner = 'pointofsale/template/search';
18
+
19
+ /**
20
+ * Return the Avail search banner
21
+ *
22
+ * @return string
23
+ */
24
+ protected function _toHtml()
25
+ {
26
+ $html = '';
27
+ $searchText = Mage::helper('catalogSearch')->getQuery()->getQueryText();
28
+ $bannerName = $this->getBannerName();
29
+
30
+ if (!empty($bannerName)) {
31
+ $html = '<div data-id="avail" data-banner="' . $bannerName . '" data-phrase="' . $searchText . '"></div>';
32
+ }
33
+
34
+ return $html;
35
+ }
36
+ }
app/code/community/Avail/Pointofsale/Block/Head.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Block_Head extends Mage_Core_Block_Text
11
+ {
12
+ /**
13
+ * Add the JS call to the head of all pages .
14
+ *
15
+ * @return string
16
+ */
17
+ public function addJs($name)
18
+ {
19
+ $js = '';
20
+
21
+ if ($this->helper('pointofsale')->isConfigured()) {
22
+ $script = '<script type="text/javascript" src="%s"></script>';
23
+ $protocol = $this->helper('pointofsale')->getProtocol();
24
+ $url = Mage::getStoreConfig('pointofsale/interface/url');
25
+ $url = (substr($url, -1) === '/') ? $url : $url . '/';
26
+ $url = str_replace('http', $protocol, $url);
27
+ $url .= Mage::getStoreConfig('pointofsale/account/customer_id') . '/' . $name.'?decorate=1';
28
+ $js = sprintf($script, $url);
29
+ }
30
+
31
+ $this->setText($js);
32
+ return $this;
33
+ }
34
+
35
+ }
app/code/community/Avail/Pointofsale/Block/Select/Attributes.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2012 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ abstract class Avail_Pointofsale_Block_Select_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field
11
+ {
12
+ /**
13
+ * Grid columns
14
+ *
15
+ * @var array
16
+ */
17
+ protected $_columns = array();
18
+
19
+ /**
20
+ * Enable the "Add after" button or not
21
+ *
22
+ * @var bool
23
+ */
24
+ protected $_addAfter = true;
25
+
26
+ /**
27
+ * Label of add button
28
+ *
29
+ * @var unknown_type
30
+ */
31
+ protected $_addButtonLabel;
32
+
33
+ /**
34
+ * Rows cache
35
+ *
36
+ * @var array|null
37
+ */
38
+ private $_arrayRowsCache;
39
+
40
+ /**
41
+ * Indication whether block is prepared to render or no
42
+ *
43
+ * @var bool
44
+ */
45
+ protected $_isPreparedToRender = false;
46
+
47
+ /**
48
+ * Attributes array
49
+ *
50
+ * @var array
51
+ */
52
+ protected $_attributes = array();
53
+
54
+ /**
55
+ * stores array
56
+ * @var array
57
+ */
58
+ protected $_stores = array();
59
+
60
+ /**
61
+ * (uasort) Used to sort an array by using the label key.
62
+ * @param string $a
63
+ * @param string $b
64
+ * @return int
65
+ */
66
+ private function cmpSortArray($a, $b)
67
+ {
68
+ if ($a['label'] == $b['label']) {
69
+ return 0;
70
+ }
71
+
72
+ return ($a['label'] < $b['label']) ? -1 : 1;
73
+ }
74
+
75
+ public function __construct()
76
+ {
77
+ if (!$this->_addButtonLabel) {
78
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add');
79
+ }
80
+
81
+ parent::__construct();
82
+
83
+ if (!$this->getTemplate()) {
84
+ $this->setTemplate('pointofsale/select/attributes/array.phtml');
85
+ }
86
+ // get the data model for the product
87
+ $model = Mage::getResourceModel('catalog/product');
88
+ // get the entity type
89
+ $typeId = $model->getTypeId();
90
+ // get all the attribute of the product
91
+ $attrs = Mage::getResourceModel('eav/entity_attribute_collection')
92
+ ->setEntityTypeFilter($typeId)
93
+ ->load();
94
+
95
+ // construct the attributes elements and put them in an array
96
+ // Customized attribute
97
+ $this->_attributes[] = array(
98
+ 'value' => 'stock',
99
+ 'label' => 'Stock'
100
+ );
101
+
102
+ foreach ($attrs as $att) {
103
+ $this->_attributes[] = array(
104
+ 'value' => $att->attribute_code,
105
+ 'label' => ucfirst(str_replace('\'', '', trim(Mage::helper('catalog')->__($att->getFrontend()->getLabel()))))
106
+ );
107
+ }
108
+
109
+ //Update the array sort
110
+ uasort($this->_attributes, array($this, 'cmpSortArray'));
111
+
112
+ //extract stores
113
+ $stores = Mage::app()->getStores(false, true);
114
+ //to add the default store
115
+ $this->_stores[] = array(
116
+ 'value' => 0,
117
+ 'label' => 'default'
118
+ );
119
+
120
+ foreach ($stores as $st) {
121
+ $this->_stores[] = array(
122
+ 'value' => $st->getStoreId(),
123
+ 'label' => $st->getName()
124
+ );
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Add a column to array-grid
130
+ *
131
+ * @param string $name
132
+ * @param array $params
133
+ */
134
+ public function addColumn($name, $params)
135
+ {
136
+ $this->_columns[$name] = array(
137
+ 'label' => empty($params['label']) ? 'Column' : $params['label'],
138
+ 'size' => empty($params['size']) ? false : $params['size'],
139
+ 'style' => empty($params['style']) ? null : $params['style'],
140
+ 'class' => empty($params['class']) ? null : $params['class'],
141
+ 'renderer' => false,
142
+ );
143
+
144
+ if ((!empty($params['renderer'])) && ($params['renderer'] instanceof Mage_Core_Block_Abstract)) {
145
+ $this->_columns[$name]['renderer'] = $params['renderer'];
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Get the grid and scripts contents
151
+ *
152
+ * @param Varien_Data_Form_Element_Abstract $element
153
+ * @return string
154
+ */
155
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
156
+ {
157
+ $this->setElement($element);
158
+ $html = $this->_toHtml();
159
+ $this->_arrayRowsCache = null; // doh, the object is used as singleton!
160
+ return $html;
161
+ }
162
+
163
+ /**
164
+ * Prepare existing row data object
165
+ *
166
+ * @param Varien_Object
167
+ */
168
+ protected function _prepareArrayRow(Varien_Object $row)
169
+ {
170
+ // override in descendants
171
+ }
172
+
173
+ /**
174
+ * Obtain existing data from form element
175
+ *
176
+ * Each row will be instance of Varien_Object
177
+ *
178
+ * @return array
179
+ */
180
+ public function getArrayRows()
181
+ {
182
+ if (null !== $this->_arrayRowsCache) {
183
+ return $this->_arrayRowsCache;
184
+ }
185
+ $result = array();
186
+ /** @var Varien_Data_Form_Element_Abstract */
187
+ $element = $this->getElement();
188
+
189
+ if ($element->getValue() && is_array($element->getValue())) {
190
+ foreach ($element->getValue() as $rowId => $row) {
191
+ foreach ($row as $key => $value) {
192
+ $row[$key] = $this->htmlEscape($value);
193
+ }
194
+ $row['_id'] = $rowId;
195
+ $result[$rowId] = new Varien_Object($row);
196
+ $this->_prepareArrayRow($result[$rowId]);
197
+ }
198
+ }
199
+ $this->_arrayRowsCache = $result;
200
+
201
+ return $this->_arrayRowsCache;
202
+ }
203
+
204
+ /**
205
+ * Render array cell for prototypeJS template
206
+ *
207
+ * @param string $columnName
208
+ * @return string
209
+ */
210
+ protected function _renderCellTemplate($columnName)
211
+ {
212
+ if ($columnName == 'stores') {
213
+ $options = $this->_stores;
214
+ } elseif ($columnName == 'attributes') {
215
+ $options = $this->_attributes;
216
+ }
217
+
218
+ if (empty($this->_columns[$columnName])) {
219
+ throw new Exception('Wrong column name specified.');
220
+ }
221
+
222
+ $column = $this->_columns[$columnName];
223
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
224
+
225
+ if ($column['renderer']) {
226
+ return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
227
+ ->toHtml();
228
+ }
229
+
230
+ $result = '<select type="text" name="' . $inputName . '" value="#{' . $columnName . '}" ' .
231
+ ($column['size'] ? 'size="' . $column['size'] . '"' : '') . ' class="' .
232
+ (isset($column['class']) ? $column['class'] : 'input-text') . '"'.
233
+ (isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '>';
234
+
235
+ foreach ($options as $op) {
236
+ $result .= '<option value="'.$op['value'].'" >'.$op['label'].'</option>';
237
+ }
238
+
239
+ $result .='</select>';
240
+
241
+ return $result;
242
+ }
243
+
244
+ /**
245
+ * Prepare to render
246
+ */
247
+ protected function _prepareToRender()
248
+ {
249
+ // Override in descendants to add columns, change add button label etc
250
+ }
251
+
252
+ /**
253
+ * Render block HTML
254
+ *
255
+ * @return string
256
+ */
257
+ protected function _toHtml()
258
+ {
259
+ if (!$this->_isPreparedToRender) {
260
+ $this->_prepareToRender();
261
+ $this->_isPreparedToRender = true;
262
+ }
263
+
264
+ if (empty($this->_columns)) {
265
+ throw new Exception('At least one column must be defined.');
266
+ }
267
+
268
+ return parent::_toHtml();
269
+ }
270
+ }
app/code/community/Avail/Pointofsale/Helper/Data.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+ const INIT_COOKIE_NAME = '__avail_cookies__';
13
+ const SEARCH_PHRASE_KEY = 'search_phrase';
14
+ const PAGE_VIEWED_KEY = 'page_viewed';
15
+ const MAX_PAGE_VIEWED = 1;
16
+ const LOG_FILENAME = 'avail-pointofsale.log';
17
+ const BUY_BUTTON_URL_PARAM = 'buy';
18
+
19
+ /**
20
+ * Add the Js code to the registry stack for avail
21
+ *
22
+ * @return bool
23
+ */
24
+ public function addJsCode($script)
25
+ {
26
+ $js = Mage::registry('avail_js');
27
+
28
+ Mage::unregister('avail_js');
29
+ if (!is_array($js)){
30
+ $js = array();
31
+ }
32
+ $js[] = $script;
33
+ Mage::register('avail_js', $js);
34
+
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * Collapse the avail Js code sections
40
+ *
41
+ * @return bool
42
+ */
43
+ public function getJsCode()
44
+ {
45
+ return implode(PHP_EOL, (array)Mage::registry('avail_js'));
46
+ }
47
+
48
+ /**
49
+ * Retrieve the suitable protocol
50
+ *
51
+ * @return bool
52
+ */
53
+ public function getProtocol()
54
+ {
55
+ return Mage::app()->getStore()->isCurrentlySecure() ? 'https' : 'http';
56
+ }
57
+
58
+ /**
59
+ * Return if there's a default configuration
60
+ *
61
+ * @return bool
62
+ */
63
+ public function isConfigured()
64
+ {
65
+ return (bool)(Mage::getStoreConfig('pointofsale/account/customer_id') && Mage::getStoreConfig('pointofsale/account/password'));
66
+ }
67
+
68
+ /**
69
+ * Retrieve all the handles used to render a page
70
+ *
71
+ * @return array
72
+ */
73
+ public function getHandles()
74
+ {
75
+ return Mage::app()->getFrontController()->getAction()->getLayout()->getUpdate()->getHandles();
76
+ }
77
+
78
+ /**
79
+ * Retrieve JSON-RPC Server URL
80
+ *
81
+ * @return string
82
+ */
83
+ public function getJsonRpcServerUrl()
84
+ {
85
+ $url = '';
86
+ $url = Mage::getStoreConfig('pointofsale/interface/url');
87
+ $url = (substr($url, -1) === '/') ? $url : $url . '/';
88
+ $url = str_replace('http', $this->getProtocol(), $url);
89
+ $url .= Mage::getStoreConfig('pointofsale/account/customer_id') . '/services/jsonrpc-1.x/';
90
+
91
+ return $url;
92
+ }
93
+
94
+ /**
95
+ * Return if the debug mode is allowed or not
96
+ *
97
+ * @return bool
98
+ */
99
+ public function isDebugMode()
100
+ {
101
+ return (bool)Mage::getStoreConfig('pointofsale/interface/debug');
102
+ }
103
+
104
+ /**
105
+ * Add logs to the Avail Point of Sale log file
106
+ *
107
+ * @param string $message
108
+ */
109
+ public function log($message)
110
+ {
111
+ Mage::log($message, null, self::LOG_FILENAME);
112
+ }
113
+
114
+ /**
115
+ * Returns buy button url parameter
116
+ *
117
+ * @return string
118
+ */
119
+ public function getBuyButtonUrlParam()
120
+ {
121
+ return self::BUY_BUTTON_URL_PARAM;
122
+ }
123
+
124
+ /**
125
+ * Retrieve Avail main cookie name
126
+ *
127
+ * @return string
128
+ */
129
+ public function getInitCookieName()
130
+ {
131
+ return self::INIT_COOKIE_NAME;
132
+ }
133
+
134
+ /**
135
+ * Returns search phrase key used in the main cookie
136
+ *
137
+ * @return string
138
+ */
139
+ public function getSearchPhraseKey()
140
+ {
141
+ return self::SEARCH_PHRASE_KEY;
142
+ }
143
+
144
+ /**
145
+ * Returns total viewed pages key used in the main cookie
146
+ *
147
+ * @return string
148
+ */
149
+ public function getPageViewedKey()
150
+ {
151
+ return self::PAGE_VIEWED_KEY;
152
+ }
153
+
154
+ /**
155
+ * Gets max total pages allowed to visit before triggering the saveSearch
156
+ *
157
+ * @return int
158
+ */
159
+ public function getMaxPageViewed()
160
+ {
161
+ return self::MAX_PAGE_VIEWED;
162
+ }
163
+
164
+ /**
165
+ * Returns add to cart url including buy button parameter
166
+ *
167
+ * @return string
168
+ */
169
+ public function getAddToCartUrl()
170
+ {
171
+ return Mage::getUrl('checkout/cart/add', array('_secure' => true));
172
+ }
173
+ }
app/code/community/Avail/Pointofsale/Model/Config/Backend/Serialized/Array.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ /**
12
+ * Backend for serialized array data
13
+ *
14
+ */
15
+ class Avail_Pointofsale_Model_Config_Backend_Serialized_Array extends Mage_Adminhtml_Model_System_Config_Backend_Serialized
16
+ {
17
+ /**
18
+ * Unset array element with '__empty' key
19
+ *
20
+ */
21
+ protected function _beforeSave()
22
+ {
23
+ $value = $this->getValue();
24
+
25
+ if (is_array($value)) {
26
+ unset($value['__empty']);
27
+ }
28
+
29
+ $this->setValue($value);
30
+ parent::_beforeSave();
31
+ }
32
+ }
app/code/community/Avail/Pointofsale/Model/Installer.php ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Avail_Pointofsale_Model_Installer {
12
+
13
+ /**
14
+ * Define the configuration file name
15
+ * @var string
16
+ */
17
+ const FILENAME = 'upload.conf';
18
+
19
+ /**
20
+ * Define the admin store id
21
+ * @var string
22
+ */
23
+ const ADMIN_STORE_ID = Mage_Core_Model_App::ADMIN_STORE_ID;
24
+
25
+ /**
26
+ * Store the file data
27
+ * @var array
28
+ */
29
+ private $fileData;
30
+
31
+ /**
32
+ * Store the file connection data
33
+ * @var string
34
+ */
35
+ private $fileConnectionData;
36
+
37
+ /**
38
+ * Verification of the data configuration
39
+ *
40
+ * @return boolean
41
+ */
42
+ public function verifyConf()
43
+ {
44
+ $confVars = array (Mage::getStoreConfig('pointofsale/account/customer_id'),
45
+ Mage::getStoreConfig('pointofsale/account/password'),
46
+ Mage::getStoreConfig('pointofsale/interface/attribute'),
47
+ Mage::getStoreConfig('pointofsale/template/default'),
48
+ Mage::getStoreConfig('pointofsale/template/search'),
49
+ Mage::getStoreConfig('pointofsale/template/product'),
50
+ Mage::getStoreConfig('pointofsale/template/category'),
51
+ Mage::getStoreConfig('pointofsale/template/cart')
52
+ );
53
+
54
+ foreach ($confVars as $cv) {
55
+ if (empty($cv)) {
56
+ return false;
57
+ }
58
+ }
59
+
60
+ return true;
61
+ }
62
+
63
+ /**
64
+ * Create config files and cron schedules
65
+ *
66
+ */
67
+ public function createFiles()
68
+ {
69
+ //create the init config file
70
+ $this->_initFile(true);
71
+ //create the ordinary config file
72
+ $this->_initFile();
73
+ }
74
+
75
+ /**
76
+ * Initiate files contents (update.conf & update.conf.init)
77
+ *
78
+ */
79
+ protected function _initFile($init = false)
80
+ {
81
+ $this->fileData = array();
82
+
83
+ if ($init) {
84
+ $fileName = self::FILENAME;
85
+ } else {
86
+ $fileName = self::FILENAME.'.after';
87
+ }
88
+
89
+ //extract stores
90
+ $stores = Mage::app()->getStores(false, true);
91
+
92
+ foreach ($stores as $st) {
93
+ $this->_stores[] = array(
94
+ 'value' => $st->getStoreId(),
95
+ 'label' => $st->getName()
96
+ );
97
+ }
98
+
99
+ $baseUrl = Mage::getBaseUrl();
100
+ $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
101
+ $mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product/';
102
+
103
+ //Customer authentification
104
+ $customerId = Mage::getStoreConfig('pointofsale/account/customer_id');
105
+ $customerPassword = Mage::getStoreConfig('pointofsale/account/password');
106
+ $optionalAttrs = Mage::getStoreConfig('pointofsale/interface/attribute');
107
+ $configFlagPath = 'pointofsale/flag/sql';
108
+ $optionalAttrs = unserialize($optionalAttrs);
109
+
110
+ $availDataExporterPath = Mage::getBaseDir() . DS . 'availdataexporter';
111
+ $availDefaulConfigData = 'default/pointofsale';
112
+ $configData = Mage::getConfig()->getNode($availDefaulConfigData);
113
+
114
+ $connectionConfig = Mage::getConfig()->getResourceConnectionConfig('default_setup');
115
+ $mysqlHost = $connectionConfig->host;
116
+ $mysqlDb = $connectionConfig->dbname;
117
+ $mysqlUser = $connectionConfig->username;
118
+ $mysqlPassword = $connectionConfig->password;
119
+
120
+ $installer = Mage::getSingleton('core/resource');
121
+ #sql tables
122
+ $categoryProductTable = $installer->getTableName('catalog/category_product_index');
123
+ $cceVarcharTable = $installer->getTableName('catalog_category_entity_varchar');
124
+ $eavAttributeTable = $installer->getTableName('eav_attribute');
125
+ $cpeTable = $installer->getTableName('catalog_product_entity');
126
+ $cisiTable = $installer->getTableName('cataloginventory_stock_item');
127
+ $cpeIntTable = $installer->getTableName('catalog_product_entity_int');
128
+ $cpeVarcharTable = $installer->getTableName('catalog_product_entity_varchar');
129
+ $cpeDecimalTable = $installer->getTableName('catalog_product_entity_decimal');
130
+ $cpeDatetimeTable = $installer->getTableName('catalog_product_entity_datetime');
131
+ $cpeTextTable = $installer->getTableName('catalog_product_entity_text');
132
+ $soitemTable = $installer->getTableName('sales/order_item');
133
+ $configTable = $installer->getTableName('core_config_data');
134
+ $soTable = $installer->getTableName('sales/order');
135
+ $stockTable = $installer->getTableName('cataloginventory_stock_item');
136
+ $sellingPriceTable = $installer->getTableName('catalog_product_index_price');
137
+
138
+ // the type of attributes
139
+ // automatic attributes
140
+ $sqlJoins = null;
141
+ $sqlSelects = null;
142
+ $counter = 1;
143
+ $haystack = array('stock', 'selling_price');
144
+
145
+ foreach ($optionalAttrs as $op) {
146
+ $opAttribute=$op['attributes'];
147
+ $opStore=$op['stores'];
148
+ $storeName = strtolower(Mage::app()->getStore($opStore)->getName());
149
+ if ($counter == 1) {
150
+ $sqlSelects = ',';
151
+ }
152
+ if (in_array($opAttribute, $haystack)) {
153
+ $tableName = '`_table_'.$opAttribute.'_'.$storeName.'`';
154
+ if ($opAttribute == 'stock') {
155
+ if($counter != count($optionalAttrs)) {
156
+ $sqlSelects .= 'IFNULL(CONVERT('.$tableName.'.`qty`, UNSIGNED INTEGER) ,\'\') as '.$opAttribute.'_'.$storeName.',';
157
+ } else {
158
+ $sqlSelects .= 'IFNULL(CONVERT('.$tableName.'.`qty`, UNSIGNED INTEGER) ,\'\') as '.$opAttribute.'_'.$storeName;
159
+ }
160
+ $sqlJoins .=" LEFT JOIN `{$stockTable}` AS {$tableName} ON ({$tableName}.product_id = e.entity_id) ";
161
+ }
162
+ } else {
163
+ $attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product',$opAttribute);
164
+ $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
165
+ $tableName = '`_table_'.$opAttribute.'_'.$storeName.'`';
166
+
167
+ if($counter != count($optionalAttrs)) {
168
+ $sqlSelects .= 'IFNULL('.$tableName.'.`value`,\'\') as '.$opAttribute.'_'.$storeName.',';
169
+ } else {
170
+ $sqlSelects .= 'IFNULL('.$tableName.'.`value`,\'\') as '.$opAttribute.'_'.$storeName;
171
+ }
172
+
173
+ $counter++;
174
+
175
+ switch ($attribute->getbackendType()) {
176
+ case 'int':
177
+ $sqlJoins .=" LEFT JOIN `{$cpeIntTable}` AS {$tableName} ON ({$tableName}.entity_id = e.entity_id) AND ({$tableName}.attribute_id='{$attribute->getAttributeId()}') AND ({$tableName}.store_id={$opStore}) ";
178
+ break;
179
+ case 'varchar':
180
+ $sqlJoins .=" LEFT JOIN `{$cpeVarcharTable}` AS {$tableName} ON ({$tableName}.entity_id = e.entity_id) AND ({$tableName}.attribute_id='{$attribute->getAttributeId()}') AND ({$tableName}.store_id={$opStore}) ";
181
+ break;
182
+ case 'decimal':
183
+ $sqlJoins .=" LEFT JOIN `{$cpeDecimalTable}` AS {$tableName} ON ({$tableName}.entity_id = e.entity_id) AND ({$tableName}.attribute_id='{$attribute->getAttributeId()}') AND ({$tableName}.store_id={$opStore}) ";
184
+ break;
185
+ case 'text':
186
+ $sqlJoins .=" LEFT JOIN `{$cpeTextTable}` AS {$tableName} ON ({$tableName}.entity_id = e.entity_id) AND ({$tableName}.attribute_id='{$attribute->getAttributeId()}') AND ({$tableName}.store_id={$opStore}) ";
187
+ break;
188
+ default:
189
+ $sqlJoins .=" LEFT JOIN `{$cpeDatetimeTable}` AS {$tableName} ON ({$tableName}.entity_id = e.entity_id) AND ({$tableName}.attribute_id='{$attribute->getAttributeId()}') AND ({$tableName}.store_id={$opStore}) ";
190
+ break;
191
+ break;
192
+ }
193
+ }
194
+ }
195
+
196
+ $installer = Mage::getModel('eav/config');
197
+ $attributeModel = Mage::getResourceModel('eav/entity_attribute');
198
+ $categoryEntityType = $installer->getEntityType('catalog_category');
199
+ $categoryEntityTypeId =(int) $categoryEntityType->getEntityTypeId();
200
+ $productEntityType = $installer->getEntityType('catalog_product');
201
+ $productEntityTypeId =(int) $productEntityType->getEntityTypeId();
202
+ $statusAttributeId = $attributeModel->getIdByCode('catalog_product', 'status');
203
+ $visibilityAttributeId = $attributeModel->getIdByCode('catalog_product', 'visibility');
204
+ $priceAttributeId = $attributeModel->getIdByCode('catalog_product', 'price');
205
+ $nameAttributeId = $attributeModel->getIdByCode('catalog_product', 'name');
206
+ $urlAttributeId = $attributeModel->getIdByCode('catalog_product', 'url_path');
207
+ $imageAttributeId = $attributeModel->getIdByCode('catalog_product', 'image');
208
+
209
+ #connection string & driver
210
+ $this->fileConnectionData = implode("\n", array(
211
+ 'SOURCE_SQL_CONNECTIONSTRING="jdbc:mysql://' . $mysqlHost . '/' . $mysqlDb . '?user=' . $mysqlUser . '&password=' . $mysqlPassword . '"',
212
+ 'SOURCE_SQL_DRIVER="com.mysql.jdbc.Driver"')
213
+ );
214
+
215
+ // File construction
216
+ $this->_getCustomerData($customerId,$customerPassword);
217
+ $this->_getCategoryData($categoryProductTable);
218
+ $this->_getCategoryNameData($cceVarcharTable, $eavAttributeTable, $categoryEntityTypeId);
219
+ $this->_getValidData($cpeTable, $cisiTable, $cpeIntTable,
220
+ $cpeIntTable, $visibilityAttributeId, $cpeIntTable,
221
+ $statusAttributeId);
222
+ $this->_getProductData($storeUrl,$mediaUrl, $sqlSelects,
223
+ $cpeTable, $sqlJoins, $cpeIntTable,
224
+ $visibilityAttributeId, $sellingPriceTable,
225
+ $cpeDecimalTable, $priceAttributeId,
226
+ $cpeVarcharTable, $urlAttributeId, $nameAttributeId,
227
+ $imageAttributeId);
228
+
229
+ if ($init) {
230
+ $this->_getTransactionData($soitemTable,$soTable);
231
+ }
232
+
233
+ $io = new Varien_Io_File();
234
+ $io->setAllowCreateFolders(true);
235
+ $io->open(array('path' => $availDataExporterPath));
236
+
237
+ if ($io->fileExists($fileName) && !$io->isWriteable($fileName)) {
238
+ Mage::throwException(Mage::helper('avail')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $fileName, $availDataExporterPath));
239
+ }
240
+
241
+ $io->streamOpen($fileName);
242
+ $io->streamWrite(implode("\n", $this->fileData));
243
+ $io->streamClose();
244
+ }
245
+
246
+ /**
247
+ * Prepare the customer data
248
+ */
249
+ protected function _getCustomerData($customerId,$customerPassword)
250
+ {
251
+ #customer_id/password
252
+ $this->fileData[] = '#Retrieve Customer Id and Password from default config data';
253
+ $this->fileData[] = 'CUSTOMER_ID="' . $customerId . '"';
254
+ $this->fileData[] = 'PASSWORD="' . $customerPassword . '"';
255
+ $this->fileData[] = '';
256
+ }
257
+
258
+ /**
259
+ * Prepare the category data
260
+ */
261
+ protected function _getCategoryData($categoryProductTable)
262
+ {
263
+ #categorydata(ProductId, CategoryId)
264
+ $categoryDataSql = "SELECT product_id AS ProductId, category_id AS CategoryId FROM {$categoryProductTable} ORDER BY product_id";
265
+ $this->fileData[] = '#categorydata';
266
+ $this->fileData[] = '{';
267
+ $this->fileData[] = 'DATA_TYPE="categorydata"';
268
+ $this->fileData[] = $this->fileConnectionData;
269
+ $this->fileData[] = 'SOURCE_SQL_QUERY="' . $categoryDataSql . '"';
270
+ $this->fileData[] = '}';
271
+ $this->fileData[] = '';
272
+ }
273
+
274
+ /**
275
+ * Prepare the category name data
276
+ */
277
+ protected function _getCategoryNameData($cceVarcharTable, $eavAttributeTable, $categoryEntityTypeId)
278
+ {
279
+ #categorynamesdata(CategoryId, Category Name)
280
+ $categoryNamesDataSql = "SELECT entity_id AS CategoryId, CONCAT(entity_id, ' ', value) AS `Category Name` from {$cceVarcharTable} where attribute_id = (select attribute_id from {$eavAttributeTable} where attribute_code = 'name' and entity_type_id = {$categoryEntityTypeId}) and store_id = ".self::ADMIN_STORE_ID ;
281
+ $this->fileData[] = '#categorynamesdata';
282
+ $this->fileData[] = '{';
283
+ $this->fileData[] = 'DATA_TYPE="categorynamesdata"';
284
+ $this->fileData[] = $this->fileConnectionData;
285
+ $this->fileData[] = 'SOURCE_SQL_QUERY="' . $categoryNamesDataSql . '"';
286
+ $this->fileData[] = '}';
287
+ $this->fileData[] = '';
288
+ }
289
+
290
+ /**
291
+ * Prepare the valid data
292
+ */
293
+ protected function _getValidData($cpeTable, $cisiTable, $cpeIntTable,
294
+ $cpeIntTable, $visibilityAttributeId, $cpeIntTable,
295
+ $statusAttributeId)
296
+ {
297
+ #validdata(ProductId)
298
+ $validDataSql = "SELECT `e`.`entity_id` AS ProductId FROM `{$cpeTable}` AS `e` LEFT JOIN `{$cisiTable}` AS `_table_qty` ON (_table_qty.product_id=e.entity_id) AND (_table_qty.stock_id=1) INNER JOIN `{$cpeIntTable}` AS `_table_visibility` ON (_table_visibility.entity_id = e.entity_id) AND (_table_visibility.attribute_id='{$visibilityAttributeId}') AND (_table_visibility.store_id=".self::ADMIN_STORE_ID.") INNER JOIN `{$cpeIntTable}` AS `_table_status` ON (_table_status.entity_id = e.entity_id) AND (_table_status.attribute_id='{$statusAttributeId}') AND (_table_status.store_id=0) WHERE (_table_visibility.value IN(2, 4)) AND (_table_status.value = '1') ORDER BY `e`.`entity_id`";
299
+ $this->fileData[] = '#validdata';
300
+ $this->fileData[] = '{';
301
+ $this->fileData[] = 'DATA_TYPE="validdata"';
302
+ $this->fileData[] = $this->fileConnectionData;
303
+ $this->fileData[] = 'SOURCE_SQL_QUERY="' . $validDataSql . '"';
304
+ $this->fileData[] = '}';
305
+ $this->fileData[] = '';
306
+ }
307
+
308
+ /**
309
+ * Prepare the product data
310
+ */
311
+ protected function _getProductData($storeUrl,$mediaUrl, $sqlSelects,
312
+ $cpeTable, $sqlJoins, $cpeIntTable,
313
+ $visibilityAttributeId, $sellingPriceTable,
314
+ $cpeDecimalTable, $priceAttributeId,
315
+ $cpeVarcharTable, $urlAttributeId, $nameAttributeId,
316
+ $imageAttributeId)
317
+ {
318
+ #$sqlSelects containts the optional attributes
319
+ #productdata(ProductId, Name, Price, Image, Url)
320
+ $productDataSql = "SELECT `e`.`entity_id` AS `ProductId`, `_table_name`.`value` AS `ProductName`, IFNULL(`_table_sellingprice`.`final_price`,'') AS `SellingPrice`, `_table_price`.`value` AS `Price`, CONCAT('{$storeUrl}', `_table_url`.`value`) AS `ProductPageURL`, CONCAT('{$mediaUrl}',`_table_image`.`value`) AS `ImageURL` {$sqlSelects} FROM `{$cpeTable}` AS `e` {$sqlJoins} INNER JOIN `{$cpeIntTable}` AS `_table_visibility` ON (_table_visibility.entity_id = e.entity_id) AND (_table_visibility.attribute_id='{$visibilityAttributeId}') AND (_table_visibility.store_id=0) INNER JOIN `{$sellingPriceTable}` AS _table_sellingprice ON (_table_sellingprice.entity_id = e.entity_id) AND (customer_group_id = 1) INNER JOIN `{$cpeDecimalTable}` AS `_table_price` ON (_table_price.entity_id = e.entity_id) AND (_table_price.attribute_id='{$priceAttributeId}') AND (_table_price.store_id=0) INNER JOIN `{$cpeVarcharTable}` AS `_table_name` ON (_table_name.entity_id = e.entity_id) AND (_table_name.attribute_id='{$nameAttributeId}') AND (_table_name.store_id=0) INNER JOIN `{$cpeVarcharTable}` AS `_table_url` ON (_table_url.entity_id = e.entity_id) AND (_table_url.attribute_id='{$urlAttributeId}') AND (_table_url.store_id=0) INNER JOIN `{$cpeVarcharTable}` AS `_table_image` ON (_table_image.entity_id = e.entity_id) AND (_table_image.attribute_id='{$imageAttributeId}') AND (_table_image.store_id=0) WHERE (_table_visibility.value IN(2, 4)) ORDER BY `e`.`entity_id`";
321
+ $this->fileData[] = '#productdata';
322
+ $this->fileData[] = '{';
323
+ $this->fileData[] = 'DATA_TYPE="productdata"';
324
+ $this->fileData[] = $this->fileConnectionData;
325
+ $this->fileData[] = 'SOURCE_SQL_QUERY="' . $productDataSql . '"';
326
+ $this->fileData[] = '}';
327
+ $this->fileData[] = '';
328
+ }
329
+
330
+ /**
331
+ * Prepare the transaction data
332
+ */
333
+ protected function _getTransactionData($soitemTable,$soTable)
334
+ {
335
+ #transactiondata(UserId, ProductId, OrderId)
336
+ $transactionDataSql = "SELECT `order`.`customer_id`, `main_table`.`product_id`, `order`.`increment_id` FROM `{$soitemTable}` AS `main_table` INNER JOIN `{$soTable}` AS `order` ON `order`.`entity_id` = `main_table`.`order_id`;";
337
+ $this->fileData[] = '#transactiondata';
338
+ $this->fileData[] = '{';
339
+ $this->fileData[] = 'DATA_TYPE="transactiondata"';
340
+ $this->fileData[] = $this->fileConnectionData;
341
+ $this->fileData[] = 'SOURCE_SQL_QUERY="' . $transactionDataSql . '"';
342
+ $this->fileData[] = '}';
343
+ $this->fileData[] = '';
344
+ }
345
+ }
app/code/community/Avail/Pointofsale/Model/Jsonrpc.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_Model_Jsonrpc
11
+ {
12
+ const SESSION_ID_COOKIE_NAME = '__avail_session__';
13
+
14
+ protected $_httpClient;
15
+ protected $_helper;
16
+
17
+ public function __construct()
18
+ {
19
+ $this->_helper = Mage::helper('pointofsale');
20
+
21
+ try {
22
+ $this->_httpClient = new Zend_Http_Client();
23
+ $this->_httpClient->setUri($this->_helper->getJsonRpcServerUrl())
24
+ ->setMethod(Zend_Http_Client::POST);
25
+ } catch (Exception $e) {
26
+ Mage::log($e->getMessage());
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Retrieve Avail session id from the cookie
32
+ *
33
+ * @return string
34
+ */
35
+ protected function _getSessionId()
36
+ {
37
+ return Mage::getModel('core/cookie')->get(self::SESSION_ID_COOKIE_NAME);
38
+ }
39
+
40
+ /**
41
+ * Log using JSON-RPC the product added to cart
42
+ *
43
+ * @param int $productId
44
+ * @return string
45
+ */
46
+ public function logAddedToCart($productId)
47
+ {
48
+ $params = array(
49
+ 'method' => 'logAddedToCart',
50
+ 'params' => array(
51
+ 'SessionID' => $this->_getSessionId(),
52
+ 'ProductID' => (string)$productId
53
+ ),
54
+ 'version' => '1.1',
55
+ 'id' => md5(md5(time()))
56
+ );
57
+
58
+ return $this->_getBody($params);
59
+ }
60
+
61
+ /**
62
+ * Log using JSON-RPC the product removed from cart
63
+ *
64
+ * @param int $productId
65
+ * @return string
66
+ */
67
+ public function logRemovedFromCart($productId)
68
+ {
69
+ $params = array(
70
+ 'method' => 'logRemovedFromCart',
71
+ 'params' => array(
72
+ 'SessionID' => $this->_getSessionId(),
73
+ 'ProductID' => (string)$productId
74
+ ),
75
+ 'version' => '1.1',
76
+ 'id' => md5(md5(time()))
77
+ );
78
+
79
+ return $this->_getBody($params);
80
+ }
81
+
82
+ /**
83
+ *
84
+ *
85
+ * @param array $params
86
+ * @return string
87
+ */
88
+ protected function _getBody($params)
89
+ {
90
+ $this->_httpClient->setRawData(json_encode($params));
91
+ $result = $this->_httpClient->request()->getBody();
92
+
93
+ if ($this->_helper->isDebugMode()) {
94
+ $this->_helper->log(json_encode($params));
95
+ $this->_helper->log($result);
96
+ }
97
+
98
+ return $result;
99
+ }
100
+
101
+ /**
102
+ * Sends order information to Avail Servers using logPurchase call
103
+ *
104
+ * @param int $orderId
105
+ * @return string
106
+ */
107
+ public function logPurchase($orderId)
108
+ {
109
+ $order = Mage::getModel('sales/order')->load($orderId);
110
+
111
+ if ($order instanceof Mage_Sales_Model_Order && $order->getId()) {
112
+
113
+ $productIds = array();
114
+ $productPrices = array();
115
+
116
+ foreach ($order->getAllItems() as $item) {
117
+ if (!$item->getParentItemId()) {
118
+ for ($i = 0; $i < $item->getQtyOrdered(); $i++) {
119
+ $productIds[] = $item->getProductId();
120
+ $productPrices[] = $item->getBasePrice();
121
+ }
122
+ }
123
+ }
124
+
125
+ $params = array(
126
+ 'method' => 'logPurchase',
127
+ 'params' => array(
128
+ 'SessionID' => $this->_getSessionId(),
129
+ 'UserID' => $this->_getHashedCustomerId($order),
130
+ 'ProductIDs' => $productIds,
131
+ 'Prices' => $productPrices,
132
+ 'OrderID' => $order->getIncrementId(),
133
+ 'Currency' => $this->_getCurrency($order)
134
+ ),
135
+ 'version' => '1.1',
136
+ 'id' => md5(md5(time()))
137
+ );
138
+
139
+ return $this->_getBody($params);
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Returns hashed customer email
145
+ * We use the email and not customer id because of Guest/Registered mode
146
+ * When purchasing with guest mode, no customer is created, so no customer id
147
+ *
148
+ * @param Mage_Sales_Model_Order $order
149
+ * @return string
150
+ */
151
+ protected function _getHashedCustomerId($order)
152
+ {
153
+ return Mage::helper('core')->getHash($order->getCustomerEmail());
154
+ }
155
+
156
+ /**
157
+ * Retrieve order currency
158
+ *
159
+ * @param Mage_Sales_Model_Order $order
160
+ * @return string
161
+ */
162
+ protected function _getCurrency($order)
163
+ {
164
+ return $order->getStore()->getCurrentCurrency()->toString();
165
+ }
166
+
167
+ /**
168
+ * Sends search phrase and product id to Avail
169
+ *
170
+ * @param string $searchPhrase
171
+ * @param int $productId
172
+ * @return string
173
+ */
174
+ public function saveSearch($searchPhrase, $productId)
175
+ {
176
+ $params = array(
177
+ 'method' => 'saveSearch',
178
+ 'params' => array(
179
+ 'SearchPhrase' => $searchPhrase,
180
+ 'ProductID' => (string)$productId
181
+ ),
182
+ 'version' => '1.1',
183
+ 'id' => md5(md5(time()))
184
+ );
185
+
186
+ return $this->_getBody($params);
187
+ }
188
+ }
app/code/community/Avail/Pointofsale/Model/Observer.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Avail_Pointofsale_Model_Observer
12
+ {
13
+ /**
14
+ * Avail log purchase operation
15
+ *
16
+ * @param Varien_Event_Observer $observer
17
+ * @return \Avail_Pointofsale_Model_Observer
18
+ */
19
+ public function logPurchase(Varien_Event_Observer $observer)
20
+ {
21
+ $orderIds = $observer->getEvent()->getOrderIds();
22
+ $api = Mage::getSingleton('pointofsale/jsonrpc');
23
+
24
+ foreach ($orderIds as $orderId) {
25
+ $api->logPurchase($orderId);
26
+ }
27
+
28
+ return $this;
29
+ }
30
+
31
+ /**
32
+ * Log the added product id to cart
33
+ *
34
+ * /!\ if the 'buy' button was clicked to add a product and this product
35
+ * has options, so you're redirected to the product page, the log won't be
36
+ * triggered again if you click on 'add to cart'
37
+ *
38
+ * @param Varien_Event_Observer $observer
39
+ * @return \Avail_Pointofsale_Model_Observer
40
+ */
41
+ public function logAddedToCart(Varien_Event_Observer $observer)
42
+ {
43
+ $helper = Mage::helper('pointofsale');
44
+
45
+ $jsonCookie = json_decode(
46
+ $observer->getEvent()->getRequest()->getCookie($helper->getInitCookieName())
47
+ );
48
+
49
+ $buyProductId = isset($jsonCookie->{$helper->getBuyButtonUrlParam()}) ?
50
+ $jsonCookie->{$helper->getBuyButtonUrlParam()} :
51
+ 0;
52
+
53
+ $product = $observer->getEvent()->getProduct();
54
+ $api = Mage::getSingleton('pointofsale/jsonrpc');
55
+
56
+ if ($product && $product->getId() && ($product->getId() != $buyProductId)) {
57
+ $api->logAddedToCart($product->getId());
58
+ }
59
+
60
+ return $this;
61
+ }
62
+
63
+ /**
64
+ * Log the removed product id from the cart
65
+ *
66
+ * @param Varien_Event_Observer $observer
67
+ * @return \Avail_Pointofsale_Model_Observer
68
+ */
69
+ public function logRemovedFromCart(Varien_Event_Observer $observer)
70
+ {
71
+ $api = Mage::getSingleton('pointofsale/jsonrpc');
72
+ $itemId = Mage::app()->getFrontController()->getRequest()->get('id');
73
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
74
+
75
+ if ($quote && $quote->getId() && $itemId) {
76
+ $item = $quote->getItemById($itemId);
77
+ if ($item && $item->getProductId()) {
78
+ $api->logRemovedFromCart($item->getProductId());
79
+ }
80
+ }
81
+
82
+ return $this;
83
+ }
84
+
85
+ /**
86
+ * Sends JS to browser to save search phrase in a cookie
87
+ *
88
+ * @return \Avail_Pointofsale_Model_Observer
89
+ */
90
+ public function saveSearchPhrase()
91
+ {
92
+ $searchPhrase = Mage::helper('catalogSearch')->getQueryText();
93
+ $escapedSearchPhrase = Mage::helper('core')->jsQuoteEscape($searchPhrase, '"');
94
+
95
+ $script = 'Cookie.setData("' .
96
+ Avail_Pointofsale_Helper_Data::SEARCH_PHRASE_KEY .
97
+ '", "' .
98
+ $searchPhrase .
99
+ '");';
100
+
101
+ $script .= 'Cookie.setData("' .
102
+ Avail_Pointofsale_Helper_Data::PAGE_VIEWED_KEY .
103
+ '", 0);';
104
+
105
+ Mage::helper('pointofsale')->addJsCode($script);
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * Log saveSearch call to Avail server if there is a search phrase and
111
+ * the visited pages are equal or less than one
112
+ *
113
+ * @param Varien_Event_Observer $observer
114
+ * @return \Avail_Pointofsale_Model_Observer
115
+ */
116
+ public function saveSearch(Varien_Event_Observer $observer)
117
+ {
118
+ $api = Mage::getSingleton('pointofsale/jsonrpc');
119
+ $product = $observer->getEvent()->getProduct();
120
+ $helper = Mage::helper('pointofsale');
121
+ $max = $helper->getMaxPageViewed();
122
+
123
+ $jsonCookie = json_decode(
124
+ $observer->getEvent()->getRequest()->getCookie($helper->getInitCookieName())
125
+ );
126
+
127
+ $searchPhrase = isset($jsonCookie->{$helper->getSearchPhraseKey()}) ?
128
+ $jsonCookie->{$helper->getSearchPhraseKey()} :
129
+ '';
130
+ $pageViewed = isset($jsonCookie->{$helper->getPageViewedKey()}) ?
131
+ $jsonCookie->{$helper->getPageViewedKey()} :
132
+ $max++;
133
+
134
+ if (!empty($searchPhrase) && $pageViewed <= $max && $product && $product->getId()) {
135
+ $api->saveSearch($searchPhrase, $product->getId());
136
+ }
137
+
138
+ return $this;
139
+ }
140
+ }
app/code/community/Avail/Pointofsale/controllers/GenerateController.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2013 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ class Avail_Pointofsale_GenerateController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ /**
13
+ * Create the configuration files and display the response message .
14
+ *
15
+ * @return bool
16
+ */
17
+ public function indexAction()
18
+ {
19
+ $modelInstaller = Mage::getSingleton('pointofsale/installer');
20
+
21
+ if ($modelInstaller->verifyConf()) {
22
+ $modelInstaller->createFiles();
23
+ Mage::getSingleton('core/session')->addSuccess('File has been created successfully !');
24
+ } else {
25
+ Mage::getSingleton('core/session')->addError('File has not been created , please check your configuration !');
26
+ }
27
+
28
+ $this->_redirect("adminhtml/system_config/edit/section/pointofsale/");
29
+ }
30
+ }
app/code/community/Avail/Pointofsale/etc/adminhtml.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Avail - Point of Sale
5
+ *
6
+ * @category Avail
7
+ * @package Avail_Pointofsale
8
+ * @copyright 2013 Avail
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <all>
16
+ <title>Point of Sale</title>
17
+ </all>
18
+ <admin>
19
+ <children>
20
+ <system>
21
+ <children>
22
+ <config>
23
+ <children>
24
+ <pointofsale translate="title">
25
+ <title>Point of Sale</title>
26
+ <sort_order>100</sort_order>
27
+ </pointofsale>
28
+ </children>
29
+ </config>
30
+ </children>
31
+ </system>
32
+ </children>
33
+ </admin>
34
+ </resources>
35
+ </acl>
36
+ </config>
app/code/community/Avail/Pointofsale/etc/config.xml ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Avail - Point of Sale
5
+ *
6
+ * @category Avail
7
+ * @package Avail_Pointofsale
8
+ * @copyright 2013 Avail
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Avail_Pointofsale>
15
+ <version>0.0.1</version>
16
+ </Avail_Pointofsale>
17
+ </modules>
18
+ <global>
19
+ <blocks>
20
+ <pointofsale>
21
+ <class>Avail_Pointofsale_Block</class>
22
+ </pointofsale>
23
+ </blocks>
24
+ <helpers>
25
+ <pointofsale>
26
+ <class>Avail_Pointofsale_Helper</class>
27
+ </pointofsale>
28
+ </helpers>
29
+ <models>
30
+ <pointofsale>
31
+ <class>Avail_Pointofsale_Model</class>
32
+ </pointofsale>
33
+ </models>
34
+ </global>
35
+ <frontend>
36
+ <layout>
37
+ <updates>
38
+ <pointofsale>
39
+ <file>pointofsale.xml</file>
40
+ </pointofsale>
41
+ </updates>
42
+ </layout>
43
+ <routers>
44
+ <pointofsale>
45
+ <use>standard</use>
46
+ <args>
47
+ <module>Avail_Pointofsale</module>
48
+ <frontName>pointofsale</frontName>
49
+ </args>
50
+ </pointofsale>
51
+ </routers>
52
+ <events>
53
+ <!-- logAddedToCart -->
54
+ <checkout_cart_add_product_complete>
55
+ <observers>
56
+ <log_added_to_cart>
57
+ <class>pointofsale/observer</class>
58
+ <method>logAddedToCart</method>
59
+ </log_added_to_cart>
60
+ </observers>
61
+ </checkout_cart_add_product_complete>
62
+
63
+ <!-- logPurchase -->
64
+ <checkout_onepage_controller_success_action>
65
+ <observers>
66
+ <pointofsale_log_purchase>
67
+ <class>pointofsale/observer</class>
68
+ <method>logPurchase</method>
69
+ </pointofsale_log_purchase>
70
+ </observers>
71
+ </checkout_onepage_controller_success_action>
72
+
73
+ <!-- logRemovedFromCart -->
74
+ <controller_action_postdispatch_checkout_cart_delete>
75
+ <observers>
76
+ <log_removed_from_cart>
77
+ <class>pointofsale/observer</class>
78
+ <method>logRemovedFromCart</method>
79
+ </log_removed_from_cart>
80
+ </observers>
81
+ </controller_action_postdispatch_checkout_cart_delete>
82
+
83
+ <!-- saveSearch -->
84
+ <controller_action_predispatch_catalogsearch_result_index>
85
+ <observers>
86
+ <save_search_phrase_js_browser>
87
+ <class>pointofsale/observer</class>
88
+ <method>saveSearchPhrase</method>
89
+ </save_search_phrase_js_browser>
90
+ </observers>
91
+ </controller_action_predispatch_catalogsearch_result_index>
92
+ <checkout_cart_add_product_complete>
93
+ <observers>
94
+ <save_search_json_rpc>
95
+ <class>pointofsale/observer</class>
96
+ <method>saveSearch</method>
97
+ </save_search_json_rpc>
98
+ </observers>
99
+ </checkout_cart_add_product_complete>
100
+ </events>
101
+ </frontend>
102
+ <default>
103
+ <pointofsale>
104
+ <interface>
105
+ <url>http://service.avail.net/2009-02-13/dynamic/</url>
106
+ <js_load>0</js_load>
107
+ <debug>0</debug>
108
+ </interface>
109
+ <template>
110
+ <default>GETPREDEXT_DEFAULT</default>
111
+ <search>SearchPage</search>
112
+ <product>ProductPage</product>
113
+ <category>CategoryPage</category>
114
+ <precart>AddToBasketPage</precart>
115
+ <cart>BasketPage</cart>
116
+ </template>
117
+ </pointofsale>
118
+ <generatefiles>
119
+ <conf>
120
+ <filename>upload.conf</filename>
121
+ </conf>
122
+ </generatefiles>
123
+ </default>
124
+ </config>
app/code/community/Avail/Pointofsale/etc/system.xml ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Avail - Point of Sale
5
+ *
6
+ * @category Avail
7
+ * @package Avail_Pointofsale
8
+ * @copyright 2013 Avail
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+ <config>
13
+ <tabs>
14
+ <pointofsale translate="label" module="pointofsale">
15
+ <label>Avail</label>
16
+ <sort_order>100</sort_order>
17
+ </pointofsale>
18
+ </tabs>
19
+ <sections>
20
+ <pointofsale translate="label" module="pointofsale">
21
+ <label>Point of Sale</label>
22
+ <tab>pointofsale</tab>
23
+ <sort_order>1000</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <groups>
28
+ <account translate="label">
29
+ <label>Account</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>100</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment><![CDATA[If you are not able to locate the information
36
+ you need in our <a target="_blank" href="http://customer.avail.com">Customer Portal</a>,
37
+ please contact Avail Support Desk, either
38
+ by email to <a href="mailto:support@avail.net">support@avail.net</a> or
39
+ by telephone, +46 40 121217, UK number +44 20 812 33 590 or US number +1 650 68 19 751.]]>
40
+ </comment>
41
+ <fields>
42
+ <customer_id translate="label">
43
+ <label>Customer Id</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>1</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </customer_id>
50
+ <password translate="label">
51
+ <label>Password</label>
52
+ <frontend_type>password</frontend_type>
53
+ <sort_order>2</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </password>
58
+ </fields>
59
+ </account>
60
+ <interface translate="label">
61
+ <label>Interface and feed</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>200</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ <fields>
68
+ <url translate="label">
69
+ <label>Request Url</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>1</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </url>
76
+ <debug translate="label">
77
+ <label>Debug mode</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_yesno</source_model>
80
+ <sort_order>3</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </debug>
85
+ <attribute translate="label">
86
+ <label>Uploaded product attributes</label>
87
+ <frontend_type>button</frontend_type>
88
+ <frontend_model>pointofsale/config_form_field_button</frontend_model>
89
+ <backend_model>pointofsale/config_backend_serialized_array</backend_model>
90
+ <sort_order>4</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <comment><![CDATA[Before adding extra product attributes, please contact <a href="mailto:support@avail.net">support@avail.net</a>
95
+ <br/>Some mandatory attributes (product id, product name, final price, price, product URL and image URL) are included
96
+ by default in the data feed.]]>
97
+ </comment>
98
+ </attribute>
99
+ </fields>
100
+ </interface>
101
+ <template translate="label">
102
+ <label>Templates and filters</label>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>300</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ <fields>
109
+ <search translate="label">
110
+ <label>Search page</label>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>1</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </search>
117
+ <product translate="label">
118
+ <label>Product page</label>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>2</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </product>
125
+ <category translate="label">
126
+ <label>Category page</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>3</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </category>
133
+ <precart translate="label">
134
+ <label>Pre-Cart page</label>
135
+ <frontend_type>text</frontend_type>
136
+ <sort_order>4</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ </precart>
141
+ <cart translate="label">
142
+ <label>Cart page</label>
143
+ <frontend_type>text</frontend_type>
144
+ <sort_order>5</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </cart>
149
+ </fields>
150
+ </template>
151
+ <conf translate="label">
152
+ <label>Files configuration</label>
153
+ <frontend_type>text</frontend_type>
154
+ <sort_order>400</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ <fields>
159
+ <default translate="label">
160
+ <frontend_type>button</frontend_type>
161
+ <label>Generate files</label>
162
+ <frontend_model>pointofsale/config_form_field_GenerateButton</frontend_model>
163
+ <sort_order>1</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ </default>
168
+ </fields>
169
+ </conf>
170
+ </groups>
171
+ </pointofsale>
172
+ </sections>
173
+ </config>
app/design/adminhtml/default/default/template/pointofsale/select/attributes/array.phtml ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2012 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
14
+
15
+ $_colspan = 2;
16
+ if (!$this->_addAfter) {
17
+ $_colspan -= 1;
18
+ }
19
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
20
+ ?>
21
+
22
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
23
+ <table cellpadding="0" cellspacing="0" class="border">
24
+ <tbody>
25
+
26
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
27
+ <?php foreach ($this->_columns as $columnName => $column):?>
28
+ <th><?php echo $column['label'] ?></th>
29
+ <?php endforeach;?>
30
+ <th <?php echo $_colspan?>></th>
31
+ </tr>
32
+
33
+ <tr id="addRow<?php echo $_htmlId ?>">
34
+ <td colspan="<?php echo count($this->_columns) ?>"></td>
35
+ <td <?php echo $_colspan?>>
36
+ <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
37
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
38
+ </button>
39
+ </td>
40
+ </tr>
41
+
42
+ </tbody>
43
+ </table>
44
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
45
+ </div>
46
+ <div id="empty<?php echo $_htmlId ?>">
47
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
48
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
49
+ </button>
50
+ </div>
51
+
52
+ <script type="text/javascript">
53
+ //<![CDATA[
54
+ // create row creator
55
+ var arrayRow<?php echo $_htmlId ?> = {
56
+ // define row prototypeJS template
57
+ template : new Template(
58
+ '<tr id="#{_id}">'
59
+ <?php foreach ($this->_columns as $columnName => $column):?>
60
+ +'<td>'
61
+ +'<?php echo $this->_renderCellTemplate($columnName)?>'
62
+ +'<\/td>'
63
+ <?php endforeach;?>
64
+ <?php if ($this->_addAfter):?>
65
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/span><\/span><\/button><\/td>'
66
+ <?php endif;?>
67
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/span><\/span><\/button><\/td>'
68
+ +'<\/tr>'
69
+ ),
70
+
71
+ rowsCount : 0,
72
+
73
+ add : function(templateData, insertAfterId)
74
+ {
75
+ // generate default template data
76
+ if ('' == templateData) {
77
+ var d = new Date();
78
+ var templateData = {
79
+ <?php foreach ($this->_columns as $columnName => $column):?>
80
+ <?php echo $columnName ?> : '',
81
+ <?php endforeach;?>
82
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
83
+ };
84
+ }
85
+
86
+ // insert before last row
87
+ if ('' == insertAfterId) {
88
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
89
+ }
90
+ // insert after specified row
91
+ else {
92
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
93
+ }
94
+
95
+ // for the attribute
96
+ var current_select = $(templateData._id).children[0].children[0];
97
+ var current_non = current_select.select('option[value="'+templateData.attributes+'"]');
98
+ var options = current_select.select("option");
99
+ if (current_non[0]) {
100
+ options.each(function(item)
101
+ {
102
+ if(item.value == current_non[0].value)
103
+ {
104
+ item.selected = true;
105
+ }
106
+ });
107
+ }
108
+
109
+ // for the store
110
+ var current_select = $(templateData._id).children[1].children[0];
111
+ var current_non = current_select.select('option[value="'+templateData.stores+'"]');
112
+ var options = current_select.select("option");
113
+ if (current_non[0]) {
114
+ options.each(function(item)
115
+ {
116
+ if(item.value == current_non[0].value)
117
+ {
118
+ item.selected = true;
119
+ }
120
+ });
121
+ }
122
+
123
+
124
+ <?php if ($this->_addAfter):?>
125
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
126
+ <?php endif;?>
127
+
128
+ this.rowsCount += 1;
129
+ },
130
+
131
+ del : function(rowId)
132
+ {
133
+ $(rowId).remove();
134
+ this.rowsCount -= 1;
135
+ if (0 == this.rowsCount) {
136
+ this.showButtonOnly();
137
+ }
138
+ },
139
+
140
+ showButtonOnly : function()
141
+ {
142
+ $('grid<?php echo $_htmlId ?>').hide();
143
+ $('empty<?php echo $_htmlId ?>').show();
144
+ }
145
+ }
146
+
147
+ // bind add action to "Add" button in last row
148
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
149
+
150
+ // add existing rows
151
+ <?php
152
+ $_addAfterId = "headings{$_htmlId}";
153
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
154
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
155
+ $_addAfterId = $_rowId;
156
+ }
157
+ ?>
158
+
159
+ // initialize standalone button
160
+ $('empty<?php echo $_htmlId ?>').hide();
161
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
162
+ $('grid<?php echo $_htmlId ?>').show();
163
+ $('empty<?php echo $_htmlId ?>').hide();
164
+ arrayRow<?php echo $_htmlId ?>.add('', '');
165
+ });
166
+
167
+ // if no rows, hide grid and show button only
168
+ <?php if (!$this->getArrayRows()):?>
169
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
170
+ <?php endif;?>
171
+
172
+ // toggle the grid, if element is disabled (depending on scope)
173
+ <?php if ($this->getElement()->getDisabled()):?>
174
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
175
+ <?php endif;?>
176
+ //]]>
177
+ </script>
app/design/frontend/base/default/layout/pointofsale.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Avail - Point of Sale
5
+ *
6
+ * @category Avail
7
+ * @package Avail_Pointofsale
8
+ * @copyright 2012 Avail
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+ <layout version="0.1.0">
13
+ <default>
14
+ <reference name="head">
15
+ <block type="pointofsale/head" name="pointofsale_head" as="pointofsale_head">
16
+ <action method="addJs"><script>emark-min.js</script></action>
17
+ </block>
18
+ <block type="page/html_head" name="pointofsale_cookie" after="head">
19
+ <action method="addJs"><script>avail/cookie.js</script></action>
20
+ </block>
21
+ <block type="pointofsale/data" name="pointofsale_data" as="pointofsale_data" template="pointofsale/data.phtml" />
22
+ </reference>
23
+ </default>
24
+
25
+ <catalog_product_view>
26
+ <reference name="right">
27
+ <block type="pointofsale/data_banner_product" name="pointofsale_banner_product" before="-" as="pointofsale_banner_product" />
28
+ </reference>
29
+ </catalog_product_view>
30
+
31
+ <checkout_cart_index>
32
+ <reference name="content">
33
+ <block type="pointofsale/data_banner_cart" name="pointofsale_banner_cart" before="-" as="pointofsale_banner_cart" />
34
+ <!--<block type="pointofsale/data_banner_precart" name="pointofsale_banner_precart" before="-" as="pointofsale_banner_precart" />-->
35
+ </reference>
36
+ </checkout_cart_index>
37
+
38
+ <catalogsearch_result_index>
39
+ <reference name="content">
40
+ <block type="pointofsale/data_banner_search" name="pointofsale_banner_search" before="-" as="pointofsale_banner_search" />
41
+ </reference>
42
+ </catalogsearch_result_index>
43
+
44
+ <catalog_category_view>
45
+ <reference name="content">
46
+ <block type="pointofsale/data_banner_category" name="pointofsale_banner_category" before="-" as="pointofsale_banner_category" />
47
+ </reference>
48
+ </catalog_category_view>
49
+ </layout>
app/design/frontend/base/default/template/pointofsale/data.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Avail - Point of Sale
4
+ *
5
+ * @category Avail
6
+ * @package Avail_Pointofsale
7
+ * @copyright 2012 Avail
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ ?>
11
+ <?php $helper = $this->helper('pointofsale'); ?>
12
+ <?php $pageViewedKey = $helper->getPageViewedKey() ?>
13
+ <?php $maxPageViewed = $helper->getMaxPageViewed() ?>
14
+
15
+ <!-- Begin Avail -->
16
+ <?php if ($this->isConfigured()) : ?>
17
+ <?php if ($this->isDebugMode()) : ?>
18
+ <div id="__avail_log__"></div>
19
+ <?php endif; ?>
20
+
21
+ <script type="text/javascript">
22
+ //<![CDATA[
23
+ function availCartItem(productId) {
24
+ Cookie.setData('<?php echo $helper->getBuyButtonUrlParam() ?>_inc', 0);
25
+ Cookie.setData('<?php echo $helper->getBuyButtonUrlParam() ?>', productId);
26
+ setLocation(<?php echo "'" . $helper->getAddToCartUrl() . "product/'" ?>+productId);
27
+ }
28
+
29
+ function incrementAndDelete(incr, flush, limit) {
30
+ var page_viewed = Cookie.getData(incr);
31
+ if (page_viewed != null) {
32
+ Cookie.setData(incr, page_viewed + 1);
33
+ }
34
+ if (page_viewed > limit) {
35
+ Cookie.removeData(incr);
36
+ Cookie.removeData(flush);
37
+ }
38
+ }
39
+
40
+ Cookie.init({
41
+ name: '<?php echo $helper->getInitCookieName() ?>',
42
+ path: '/',
43
+ domain: '<?php echo Mage::getModel('core/cookie')->getDomain() ?>'
44
+ });
45
+
46
+ <?php if ($this->isDebugMode()) : ?>
47
+ var emark = new Emark(true);
48
+ <?php else: ?>
49
+ var emark = new Emark();
50
+ <?php endif; ?>
51
+
52
+ incrementAndDelete('<?php echo $pageViewedKey ?>', '<?php echo $helper->getSearchPhraseKey() ?>', <?php echo $maxPageViewed ?>);
53
+ incrementAndDelete('<?php echo $helper->getBuyButtonUrlParam() ?>_inc', '<?php echo $helper->getBuyButtonUrlParam() ?>', <?php echo $maxPageViewed ?>);
54
+
55
+ <?php echo $helper->getJsCode(); ?>
56
+
57
+ emark.commit();
58
+ //]]>
59
+ </script>
60
+ <?php endif; ?>
61
+ <!-- End Avail -->
app/etc/modules/Avail_Pointofsale.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Avail - Point of Sale
5
+ *
6
+ * @category Avail
7
+ * @package Avail_Pointofsale
8
+ * @copyright 2012 Avail
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Avail_Pointofsale>
15
+ <active>true</active>
16
+ <codePool>community</codePool>
17
+ </Avail_Pointofsale>
18
+ </modules>
19
+ </config>
availdataexporter/availdataexporter.bat ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ @echo off
2
+ rem Suppress standard error since its a subset of whats output to stdout.
3
+ java -jar -Djava.ext.dirs=lib -Xmx256m bin\availdataexporter.jar %1 2> NUL
availdataexporter/availdataexporter.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # redirect std err since its a subset of std out
4
+ exec java -Djava.ext.dirs=lib -Xmx256m -jar bin/availdataexporter.jar $@ 2> /dev/null
availdataexporter/bin/availdataexporter.jar ADDED
Binary file
availdataexporter/exampleupload.conf ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Create a comment by prefixing a line with '#'.
2
+
3
+ # In the rare case that the upload address should be changed from the default
4
+ # it can be specified as below
5
+ # BASE_URL="https://upload.avail.net/2009-02-25/upload"
6
+
7
+ # The customer id is assigned to you by Avail
8
+ CUSTOMER_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
9
+
10
+ # The password is assigned to you by Avail
11
+ PASSWORD="MyPassword"
12
+
13
+ # MS SQL upload example
14
+ {
15
+ DATA_TYPE="productdata"
16
+ SOURCE_SQL_CONNECTIONSTRING="jdbc:jtds:sqlserver://192.168.0.212:1433/SampleDB;user=MyLogin;password=MyPsw"
17
+ SOURCE_SQL_DRIVER="net.sourceforge.jtds.jdbc.Driver"
18
+ SOURCE_SQL_QUERY="SELECT * FROM products"
19
+ }
20
+
21
+ # MySQL upload example
22
+ {
23
+ DATA_TYPE="categorydata"
24
+ SOURCE_SQL_CONNECTIONSTRING="jdbc:mysql://192.168.0.212/sampledb?user=myuser&password=mypsw"
25
+ SOURCE_SQL_DRIVER="com.mysql.jdbc.Driver"
26
+ SOURCE_SQL_QUERY="SELECT * FROM categories"
27
+ }
28
+
29
+ # Oracle upload example
30
+ {
31
+ DATA_TYPE="transactiondata"
32
+ # orcl is the SID.
33
+ SOURCE_SQL_CONNECTIONSTRING="jdbc:oracle:thin:MyUser/MyPsw@192.168.0.212:1521:orcl"
34
+ SOURCE_SQL_DRIVER="oracle.jdbc.driver.OracleDriver"
35
+ SOURCE_SQL_QUERY="select * from myts.orders"
36
+ }
37
+
38
+ # Oracle upload example with stored procedure or function
39
+ {
40
+ DATA_TYPE="transactiondata"
41
+
42
+ SOURCE_SQL_ORACLE_SP_OR_FUNCTION="true"
43
+ # orcl is the SID.
44
+ SOURCE_SQL_CONNECTIONSTRING="jdbc:oracle:thin:MyUser/MyPsw@192.168.0.212:1521:orcl"
45
+ SOURCE_SQL_DRIVER="oracle.jdbc.driver.OracleDriver"
46
+
47
+ # function
48
+ SOURCE_SQL_QUERY="begin :1 := myts.emark_sf.sf_gettrans();end;"
49
+
50
+ # stored procedure
51
+ # SOURCE_SQL_QUERY="{call myts.emark_sp.sp_gettrans(?)}"
52
+ }
53
+
54
+ # File to file example
55
+ #
56
+ # Format examples:
57
+ #
58
+ # To set the column delimiter to ';', the row delimiter to unix line
59
+ # break (\n), the start text qualifier to double quote ("), the end text
60
+ # qualifier to double quote ("), the encoding to UTF-8 and text escaping
61
+ # to escaped (text qualifiers must be escaped inside a text block, tabs,
62
+ # backslashes and line breaks etc. may be be escaped inside a text block)
63
+ # the following format string should be used:
64
+ #
65
+ # SOURCE_FILE_FORMATSTRING=";_\n_\"_\"_UTF-8_escaped"
66
+ #
67
+ # To set the column delimiter to the string "coldelimiter", the row
68
+ # delimiter to universal (all of unix, windows and mac os line breaks
69
+ # are interpreted as valid line breaks), the start text qualifier to the
70
+ # string "starttextq", the end text qualifier to the string "endtextq",
71
+ # the encoding to ISO-8859-1 and text escaping to unescaped (no text
72
+ # delimiters may exist inside a text block).
73
+ #
74
+ # SOURCE_FILE_FORMATSTRING="coldelimiter_universal_starttextq_endtextq_ISO-8859-1_unescaped"
75
+
76
+ # You can test the format string by setting the destination to a file.
77
+ # If a destination file name is given, the data will not be sent to Avail.
78
+ # If the destination file name is omitted, the data is sent to Avail.
79
+ {
80
+ DATA_TYPE="categorydata"
81
+ # File paths can be either relative or absolute.
82
+ SOURCE_FILE_NAME="../../../categories.txt"
83
+ SOURCE_FILE_FORMATSTRING=";_\n_\"_\"_UTF-8_unescaped"
84
+ DESTINATION_FILE_NAME="categories.readyforupload.txt"
85
+ }
availdataexporter/lib/commons-codec-1.3.jar ADDED
Binary file
availdataexporter/lib/commons-httpclient-3.1.jar ADDED
Binary file
availdataexporter/lib/commons-logging-1.1.1.jar ADDED
Binary file
availdataexporter/lib/jtds-1.2.2.jar ADDED
Binary file
availdataexporter/lib/log4j-1.2.15.jar ADDED
Binary file
availdataexporter/lib/ms_sql_1.1.1501.jar ADDED
Binary file
availdataexporter/lib/mysql_5.1.6.jar ADDED
Binary file
availdataexporter/lib/oracle_10.2.0.4.jar ADDED
Binary file
availdataexporter/lib/sunjce_provider.jar ADDED
Binary file
availdataexporter/log/log4j.properties ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # log4j.properties is automatically loaded if it can be found in the class path
2
+ # or specified by the system property log4j.configuration
3
+ # log4j.debug=true better to specify -Dlog4j.debug
4
+
5
+ # setting the hierarchy-wide threshold OFF will turn of everything
6
+ # log4j.threshold=OFF
7
+
8
+ detailedConversionPattern=%d{ISO8601} [%t] %-5p %c %x- %m\r%n
9
+ summaryConversionPattern=%d{ISO8601} %m%n
10
+
11
+ # set root logger level to DEBUG and add a consoleappender to it
12
+ log4j.rootLogger=ALL, ConsoleOut, ConsoleErr, SummaryFileLog, DetailedFileLog
13
+
14
+ # standard out console output
15
+ log4j.appender.ConsoleOut=org.apache.log4j.ConsoleAppender
16
+ log4j.appender.ConsoleOut.Threshold=INFO
17
+ log4j.appender.ConsoleOut.layout=net.avail.saas.dataexporter.log4j.PatternLayout
18
+ log4j.appender.ConsoleOut.layout.ConversionPattern=${summaryConversionPattern}
19
+ # OBS! custom PatternLayout
20
+ log4j.appender.ConsoleOut.layout.OutputStacktrace=false
21
+
22
+ # standard err console output - should be suppressed in most cases since
23
+ # standard err is a subset of standard out
24
+ log4j.appender.ConsoleErr=org.apache.log4j.ConsoleAppender
25
+ log4j.appender.ConsoleErr.Threshold=ERROR
26
+ log4j.appender.ConsoleErr.layout=net.avail.saas.dataexporter.log4j.PatternLayout
27
+ log4j.appender.ConsoleErr.layout.ConversionPattern=${summaryConversionPattern}
28
+ log4j.appender.ConsoleErr.Target=System.err
29
+ # OBS! custom PatternLayout
30
+ log4j.appender.ConsoleErr.layout.OutputStacktrace=false
31
+
32
+ log4j.additivity.net.avail=true
33
+
34
+ log4j.appender.DetailedFileLog=org.apache.log4j.RollingFileAppender
35
+ log4j.appender.DetailedFileLog.Threshold=ALL
36
+ log4j.appender.DetailedFileLog.File=log/AvailDataExporterDetailed.log
37
+ log4j.appender.DetailedFileLog.MaxBackupIndex=2
38
+ log4j.appender.DetailedFileLog.MaxFileSize=10Mb
39
+ log4j.appender.DetailedFileLog.layout=org.apache.log4j.PatternLayout
40
+ log4j.appender.DetailedFileLog.layout.ConversionPattern=${detailedConversionPattern}
41
+
42
+ log4j.appender.SummaryFileLog=org.apache.log4j.RollingFileAppender
43
+ log4j.appender.SummaryFileLog.Threshold=INFO
44
+ log4j.appender.SummaryFileLog.File=log/AvailDataExporterSummary.log
45
+ log4j.appender.SummaryFileLog.MaxBackupIndex=2
46
+ log4j.appender.SummaryFileLog.MaxFileSize=10Mb
47
+ log4j.appender.SummaryFileLog.layout=net.avail.saas.dataexporter.log4j.PatternLayout
48
+ log4j.appender.SummaryFileLog.layout.ConversionPattern=${summaryConversionPattern}
49
+ # OBS! custom PatternLayout
50
+ log4j.appender.SummaryFileLog.layout.OutputStacktrace=false
51
+
52
+ # turn off httpclient log
53
+ log4j.additivity.httpclient.wire.content=false
54
+ log4j.logger.httpclient=OFF
55
+ log4j.logger.org.apache=ERROR
availdataexporter/pointofsale.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #testing the existance of upload.conf.init
3
+ #Magento module : Pointofsale
4
+
5
+ FILE_INIT=upload.conf.init
6
+ FILE_AFTER=upload.conf.after
7
+ FILE=upload.conf
8
+ if [[ -f $FILE_INIT ]]
9
+ then
10
+ if [[ -f $FILE_AFTER ]]
11
+ then
12
+ mv $FILE_AFTER $FILE
13
+ fi
14
+ #Anyway execute the availdataexporter script
15
+ ./availdataexporter.sh
16
+ else
17
+ if [[ -f $FILE ]]
18
+ then if [[ -f $FILE_AFTER ]]
19
+ then
20
+ #execute the script with transaction data before renaming the files
21
+ ./availdataexporter.sh
22
+ mv $FILE $FILE_INIT
23
+ mv $FILE_AFTER $FILE
24
+ fi
25
+ fi
26
+
27
+ fi
28
+
availdataexporter/readme.txt ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Avail Data Exporter is used to transfer data from either a supported database or from properly formatted text files to Avail.
2
+
3
+ To see which version you are currently using, see the first line of standard out output.
4
+
5
+ To use the data exporter you have to set the customer id, password and the data source(s) in a configuration file. The customer id and password are given to you by Avail. The default configuration file is upload.conf but you can also explicitly specify the configuration file as the first argument to the data exporter start files (or by editing the start files and passing the filename to the java program). An example configuration file is exampleupload.conf. To use that file you start the exporter with:
6
+
7
+ availdataexporter.bat exampleupload.conf
8
+
9
+ To define an upload from a database you must specify the sql connection string, the sql driver to use and the sql query used to retrieve the data. Additionally you must specify which data type (*) you are uploading. Each separate upload must be enclosed within curly brackets ('{' and '}'). The values of all settings must be within double quotes (").
10
+
11
+ To define an upload from a text file you must specify the file name and the file format string. The format string consists of six parts separated with an underscore '_'. See exampleupload.conf for examples.
12
+
13
+ Format string syntax:
14
+ <column delimiter>_<row delimiter>_<start text qualifier>_<end text qualifier>_<encoding>_<escaped/unescaped>.
15
+
16
+ Note that the string inside the outer double quotes is interpreted as
17
+ a C/Java string and therefore certain characters must be escaped. A non
18
+ complete list is:
19
+ tab -> \t
20
+ " -> \"
21
+ \ -> \\
22
+ unix line break -> \n
23
+ windows line break -> \r\n
24
+
25
+ Multiple uploads can be defined in the same file. See exampleupload.conf for examples.
26
+
27
+ If, while processing a configuration file, anything goes wrong all data uploaded so far will be disregarded and the entire upload will have to be performed again.
28
+
29
+ When used, the data exporter will generate log files in the sub directory log/. By default up to six log files in total can exists, each having a maximum size of 10Mb.
30
+
31
+ To setup the data exporter as a scheduled task in Windows 2003 Server:
32
+
33
+ 1. Click Start->Control Panel->Scheduled Tasks->Add Scheduled Task
34
+ 2. Click Next in the wizard and click Browse
35
+ 3. Browse to the availdataexporter.bat file and select it
36
+ 4. Specify when you want to run it
37
+
38
+ On an average desktop with a 10Mbit/s upstream connection typical upload times for categorydata are:
39
+ 1M rows - 12 seconds
40
+ 5M rows - 75 seconds
41
+ 10M rows - 140 seconds
42
+
43
+ (*)
44
+ The valid data types are (see Avail SaaS documentation for more info):
45
+ transactiondata - The data used for product and user recommendations.
46
+ productdata - The data used to filter and display product data.
47
+ categorydata - The data used for category filters.
48
+ categorynamesdata - Alternative category names.
49
+ validdata - The data used for valid products filters.
js/avail/cookie.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Cookie = {
2
+ data: {},
3
+ options: {expires: 1, domain: "", path: "", secure: false},
4
+
5
+ init: function(options, data) {
6
+ Cookie.options = Object.extend(Cookie.options, options || {});
7
+
8
+ var payload = Cookie.retrieve();
9
+ if(payload) {
10
+ Cookie.data = payload.evalJSON();
11
+ }
12
+ else {
13
+ Cookie.data = data || {};
14
+ }
15
+ Cookie.store();
16
+ },
17
+ getData: function(key) {
18
+ return Cookie.data[key];
19
+ },
20
+ setData: function(key, value) {
21
+ Cookie.data[key] = value;
22
+ Cookie.store();
23
+ },
24
+ removeData: function(key) {
25
+ delete Cookie.data[key];
26
+ Cookie.store();
27
+ },
28
+ retrieve: function() {
29
+ var start = document.cookie.indexOf(Cookie.options.name + "=");
30
+
31
+ if(start == -1) {
32
+ return null;
33
+ }
34
+ if(Cookie.options.name != document.cookie.substr(start, Cookie.options.name.length)) {
35
+ return null;
36
+ }
37
+
38
+ var len = start + Cookie.options.name.length + 1;
39
+ var end = document.cookie.indexOf(';', len);
40
+
41
+ if(end == -1) {
42
+ end = document.cookie.length;
43
+ }
44
+ return unescape(document.cookie.substring(len, end));
45
+ },
46
+ store: function() {
47
+ var expires = '';
48
+
49
+ if (Cookie.options.expires) {
50
+ var today = new Date();
51
+ expires = Cookie.options.expires * 86400000;
52
+ expires = ';expires=' + new Date(today.getTime() + expires);
53
+ }
54
+
55
+ document.cookie = Cookie.options.name + '=' + escape(Object.toJSON(Cookie.data)) + Cookie.getOptions() + expires;
56
+ },
57
+ erase: function() {
58
+ document.cookie = Cookie.options.name + '=' + Cookie.getOptions() + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
59
+ },
60
+ getOptions: function() {
61
+ return (Cookie.options.path ? ';path=' + Cookie.options.path : '') + (Cookie.options.domain ? ';domain=' + Cookie.options.domain : '') + (Cookie.options.secure ? ';secure' : '');
62
+ }
63
+ };
64
+
package.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>AvailPointofSale</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Avail Point-of-Sale will help you generate and display recommended products on different pages of your website.</summary>
10
+ <description>This extension is compatible with the following Magento versions:&#xD;
11
+ &#x2022; Magento Community Edition 1.6 and 1.7&#xD;
12
+ &#x2022; Magento Enterprise Edition 1.9, 1.10, 1.11 and 1.12&#xD;
13
+ </description>
14
+ <notes>This extension is compatible with the following Magento versions:&#xD;
15
+ &#x2022; Magento Community Edition 1.6 and 1.7&#xD;
16
+ &#x2022; Magento Enterprise Edition 1.9, 1.10, 1.11 and 1.12</notes>
17
+ <authors><author><name>Smile</name><user>SmileOSS</user><email>solution.magento@smile.fr</email></author></authors>
18
+ <date>2013-02-11</date>
19
+ <time>10:33:47</time>
20
+ <contents><target name="magecommunity"><dir name="Avail"><dir name="Pointofsale"><dir name="Block"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Button.php" hash="d4dac482f8d688ba49eef3df0cab7a80"/><file name="GenerateButton.php" hash="935e5f5cb347890ce147328a9193027c"/></dir></dir></dir><dir name="Data"><dir name="Banner"><file name="Cart.php" hash="04a32ebc21d78018ab71e4ea7e411e6c"/><file name="Category.php" hash="7c14ac1ea103d4a889380bf170633c2b"/><file name="Precart.php" hash="e6e697dfa7b9744deaa92f1fd05ef79b"/><file name="Product.php" hash="5efeac4df57a40053f46c26a8ea6bc67"/><file name="Search.php" hash="97cc0a574f2af78972182521c2fa65de"/></dir><file name="Banner.php" hash="f14c1370d0abff081db851e04fe750df"/></dir><file name="Data.php" hash="45a3a0b596544e3975bfe8655699ae8a"/><file name="Head.php" hash="fbbf6fa7a5b321456d3332e01173ce40"/><dir name="Select"><file name="Attributes.php" hash="d154be5a2caab5df010aa1a6eb16fe22"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5ea865936705af3ef1c4b954135c4bc6"/></dir><dir name="Model"><dir name="Config"><dir name="Backend"><dir name="Serialized"><file name="Array.php" hash="a8224fb965f7ec1e4a82292fe98c6af4"/></dir></dir></dir><file name="Installer.php" hash="d3277e9f79cc8191dbf7d7622ab1da76"/><file name="Jsonrpc.php" hash="938c35541b1c94d83a958595d91dfd83"/><file name="Observer.php" hash="d00e11d3c34edc6ad29a8f323cf171a5"/></dir><dir name="controllers"><file name="GenerateController.php" hash="aa42b9c659f3b66b3352bd3abf95852b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3514aa3c086e54d0ddf297f23fcfea73"/><file name="config.xml" hash="cd4023a40908640282339a89fac12a7e"/><file name="system.xml" hash="437749d3e6214ef53d0b0fcb1066ab4b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Avail_Pointofsale.xml" hash="13e371266225cc941048708a4161b447"/></dir></target><target name="mage"><dir name="availdataexporter"><file name="availdataexporter.bat" hash="15a9bf7b0de5f1ba2f6ffa95f6eec822"/><file name="availdataexporter.sh" hash="bba50d7881b26d8fc6452da9be778644"/><dir name="bin"><file name="availdataexporter.jar" hash="d5c945b01bb5356e991d77046907a9c1"/></dir><file name="exampleupload.conf" hash="091063e893b280cd58ace87ef63cbd1f"/><dir name="lib"><file name="commons-codec-1.3.jar" hash="6061dbc7e724e3066851a523b11a8101"/><file name="commons-httpclient-3.1.jar" hash="0d6dc1d0940e7c535a200cd6899e4a30"/><file name="commons-logging-1.1.1.jar" hash="47e83632f7bff28663b44a73fb634fda"/><file name="jtds-1.2.2.jar" hash="a8f0d9493455a962d0a6413977e8d80a"/><file name="log4j-1.2.15.jar" hash="add681ca6101e8d48ecfc5097514a576"/><file name="ms_sql_1.1.1501.jar" hash="3bc12b220fd0ed6e074eb26b938185e5"/><file name="mysql_5.1.6.jar" hash="40be305ee91fb6a7a385eeb260c7c08a"/><file name="oracle_10.2.0.4.jar" hash="9e8d485e0a0d029a7d6a717291c239c6"/><file name="sunjce_provider.jar" hash="dbea59e0bc9dd230c943f2417203c4b2"/></dir><dir name="log"><file name="log4j.properties" hash="2b80f1b69f03b4b4f8e5701e4da561cd"/></dir><file name="pointofsale.sh" hash="9c3f3f94728ac88fee98fcab40f92de6"/><file name="readme.txt" hash="47667ea172073ac6e45e3eb78827811b"/></dir><dir name="js"><dir name="avail"><file name="cookie.js" hash="74f3f3fdc90fc154c750386b90bf97c1"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="pointofsale"><dir><dir name="select"><dir name="attributes"><file name="array.phtml" hash="00afe76c365eca665e9b8ad016de66a2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pointofsale.xml" hash="b55f936504f8d53d2d7974f0991dc2bc"/></dir><dir name="template"><dir name="pointofsale"><file name="data.phtml" hash="516d4dd14212e2a7822d7fd1bf58aa48"/></dir></dir></dir></dir></dir></target></contents>
21
+ <compatible/>
22
+ <dependencies><required><php><min>5.2.13</min><max>5.3.15</max></php></required></dependencies>
23
+ </package>