Creare_Order_Before_X - Version 1.0.0

Version Notes

First Release

Download this release

Release Info

Developer E-Commerce Web Design
Extension Creare_Order_Before_X
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Creare/OrderBeforeX/Block/Orderbeforex.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Creare_Orderbeforex_Block_OrderBeforeX extends Mage_Core_Block_Template
3
+ {
4
+
5
+ public function getCountDownClock()
6
+ {
7
+ $time = Mage::getStoreConfig('carriers/orderbeforex/time');
8
+
9
+ return $time;
10
+ }
11
+
12
+ public function checkAvailableDays()
13
+ {
14
+ $day = strtolower(date("l"));
15
+ $notarr = explode(",",Mage::getStoreConfig('carriers/orderbeforex/available'));
16
+ if(!in_array($day, $notarr)){
17
+ return false;
18
+ } else {
19
+ return true;
20
+ }
21
+ }
22
+
23
+ }
app/code/local/Creare/OrderBeforeX/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Creare_OrderBeforeX_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Creare/OrderBeforeX/Model/Adminhtml/System/Config/Source/Days.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Creare_OrderBeforeX_Model_Adminhtml_System_Config_Source_Days
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ $arr = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
7
+ $array = array();
8
+ foreach($arr as $a)
9
+ {
10
+ $array[] = array('value'=>$a, 'label'=>ucfirst($a));
11
+ }
12
+ return $array;
13
+ }
14
+ }
app/code/local/Creare/OrderBeforeX/Model/Adminhtml/System/Config/Source/Times.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Creare_OrderBeforeX_Model_Adminhtml_System_Config_Source_Times
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ $arr = array();
7
+ $event_time = "00:00";
8
+ $time_block = 96;
9
+ $event_length = 15; // minutes
10
+ for($i = 0,$eTime =strtotime($event_time);$i<$time_block; $i++, $eTime = strtotime("+$event_length minutes", $eTime))
11
+ {
12
+ $time = date('H:i', $eTime);
13
+ $arr[] = array('value'=>$time, 'label'=>$time);
14
+ }
15
+ return $arr;
16
+ }
17
+ }
app/code/local/Creare/OrderBeforeX/etc/config.xml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Creare
5
+ * @package Creare_OrderBeforeX
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Creare_OrderBeforeX>
12
+ <version>0.1.0</version>
13
+ </Creare_OrderBeforeX>
14
+ </modules>
15
+ <frontend>
16
+ <layout>
17
+ <updates>
18
+ <orderbeforex>
19
+ <file>orderbeforex.xml</file>
20
+ </orderbeforex>
21
+ </updates>
22
+ </layout>
23
+ </frontend>
24
+ <adminhtml>
25
+ <layout>
26
+ <updates>
27
+ <orderbeforex>
28
+ <file>orderbeforex.xml</file>
29
+ </orderbeforex>
30
+ </updates>
31
+ </layout>
32
+ </adminhtml>
33
+ <global>
34
+ <models>
35
+ <orderbeforex>
36
+ <class>Creare_OrderBeforeX_Model</class>
37
+ <resourceModel>orderbeforex_mysql4</resourceModel>
38
+ </orderbeforex>
39
+ <orderbeforex_adminhtml>
40
+ <class>Creare_OrderBeforeX_Model_Adminhtml</class>
41
+ </orderbeforex_adminhtml>
42
+ <orderbeforex_mysql4>
43
+ <class>Creare_OrderBeforeX_Model_Mysql4</class>
44
+ <entities>
45
+ <orderbeforex>
46
+ <table>orderbeforex</table>
47
+ </orderbeforex>
48
+ </entities>
49
+ </orderbeforex_mysql4>
50
+ </models>
51
+ <resources>
52
+ <creare_orderbeforex_setup>
53
+ <setup>
54
+ <module>Creare_OrderBeforeX</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </creare_orderbeforex_setup>
60
+ </resources>
61
+ <blocks>
62
+ <orderbeforex>
63
+ <class>Creare_OrderBeforeX_Block</class>
64
+ </orderbeforex>
65
+ </blocks>
66
+ <helpers>
67
+ <orderbeforex>
68
+ <class>Creare_OrderBeforeX_Helper</class>
69
+ </orderbeforex>
70
+ </helpers>
71
+ </global>
72
+ <default>
73
+ <orderbeforex>
74
+ <orderbeforex>
75
+ <active>1</active>
76
+ <top_message>Order Before 8pm</top_message>
77
+ <time>20:00</time>
78
+ <bottom_message>For Next Day Delivery</bottom_message>
79
+ </orderbeforex>
80
+ </orderbeforex>
81
+ </default>
82
+ <adminhtml>
83
+ <acl>
84
+ <resources>
85
+ <all>
86
+ <title>Allow Everything</title>
87
+ </all>
88
+ <admin>
89
+ <children>
90
+ <system>
91
+ <children>
92
+ <config>
93
+ <children>
94
+ <orderbeforex>
95
+ <title>CreareGroup - All</title>
96
+ </orderbeforex>
97
+ </children>
98
+ </config>
99
+ </children>
100
+ </system>
101
+ </children>
102
+ </admin>
103
+ </resources>
104
+ </acl>
105
+ </adminhtml>
106
+ </config>
app/code/local/Creare/OrderBeforeX/etc/system.xml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <creare translate="label" module="orderbeforex">
4
+ <label>CreareGroup</label>
5
+ <sort_order>100</sort_order>
6
+ </creare>
7
+ </tabs>
8
+ <sections>
9
+ <orderbeforex translate="label" module="orderbeforex">
10
+ <label>Order Before X</label>
11
+ <tab>creare</tab>
12
+ <sort_order>1000</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <groups>
17
+ <orderbeforex translate="label" module="orderbeforex">
18
+ <label>Order Before X</label>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>1000</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <comment>
25
+ <![CDATA[<div class="creare-container">
26
+ <div class="creare-header">This module was developed by <a href="http://www.e-commercewebdesign.co.uk" target="_blank">www.e-commercewebdesign.co.uk</a> - <strong>Magento Design, Development &amp; Extensions</strong>.</div>
27
+ <div class="creare-footer"><a href="http://www.e-commercewebdesign.co.uk" class="ecom-creare" target="_blank" title="E-Commerce Web Design"><span>E-Commerce Web Design</span></a> <a href="http://www.webdesigncreare.co.uk" class="web-creare" target="_blank" title="Web Design &amp; Development"><span>Web Design &amp; Development</span></a> <a href="http://www.seo-creare.co.uk" class="seo-creare" target="_blank" title="SEO &amp; Internet Marketing"><span>SEO (Search Engine Optimisation)</span></a> <span class="uk-flag"><span>Based In The UK</span></span></div>
28
+ </div>
29
+ <div class="creare-clear"></div>]]>
30
+ </comment>
31
+ <fields>
32
+ <active translate="label">
33
+ <label>Enabled</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_yesno</source_model>
36
+ <sort_order>10</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </active>
41
+ <top_message translate="label">
42
+ <label>Top Message</label>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>20</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </top_message>
49
+ <time translate="label">
50
+ <label>Time</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>orderbeforex_adminhtml/system_config_source_times</source_model>
53
+ <sort_order>30</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
+ </time>
58
+ <available translate="label">
59
+ <label>Exclude Days</label>
60
+ <frontend_type>multiselect</frontend_type>
61
+ <source_model>orderbeforex_adminhtml/system_config_source_days</source_model>
62
+ <sort_order>30</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </available>
67
+ <bottom_message translate="label">
68
+ <label>Bottom Message</label>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>40</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </bottom_message>
75
+ </fields>
76
+ </orderbeforex>
77
+ </groups>
78
+ </orderbeforex>
79
+ </sections>
80
+ </config>
app/design/frontend/default/default/layout/orderbeforex.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>css/orderbeforex.css</stylesheet></action>
6
+ </reference>
7
+
8
+ <reference name="right">
9
+ <block type="orderbeforex/orderbeforex" name="orderbeforex" template="orderbeforex/orderbeforex.phtml" before="-" />
10
+ </reference>
11
+ <!--<reference name="left">
12
+ <block type="orderbeforex/orderbeforex" name="orderbeforex" template="orderbeforex/orderbeforex.phtml" before="-" />
13
+ </reference>-->
14
+ </default>
15
+ </layout>
app/design/frontend/default/default/template/orderbeforex/orderbeforex.phtml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Creare (E-commerce Web Design)
4
+ * OrderBeforeX
5
+ *
6
+ * Display the order before time
7
+ *
8
+ */
9
+
10
+ date_default_timezone_get();
11
+ ?>
12
+
13
+ <?php $time = Mage::getStoreConfig('orderbeforex/orderbeforex/time'); ?>
14
+ <?php if(Mage::getStoreConfig('orderbeforex/orderbeforex/active') && !$this->checkAvailableDays() && date('H:i') < date($time)): ?>
15
+ <script type="text/javascript">
16
+
17
+ var id_to_hide = "creare_cdc";
18
+
19
+ function Countdown(then) {
20
+
21
+ this.then = then;
22
+
23
+ function setElement(id, value) {
24
+ if (value < 10) {
25
+ value = '<span class="digit ccdc-0"><strong class="no-display">0</strong></span>' + '<span class="digit ccdc-'+value+'"><strong class="no-display">'+value+'</strong></span>';
26
+ } else {
27
+ temp = value.toString();
28
+ temp2 = temp.substr(0,1);
29
+ temp3 = temp.substr(1,1);
30
+ value = '<span class="digit ccdc-'+temp2+'"><strong class="no-display">'+temp2+'</strong></span>' + '<span class="digit ccdc-'+temp3+'"><strong class="no-display">'+temp3+'</strong></span>';
31
+ }
32
+ window.document.getElementById(id).innerHTML = value;
33
+ }
34
+
35
+ var now = new Date(<?php echo time()*1000; ?>);
36
+
37
+ function countdown() {
38
+
39
+ now.setTime(now.getTime() + 1000);
40
+
41
+ diff = new Date(this.then - now);
42
+
43
+ seconds_left = Math.floor(diff.valueOf() / 1000);
44
+
45
+ seconds = Math.floor(seconds_left / 1) % 60;
46
+ minutes = Math.floor(seconds_left / 60) % 60;
47
+ hours = Math.floor(seconds_left / 3600) % 24;
48
+ days = Math.floor(seconds_left / 86400) % 86400;
49
+
50
+
51
+ //setElement('creare-days', days);
52
+ setElement('creare-hours', hours);
53
+ setElement('creare-minutes', minutes);
54
+ setElement('creare-seconds', seconds);
55
+
56
+ if(hours <= 0 && minutes <= 0 && seconds <= 0){
57
+ document.getElementById('creare-container').innerHTML = "";
58
+ } else {
59
+ countdown.timer = setTimeout(countdown, 1000);
60
+ }
61
+
62
+
63
+
64
+ }
65
+
66
+ function start() {
67
+ this.timer = setTimeout(countdown, 1000);
68
+ }
69
+
70
+ start(then);
71
+ }
72
+
73
+ Countdown(new Date("<?php echo date("m/d/Y $time:00"); ?>"));
74
+
75
+ </script>
76
+ <div class="block" id="creare-container">
77
+ <div class="block-title"> <strong><span>Need it Quick?</span></strong> </div>
78
+ <div class="block-content" id="creare-container">
79
+ <p class="block-subtitle a-center"><?php echo Mage::getStoreConfig('orderbeforex/orderbeforex/top_message'); ?></p>
80
+ <p class="block-subtitle a-center" id="creare_cdc">
81
+ <span id="creare-hours"></span>
82
+ <span id="creare-minutes"></span>
83
+ <span id="creare-seconds"></span>
84
+ </p>
85
+ <p class="block-subtitle a-center"><?php echo Mage::getStoreConfig('orderbeforex/orderbeforex/bottom_message'); ?></p>
86
+ </div>
87
+ </div>
88
+ <?php endif; ?>
app/etc/modules/Creare_OrderBeforeX.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Creare_OrderBeforeX>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>1.0</version>
8
+ </Creare_OrderBeforeX>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Creare_Order_Before_X</name>
4
+ <version>1.0.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>Order before a certain time - widget appears with countdown. Control time &amp; days in admin.</summary>
10
+ <description>Order before a certain time - customer incentive - displays a countdown clock until a set time. &#xD;
11
+ &#xD;
12
+ Customise text above and below the countdown timer.&#xD;
13
+ &#xD;
14
+ Choose which days of the week to not display this incentive.&#xD;
15
+ &#xD;
16
+ Easy to install and easy to set up. Shows in right side bar.</description>
17
+ <notes>First Release</notes>
18
+ <authors><author><name>E-Commerce Web Design</name><user>EcommerceWD</user><email>dev@e-commercewebdesign.co.uk</email></author></authors>
19
+ <date>2012-01-13</date>
20
+ <time>17:09:37</time>
21
+ <contents><target name="magelocal"><dir name="Creare"><dir name="OrderBeforeX"><dir name="Block"><file name="Orderbeforex.php" hash="47d5521f1e65c40e53195dc0a2665aa9"/></dir><dir name="Helper"><file name="Data.php" hash="d516d77f87f2bfde7c215e34e7fda6bb"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Days.php" hash="30d48e234157ce5fbef5ab09545cddaa"/><file name="Times.php" hash="42a96f74a7e419ad9b373d7b80117fe1"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="52bd3527250d8b4f669963725b093750"/><file name="system.xml" hash="8cd2c1b87aa2cf673c12e10cf2be9521"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="orderbeforex"><file name="orderbeforex.phtml" hash="c6c62cbf50fc96ae2a50a03b9b4c506b"/></dir></dir><dir name="layout"><file name="orderbeforex.xml" hash="3e2e7a470e75faca54a20dcc120f5122"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Creare_OrderBeforeX.xml" hash="abb800e36b5538f1e67c9b40403ef233"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="orderbeforex.css" hash="7b33d53a93d3d706b04600de70a4eb40"/></dir><dir name="images"><dir name="orderbeforex"><file name="colon.png" hash="4fa6d16ed9896e4effea4e49b9b8d68e"/><file name="digits.png" hash="4af0e1e32079b80be673b2b395b12c08"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="orderbeforex"><file name="admin.css" hash="790b7a705efea5b2f7d2f6e657244706"/><dir name="images"><file name="creare-ecommerce.gif" hash="6e1f6c7c2a1dc12e5e1b60e952bea84d"/><file name="creare-seo.gif" hash="e76366079e7c396f2082cf923c3791bd"/><file name="creare-web.gif" hash="4b847b10079747165a62835cc81e827f"/><file name="uk-flag.gif" hash="d8317bf811ecf839c91194c7ecb7ea1f"/></dir></dir></dir></dir></dir></target></contents>
22
+ <compatible/>
23
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
+ </package>
skin/adminhtml/default/default/orderbeforex/admin.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CSS Document */
2
+ .creare-header { width: 100%; }
3
+ .creare-footer { width: 100%; padding: 10px 0 0; clear: both; }
4
+ .creare-footer a span { display: none; }
5
+ .creare-footer a { display: block; float: left; margin-right: 5px; }
6
+ .creare-container { background-color:#fff;border:1px solid #CCC;padding:10px;margin-bottom:7px; height: 90px; }
7
+ .ecom-creare { background: url(images/creare-ecommerce.gif) no-repeat; width: 150px; height: 55px; }
8
+ .seo-creare { background: url(images/creare-seo.gif) no-repeat; width: 150px; height: 55px; }
9
+ .web-creare { background: url(images/creare-web.gif) no-repeat; width: 150px; height: 55px;}
10
+ .uk-flag { background: url(images/uk-flag.gif) no-repeat; width: 150px; height: 55px; display: block; float: left; }
11
+ .uk-flag span { display: none; }
12
+ .creare-clear { clear: both; }
skin/adminhtml/default/default/orderbeforex/images/creare-ecommerce.gif ADDED
Binary file
skin/adminhtml/default/default/orderbeforex/images/creare-seo.gif ADDED
Binary file
skin/adminhtml/default/default/orderbeforex/images/creare-web.gif ADDED
Binary file
skin/adminhtml/default/default/orderbeforex/images/uk-flag.gif ADDED
Binary file
skin/frontend/default/default/css/orderbeforex.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Creare OrderBeforeX */
2
+ #creare_cdc { height: 37px; display: block; clear: both; }
3
+ #creare-hours { padding: 0 10px 0 0; height: 37px; display: block; float: left; background: url('../images/orderbeforex/digits.png') right -2183px no-repeat; }
4
+ #creare-minutes { padding: 0 10px 0 0; height: 37px; display: block; float: left; background: url('../images/orderbeforex/digits.png') right -2183px no-repeat; }
5
+ #creare_cdc span span { background: url('../images/orderbeforex/digits.png') no-repeat 0 0; width: 25px; height: 37px; display: block; float: left; }
6
+ .ccdc-0 { background-position: 0 0!important; }
7
+ .ccdc-1 { background-position: 0 -182px!important; }
8
+ .ccdc-2 { background-position: 0 -436px!important; }
9
+ .ccdc-3 { background-position: 0 -654px!important; }
10
+ .ccdc-4 { background-position: 0 -836px!important; }
11
+ .ccdc-5 { background-position: 0 -1054px!important; }
12
+ .ccdc-6 { background-position: 0 -1308px!important; }
13
+ .ccdc-7 { background-position: 0 -1526px!important; }
14
+ .ccdc-8 { background-position: 0 -1744px!important; }
15
+ .ccdc-9 { background-position: 0 -1961px!important; }
skin/frontend/default/default/images/orderbeforex/colon.png ADDED
Binary file
skin/frontend/default/default/images/orderbeforex/digits.png ADDED
Binary file