New product type saving issue on manage product section.

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM New product type saving issue on manage product section.

Viewing 19 reply threads
  • Author
    Posts
    • #31989
      info31
      Participant

      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!!!

    • #32031
      WCFM Forum
      Member

      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

    • #32354
      info31
      Participant

      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!!!

    • #32364
      info31
      Participant

      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!!!

    • #32396
      WCFM Forum
      Member

      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

    • #32478
      info31
      Participant
      This reply has been marked as private.
    • #32556
      info31
      Participant

      Hello,

      Any updates?

      Thanks in advance.

    • #32657
      WCFM Forum
      Member

      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

    • #32765
      info31
      Participant

      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.

    • #32774
      WCFM Forum
      Member

      HI,

      First tell me, is product is now saving as “tickets” product type?

      Thank You

    • #32959
      info31
      Participant

      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.

    • #33128
      WCFM Forum
      Member

      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

    • #33150
      info31
      Participant

      Hello,

      “What we need to do for store “Use as Variation” value into the database?”
      – it is working in admin panel.

    • #33323
      info31
      Participant

      Hello,

      We you please check my issue.

      Thanks in advance.

    • #33411
      WCFM Forum
      Member

      Hi,

      I am writing that code for you.
      Please give me a bit time, I will send you that.

      Thank You

    • #33520
      info31
      Participant

      Hi,

      Any updates?

      Thank you

    • #33671
      Bingal
      Guest

      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

    • #33673
      info31
      Participant

      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.

    • #33713
      info31
      Participant

      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.

    • #33786
      WCFM Forum
      Member

      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

Viewing 19 reply threads
  • The topic ‘New product type saving issue on manage product section.’ is closed to new replies.