Added documentation to methods
This commit is contained in:
@@ -27,10 +27,16 @@ function construct_template_products_class() {
|
||||
return 'wiaastemplate';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template categories from template product meta
|
||||
*
|
||||
* @param $template_id integer
|
||||
* @param $template_category_slug string the name of the main wiaas category
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_template_categories_from_meta($template_id, $template_category_slug) {
|
||||
|
||||
return get_post_meta($template_id, $template_category_slug, true);
|
||||
|
||||
}
|
||||
|
||||
public static function extract_template_product_categories($category_meta) {
|
||||
@@ -60,6 +66,12 @@ function construct_template_products_class() {
|
||||
return empty($category_objects) ? null : $category_objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template categories from bundled products items
|
||||
*
|
||||
* @param $bundled_items array
|
||||
* @return array
|
||||
*/
|
||||
public static function extract_bundled_product_categories($bundled_items) {
|
||||
|
||||
$template_category_objects = array();
|
||||
@@ -89,6 +101,13 @@ function construct_template_products_class() {
|
||||
return $template_category_objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save selected template to bundled product meta
|
||||
*
|
||||
* @param $selected_template integer
|
||||
* @param $post_id integer
|
||||
*/
|
||||
|
||||
public static function bind_selected_template_to_product($selected_template, $post_id) {
|
||||
if (!empty($selected_template))
|
||||
update_post_meta($post_id, '_select_template', esc_attr($selected_template));
|
||||
@@ -97,6 +116,14 @@ function construct_template_products_class() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save template categories to template product meta
|
||||
*
|
||||
* @param $post_id integer
|
||||
* @param $option string a main wiaas category
|
||||
* @param $processed_template_data array actual template category data
|
||||
*/
|
||||
|
||||
public static function save_template_product_meta($post_id, $option, $processed_template_data) {
|
||||
|
||||
update_post_meta($post_id, '_template_items_' . $option, $processed_template_data);
|
||||
|
||||
Reference in New Issue
Block a user