Skip to content

Jeroen's Project Notes

JeroenSormani edited this page Jul 25, 2014 · 2 revisions

Using the plugin

  1. Copy the folder 'woocommerce-availability-chart' to your wp-content/plugins/ to install it within WordPress.
  2. Go to your website's admin and go to the 'plugins' page.
  3. Click on 'Activate' at the WooCommerce Availability Chart plugin.

Activate charts on products

  1. Open an variable product.
  2. Scroll down to the 'Product data' tab.
  3. Under the 'general' tab you will find a checkbox 'Availability chart', enable this.
  4. Save your product view the chart up front.
  • You can also use the bulk or quick edit function within WooCommerce to enable Availability charts.*

Changing color scheme

Add the following CSS code to your style.css of your (child) theme: .bar { background-color: #ddd; } .filled { background: #70BAFD; } You can change the colors to any color you want.

Plugin Structure

I've chosen for one of my regular plugin structures.

  • Main file
  • Other required files (like readme, screenshots)
    • assets/
      • css/
        • stylesheet.css
  • admin/

All required files that are in the main folder are there, other files are grouped in other folders. (admin is usually of the time divided under the 'includes' map)

Classes

I used classes because I find that they give a good structure to your code and is better readable vs. regular functions.

The class names are descriptive of what you can expect whats in the file.

There are four classes

  • Woocommerce_Availability_Chart
  • WAC_Admin
  • WAC_Admin_Bulk_Edit
  • WAC_Admin_Quick_Edit

I separated the Bulk and Quick Edit from the regular Admin class to provide better readability of the code.

Coding standards

All code has been written in compliance with the WordPress coding standards to the best of my knowledge.