Seur - Version 0.1.0

Version Notes

INFO:
app/code/local/Mage/Seur/etc/
app/code/local/Mage/Seur/Helper/
app/code/local/Mage/Seur/Model/
app/etc/Modules/Mage_Seur.xml
app/design/frontend/default/default/template/Seur/

Download this release

Release Info

Developer Magento Core Team
Extension Seur
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Mage/Seur/Helper/Data.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ class Mage_Seur_Helper_Data extends Mage_Core_Helper_Data {
3
+ }
app/code/local/Mage/Seur/INFO-Seur.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ES | Metodo de envio para SEUR.
2
+ EN | Shipping method to SEUR.
3
+ DE | Liefer-Methode SEUR
4
+
5
+ Version: 0.1.0
6
+ �������
7
+
8
+ * Create Module - Seur
9
+
10
+ <b>DEFAULT:</b>
11
+ app/code/local/Mage/Seur/etc/
12
+ app/code/local/Mage/Seur/Helper/
13
+ app/code/local/Mage/Seur/Model/
14
+ app/etc/Modules/Mage_Seur.xml
15
+ app/design/frontend/default/default/template/Seur/
app/code/local/Mage/Seur/Model/Seur/Seur.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mage_Seur_Model_Seur_Seur extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
3
+
4
+ protected $_code = 'seur';
5
+ protected $total;
6
+ protected $weightType;
7
+ protected $weightPackage;
8
+ protected $weightUnitPrice;
9
+ protected $shippingPrice;
10
+ protected $_total;
11
+
12
+ public function getTitle(){
13
+ return $this->getConfigData('title');
14
+ }
15
+
16
+ public function getAllowedMethods(){
17
+ return array($this->_code => $this->getConfigData('msg'));
18
+ }
19
+
20
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
21
+ // Check if this method is active
22
+ if (!$this->getConfigFlag('active')) {
23
+ return false;
24
+ }
25
+
26
+ // Check if this method is even applicable (must ship from Spain)
27
+ $origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
28
+ $result = Mage::getModel('shipping/rate_result');
29
+
30
+ $error = Mage::getModel('shipping/rate_result_error');
31
+ if ($origCountry != "ES") {
32
+ if($this->getConfigData('showmethod')){
33
+ $error->setCarrier($this->_code)
34
+ ->setCarrierTitle($this->getConfigData('title'))
35
+ ->setErrorMessage($this->getConfigData('specificerrmsg'));
36
+ $result->append($error);
37
+ return $result;
38
+ } else {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ //check if cart order value falls between the minimum and maximum order amounts required
44
+ $packagevalue = $request->getBaseCurrency()->convert($request->getPackageValue(), $request->getPackageCurrency());
45
+ $minorderval = (int)$this->getConfigData('min_order_value');
46
+ $maxorderval = (int)$this->getConfigData('max_order_value');
47
+ if(
48
+ /* EL PAQUETE ES MENOR O IGUAL AL MINIMO Y EL MINIMO ESTA HABILITADO*/
49
+ ($packagevalue <= $minorderval) && ($minorderval > 0) ||
50
+ /* EL PAQUETE ES MAYOR O IGUAL AL MAXIMO Y EL MAXIMO ESTA HABILITADO*/
51
+ (($maxorderval != 0) && ($packagevalue >= $maxorderval))){
52
+ if($this->getConfigData('showmethod')){
53
+ $error->setCarrier($this->_code)
54
+ ->setCarrierTitle($this->getConfigData('title'));
55
+ $currency = Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
56
+ /* SI EL MINIMO Y EL MAXIMO ESTA HABILITADO*/
57
+ if($minorderval != 0 && $maxorderval != 0){
58
+ $errorMsg=Mage::helper('seur')->__('Package value must be between %s and %s',Mage::app()->getStore()->formatPrice($minorderval),Mage::app()->getStore()->formatPrice($maxorderval));
59
+ /* SI EL MAXIMO ESTA HABILITADO*/
60
+ }elseif($maxorderval != 0){
61
+ $errorMsg=Mage::helper('seur')->__('Package value must be less than %s',
62
+ Mage::app()->getStore()->formatPrice($maxorderval)
63
+ );
64
+ /* SI EL MINIMO ESTA HABILITADO*/
65
+ }else{
66
+ $errorMsg = Mage::helper('seur')->__('Package value must be higher than %s',Mage::app()->getStore()->formatPrice($minorderval));
67
+ }
68
+ $error->setErrorMessage($errorMsg);
69
+ $result->append($error);
70
+
71
+ return $result;
72
+ } else {
73
+ return false;
74
+ }
75
+ }
76
+
77
+ // Armo el precio segun el peso del paquete y las configuraciones del sistema
78
+ $weightType = $this->getConfigData('weight_units'); // Si son gramos o kilogramos
79
+ $weightPackage = $request->getPackageWeight() * $weightType;
80
+ $weightUnitPrice = $this->getConfigData('xtra');
81
+ $shippingPrice = $this->getConfigData('handling_fee');
82
+
83
+ // al peso hay que siempre hacerlo entero y si es 1,1 kg toma como que pesa 2 kg. (KILOGRAMOS)
84
+ $weightTotal = ($weightPackage/$weightType);
85
+ if (!is_int($weightTotal)) $weightTotal = ceil($weightTotal);
86
+
87
+ $total = $shippingPrice + ($weightUnitPrice * $weightTotal);
88
+
89
+ $rate = Mage::getModel('shipping/rate_result_method');
90
+ $rate->setCarrier($this->_code);
91
+ $rate->setCarrierTitle($this->getConfigData('title'));
92
+ $rate->setMethod($this->_code);
93
+ $rate->setMethodTitle($this->getConfigData('msg'));
94
+ $rate->setCost($shippingPrice);
95
+ $rate->setPrice($total);
96
+
97
+ $result->append($rate);
98
+
99
+
100
+ return $result;
101
+ }
102
+
103
+ }
app/code/local/Mage/Seur/Model/Standard/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mage_Seur_Model_Standard_Data {
3
+
4
+ public function getPrecio($params){
5
+ // aca le paso el peso y calculo el precio del paquete
6
+ return $precio;
7
+ }
8
+
9
+ }
app/code/local/Mage/Seur/Model/Standard/Weightunits.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mage_Seur_Model_Standard_Weightunits {
3
+ public function toOptionArray() {
4
+ return array(
5
+ array('value'=>1000, 'label'=>Mage::helper('seur')->__('Kilogramos')),
6
+ array('value'=>1, 'label'=>Mage::helper('seur')->__('Gramos')),
7
+ );
8
+ }
9
+ }
app/code/local/Mage/Seur/Seur ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <NotepadPlus>
2
+ <Session activeView="0">
3
+ <mainView activeIndex="3">
4
+ <File firstVisibleLine="10" xOffset="0" scrollWidth="524280" startPos="630" endPos="630" selMode="0" lang="XML" filename="C:\wamp\www\perfume\app\code\local\Mage\Seur\etc\config.xml" />
5
+ <File firstVisibleLine="27" xOffset="0" scrollWidth="524280" startPos="2078" endPos="2090" selMode="0" lang="XML" filename="C:\wamp\www\perfume\app\code\local\Mage\Seur\etc\system.xml" />
6
+ <File firstVisibleLine="0" xOffset="0" scrollWidth="524280" startPos="91" endPos="91" selMode="0" lang="XML" filename="C:\wamp\www\perfume\app\etc\modules\Mage_Seur.xml" />
7
+ <File firstVisibleLine="59" xOffset="0" scrollWidth="524280" startPos="2937" endPos="2937" selMode="0" lang="PHP" filename="C:\wamp\www\perfume\app\code\local\Mage\Seur\Model\Seur\Seur.php">
8
+ <Mark line="82" />
9
+ </File>
10
+ <File firstVisibleLine="0" xOffset="0" scrollWidth="524280" startPos="136" endPos="136" selMode="0" lang="PHP" filename="C:\wamp\www\perfume\app\code\local\Mage\Seur\Model\Standard\Data.php" />
11
+ <File firstVisibleLine="0" xOffset="0" scrollWidth="524280" startPos="120" endPos="124" selMode="0" lang="PHP" filename="C:\wamp\www\perfume\app\code\local\Mage\Seur\Model\Standard\Weightunits.php" />
12
+ <File firstVisibleLine="0" xOffset="0" scrollWidth="524280" startPos="0" endPos="0" selMode="0" lang="Normal Text" filename="C:\wamp\www\perfume\var\log\system.log" />
13
+ <File firstVisibleLine="0" xOffset="0" scrollWidth="524280" startPos="84" endPos="84" selMode="0" lang="PHP" filename="C:\wamp\www\perfume\app\design\frontend\default\default\template\seur\form.phtml" />
14
+ <File firstVisibleLine="0" xOffset="0" scrollWidth="524280" startPos="156" endPos="156" selMode="0" lang="PHP" filename="C:\wamp\www\perfume\app\design\frontend\default\default\template\seur\info.phtml" />
15
+ </mainView>
16
+ <subView activeIndex="0" />
17
+ </Session>
18
+ </NotepadPlus>
app/code/local/Mage/Seur/etc/config.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mage_Seur>
5
+ <version>0.1.0</version>
6
+ </Mage_Seur>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <seur>
11
+ <class>Mage_Seur_Block</class>
12
+ </seur>
13
+ </blocks>
14
+ <helpers>
15
+ <seur>
16
+ <class>Mage_Seur_Helper</class>
17
+ </seur>
18
+ </helpers>
19
+ <models>
20
+ <seur>
21
+ <class>Mage_Seur_Model</class>
22
+ </seur>
23
+ </models>
24
+ <sales>
25
+ <shipping>
26
+ <carriers>
27
+ <seur>
28
+ <class>Mage_Seur_Model_Seur</class>
29
+ </seur>
30
+ </carriers>
31
+ </shipping>
32
+ </sales>
33
+ </global>
34
+ <default>
35
+ <carriers>
36
+ <seur>
37
+ <active>1</active>
38
+ <model>mage_seur_model_seur_seur</model>
39
+ <title>Seur</title>
40
+ <msg></msg>
41
+ <min_order_value>0</min_order_value>
42
+ <max_order_value>0</max_order_value>
43
+ <weight_units>1</weight_units>
44
+ <handling_fee>0</handling_fee>
45
+ <xtra>0</xtra>
46
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
47
+ </seur>
48
+ </carriers>
49
+ </default>
50
+ </config>
app/code/local/Mage/Seur/etc/system.xml ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <carriers>
5
+ <groups>
6
+ <seur translate="label" module="shipping">
7
+ <label>Seur</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>1</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <msg translate="label">
24
+ <label>Message</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </msg>
31
+ <title translate="label">
32
+ <label>Title</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>22</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </title>
39
+ <weight_units translate="label">
40
+ <label>Weight Unit</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>seur/standard_weightunits</source_model>
43
+ <sort_order>33</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </weight_units>
48
+ <handling_type translate="label">
49
+ <label>Calculate Handling Fee</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>shipping/source_handlingType</source_model>
52
+ <sort_order>40</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </handling_type>
57
+ <handling_fee translate="label">
58
+ <label>Handling Fee</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>41</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </handling_fee>
65
+ <xtra translate="label">
66
+ <label>Extra amount</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>45</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </xtra>
73
+ <max_order_value translate="label">
74
+ <label>Maximum Order Value</label>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>50</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </max_order_value>
81
+ <min_order_value translate="label">
82
+ <label>Minimum Order Value</label>
83
+ <frontend_type>text</frontend_type>
84
+ <sort_order>60</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </min_order_value>
89
+ <sort_order translate="label">
90
+ <label>Sort order</label>
91
+ <frontend_type>text</frontend_type>
92
+ <sort_order>80</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </sort_order>
97
+ <showmethod translate="label">
98
+ <label>Show method if not applicable</label>
99
+ <frontend_type>select</frontend_type>
100
+ <sort_order>90</sort_order>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </showmethod>
106
+ <specificerrmsg translate="label">
107
+ <label>Displayed Error Message</label>
108
+ <frontend_type>textarea</frontend_type>
109
+ <sort_order>91</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </specificerrmsg>
114
+ </fields>
115
+ </seur>
116
+ </groups>
117
+ </carriers>
118
+ </sections>
119
+ </config>
app/design/frontend/default/default/template/seur/form.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
2
+ <table>
3
+ <?php if ($this->getMethod()->getCustomTextForm()){ ?>
4
+ <tr>
5
+ <td><?php echo $this->getMethod()->getCustomTextForm() ?></td>
6
+ </tr>
7
+ <?php } else { ?>
8
+ <tr>
9
+ <td><?php echo $this->__('El env�o ser&aacute; realizado via SEUR.') ?></td>
10
+ </tr>
11
+ <?php } ?>
12
+ </table>
13
+ </div>
app/design/frontend/default/default/template/seur/info.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <p><?php echo $this->getMethod()->getTitle() ?><br />
2
+ <?php if ($this->getMethod()->getCustomTextInfo()): ?>
3
+ <?php echo $this->getMethod()->getCustomTextInfo() ?><br />
4
+ <?php endif; ?>
5
+ </p>
app/etc/modules/Mage_Seur.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mage_Seur>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Mage_Seur>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Seur</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Metodo de envio SEUR.</summary>
10
+ <description>ES | Metodo de envio para SEUR.
11
+ EN | Shipping method to SEUR.
12
+ DE | Liefer-Methode SEUR</description>
13
+ <notes>&lt;b&gt;INFO:&lt;/b&gt;
14
+ app/code/local/Mage/Seur/etc/
15
+ app/code/local/Mage/Seur/Helper/
16
+ app/code/local/Mage/Seur/Model/
17
+ app/etc/Modules/Mage_Seur.xml
18
+ app/design/frontend/default/default/template/Seur/</notes>
19
+ <authors><author><name>Manuel</name><user>auto-converted</user><email>manuelcanepa@gmail.com</email></author><author><name>Gaspar Mac</name><user>auto-converted</user><email>gasparmac@gmail.com</email></author><author><name>Laly</name><user>auto-converted</user><email>lalyostres@gmail.com</email></author></authors>
20
+ <date>2009-02-13</date>
21
+ <time>09:23:54</time>
22
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="seur"><file name="form.phtml" hash="c2c387ef950c01bfda459d90e4e4e4dd"/><file name="info.phtml" hash="f17acb410c3b9e14426c7d727973e4db"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Seur"><dir name="etc"><file name="config.xml" hash="8053e0d288250feadd9abb46b6deab9f"/><file name="system.xml" hash="44a30f6893a0a79a42dea397562ecc90"/></dir><dir name="Helper"><file name="Data.php" hash="902dfd72eed575b009cabcf5ea6ad7f4"/></dir><dir name="Model"><dir name="Seur"><file name="Seur.php" hash="982b38a9398094774047c6e85a126abc"/></dir><dir name="Standard"><file name="Data.php" hash="c0cb09aa57d0534e6fb11b5ae5e63eaf"/><file name="Weightunits.php" hash="14a3d7a2696a0c7cfdea34a2e7e46b6e"/></dir></dir><file name="INFO-Seur.txt" hash="28b891a2e4ba58dae7bf0939fb7cb3a6"/><file name="Seur" hash="e8ebf11928f18117082c34bcc258208d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Seur.xml" hash="2c45b19f8db4706ffa1b97e5b60fea23"/></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies/>
25
+ </package>