We shall discuss how to create a WordPress plugin from scratch that utilizes and shows products from the database of an external OScommerce shop.
You can start by installing the WordPress in your system and follow the guidelines. In order to do this, you require a local server which runs on the system like XAMPP. After completing downloading and installing the WordPress, you can read the information on “installation process and troubleshooting”.
You can download the latest version of OSCommerce and install on the system.
Basic files and folder structure should be created. The place where you will add plugins and files is wp-content/plugins/folder. If the plugin is simple, everything along with the code can be stored in one PHP file. You can just save it in the path given above. In case you want to utilize two files, one for the administration page and the other one for the main plugin file, you have to create a folder named “osCommerce importer”.
Create plugin file
Now the main plug in file must be created. Name it as “oscommerce_importer.php” or any other name.
Go to WordPress administration panel, you can see the “plugins” section.
Ensure to retain all lines in the header because it will become difficult for WordPress to recognize the new plugin.
After you refresh the plugin page in the administration panel, you will see the new plugins along with others.
You can activate the plugin with the click on “activate”.
You can include the plugin code at various places inside a page or in specific positions in the page that will be shown. The logical positions can be termed as “action hooks”.
Actionhooks can be viewed as call back function. While performing simple operation like showing the page footer, it permits the plugins to use code which has to run at the given time.
Create the administration page
The module can be implemented by identifying the configurable parameters which the site administrator can access.
To connect and extract the required date, you should know the name of the database host, password and user. General information about the store like the URL and the folder (product images) also should be known. This information is required to create links.