DropShippingPlugin header

Drop Shipping Offline - WP Plugin

  • Wordpress
  • WooCommerce
  • Plugin
  • PHP
  • MySQL

DropShipping Offline is a WordPress plugin, its task is to solve the problem of managing a hybrid e-commerce system, with dropshipping products and products in stock, going to generate a report of the products sold daily divided between dropshipping products and products in stock.

Click here for the full code on gitHub.

The plugin development phases were:

  • Requirements analysis: phase in which, through discussions with the customer, it was decided what the fundamental requirements were that the plugin had to support.
  • Data modeling: phase in which the data schema was analyzed, using the entity / relationship model and the relational schema.
  • Business logic: phase in which, through specific UML diagrams, the implementation of the application logic is defined.
  • Implementation: phase in which the implementation of the plugin takes place.
coding page

Requirements analysis

  1. Sending the daily report via email

    Functional requirement, MUST

    Actors: User, Server.

    Archives: order archive, product archive, information archive.

    Daily the Server starts an application, which accesses the archives: order archive, product archive, information archive, and through queries it obtains the products sold in the day, divides them between drop shipping and in stock products, accessing the information archive obtains the e-mail address set and send the email to the User with the daily report.

  1. View previous reports.

    functional requirement, SHOULD

    Actors: User.

    Archives: order archive, product archive.

    The user by starting an application, which accesses the order archive, product archive and through queries obtains the products sold on the selected day, divides them between products in drop shipping and in stock, and displays the report on the screen.

  1. Change email address

    Functional requirement, MUST

    Actors: User.

    Archives: information archive.

    The User can change the present email address as he wishes in the information archive archive.

  2. Activation / Deactivation e-mail service

    Functional requirement, SHOULD

    Actors: User.

    Archives: information archive.

    The User can activate or deactivate the mail service at his convenience.

  1. Use graphic interface within the WordPress backend

    not-functional requirement, MUST

    Actors: User.

    Archives: none.

    The User accesses the plugin settings via a page inserted in the WordPress back-end menu.

Entity - Relationship Model

Data Modeling

E-R model

The Entity Relationship model is a conceptual data model, and provides a series of structures designed to describe reality in an easy-to-understand way, to do this it uses graphic symbols, so that understanding is immediate.

relational schema

The relational schema is a logical model of representation of data on an database.

Relational Schema

Business Logic

The term business logic refers to all the application logic that makes an application operational. Diagrams have been used to describe it, which broadly reproduce the semantics of the UML language, used in Class Diagrams. In the specification:

  • The upper part indicates the Application layer, ie an interface with the methods that allow you to perform the operations described in the functional requirements. In addition, the actor who can use the methods is indicated for each interface.
  • The lower part indicates the Data Layer, or an abstraction of how the data, represented in the Entity / Relationship model, are used by the various methods.

Daily report business logic

Through the “send the daily report” interface, the server can create the daily report, by accessing the entities wp_posts, wp_postmeta wp_woocommerce_order_items and wp_woocommerce_itemmeta, and the same can send the email by accessing the information contained in the entity wp_options.

View past reports business logic

Through the “View past reports” interface, the user can create the report of the previous days, by accessing the entities wp_posts, wp_postmeta, wp_woocommerce_order_items and wp_woocommerce_itemmeta.

Change settings business logic

Through the “Change settings” interface, the user can change the settings such as e-mail address, and activate / deactivate Mail service, by accessing the information contained in the entity wp_options.

Functional requirements implementation

  1. The creaReport( ) function receives a date as input and generates the report of the products sold on that particular day. To do this, through queries I entered into the satabase, and, I could obtain: order ID, product ID into the order, product ID, product name, quantity sold, address, and type of sale. By learning this information, a table is generated.
  2. The inviaMail( ) function, sends the table generated by the creaReport() function to the address of the Database in the ‘DSO_mail’ option only if the ‘DSO_abilita’ option is set to ‘si’.
  3. the modificaMail( ) and attivaServizio( ) functions have been incorporated into the modifica_proprieta.php file, which receives the new values to be entered in the database via the POST method of HTTP and to modify the DPO_mail and DPO_abilita values
Report page
plugin WP backeng page

Graphic interface implementation

In order to meet the non-functional requirement “Use of a graphical interface within the WordPress backend”, a settings page has been implemented within the WordPress backend. To do this, the “Hook” admin_menuwas used, which gives the possibility of inserting a new section into the WP menu. inside it has been inserted an HTML page with 2 forms, to modify the settings of the mail service, and to generate the report.

Installation

The installation is divided into 2 main parts, the first is the classic installation of wordpress plugins, while the second is used to install the daily report sending service via email. In order for the server to execute the PHP file that sends the email, there is a need to configure the Scheduled task, i.e. the Aruba function that allows you to program the launch of applications present within the web space, specifying start times and dates and completion and planning time intervals for the repetition of the task.

Installation on Aruba

Tool used

vsc logo
MAMP

To simulate the server

vsc logo
Visual Studio Code

To code

Language used

PHP logo
PHP
html 5 logo
HTML 5
css 3 logo
CSS 3