Namespace \PlusBusinessSoftware\King
Bestand: Plus_King_Artikel.php
/**
* Since empty fields are not sent in the King XML, we might use alternative strings to indicate an empty field.
* By adding a filter here, we can change the received value
*
* @filter plus_before_freefield_processing.
* @param mixed $value The value of the vrijerubriek.
* @param string $rubrieknaam The name of the vrijerubriek. (Case sensitive)
* @param string $woo_function The name of the function in WooCommerce.
* @param WC_Product $product A reference to the WC_Product object.
* @return mixed The value of the vrijerubriek.
*/
$value = apply_filters( 'plus_before_freefield_processing', $value, $rubrieknaam, $woo_function, $product );
/**
* Allow manipulation of the category IDs.
* This can be useful when categories have been imported from an older webshop and contain the old ID's in the metadata.
*
* @filter plus_product_category_ids.
* @param array $value An array of category IDs.
* @param WC_Product $product A reference to the WC_Product object.
* @return array An array of category IDs.
*/
$value = apply_filters( 'plus_product_category_ids', $value, $product );
/**
* @filter plus_vr_value_is_notify
* @param bool $is_notify True if the value corresponds with a value that translates to 'allow backorder, but notify customer', else FALSE.
* @param mixed $value The value from the vrijerubriek in King.
* @return bool True if the value corresponds with a value that translates to 'allow backorder, but notify customer', else FALSE.
*/
$is_notify = trim( $value ) == 'notify' ? true : false;
$is_notify = apply_filters( 'plus_vr_value_is_notify', $is_notify, $value );
/**
* @filter plus_vr_value_is_no
* @param bool $is_no True if the value corresponds with a value that translates to 'do not allow backorders', else FALSE.
* @param mixed $value The value from the vrijerubriek in King.
* @return bool True if the value corresponds with a value that translates to 'do not allow backorders', else FALSE.
*/
$is_no = trim( $value ) == 'no' ? true : false;
$is_no = apply_filters( 'plus_vr_value_is_no', $is_no, $value );
/**
* @filter plus_vr_value_is_yes
* @param bool $is_yes True if the value corresponds with a value that translates to 'allow backorders', else FALSE.
* @param mixed $value The value from the vrijerubriek in King.
* @return bool True if the value corresponds with a value that translates to 'allow backorders', else FALSE.
*/
$is_yes = trim( $value ) == 'yes' ? true : false;
$is_yes = apply_filters( 'plus_vr_value_is_yes', $is_yes, $value );
/**
* @filter plus_vr_value_is_instock
* @param bool $is_instock True if the value corresponds with a value that translates to 'in stock', else FALSE.
* @param mixed $value The value from the vrijerubriek in King.
* @return bool True if the value corresponds with a value that translates to 'in stock', else FALSE.
*/
$is_instock = trim( $value ) == 'instock' ? true : false;
$is_instock = apply_filters( 'plus_vr_value_is_instock', $is_instock, $value );
/**
* @filter plus_vr_value_is_outofstock
* @param bool $is_outofstock True if the value corresponds with a value that translates to 'out of stock', else FALSE.
* @param mixed $value The value from the vrijerubriek in King.
* @return bool True if the value corresponds with a value that translates to 'out of stock', else FALSE.
*/
$is_outofstock = trim( $value ) == 'outofstock' ? true : false;
$is_outofstock = apply_filters( 'plus_vr_value_is_outofstock', $is_outofstock, $value );
/**
* @filter plus_vr_value_is_onbackorder
* @param bool $onbackorder True if the value corresponds with a value that translates to 'on backorder', else FALSE.
* @param mixed $value The value from the vrijerubriek in King.
* @return bool True if the value corresponds with a value that translates to 'on backorder', else FALSE.
*/
$onbackorder = trim( $value ) == 'onbackorder' ? true : false;
$onbackorder = apply_filters( 'plus_vr_value_is_onbackorder', $onbackorder, $value );
/**
* @filter plus_default_product_status
* @param string The default product status.
* @param WC_Product $product A reference to the WC_Product object
* @return string The default product status.
*/
$product_status = apply_filters( 'plus_default_product_status', 'publish', $product );
$product->set_status( $product_status );
/**
* @filter plus_vr_value_product_status
* @param string $product_status The product status. Common values are: draft, pending, private and publish.
* @param string $value The value from the vrijerubriek in King.
* @return string The product status.
*/
$product_status = trim( strtolower( $value ) );
$product_status = apply_filters( 'plus_vr_value_product_status', $product_status, $value );
/**
* @filter plus_vr_value_product_visibility
* @param string $product_visibility The product visibility. Common values are: visible, catalog, search and hidden.
* @param string $value The value from the vrijerubriek in King.
* @return string The product visibility.
*/
$product_visibility = trim( strtolower( $value ) );
$product_visibility = apply_filters( 'plus_vr_value_product_visibility', $product_visibility, $value );
/**
* When adding taxonomy terms to a product we can encounter hierarchical structures like categories.
* If we want to add the product to the provided taxonomy term, we can also decide to add it to the terms ancestors.
*
* @filter plus_artikelen_add_to_parent_properties
* @param bool Wether or not to add all ancestors of a taxonomy term to a product.
* @param string $taxonomy The name of the taxonomy.
* @return bool Wether or not to add all ancestors of a taxonomy term to a product.
*/
$add_to_parent_properties = apply_filters( 'plus_artikelen_add_to_parent_properties', false, $taxonomy );
/**
* @filter woocommerce_taxonomy_objects_[$taxonomy_name]
* @param array|string Object type or array of object types with which the taxonomy should be associated.
* @return array|string Object type or array of object types with which the taxonomy should be associated.
*/
$object_type = apply_filters( 'woocommerce_taxonomy_objects_' . $taxonomy_name, array( 'product' ) );
/**
* @filter woocommerce_taxonomy_args_[$taxonomy_name]
* @param array|string Array or query string of arguments for registering a taxonomy.
* @return array|string Array or query string of arguments for registering a taxonomy.
*/
$args = apply_filters(
'woocommerce_taxonomy_args_' . $taxonomy_name,
array(
'labels' => array(
'name' => $raw_name,
),
'hierarchical' => false,
'show_ui' => false,
'query_var' => true,
'rewrite' => false,
)
);
/**
* Allow filtering to manipulate taalcodes
*
* @filter plus_pre_languagecodes_product_properties
* @param \PlusBusinessSoftware\King\Plus_King_Artikel_Object $artikel_obj An Artikel_Object instance.
* @param array $settings An array of settings.
* @param WC_Product $product An instance of the WC_Product.
* @return \PlusBusinessSoftware\King\Plus_King_Artikel_Object An Artikel_Object instance.
*/
$artikel_obj = apply_filters( 'plus_pre_languagecodes_product_properties', $artikel_obj, $settings, $product );
/**
* Allow filtering to manipulate vrije rubrieken
*
* @filter plus_pre_freefield_product_properties
* @param \PlusBusinessSoftware\King\Plus_King_Artikel_Object $artikel_obj An Artikel_Object instance.
* @param array $settings An array of settings.
* @param WC_Product $product An instance of the WC_Product.
* @return \PlusBusinessSoftware\King\Plus_King_Artikel_Object An Artikel_Object instance.
*/
$artikel_obj = apply_filters( 'plus_pre_freefield_product_properties', $artikel_obj, $settings, $product );
/**
* Allow product manipulation after taalcodes and vrijerubrieken have been processed.
*
* @filter plus_after_freefield_product_properties
* @param WC_Product $product An instance of the WC_Product.
* @param \PlusBusinessSoftware\King\Plus_King_Artikel_Object $artikel_obj An Artikel_Object instance.
* @param array $settings An array of settings.
* @return WC_Product $product An instance of the WC_Product.
*/
$product = apply_filters( 'plus_after_freefield_product_properties', $product, $artikel_obj, $settings );
/**
* Force catalog mode if the product has been blocked for sales.
* This filter allows overriding of this feature.
*
* @filter plus_sales_block_force_catalog_mode
* @param bool $force_catalog_mode TRUE if the product should not be purchasable, FALSE otherwise.
* @param WC_Product $product An instance of the WC_Product.
* @param \PlusBusinessSoftware\King\Plus_King_Artikel_Object $artikel_obj An Artikel_Object instance.
* @return bool TRUE if the product should not be purchasable, FALSE otherwise.
*/
$force_catalog_mode = apply_filters( 'plus_sales_block_force_catalog_mode', $force_catalog_mode, $product, $artikel_obj );
/**
* Allow skipping of articles.
*
* @filter plus_king_artikel_sync_skip_add_update
* @param bool TRUE if the product should be skipped. FALSE otherwise.
* @param \PlusBusinessSoftware\King\Plus_King_Artikel_Object $this_artikel_obj An Artikel_Object instance.
* @return bool TRUE if the product should be skipped. FALSE otherwise.
*/
$skip_article = apply_filters( 'plus_king_artikel_sync_skip_add_update', false, $this_artikel_obj );
/**
* Allow manipulation of the vrije rubriek value before checking.
* This means we can turn a 'Ja' into a boolean 'true' for example.
*
* @filter plus_product_type_check_vrijerubriek_value
* @param mixed $vr_value The value in the vrije rubriek as sent to us by King.
* @param string $field_name The name of the vrije rubriek in King.
* @param string $woo_func The internal name of the function this field has in WooCommerce.
*/
$vr_value = apply_filters( 'plus_product_type_check_vrijerubriek_value', $vr_value, $field_name, $woo_func );