Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › New product type saving issue on manage product section.
- This topic has 19 replies, 3 voices, and was last updated 6 years, 1 month ago by WCFM Forum.
- AuthorPosts
- September 19, 2018 at 6:06 am #31989info31Participant
Hello,
I have added new product type “Tickets” programmatically and did code for fetch this tickets product type into the dropdown of dashboard admin -> product manage -> add new product. This tickets product type is variable product. When I was adding tickets product, my product was creating successfully but product type set to simple instead of tickets and variation/attributes not added. So can please guide me how can save product as ticket product. It’s good if you can help me asap for thing.
Thanks in advance!!!
- September 19, 2018 at 7:43 pm #32031WCFM ForumMember
Hi,
I will definitely help you in this.
First of all tell me, are you able to create such product from wp-admin area?
Please be careful when you are creating product type drop-down, product slug specially, is this starts with capital “Tickets”?
Thank You
- September 24, 2018 at 4:38 am #32354info31Participant
Hello,
Yes, I am able to create ticket product from wp-admin area.
I am using below code for new product type “Ticket” and this product type is variable product. Please check and let me asap:
add_filter( ‘wcfm_capability_settings_fields_product_types’, function( $product_types, $handler = ‘wcfm_capability_options’, $wcfm_capability_options = array() ) {
global $WCFM;$tickets = ( isset( $wcfm_capability_options[‘Tickets’] ) ) ? $wcfm_capability_options[‘Tickets’] : ‘no’;
$product_types[“Tickets”] = array(‘label’ => __(‘Tickets’, ‘wc-frontend-manager’) , ‘name’ => $handler . ‘[Tickets]’,’type’ => ‘checkboxoffon’, ‘class’ => ‘wcfm-checkbox wcfm_ele’, ‘value’ => ‘yes’, ‘label_class’ => ‘wcfm_title checkbox_title’, ‘dfvalue’ => $tickets );
return $product_types;
}, 60, 3 );function wcfmcap_is_allow_custom_product_types( $product_types ) {
$wcfm_capability_options = apply_filters( ‘wcfm_capability_options_rules’, get_option( ‘wcfm_capability_options’, array() ) );
$ickets = ( isset( $wcfm_capability_options[‘Tickets’] ) ) ? $wcfm_capability_options[‘Tickets’] : ‘no’;
if( $tickets == ‘yes’ ) unset( $product_types[ ‘Tickets’ ] );
return $product_types;
}
add_filter( ‘wcfm_product_types’, ‘wcfmcap_is_allow_custom_product_types’, 700 );This is urgent for me please check and let me asap.
Thanks in advance!!!
- September 24, 2018 at 11:33 am #32364info31Participant
Hello,
I have checked controller code in the “wcfm-controller-products-manage.php” file and I found that functionality added for particular product types. In plugin, is_variation value set 1 if product_type is variable or variable-subscription. I want to store my variations for custom product type “Ticket” but I am getting any function for do this thing. Will you please guide me that how can I add code for custom product type “Ticket”?
Thanks in advance!!!
- September 24, 2018 at 3:21 pm #32396WCFM ForumMember
Hi,
I know all this code which you have added for WCFM,
But, I am asking for the code, which you have added for creating this new “Product Type” for WooCommerce?
Thank You
- September 25, 2018 at 5:17 am #32478info31ParticipantThis reply has been marked as private.
- September 26, 2018 at 4:15 am #32556info31Participant
Hello,
Any updates?
Thanks in advance.
- September 27, 2018 at 1:05 pm #32657WCFM ForumMember
Hi,
$this->product_type = ‘tickets’; // name of your custom product type
You have used small “t” for creating WC product type then why are using capital “T” for writing WCFM product type code?
Please correct this and take a look.
Thank You
- September 28, 2018 at 10:53 am #32765info31Participant
Hello,
I have did changes as you said but still my “Use as Variation” value not saved into the database. Will you please check.
Thanks in advance.
- September 28, 2018 at 12:17 pm #32774WCFM ForumMember
HI,
First tell me, is product is now saving as “tickets” product type?
Thank You
- October 1, 2018 at 8:39 am #32959info31Participant
Hello,
Yes, product is saving as “tickets” product type. What we need to do for store “Use as Variation” value into the database?
Thanks in advance.
- October 3, 2018 at 4:34 am #33128WCFM ForumMember
Hi,
“product is saving as “tickets” product type”
– That’s great.
“What we need to do for store “Use as Variation” value into the database?”
– i don’t think this is happening from wp-admin area as well!
Thank You
- October 3, 2018 at 8:36 am #33150info31Participant
Hello,
“What we need to do for store “Use as Variation” value into the database?”
– it is working in admin panel. - October 5, 2018 at 4:46 am #33323info31Participant
Hello,
We you please check my issue.
Thanks in advance.
- October 6, 2018 at 11:06 am #33411WCFM ForumMember
Hi,
I am writing that code for you.
Please give me a bit time, I will send you that.Thank You
- October 8, 2018 at 4:12 am #33520info31Participant
Hi,
Any updates?
Thank you
- October 10, 2018 at 4:57 am #33671BingalGuest
Hi,
I have checked your code but unfortunately it’s not for creating a valid “WC Product type” or “Variable Product Type”.
Just showing “variation” product tab using script will not create variable product type for you.
Please go through documentation and correct your code.Here is code for WCFM Product Manager, when you will correct your code this will also working.
First create a perfect variable “tickets” product from wp-admin area and then only it will for WCFM.
function wcfm_1010_custom_product_type( $product_types ) { $product_types[ 'tickets' ] = __( 'Tickets' ); return $product_types; } add_filter( 'wcfm_product_types', 'wcfm_1010_custom_product_type', 500 ); function wcfmcap_is_allow_1010_custom_product_types( $product_types ) { $wcfm_capability_options = apply_filters( 'wcfm_capability_options_rules', get_option( 'wcfm_capability_options', array() ) ); $tickets = ( isset( $wcfm_capability_options['tickets'] ) ) ? $wcfm_capability_options['tickets'] : 'no'; if( $tickets == 'yes' ) unset( $product_types[ 'tickets' ] ); return $product_types; } add_filter( 'wcfm_product_types', 'wcfmcap_is_allow_1010_custom_product_types', 700 ); add_filter( 'wcfm_variable_product_types', function( $variable_product_types ) { $variable_product_types[] = 'tickets'; return $variable_product_types; }, 50 ); add_action( 'after_wcfm_products_manage', function() { ob_start(); ?> $( document.body ).on( 'wcfm_product_type_changed', function() { if( $('#product_type').val() == 'tickets' ) { $('#wcfm_products_manage_form .page_collapsible').addClass('wcfm_head_hide'); $('#wcfm_products_manage_form .wcfm-container').addClass('wcfm_block_hide'); $('.wcfm_ele').addClass('wcfm_ele_hide'); $('.variable').removeClass('wcfm_ele_hide wcfm_block_hide wcfm_head_hide'); } }); setTimeout(function() { if( $('#product_type').val() == 'tickets' ) { $('#wcfm_products_manage_form .page_collapsible').addClass('wcfm_head_hide'); $('#wcfm_products_manage_form .wcfm-container').addClass('wcfm_block_hide'); $('.wcfm_ele').addClass('wcfm_ele_hide'); $('.variable').removeClass('wcfm_ele_hide wcfm_block_hide wcfm_head_hide'); } }, 700); <?php $javascript = ob_get_clean(); wc_enqueue_js( $javascript ); });
Thank You
- October 10, 2018 at 6:49 am #33673info31Participant
Hello,
Sorry but if my code is wrong then why it is saved into the database from admin panel? Even after saved the product, when I checked into the product edit screen. “Tickets” product type is displaying as selected product type into the admin panel.
Thanks in advance.
- October 10, 2018 at 12:34 pm #33713info31Participant
Hello,
Can you please guide me for, How can I override “if( ( $wcfm_products_manage_form_data[‘product_type’] != ‘variable’ ) && ( $wcfm_products_manage_form_data[‘product_type’] != ‘variable-subscription’ ) ) $is_variation = 0;” code into the function.php? because of this condition my variations are not saving into the database for custom product type.
I have tested my code by added into the plugin file and from plugin, my code has worked for variation. But when I tried to add that code into the function file it was not working. I have checked my function file code on “after_wcfm_product_variation_meta_save” and “after_wcfm_products_manage_meta_save” action. Please correct me if I am wrong. It is very urgent for me.
I am waiting for your response.
Thanks in advance.
- October 11, 2018 at 9:55 am #33786WCFM ForumMember
HI,
I think you are not using latest WCFM, can please update this to 5.1.4
“if( ( $wcfm_products_manage_form_data[‘product_type’] != ‘variable’ ) && ( $wcfm_products_manage_form_data[‘product_type’] != ‘variable-subscription’ ) ) $is_variation = 0;” – Where you see such line? There is no such file in WCFM right now!
Between, do you have template override for WCFM Product Manager templates?
Thank You
- AuthorPosts
- The topic ‘New product type saving issue on manage product section.’ is closed to new replies.