Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #513388

    Hi!

    I’m using Woocommerce Product Filter plugin, everything works fine with the theme, just there’s one thing that keeps like “pending” for being fully integrated. I need to configure the config.php file inside config-woocommerce folder, but is there any way to make this permanent? (Like using a code in functions.php to avoid being override everytime when Enfold is updated, or load addtional code from the config.php in the Child theme folder).

    Thank you.

    PS. So to have the complete information (maybe it can give you some background) to the plugin to work I need to do the next things:

    To insert the Product Filter template locate the avia_woocommerce_before_shop_loop() function. After the main wrapper insert the Product Filter action. The function should then look something like this

        add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop', 1);
    
        function avia_woocommerce_before_shop_loop()
        {
    
        	global $avia_config;
        	if(isset($avia_config['dynamic_template'])) return;
        	$markup = avia_markup_helper(array('context' => 'content','echo'=>false,'post_type'=>'products'));
        	echo "<main class='template-shop content ".avia_layout_class( 'content' , false)." units' $markup><div class='entry-content-wrapper'>";
        	do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */
        }

    Now, in order to disable the deafult Enfold product filter you should locate the avia_woocommerce_frontend_search_params() function and remove the action for inserting this bit of code. The first lines of this function should look like this

        if(!function_exists('avia_woocommerce_frontend_search_params'))
        {
        	//add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20);
    
        	function avia_woocommerce_frontend_search_params()
        	{

    The two // chars comment the line and the action for inserting the Enfold product filter. Now save your file and the filter will be available on your shop and product archive pages.

    #513626

    Hi C-LabMX!

    Thank you for using Enfold.

    You can try this in the functions.php file:

    remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop', 1);
    remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20);
    
    add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop_mod', 1);
    
    function avia_woocommerce_before_shop_loop_mod()
    {
    	global $avia_config;
    	if(isset($avia_config['dynamic_template'])) return;
    	$markup = avia_markup_helper(array('context' => 'content','echo'=>false,'post_type'=>'products'));
    	echo "<main class='template-shop content ".avia_layout_class( 'content' , false)." units' $markup><div class='entry-content-wrapper'>";
    	do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */
    }

    Cheers!
    Ismael

    #514107

    Hi Ismael!

    Thank you! Just one little thing, with that code the footer had some changes in color, for example the titles went gray, the links blue, and white line appeared. This just happens in the pages where the product filter is visible.

    Using the code directly in the config.php didn’t had this effect.

    Any ideas?

    #514274

    Hey!

    Did you remove the previous modifications after adding the code? It doesn’t affect the footer on my installation.

    Best regards,
    Ismael

    #514494

    Hi Ismael!

    Yes, that was the first thing I did. Already tried erasing the cache without success and visiting the site from Incognito mode. You see correctly the links? (In white color)

    #514994

    Hi!

    What happens when you remove this line of code?

    do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */
    

    I know it will remove the new filter. Is the footer OK when you remove that line?

    Cheers!
    Ismael

    #517027

    Hi Ismael!

    The footer keeps the same when removing that line, sorry for the delay.

    Any ideas?

    PS. Removing the whole function avia_woocommerce_before_shop_loop_mod() the footer returned to its usual design.

    • This reply was modified 9 years ago by odmv.
    #521438

    Hey!

    Sorry for the delay. Please try to replace the code with this:

    remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop', 1);
    remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20);
    remove_action( 'woocommerce_after_shop_loop', 'avia_woocommerce_after_shop_loop', 10);
    
    add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop_mod', 1);
    
    function avia_woocommerce_before_shop_loop_mod()
    {
    	global $avia_config;
    	if(isset($avia_config['dynamic_template'])) return;
    	$markup = avia_markup_helper(array('context' => 'content','echo'=>false,'post_type'=>'products'));
    	echo "<main class='template-shop content ".avia_layout_class( 'content' , false)." units' $markup><div class='entry-content-wrapper'>";
    	do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */
    }
    
    #
    # closes the avia framework content container arround the shop loop
    #
    
    add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_after_shop_loop_mod', 1);
    function avia_woocommerce_after_shop_loop_mod()
    {
    			global $avia_config;
    			if(isset($avia_config['dynamic_template'])) return;
    			if(isset($avia_config['overview'] )) echo avia_pagination('', 'nav');
    			echo "</main>"; //end content
    }
    

    Regards,
    Ismael

    #522201

    Thank you Ismael! Just made two small changes and now works great (the default filter wasn’t hidding for a strange reason and there was an extra pagination at the top).

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Child theme’ is closed to new replies.