♥JcMagpie Posted February 1, 2020 Posted February 1, 2020 JcM Events Calender V1.0 Phoenix 1.0.4.0 This is a simple add-on that lets you add a store events calender to your site. It make use of fullcalender.js to render the calender. All the required css and scripts a loaded using a hook so don’t for get to load that. A simple button in a card is used to access the calender. You can change this if you wish to make it just a test link or something else, but as stock it’s a button. The button class can be changed in admin. The calender itself is shown on a new page. FullCalender.js can be as simple or as complex as you like. This is a simple implementation, the styling is basic and so is the complexity. To add new events or edit existing ones all that is required is to edit the language file calender.php. The install is provided with a number of test evens showing how they can be setup. You can get more information form the official site https://fullcalendar.io/ That’s it enjoy. It has only been tested on Phoenix 1.0.4.3 only. Can be seen working on this custom test site Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 @JcMagpie have you considered doing this using database driven events? Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 The script will not care where the events come from as long as they are provided in the format required. Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 Just now, JcMagpie said: The script will not care where the events come from as long as they are provided in the format required. Would that be in the language file or in the calendar file? Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 I have made the below changes to the language file and it will only show one of the events I have in my database, not all of them (I currently have 2) define('NAVBAR_TITLE', 'Events Calender'); define('HEADING_TITLE', 'Events Calender'); $db_query = tep_db_query("select * from stores"); while ($events = tep_db_fetch_array($db_query)) { $title = $events['stores_title']; $url = $events['event_url']; $start = $events['event_date']; $event = array( "'{title" => $title, "url" => $url, "start" => $start . "},'" ); // Loop through superhero array foreach($event as $key => $value){ echo $key . ": " . $value . "<br>"; } define('JCM_EVENTS_FULLCALENDER_BUTTON_EVENTS', '{ title: "'.$title.'", url: "'.$url.'", start: "'.$start.'" },'); } Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 You need to edit the language file public_html/includes/languages/english/calender.php As you can see as long as the data follows ths format it should work. define('JCM_EVENTS_FULLCALENDER_BUTTON_EVENTS', '{ title: "All Day Event", url: "https://kuuza.co.uk/", start: "2020-01-31", description: "This is a test event" }, Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 1 hour ago, LeeFoster said: I have made the below changes to the language file and it will only show one of the events I have in my database, not all of them (I currently have 2) So it's geting the data just not reading more that one! Check the HTML beeing generated and make sure the output is correct format? must be an issue with your loop. Quote
Omar_one Posted February 4, 2020 Posted February 4, 2020 3 hours ago, LeeFoster said: have you considered doing this using database driven events? @LeeFoster there is Events Calendar (28d07) made by @burt .. Quote Get the latest Responsive osCommerce CE (community edition) here .
LeeFoster Posted February 4, 2020 Posted February 4, 2020 15 minutes ago, Omar_one said: @LeeFoster there is Events Calendar (28d07) made by @burt .. Yes I know but I don't have access to it and there's been no information on if it is going to be released for Phoenix and if so when. Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 1 hour ago, JcMagpie said: So it's geting the data just not reading more that one! Check the HTML beeing generated and make sure the output is correct format? must be an issue with your loop. This is what is being generated - <script> document.addEventListener('DOMContentLoaded', function() { var calendarEl = document.getElementById('calendar'); var calendar = new FullCalendar.Calendar(calendarEl, { plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'dayGridDay', 'dayGridWeek', 'timeGridDay', 'dayGridMonth' ], defaultView: 'dayGridMonth', defaultDate: '2020-02-04', //defaultDate: '2020-01-31', header: { left: 'today prev,next', center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay' }, events: [ { title: "Chillcon - Sheffield", url: "http://www.chillcon.co.uk/sheffield-venue", start: "2020-03-28" }, ] }); calendar.render(); }); </script> Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 (edited) So the calender is working fine, looks like your loop for the events is not working... check you error logs? also make sure the loop is in corect position. is the event shown the first or the second? at which point is the loop stuck? I don't have any db events so am not able to check. Edited February 4, 2020 by JcMagpie Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 3 minutes ago, JcMagpie said: So the calender is working fine, looks like your loop for the events is not working... check you error logs? also make sure the loop is in corect position. is the event shown the first or the second? at which point is the loop stuck? I don't have any db events so am not able to check. It's the first event that is shown. Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 (edited) Then the loop is simply not doing it's job, check it's actualy looping by adding a simple echo statment or count in the loop? I would say pm a link but not sure that's much use in this case.... Edited February 4, 2020 by JcMagpie Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 https://www.w3schools.in/php/looping/foreach/ Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 21 minutes ago, JcMagpie said: Then the loop is simply not doing it's job, check it's actualy looping by adding a simple echo statment or count in the loop? When I echo the loop it's fine so it has to be the way the data is being pushed into the define. Quote
♥JcMagpie Posted February 4, 2020 Author Posted February 4, 2020 (edited) Yeah the add-on is writen to keep it simple for most people to use by simply editing a language file to add events! Stock osC/Phoenix has no events in db. If you wish to pull from db you can.... just dont do it using the define as I'm not sure but I don't think you can have a loop in a define. Just move the script to the public_html/calender.php and replace <?php echo JCM_EVENTS_FULLCALENDER_BUTTON_EVENTS ?> with the actual script pulled from your db. events: [ <?php echo JCM_EVENTS_FULLCALENDER_BUTTON_EVENTS ?> ] That should allow you to use the loop as required. Your basicly making a new add-on............. Edited February 4, 2020 by JcMagpie Quote
LeeFoster Posted February 4, 2020 Posted February 4, 2020 16 minutes ago, JcMagpie said: Yeah the add-on is writen to keep it simple for most people to use by simply editing a language file to add events! Stock osC/Phoenix has no events in db. If you wish to pull from db you can.... just dont do it using the define as I'm not sure but I don't think you can have a loop in a define. Just move the script to the public_html/calender.php and replace <?php echo JCM_EVENTS_FULLCALENDER_BUTTON_EVENTS ?> with the actual script pulled from your db. events: [ <?php echo JCM_EVENTS_FULLCALENDER_BUTTON_EVENTS ?> ] That should allow you to use the loop as required. Your basicly making a new add-on............. Got it sorted, thank you for your help. Quote
♥JcMagpie Posted February 5, 2020 Author Posted February 5, 2020 cool....glad you got things to work out. Quote
♥JcMagpie Posted February 5, 2020 Author Posted February 5, 2020 14 hours ago, Omar_one said: @LeeFoster there is Events Calendar (28d07) made by @burt .. This is a support thread for this free add-on, it helps no one to post about other add-on.... especially if they are not free to download in the app's store Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.