These are the Plug in instruction but part would apply to a Hubspot Installation.
Install plugin from zip file (tap-the-web-catalog.zip) and activate.
• Once the plugin is activated, a new setting will become available from Settings > Tap The Web Catalog i.e. https://www.customerdomain.com/wp-admin/options-general.php?page=tap-the-web-catalog
• This settings page has some basic settings. The key thing to enter here is the API key, this is: GOeN64wNGs3q8Bu54N0EDTkRFx1nCJNBAP1gVKMKT6T8oYeomAqBMjfyhSaow4eY
• The API key does 2 things, firstly it is used to authenticate updates and secondly it is used to secure the API requests to the master catalog. So, without this entered correctly, nothing can really happen.
• Once this is entered click the “Save Settings” button. By doing this you should see the new setting appear “Enable Brands” – this setting only becomes available after entering the API key, because it does an API request to get the brands from the master catalog to populate this setting.
• There are 2 other buttons on this page, “Force Sync” which does a force sync from the master catalog to the child site, and “Delete All Products” which does just that.
• After an initial sync has been performed (this can take up to 15 minutes) you will notice all products, manufacturers, classes and types will be automatically populated in the products custom post type on the child site.
• After the settings have been saved, I advise saving the permalinks by going here: https://www.customerdomain.com/wp-admin/options-permalink.php and clicking “Save Changes”, what this does is re-write the permalink cache with our custom post type as otherwise the products may not be visible on the frontend – this is a bit of a weird WordPress quirk.
• The main products page can be viewed here: https://www.customerdomain.com/products/ and the rest of the frontend should be self-explanatory.
Below is the php code that runs the product catalog
<?php /* * Plugin Name: Tap The Web Catalog * Plugin URI: https://www.northernbeacheswebsites.com.au * Description: Performs duties for the child site * Version: 1.4 * Author: Martin Gibson * Developer: Northern Beaches Websites * Developer URI: https://www.northernbeacheswebsites.com.au * Text Domain: tap-the-web-catalog * Support: https://www.northernbeacheswebsites.com.au/contact */ /** * * * * Declare plugin name - we are going to do this as we might change the name later */ function tap_the_web_catalog_plugin_name() { return __('Tap The Web Catalog','tap-the-web-catalog'); } /** * * * * Parent site base URL */ function tap_the_web_catalog_parent_base_url() { return 'https://api.taptheweb.net'; } /** * * * * Gets version number of plugin */ function tap_the_web_catalog_version() { if ( ! function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) ); $plugin_file = basename( ( __FILE__ ) ); return $plugin_folder[$plugin_file]['Version']; } /** * * * * Create custom post type for products */ add_action( 'init', 'tap_the_web_catalog_create_product_post_type', 0 ); function tap_the_web_catalog_create_product_post_type() { // Set UI labels for Custom Post Type $labels = array( 'name' => _x( 'Products', 'Post Type General Name', 'tap-the-web-catalog' ), 'singular_name' => _x( 'Product', 'Post Type Singular Name', 'tap-the-web-catalog' ), 'menu_name' => __( 'Products', 'tap-the-web-catalog' ), 'parent_item_colon' => __( 'Parent Product', 'tap-the-web-catalog' ), 'all_items' => __( 'All Products', 'tap-the-web-catalog' ), 'view_item' => __( 'View Product', 'tap-the-web-catalog' ), 'add_new_item' => __( 'Add New Product', 'tap-the-web-catalog' ), 'add_new' => __( 'Add New', 'tap-the-web-catalog' ), 'edit_item' => __( 'Edit Product', 'tap-the-web-catalog' ), 'update_item' => __( 'Update Product', 'tap-the-web-catalog' ), 'search_items' => __( 'Search Product', 'tap-the-web-catalog' ), 'not_found' => __( 'Not Found', 'tap-the-web-catalog' ), 'not_found_in_trash' => __( 'Not found in Trash', 'tap-the-web-catalog' ), ); // Set other options for Custom Post Type $args = array( 'label' => __( 'Products', 'tap-the-web-catalog' ), 'description' => __( 'Tap The Web Products', 'tap-the-web-catalog' ), 'labels' => $labels, // Features this CPT supports in Post Editor // 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ), 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions','custom-fields'), // You can associate this CPT with a taxonomy or custom taxonomy. 'taxonomies' => array( 'manufacturers', 'classes', 'types' ), /* A hierarchical CPT is like Pages and can have * Parent and child items. A non-hierarchical CPT * is like Posts. */ 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', 'show_in_rest' => true, 'rewrite' => array( 'slug' => 'products' ), //remember to update permalinks if you change!!! ); // Registering your Custom Post Type register_post_type( 'ttw_products', $args ); } /** * * * * Create taxonomies */ add_action( 'init', 'tap_the_web_catalog_create_taxonomies', 0 ); function tap_the_web_catalog_create_taxonomies() { //create labels $labels = array( 'name' => _x( 'Manufacturers', 'taxonomy general name' ), 'singular_name' => _x( 'Manufacturer', 'taxonomy singular name' ), 'search_items' => __( 'Search Manufacturers' ), 'all_items' => __( 'All Manufacturers' ), 'parent_item' => __( 'Parent Manufacturer' ), 'parent_item_colon' => __( 'Parent Manufacturer:' ), 'edit_item' => __( 'Edit Manufacturer' ), 'update_item' => __( 'Update Manufacturer' ), 'add_new_item' => __( 'Add New Manufacturer' ), 'new_item_name' => __( 'New Manufacturer Name' ), 'menu_name' => __( 'Manufacturers' ), ); //Now register the taxonomy register_taxonomy('manufacturers',array('ttw_products'), array( 'hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'publicly_queryable' => true, 'rewrite' => array( 'slug' => 'manufacturer' ), )); //create labels $labels = array( 'name' => _x( 'Classes', 'taxonomy general name' ), 'singular_name' => _x( 'Class', 'taxonomy singular name' ), 'search_items' => __( 'Search Classes' ), 'all_items' => __( 'All Classes' ), 'parent_item' => __( 'Parent Class' ), 'parent_item_colon' => __( 'Parent Class:' ), 'edit_item' => __( 'Edit Class' ), 'update_item' => __( 'Update Class' ), 'add_new_item' => __( 'Add New Class' ), 'new_item_name' => __( 'New Class Name' ), 'menu_name' => __( 'Classes' ), ); //Now register the taxonomy register_taxonomy('classes',array('ttw_products'), array( 'hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'publicly_queryable' => false, 'rewrite' => array( 'slug' => 'class' ), )); //create labels $labels = array( 'name' => _x( 'Types', 'taxonomy general name' ), 'singular_name' => _x( 'Type', 'taxonomy singular name' ), 'search_items' => __( 'Search Types' ), 'all_items' => __( 'All Types' ), 'parent_item' => __( 'Parent Type' ), 'parent_item_colon' => __( 'Parent Type:' ), 'edit_item' => __( 'Edit Type' ), 'update_item' => __( 'Update Type' ), 'add_new_item' => __( 'Add New Type' ), 'new_item_name' => __( 'New Type Name' ), 'menu_name' => __( 'Types' ), ); //Now register the taxonomy register_taxonomy('types',array('ttw_products'), array( 'hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'publicly_queryable' => false, 'rewrite' => array( 'slug' => 'type' ), )); } /** * * * * Create custom cron schedule */ add_filter( 'cron_schedules', 'tap_the_web_catalog_add_weekly' ); function tap_the_web_catalog_add_weekly( $schedules ) { $option_name = 'tap_the_web_catalog_settings'; if(get_option($option_name)){ $option = get_option($option_name); $interval = 604800/$option['syncs-a-week']; } else { $interval = 604800; //i.e. seconds in 7 days } // Adds once weekly to the existing schedules. $schedules['times_per_week'] = array( 'interval' => $interval, 'display' => __( 'Custom Amount of Times per Week' ) ); return $schedules; } /** * * * * Run on plugin active */ register_activation_hook( __FILE__, 'tap_the_web_catalog_activate' ); function tap_the_web_catalog_activate() { //Create plugin setting if it doesn't already exist $option_name = 'tap_the_web_catalog_settings'; if(!get_option($option_name)){ add_option($option_name, array()); } $option_name = 'tap_the_web_catalog_sync_status'; if(!get_option($option_name)){ add_option($option_name, 'NO SYNC'); } //create event if (! wp_next_scheduled ( 'tap_the_web_catalog_scheduled_sync' )) { wp_schedule_event( time(), 'times_per_week', 'tap_the_web_catalog_scheduled_sync' ); } } /** * * * * Adds style and scripts to admin */ add_action( 'admin_enqueue_scripts', 'tap_the_web_catalog_admin_styles_scripts' ); function tap_the_web_catalog_admin_styles_scripts() { //scripts wp_register_script( 'tap_the_web_catalog_admin_script', plugins_url( '/inc/admin-script.js', __FILE__ ), array( 'jquery'),tap_the_web_catalog_version()); wp_register_script('tap_the_web_catalog_sweet_alert_script', plugins_url('/inc/sweetalert2.all.min.js', __FILE__ ), array( 'jquery'),tap_the_web_catalog_version()); //styles wp_register_style( 'tap_the_web_catalog_admin_style', plugins_url( '/inc/admin-style.css', __FILE__ ),array(),tap_the_web_catalog_version()); wp_register_style( 'tap_the_web_catalog_sweet_alert_style', plugins_url( '/inc/sweetalert2.min.css', __FILE__ ),array(),tap_the_web_catalog_version()); } /** * * * * Adds style and scripts to the frontend */ add_action( 'wp_enqueue_scripts', 'tap_the_web_catalog_frontend_styles_scripts' ); function tap_the_web_catalog_frontend_styles_scripts() { //scripts wp_register_script( 'tap_the_web_catalog_frontend_script', plugins_url( '/inc/frontend-script.js', __FILE__ ), array( 'jquery'),tap_the_web_catalog_version()); wp_localize_script('tap_the_web_catalog_frontend_script','update_display', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); //styles wp_register_style( 'tap_the_web_catalog_frontend_style', plugins_url( '/inc/frontend-style.css', __FILE__ ),array(),tap_the_web_catalog_version()); } /** * * * * Make translateable */ add_action('init', 'tap_the_web_catalog_languages'); function tap_the_web_catalog_languages() { load_plugin_textdomain( 'tap-the-web-catalog', false, 'tap-the-web-catalog/inc/languages' ); } /** * * * * Run other files */ require('inc/main-settings.php'); require('inc/data.php'); require('inc/initial-import.php'); require('inc/sync.php'); require('inc/delete-products.php'); require('inc/schedule.php'); require('inc/templates.php'); require('inc/manufacturer-display.php'); require('inc/menu-order.php'); /** * * * * Initialise the update check */ require 'inc/plugin-update-checker/plugin-update-checker.php'; $updateChecker = Puc_v4_Factory::buildUpdateChecker( tap_the_web_catalog_parent_base_url().'/?update_action=get_metadata&update_slug=tap-the-web-catalog', //Metadata URL. __FILE__, //Full path to the main plugin file. 'tap-the-web-catalog' //Plugin slug. Usually it's the same as the name of the directory. ); /** * * * * Add queries to the update call */ $updateChecker->addQueryArgFilter('tap_the_web_catalog_filter_update_checks'); function tap_the_web_catalog_filter_update_checks($queryArgs) { $option_name = 'tap_the_web_catalog_settings'; if(get_option($option_name)){ $option = get_option($option_name); if(array_key_exists('api-key',$option) && strlen($option['api-key'])>0){ $queryArgs['api-key'] = $option['api-key']; } } return $queryArgs; } /** * * * * Set the transient to check for updates */ function tap_the_web_catalog_filter_puc_request_info_result_slug( $plugininfo, $result ) { //get the message from the server and set as transient if(!is_null($plugininfo)){ set_transient('tap-the-web-catalog-update',$plugininfo->{'message'},YEAR_IN_SECONDS * 1); } return $plugininfo; }; add_filter( "puc_request_info_result-tap-the-web-catalog", 'tap_the_web_catalog_filter_puc_request_info_result_slug', 10, 2 ); /** * * * * Show message underneath plugin */ $path = plugin_basename( __FILE__ ); add_action("after_plugin_row_{$path}", function( $plugin_file, $plugin_data, $status ) { //get transient $message = get_transient('tap-the-web-catalog-update'); // var_dump($message); if($message !== 'Yes'){ $display_message = __('Make sure you enter a valid API key in the plugin settings to receive updates.','tap-the-web-catalog'); echo '<tr class="plugin-update-tr active"><td colspan="3" class="plugin-update colspanchange"><div class="update-message notice inline notice-error notice-alt"><p class="installer-q-icon">'.$display_message.'</p></div></td></tr>'; } }, 10, 3 ); ?>