AR Model Viewer for WooCommerce

Ar_Model_Viewer_For_Woocommerce_Admin_Settings

The admin-specific functionality in Settings of the plugin.

Defines the plugin name, version, and two hooks to enqueue the admin-facing stylesheet and JavaScript.

Tags
subpackage

Ar_Model_Viewer_For_Woocommerce/admin

author

Manuel Ramirez Coronel ra_cm@outlook.com

Table of Contents

Properties

$logger  : object
The variable to call WooCommerce class logger.
$plugin_name  : string
The ID of this plugin.
$plugin_prefix  : string
The unique prefix of this plugin.
$version  : string
The version of this plugin.

Methods

__construct()  : mixed
Initialize the class and set its properties.
ar_model_viewer_for_woocommerce_cmb2_after_row()  : mixed
ar_model_viewer_for_woocommerce_cmb2_settings()  : mixed
Define the metabox and field configurations.
ar_model_viewer_for_woocommerce_get_model_preview_with_global_settings()  : void
Handles the retrieval of 3D model settings and product details via AJAX request.
ar_model_viewer_for_woocommerce_get_model_to_preview_in_settings()  : mixed
get_model_3d_file_or_fallback()  : string
Retrieves the 3D model file for the product or falls back to a default file.
get_ar_model_viewer_settings()  : array<string|int, mixed>
Retrieves AR model viewer settings from the options page.
get_model_poster_or_fallback()  : string
Retrieves the 3D model poster URL or falls back to the default placeholder image.

Properties

Methods

__construct()

Initialize the class and set its properties.

public __construct(string $plugin_name, string $plugin_prefix, string $version) : mixed
Parameters
$plugin_name : string

The name of this plugin.

$plugin_prefix : string

The unique prefix of this plugin.

$version : string

The version of this plugin.

Tags
since
1.0.0

ar_model_viewer_for_woocommerce_get_model_preview_with_global_settings()

Handles the retrieval of 3D model settings and product details via AJAX request.

public ar_model_viewer_for_woocommerce_get_model_preview_with_global_settings() : void

This function is triggered by an AJAX request to get the 3D model settings and product details. It verifies the validity of the product ID, retrieves global settings, and prepares the data for response.

Tags
since
1.0.0

get_model_3d_file_or_fallback()

Retrieves the 3D model file for the product or falls back to a default file.

public get_model_3d_file_or_fallback() : string

This function tries to get the 3D model file URL for a product. If the 3D model file is not available, it returns a default model file located in the 'admin/models/' directory. If the model file cannot be retrieved, it logs an error using the WooCommerce logger.

Tags
since
1.0.0
Return values
string

The URL of the 3D model file or an empty string if the file is missing.

get_ar_model_viewer_settings()

Retrieves AR model viewer settings from the options page.

private get_ar_model_viewer_settings() : array<string|int, mixed>

This function gets the AR model viewer settings configured in the options page using CMB2.

Tags
since
1.0.0
Return values
array<string|int, mixed>

An array of AR model viewer settings.

get_model_poster_or_fallback()

Retrieves the 3D model poster URL or falls back to the default placeholder image.

private get_model_poster_or_fallback() : string

This function is designed to retrieve the URL of the 3D model poster image. If the poster image is not found or doesn't exist, it returns a default placeholder image instead. In case there is an issue retrieving the image, the function logs an error using the WooCommerce logger.

Tags
since
1.0.0
Return values
string

The URL of the poster image or the fallback placeholder image.


        
On this page

Search results