Cartcake now has support for plugins. To install them, put them in the functions/ folder.
Compatible with v1.2
How can I make plugins myself, or have more hooks?There isn't enough hooks inside CartCake right now, so its functionality can't be modified much.
Because of this, you unfortunately cannot make your own plugins yet.
However if you contact us asking what plugin you want, we'll make it for you.
Guide for desbest about writing pluginsStep 1: Tabula Rasa
Use this code below to create a plugin, tabula rasa.
It should be a php file called plugin_X.php, where X is a unique string/word/letters that is not taken.
You'll have to make sure that your Cartcake plugin, doesn't conflict with the filename of an already existing plugin.
You can check which plugin names are taken, by scrolling up and looking for pl_Filename.
Step 2: About Your Plugin
In the about section, fill in the fields with the relevant plugin information.
Step 3: Plugin Settings
Plugins allow there to be configurable settings, for they should be run.
The admin of the shopping cart, will be able to change these settings from the admin panel.
These settings are stored in a key/value manner. Below is an example.
To give your own plugin settings, simply make a numerically indexed array called $ph_Settings, and place it in the settings section.
The value of the array, will be considered as a key, where the admin would enter the value.
Only text input settings are supported.
Plugin settings are not validated.
Step 4: Hooks
Cartcake plugins use hooks to be able to interject themselves into the core Cartcake code.
There are various hooks inside the Cartcake core code, and once reached, all the plugins that use that hook are executed.
This means that you can have your code running as if it was in the core, whilst not being in the core.
You will find this much easier to deal with, than other so called plugin systems, ahem, phpBB.
Below are the hooks that are in Cartcake.
Step 5: Plugin Storage
So you've got your hooks to modify the files, but how are you going to modify the database?
You don't have the rights to create a new database table, or mess with the table structure.
How can you store data efficently for your plugin, that relates to existing rows in the database?
The answer is plugin storage.
How plugin storage works
Every entry of information you store in plugin storage, is called a plugin storage entry.
There is a database table called pluginsettings, which stores the plugin settings. Below are its columns.
There are 2 code samples regarding plugin storage in the next section, which will greatly assist you about this.
First things first
Now it's the time for you to write the part of the plugin that does stuff, the activity.
First things first, do a find and replace for /* blank plugin and *///// and delete them.
What I would do instead of that, is to delete those 4 lines, as it makes the file look nicer.
You will need (or should have) this code in the activity section of the plugin, for each hook that you have.
Inbetween the braces, is where you place the code you want your plugin to execute once the hook is called.
Replace XX with the name of the hook that you are using.
Getting the pluginid
Here's how to get the pluginid.
Using plugin storage
Here is a code sample to help you fetch information from plugin storage.
Debugging your pluginid
As plugins cannot print text on the webpage you visit with a web browser, you'll have to view their variables in another way.
You can use functions/test.txt for this.
But first, make sure that functions/test.txt is writeable. Once it is, don't use it for sensitive information.
Be sure to wipe it clean afterwards.
And that's it! :)