wcfm-santa

A deal you can't resist! Get upto 35% Off on this entire cyber week.

CLAIM OFFER
02Day 11Hr 31Min 33Sec
wcfm-santa

Product Custom Validation not working with snippet

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 – Ultimate Product Custom Validation not working with snippet

Viewing 5 reply threads
  • Author
    Posts
    • #130305
      Henriette
      Participant

      Hi,
      On Admin Dashboard in Product Custom validation I made required:
      Price
      Featured Image
      Categories

      But when vendor adds a product without filling in any fields only error messages are showing for:
      Price
      Product Title
      Featured Image

      The category part has a required asterix but vendor can still add product without choosing a category.
      I think this is because of a snippet I used from this forum to restrict vendor to add a product in the main category (which works very well by the way).
      When I remove the snippet from my child theme’s functions.php the message of required category is visible when vendor tries to publish his product.

      The snippet I used:

      // Main category restriction
      
      function wcfm_pm_custom_script( $end_point ) {
      	switch( $end_point ) {
      		case 'wcfm-products-manage':
      			?>
      			<script>
      			jQuery(document).ready(function($) {
      				$('#product_cats_checklist').children('.product_cats_checklist_item').each(function() {
      					if( $(this).children('.product_taxonomy_sub_checklist').length > 0 ) {
      					  $(this).children('label').children('input').addClass('wcfm_custom_hide');
      					}
      				});
      			});
      			</script>
      		<?php
      		break;
        }
      }
      add_action( 'after_wcfm_load_views', 'wcfm_pm_custom_script' );

      Is there any way I can keep this snippet but with the required category choosing message when vendor forgets to pick a category?

      Thank you!

    • #131386
      Henriette
      Participant

      Anyone?

      • #131506
        Sushobhan
        Keymaster
        This reply has been marked as private.
    • #131503
      Sushobhan
      Keymaster

      Hi,
      Please use the following snippet-

      function wcfm_pm_custom_script( $end_point ) {
      	switch( $end_point ) {
      		case 'wcfm-products-manage':
      			?>
      			<script>
      			jQuery(document).ready(function($) {
      				$('#product_cats_checklist').children('.product_cats_checklist_item').each(function() {
      					if( $(this).children('.product_taxonomy_sub_checklist').length > 0 ) {
      					  $(this).children('label').children('input').hide();
      					}
      				});
      			});
      			</script>
      		<?php
      		break;
        }
      }
      add_action( 'after_wcfm_load_views', 'wcfm_pm_custom_script' );

      Add this code to your child themes functions.php
      Thank You!

      • #132661
        Henriette
        Participant

        Hi Sushobhan,
        thank you for your patience.
        Unfortunately this snippet breaks my site.

        • #132698
          Sushobhan
          Keymaster

          Sorry about that 🙁
          Provide me some details, maybe a snapshot to understand this better. The script only runs on the Product Editing page so other pages of the site should not be affected.
          Let me know.
          Thank You!

          • #132710
            Henriette
            Participant

            Please don’t be sorry, no need to.
            Now first code breaks my site too. Before the update it was working fine.
            At least for the main category restriction.
            So I can not give you screendumps of vendor product page.

            I don’t know if it works to give you vendor access in private post so you can see it in your mailbox and than I remove the credentials in post again.
            I will try okay?

            Meanwhile, here are printscreens of the snippets and the error message on my site in attachments.

            Attachments:
            You must be logged in to view attached files.
            • #132715
              Henriette
              Participant
              This reply has been marked as private.
            • #132747
              Sushobhan
              Keymaster
              This reply has been marked as private.
              • #132904
                Henriette
                Participant
                This reply has been marked as private.
                • #132910
                  Sushobhan
                  Keymaster
                  This reply has been marked as private.
                  • #132913
                    Henriette
                    Participant
                    This reply has been marked as private.
                    • #134645
                      Henriette
                      Participant
                      This reply has been marked as private.
                      • #134765
                        Sushobhan
                        Keymaster
                        This reply has been marked as private.
                      • #135848
                        Henriette
                        Participant
                        This reply has been marked as private.
                      • #135871
                        Sushobhan
                        Keymaster
                        This reply has been marked as private.
    • #131642
      Henriette
      Participant

      Hope you don’t mind

      I certainly don’t. Thank you very much.

    • #132407
      Henriette
      Participant

      Request to keep this topic open.
      Not solved yet but first I’m busy on fixing many emails to customer as described in another topic.
      Thank you.

    • #132738
      Sushobhan
      Keymaster

      Hi,
      I don’t think the problem is due to this code snippet. Remember earlier how a single bracket was causing trouble to your functions.php, I think it’s a similar issue. Have you changed anything in your functions.php recently? If possible please switch to Code Snippet plugin. That option is much easier to handle.
      Thank You.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.