Version Notes
mage-bnr-currency-import
Download this release
Release Info
Developer | George Babarus |
Extension | bb_bnr |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- app/code/community/Bb/Bnr/Model/Currency/Import/Bnr.php +104 -104
- app/code/community/Bb/Bnr/etc/adminhtml.xml +58 -49
- app/code/community/Bb/Bnr/etc/config.xml +25 -25
- app/code/community/Bb/Core/Helper/Data.php +19 -19
- app/code/community/Bb/Core/controllers/Adminhtml/BbModulesController.php +56 -41
- app/code/community/Bb/Core/etc/adminhtml.xml +39 -39
- app/code/community/Bb/Core/etc/config.xml +64 -64
- app/design/adminhtml/default/default/layout/bb_core.xml +29 -0
- app/design/adminhtml/default/default/template/bb_products/help.phtml +9 -0
- app/etc/modules/Bb_Bnr.xml +9 -9
- app/etc/modules/Bb_Core.xml +15 -15
- lib/Bnr/Api.php +91 -0
- package.xml +11 -6
app/code/community/Bb/Bnr/Model/Currency/Import/Bnr.php
CHANGED
@@ -1,104 +1,104 @@
|
|
1 |
-
<?php
|
2 |
-
//include_once 'Bnr/Api.php';
|
3 |
-
|
4 |
-
/**
|
5 |
-
* George Babarus extension for Magento
|
6 |
-
*
|
7 |
-
* Long description of this file (if any...)
|
8 |
-
*
|
9 |
-
* NOTICE OF LICENSE
|
10 |
-
*
|
11 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
12 |
-
* that is bundled with this package in the file LICENSE.txt.
|
13 |
-
* It is also available through the world-wide-web at this URL:
|
14 |
-
* http://opensource.org/licenses/osl-3.0.php
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade
|
19 |
-
* the Bb TopMenu module to newer versions in the future.
|
20 |
-
* If you wish to customize the Bb TopMenu module for your needs
|
21 |
-
* please refer to http://www.magentocommerce.com for more information.
|
22 |
-
*
|
23 |
-
* @category Bb
|
24 |
-
* @package Bb_TopMenu
|
25 |
-
* @copyright Copyright (C) 2014 http://www.babarus.ro
|
26 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
27 |
-
*/
|
28 |
-
/**
|
29 |
-
*
|
30 |
-
* Currency rate import model (From www.bnr.net)
|
31 |
-
*
|
32 |
-
* @category Bb
|
33 |
-
* @package Bb_Bnr
|
34 |
-
* @subpackage Block
|
35 |
-
* @author George Babarus <george.babarus@gmail.com>
|
36 |
-
*/
|
37 |
-
class Bb_Bnr_Model_Currency_Import_Bnr extends Mage_Directory_Model_Currency_Import_Abstract
|
38 |
-
{
|
39 |
-
protected $_url = 'http://www.bnr.ro/nbrfxrates.xml';
|
40 |
-
protected $_messages = array();
|
41 |
-
|
42 |
-
/**
|
43 |
-
* HTTP client
|
44 |
-
*
|
45 |
-
* @var Varien_Http_Client
|
46 |
-
*/
|
47 |
-
protected $_httpClient;
|
48 |
-
|
49 |
-
public function __construct()
|
50 |
-
{
|
51 |
-
$this->_httpClient = new Bnr_Api();
|
52 |
-
$this->_httpClient->load($this->_url);
|
53 |
-
}
|
54 |
-
|
55 |
-
protected function _convert($currencyFrom, $currencyTo, $retry=0)
|
56 |
-
{
|
57 |
-
if (strtoupper($currencyFrom) != 'RON' && strtoupper($currencyTo) != 'RON' ){
|
58 |
-
return null;
|
59 |
-
}
|
60 |
-
|
61 |
-
try {
|
62 |
-
if (strtoupper($currencyFrom) === 'RON') {
|
63 |
-
$value = 1 / floatval($this->_httpClient->getRate($currencyTo));
|
64 |
-
}elseif(strtoupper($currencyTo) === 'RON') {
|
65 |
-
$value = floatval($this->_httpClient->getRate($currencyFrom));
|
66 |
-
} else {
|
67 |
-
$this->_messages[] = Mage::helper('directory')->__('Bnr method is applied only for %s <> %s',$currencyFrom, $currencyTo);
|
68 |
-
}
|
69 |
-
|
70 |
-
if( empty($value)) {
|
71 |
-
$this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s. ( %s <> %s)', $this->_url, $currencyFrom, $currencyTo);
|
72 |
-
return null;
|
73 |
-
|
74 |
-
}
|
75 |
-
return (float) $value;
|
76 |
-
}
|
77 |
-
catch (Exception $e) {
|
78 |
-
if( $retry === 0 ) {
|
79 |
-
$this->_convert($currencyFrom, $currencyTo, 1);
|
80 |
-
} else {
|
81 |
-
$this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s. ( %s <> %s)', $this->_url, $currencyFrom, $currencyTo);
|
82 |
-
}
|
83 |
-
}
|
84 |
-
return floatval(0);
|
85 |
-
}
|
86 |
-
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Saving currency rates
|
90 |
-
*
|
91 |
-
* @param array $rates
|
92 |
-
* @return Mage_Directory_Model_Currency_Import_Abstract
|
93 |
-
*/
|
94 |
-
protected function _saveRates($rates)
|
95 |
-
{
|
96 |
-
Mage::getModel('directory/currency')
|
97 |
-
->saveRates($rates);
|
98 |
-
|
99 |
-
return $this;
|
100 |
-
}
|
101 |
-
|
102 |
-
|
103 |
-
}
|
104 |
-
|
1 |
+
<?php
|
2 |
+
//include_once 'Bnr/Api.php';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* George Babarus extension for Magento
|
6 |
+
*
|
7 |
+
* Long description of this file (if any...)
|
8 |
+
*
|
9 |
+
* NOTICE OF LICENSE
|
10 |
+
*
|
11 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
12 |
+
* that is bundled with this package in the file LICENSE.txt.
|
13 |
+
* It is also available through the world-wide-web at this URL:
|
14 |
+
* http://opensource.org/licenses/osl-3.0.php
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade
|
19 |
+
* the Bb TopMenu module to newer versions in the future.
|
20 |
+
* If you wish to customize the Bb TopMenu module for your needs
|
21 |
+
* please refer to http://www.magentocommerce.com for more information.
|
22 |
+
*
|
23 |
+
* @category Bb
|
24 |
+
* @package Bb_TopMenu
|
25 |
+
* @copyright Copyright (C) 2014 http://www.babarus.ro
|
26 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
27 |
+
*/
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* Currency rate import model (From www.bnr.net)
|
31 |
+
*
|
32 |
+
* @category Bb
|
33 |
+
* @package Bb_Bnr
|
34 |
+
* @subpackage Block
|
35 |
+
* @author George Babarus <george.babarus@gmail.com>
|
36 |
+
*/
|
37 |
+
class Bb_Bnr_Model_Currency_Import_Bnr extends Mage_Directory_Model_Currency_Import_Abstract
|
38 |
+
{
|
39 |
+
protected $_url = 'http://www.bnr.ro/nbrfxrates.xml';
|
40 |
+
protected $_messages = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* HTTP client
|
44 |
+
*
|
45 |
+
* @var Varien_Http_Client
|
46 |
+
*/
|
47 |
+
protected $_httpClient;
|
48 |
+
|
49 |
+
public function __construct()
|
50 |
+
{
|
51 |
+
$this->_httpClient = new Bnr_Api();
|
52 |
+
$this->_httpClient->load($this->_url);
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function _convert($currencyFrom, $currencyTo, $retry=0)
|
56 |
+
{
|
57 |
+
if (strtoupper($currencyFrom) != 'RON' && strtoupper($currencyTo) != 'RON' ){
|
58 |
+
return null;
|
59 |
+
}
|
60 |
+
|
61 |
+
try {
|
62 |
+
if (strtoupper($currencyFrom) === 'RON') {
|
63 |
+
$value = 1 / floatval($this->_httpClient->getRate($currencyTo));
|
64 |
+
}elseif(strtoupper($currencyTo) === 'RON') {
|
65 |
+
$value = floatval($this->_httpClient->getRate($currencyFrom));
|
66 |
+
} else {
|
67 |
+
$this->_messages[] = Mage::helper('directory')->__('Bnr method is applied only for %s <> %s',$currencyFrom, $currencyTo);
|
68 |
+
}
|
69 |
+
|
70 |
+
if( empty($value)) {
|
71 |
+
$this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s. ( %s <> %s)', $this->_url, $currencyFrom, $currencyTo);
|
72 |
+
return null;
|
73 |
+
|
74 |
+
}
|
75 |
+
return (float) $value;
|
76 |
+
}
|
77 |
+
catch (Exception $e) {
|
78 |
+
if( $retry === 0 ) {
|
79 |
+
$this->_convert($currencyFrom, $currencyTo, 1);
|
80 |
+
} else {
|
81 |
+
$this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s. ( %s <> %s)', $this->_url, $currencyFrom, $currencyTo);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
return floatval(0);
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Saving currency rates
|
90 |
+
*
|
91 |
+
* @param array $rates
|
92 |
+
* @return Mage_Directory_Model_Currency_Import_Abstract
|
93 |
+
*/
|
94 |
+
protected function _saveRates($rates)
|
95 |
+
{
|
96 |
+
Mage::getModel('directory/currency')
|
97 |
+
->saveRates($rates);
|
98 |
+
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
}
|
104 |
+
|
app/code/community/Bb/Bnr/etc/adminhtml.xml
CHANGED
@@ -1,50 +1,59 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<menu>
|
4 |
-
<bb_products>
|
5 |
-
<children>
|
6 |
-
<bb_bnr>
|
7 |
-
<title>BNR</title>
|
8 |
-
<sort_order>0</sort_order>
|
9 |
-
<action>adminhtml/system_config/edit/section/currency</action>
|
10 |
-
<children>
|
11 |
-
<bb_bnr>
|
12 |
-
<title>Configure BNR currency import</title>
|
13 |
-
<sort_order>0</sort_order>
|
14 |
-
<action>adminhtml/system_config/edit/section/currency</action>
|
15 |
-
</bb_bnr>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<bb_products>
|
5 |
+
<children>
|
6 |
+
<bb_bnr>
|
7 |
+
<title>BNR</title>
|
8 |
+
<sort_order>0</sort_order>
|
9 |
+
<action>adminhtml/system_config/edit/section/currency</action>
|
10 |
+
<children>
|
11 |
+
<bb_bnr>
|
12 |
+
<title>Configure BNR currency import</title>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
<action>adminhtml/system_config/edit/section/currency</action>
|
15 |
+
</bb_bnr>
|
16 |
+
<bb_help>
|
17 |
+
<title>Help</title>
|
18 |
+
<sort_order>110</sort_order>
|
19 |
+
<action>adminhtml/bbModules/help/module/bb_bnr</action>
|
20 |
+
</bb_help>
|
21 |
+
</children>
|
22 |
+
</bb_bnr>
|
23 |
+
</children>
|
24 |
+
</bb_products>
|
25 |
+
|
26 |
+
</menu>
|
27 |
+
|
28 |
+
<acl>
|
29 |
+
<resources>
|
30 |
+
<all>
|
31 |
+
<title>Allow Everything</title>
|
32 |
+
</all>
|
33 |
+
<admin>
|
34 |
+
<children>
|
35 |
+
<bb_products>
|
36 |
+
<title>BB Products - Menu</title>
|
37 |
+
<sort_order>1</sort_order>
|
38 |
+
<children>
|
39 |
+
<bb_bnr>
|
40 |
+
<title>BNR</title>
|
41 |
+
<sort_order>0</sort_order>
|
42 |
+
<children>
|
43 |
+
<bb_bnr>
|
44 |
+
<title>Configure BNR currency import</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
</bb_bnr>
|
47 |
+
<bb_help>
|
48 |
+
<title>Help</title>
|
49 |
+
<sort_order>110</sort_order>
|
50 |
+
</bb_help>
|
51 |
+
</children>
|
52 |
+
</bb_bnr>
|
53 |
+
</children>
|
54 |
+
</bb_products>
|
55 |
+
</children>
|
56 |
+
</admin>
|
57 |
+
</resources>
|
58 |
+
</acl>
|
59 |
</config>
|
app/code/community/Bb/Bnr/etc/config.xml
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Bb_Bnr>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Bb_Bnr>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<currency>
|
10 |
-
<import>
|
11 |
-
<services>
|
12 |
-
<bnr>
|
13 |
-
<name>BNR RON</name>
|
14 |
-
<model>bb_bnr/currency_import_bnr</model>
|
15 |
-
</bnr>
|
16 |
-
</services>
|
17 |
-
</import>
|
18 |
-
</currency>
|
19 |
-
|
20 |
-
<models>
|
21 |
-
<bb_bnr>
|
22 |
-
<class>Bb_Bnr_Model</class>
|
23 |
-
</bb_bnr>
|
24 |
-
</models>
|
25 |
-
</global>
|
26 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Bb_Bnr>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Bb_Bnr>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<currency>
|
10 |
+
<import>
|
11 |
+
<services>
|
12 |
+
<bnr>
|
13 |
+
<name>BNR RON</name>
|
14 |
+
<model>bb_bnr/currency_import_bnr</model>
|
15 |
+
</bnr>
|
16 |
+
</services>
|
17 |
+
</import>
|
18 |
+
</currency>
|
19 |
+
|
20 |
+
<models>
|
21 |
+
<bb_bnr>
|
22 |
+
<class>Bb_Bnr_Model</class>
|
23 |
+
</bb_bnr>
|
24 |
+
</models>
|
25 |
+
</global>
|
26 |
</config>
|
app/code/community/Bb/Core/Helper/Data.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Bb extension for Magento - fully suport - easy to use
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @category Bb
|
8 |
-
* @package Bb_Slider
|
9 |
-
* @copyright Copyright (C) 2014 Bb (http://www.babarus.ro/)
|
10 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
-
*
|
12 |
-
* @author George Babarus <george.babarus@gmail.com>
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
class Bb_Core_Helper_Data extends Mage_Adminhtml_Helper_Data
|
16 |
-
{
|
17 |
-
|
18 |
-
|
19 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Bb extension for Magento - fully suport - easy to use
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @category Bb
|
8 |
+
* @package Bb_Slider
|
9 |
+
* @copyright Copyright (C) 2014 Bb (http://www.babarus.ro/)
|
10 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
+
*
|
12 |
+
* @author George Babarus <george.babarus@gmail.com>
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class Bb_Core_Helper_Data extends Mage_Adminhtml_Helper_Data
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
}
|
app/code/community/Bb/Core/controllers/Adminhtml/BbModulesController.php
CHANGED
@@ -1,42 +1,57 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Bb extension for Magento - fully suport - easy to use
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @category Bb
|
8 |
-
* @package Bb_Slider
|
9 |
-
* @copyright Copyright (C) 2014 Bb (http://www.babarus.ro/)
|
10 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
-
*
|
12 |
-
* @author George Babarus <george.babarus@gmail.com>
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
class Bb_Core_Adminhtml_BbModulesController extends Mage_Adminhtml_Controller_Action
|
16 |
-
{
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
$this->
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Bb extension for Magento - fully suport - easy to use
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @category Bb
|
8 |
+
* @package Bb_Slider
|
9 |
+
* @copyright Copyright (C) 2014 Bb (http://www.babarus.ro/)
|
10 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
+
*
|
12 |
+
* @author George Babarus <george.babarus@gmail.com>
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class Bb_Core_Adminhtml_BbModulesController extends Mage_Adminhtml_Controller_Action
|
16 |
+
{
|
17 |
+
|
18 |
+
/**
|
19 |
+
* put some init stuff here
|
20 |
+
*/
|
21 |
+
public function init()
|
22 |
+
{
|
23 |
+
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* help user to use bb products
|
30 |
+
*/
|
31 |
+
public function productsAction()
|
32 |
+
{
|
33 |
+
$this->loadLayout();
|
34 |
+
$this->_setActiveMenu('bb_products');
|
35 |
+
$this->renderLayout();
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* help user to use bb products
|
41 |
+
*/
|
42 |
+
public function helpAction()
|
43 |
+
{
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->_setActiveMenu('bb_products');
|
46 |
+
|
47 |
+
$url = sprintf('http://docs.babarus.ro/help-documents/products/%s/help.html',$this->getRequest()->getParam('module'));
|
48 |
+
$this->getLayout()->getBlock('bb_help')->setData('url', $url);
|
49 |
+
$this->renderLayout();
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _isAllowed()
|
53 |
+
{
|
54 |
+
return Mage::getSingleton('admin/session')->isAllowed('bb_slider');
|
55 |
+
}
|
56 |
+
|
57 |
}
|
app/code/community/Bb/Core/etc/adminhtml.xml
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<menu>
|
4 |
-
<bb_products>
|
5 |
-
<title>BB Products</title>
|
6 |
-
<sort_order>99999</sort_order>
|
7 |
-
<action>adminhtml/bbModules/products</action>
|
8 |
-
<children>
|
9 |
-
<news>
|
10 |
-
<title>News</title>
|
11 |
-
<sort_order>0</sort_order>
|
12 |
-
<action>adminhtml/bbModules/products</action>
|
13 |
-
</news>
|
14 |
-
</children>
|
15 |
-
</bb_products>
|
16 |
-
|
17 |
-
</menu>
|
18 |
-
|
19 |
-
<acl>
|
20 |
-
<resources>
|
21 |
-
<all>
|
22 |
-
<title>Allow Everything</title>
|
23 |
-
</all>
|
24 |
-
<admin>
|
25 |
-
<children>
|
26 |
-
<bb_products>
|
27 |
-
<title>BB Products - Menu</title>
|
28 |
-
<sort_order>1</sort_order>
|
29 |
-
<children>
|
30 |
-
<news>
|
31 |
-
<title>News</title>
|
32 |
-
<sort_order>0</sort_order>
|
33 |
-
</news>
|
34 |
-
</children>
|
35 |
-
</bb_products>
|
36 |
-
</children>
|
37 |
-
</admin>
|
38 |
-
</resources>
|
39 |
-
</acl>
|
40 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<bb_products>
|
5 |
+
<title>BB Products</title>
|
6 |
+
<sort_order>99999</sort_order>
|
7 |
+
<action>adminhtml/bbModules/products</action>
|
8 |
+
<children>
|
9 |
+
<news>
|
10 |
+
<title>News</title>
|
11 |
+
<sort_order>0</sort_order>
|
12 |
+
<action>adminhtml/bbModules/products</action>
|
13 |
+
</news>
|
14 |
+
</children>
|
15 |
+
</bb_products>
|
16 |
+
|
17 |
+
</menu>
|
18 |
+
|
19 |
+
<acl>
|
20 |
+
<resources>
|
21 |
+
<all>
|
22 |
+
<title>Allow Everything</title>
|
23 |
+
</all>
|
24 |
+
<admin>
|
25 |
+
<children>
|
26 |
+
<bb_products>
|
27 |
+
<title>BB Products - Menu</title>
|
28 |
+
<sort_order>1</sort_order>
|
29 |
+
<children>
|
30 |
+
<news>
|
31 |
+
<title>News</title>
|
32 |
+
<sort_order>0</sort_order>
|
33 |
+
</news>
|
34 |
+
</children>
|
35 |
+
</bb_products>
|
36 |
+
</children>
|
37 |
+
</admin>
|
38 |
+
</resources>
|
39 |
+
</acl>
|
40 |
</config>
|
app/code/community/Bb/Core/etc/config.xml
CHANGED
@@ -1,65 +1,65 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Bb_Core>
|
5 |
-
<version>1.0.0</version>
|
6 |
-
</Bb_Core>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<helpers>
|
10 |
-
<bb_core>
|
11 |
-
<class>Bb_Core_Helper</class>
|
12 |
-
</bb_core>
|
13 |
-
</helpers>
|
14 |
-
</global>
|
15 |
-
<frontend>
|
16 |
-
<routers>
|
17 |
-
<bb_core>
|
18 |
-
<args>
|
19 |
-
<modules>
|
20 |
-
<Bb_Core>Bb_Core</Bb_Core>
|
21 |
-
</modules>
|
22 |
-
</args>
|
23 |
-
</bb_core>
|
24 |
-
</routers>
|
25 |
-
|
26 |
-
<translate>
|
27 |
-
<modules>
|
28 |
-
<bb_core>
|
29 |
-
<files>
|
30 |
-
<default>Bb_Core.csv</default>
|
31 |
-
</files>
|
32 |
-
</bb_core>
|
33 |
-
</modules>
|
34 |
-
</translate>
|
35 |
-
<layout>
|
36 |
-
<updates>
|
37 |
-
<bb_core>
|
38 |
-
<file>bb_core.xml</file>
|
39 |
-
</bb_core>
|
40 |
-
</updates>
|
41 |
-
</layout>
|
42 |
-
</frontend>
|
43 |
-
<adminhtml>
|
44 |
-
<layout>
|
45 |
-
<updates>
|
46 |
-
<bb_core>
|
47 |
-
<file>bb_core.xml</file>
|
48 |
-
</bb_core>
|
49 |
-
</updates>
|
50 |
-
</layout>
|
51 |
-
|
52 |
-
</adminhtml>
|
53 |
-
<admin>
|
54 |
-
<routers>
|
55 |
-
<adminhtml>
|
56 |
-
<args>
|
57 |
-
<modules>
|
58 |
-
<Bb_Core before="Mage_Adminhtml">Bb_Core_Adminhtml</Bb_Core>
|
59 |
-
</modules>
|
60 |
-
</args>
|
61 |
-
</adminhtml>
|
62 |
-
</routers>
|
63 |
-
</admin>
|
64 |
-
|
65 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Bb_Core>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Bb_Core>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<bb_core>
|
11 |
+
<class>Bb_Core_Helper</class>
|
12 |
+
</bb_core>
|
13 |
+
</helpers>
|
14 |
+
</global>
|
15 |
+
<frontend>
|
16 |
+
<routers>
|
17 |
+
<bb_core>
|
18 |
+
<args>
|
19 |
+
<modules>
|
20 |
+
<Bb_Core>Bb_Core</Bb_Core>
|
21 |
+
</modules>
|
22 |
+
</args>
|
23 |
+
</bb_core>
|
24 |
+
</routers>
|
25 |
+
|
26 |
+
<translate>
|
27 |
+
<modules>
|
28 |
+
<bb_core>
|
29 |
+
<files>
|
30 |
+
<default>Bb_Core.csv</default>
|
31 |
+
</files>
|
32 |
+
</bb_core>
|
33 |
+
</modules>
|
34 |
+
</translate>
|
35 |
+
<layout>
|
36 |
+
<updates>
|
37 |
+
<bb_core>
|
38 |
+
<file>bb_core.xml</file>
|
39 |
+
</bb_core>
|
40 |
+
</updates>
|
41 |
+
</layout>
|
42 |
+
</frontend>
|
43 |
+
<adminhtml>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<bb_core>
|
47 |
+
<file>bb_core.xml</file>
|
48 |
+
</bb_core>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
+
|
52 |
+
</adminhtml>
|
53 |
+
<admin>
|
54 |
+
<routers>
|
55 |
+
<adminhtml>
|
56 |
+
<args>
|
57 |
+
<modules>
|
58 |
+
<Bb_Core before="Mage_Adminhtml">Bb_Core_Adminhtml</Bb_Core>
|
59 |
+
</modules>
|
60 |
+
</args>
|
61 |
+
</adminhtml>
|
62 |
+
</routers>
|
63 |
+
</admin>
|
64 |
+
|
65 |
</config>
|
app/design/adminhtml/default/default/layout/bb_core.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
+
<layout>
|
3 |
+
|
4 |
+
<adminhtml_bbmodules_products>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="setCanLoadExtJs">
|
7 |
+
<true>true</true>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="core/template" template="bb_products/help.phtml" name="sliders_admin" alias="sliders_admin" />
|
12 |
+
|
13 |
+
</reference>
|
14 |
+
</adminhtml_bbmodules_products>
|
15 |
+
|
16 |
+
|
17 |
+
<adminhtml_bbmodules_help>
|
18 |
+
<reference name="head">
|
19 |
+
<action method="setCanLoadExtJs">
|
20 |
+
<true>true</true>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
+
<reference name="content">
|
24 |
+
<block type="core/template" template="bb_products/help.phtml" name="bb_help" alias="bb_help" />
|
25 |
+
|
26 |
+
</reference>
|
27 |
+
</adminhtml_bbmodules_help>
|
28 |
+
|
29 |
+
</layout>
|
app/design/adminhtml/default/default/template/bb_products/help.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $url = $this->getData('url'); ?>
|
2 |
+
<?php if (!empty($url)): ?>
|
3 |
+
<iframe width="100%" height="600" src="<?php echo $url; ?>" frameborder="0"
|
4 |
+
allowfullscreen></iframe>
|
5 |
+
|
6 |
+
<?php else : ?>
|
7 |
+
<iframe width="100%" height="600" src="http://docs.babarus.ro/help-documents/products/help.html" frameborder="0"
|
8 |
+
allowfullscreen></iframe>
|
9 |
+
<?php endif; ?>
|
app/etc/modules/Bb_Bnr.xml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Bb_Bnr>
|
5 |
-
<version>1.0.0</version>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
<active>true</active>
|
8 |
-
</Bb_Bnr>
|
9 |
-
</modules>
|
10 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Bb_Bnr>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<active>true</active>
|
8 |
+
</Bb_Bnr>
|
9 |
+
</modules>
|
10 |
</config>
|
app/etc/modules/Bb_Core.xml
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<modules>
|
5 |
-
|
6 |
-
<Bb_Core>
|
7 |
-
<active>true</active>
|
8 |
-
<codePool>community</codePool>
|
9 |
-
<depends>
|
10 |
-
</depends>
|
11 |
-
</Bb_Core>
|
12 |
-
|
13 |
-
|
14 |
-
</modules>
|
15 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
|
6 |
+
<Bb_Core>
|
7 |
+
<active>true</active>
|
8 |
+
<codePool>community</codePool>
|
9 |
+
<depends>
|
10 |
+
</depends>
|
11 |
+
</Bb_Core>
|
12 |
+
|
13 |
+
|
14 |
+
</modules>
|
15 |
+
</config>
|
lib/Bnr/Api.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Class cursBnrXML v1.0
|
4 |
+
* Author: Ciuca Valeriu
|
5 |
+
* E-mail: vali.ciuca@gmail.com
|
6 |
+
* This class parses BNR's XML and returns the current exchange rate
|
7 |
+
*
|
8 |
+
* Requirements: PHP5
|
9 |
+
*
|
10 |
+
* Last update: October 2011, 27
|
11 |
+
* More info: www.curs-valutar-bnr.ro
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Bnr_Api
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* xml document
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
var $xmlDocument = "";
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* exchange date
|
26 |
+
* BNR date format is Y-m-d
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
var $date = "";
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* currency
|
34 |
+
* @var associative array
|
35 |
+
*/
|
36 |
+
var $currency = array();
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* cursBnrXML class constructor
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @param $url string
|
44 |
+
* @return void
|
45 |
+
*/
|
46 |
+
public function load($url)
|
47 |
+
{
|
48 |
+
$this->xmlDocument = file_get_contents($url);
|
49 |
+
$this->parseXMLDocument();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* parseXMLDocument method
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
public function parseXMLDocument()
|
59 |
+
{
|
60 |
+
$xml = new SimpleXMLElement($this->xmlDocument);
|
61 |
+
|
62 |
+
$this->date=$xml->Header->PublishingDate;
|
63 |
+
|
64 |
+
foreach($xml->Body->Cube->Rate as $line)
|
65 |
+
{
|
66 |
+
$this->currency[]=array("name"=>$line["currency"], "value"=>$line, "multiplier"=>$line["multiplier"]);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* getRate method
|
72 |
+
*
|
73 |
+
* get current exchange rate: example getRate("USD")
|
74 |
+
*
|
75 |
+
* @access public
|
76 |
+
* @return double
|
77 |
+
*/
|
78 |
+
public function getRate($currency)
|
79 |
+
{
|
80 |
+
foreach($this->currency as $line)
|
81 |
+
{
|
82 |
+
if($line["name"]==$currency)
|
83 |
+
{
|
84 |
+
return $line["value"];
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
return "Incorrect currency!";
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
package.xml
CHANGED
@@ -1,23 +1,28 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>bb_bnr</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Automatically import currency rate between RON and others accepted currencies by BNR</summary>
|
10 |
<description>This extension will provide you an automatically currency exchange tool for BNR (Banca Nationala Romana). 
|
11 |

|
|
|
|
|
12 |
<h3>RON currency import </h3> 
|
|
|
13 |
You can schedule your store to import the currency on cron run. See the screen shot for more details. 
|
14 |

|
|
|
|
|
15 |
<a href="http://www.babarus.ro/developement/magento-commerce/modules">Technical information</a></description>
|
16 |
<notes>mage-bnr-currency-import</notes>
|
17 |
<authors><author><name>George Babarus</name><user>MAG000308246</user><email>george.babarus@gmail.com</email></author></authors>
|
18 |
-
<date>
|
19 |
-
<time>
|
20 |
-
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Bb"><dir name="Bnr"><dir name="Model"><dir name="Currency"><dir name="Import"><file name="Bnr.php" hash="
|
21 |
<compatible/>
|
22 |
-
<dependencies><required><php><min>5.
|
23 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>bb_bnr</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Automatically import currency rate between RON and others accepted currencies by BNR</summary>
|
10 |
<description>This extension will provide you an automatically currency exchange tool for BNR (Banca Nationala Romana). 
|
11 |

|
12 |
+

|
13 |
+

|
14 |
<h3>RON currency import </h3> 
|
15 |
+

|
16 |
You can schedule your store to import the currency on cron run. See the screen shot for more details. 
|
17 |

|
18 |
+

|
19 |
+

|
20 |
<a href="http://www.babarus.ro/developement/magento-commerce/modules">Technical information</a></description>
|
21 |
<notes>mage-bnr-currency-import</notes>
|
22 |
<authors><author><name>George Babarus</name><user>MAG000308246</user><email>george.babarus@gmail.com</email></author></authors>
|
23 |
+
<date>2015-02-26</date>
|
24 |
+
<time>14:28:48</time>
|
25 |
+
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Bb"><dir name="Bnr"><dir name="Model"><dir name="Currency"><dir name="Import"><file name="Bnr.php" hash="50206b74b88f357435edad01c6dafe98"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="278dff9e3b6452c77cb2c32d00b6b18b"/><file name="config.xml" hash="21a653e5d5646bee57b3f18b54b56832"/></dir></dir><dir name="Core"><dir name="Helper"><file name="Data.php" hash="c2daa6289925ca2f34dfd979c22a6e32"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BbModulesController.php" hash="ac384fee9e7892fc611221622c333716"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d65e308569fd4ff8efd88a49f3d8b953"/><file name="config.xml" hash="c882a77220f67bf8ebe3ff7c222b88f9"/></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bb_core.xml" hash="ceb184ef1266b85464f65c5f9460dba8"/></dir><dir name="template"><dir name="bb_products"><file name="help.phtml" hash="ddf223964c3f662c1c352068f050857e"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Bb_Bnr.xml" hash="f6da02004e5dca23839f7e37a1cf2e01"/><file name="Bb_Core.xml" hash="f8770daf502376cca878b68672cbc12b"/></dir></dir></dir><dir name="lib"><dir name="Bnr"><file name="Api.php" hash="a7773422e6fe4c6dde289e09f961a856"/></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
28 |
</package>
|