Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for JcM Events Calender V1.0 Phoenix 1.0.4.0


JcMagpie

Recommended Posts

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

image.thumb.png.0d00c58f5462dbf6ee614d02676d32ba.png

 

 

Link to comment
Share on other sites

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.'"
      },');
 }

 

Link to comment
Share on other sites

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"
      },

 

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

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 by JcMagpie

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by JcMagpie

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by JcMagpie

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...