Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1440515

    Error /var/www/vhosts/domain.com/httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061′

    We get constant PHP warnings and increased server load due to these warnings. Can you support in providing a fix for this. I am unsure why this happens but it seems to be an issue.

    Thanks,
    El

    #1440522

    This line:

    
    $output .=			"<li><span class='currently-selected'>" . __( 'Sort by', 'avia_framework' ) . " <strong>{$product_order[$po_key]}</strong></span>";

    The only thing we do is to create our own list of sorting options in the child functions.php according to your recommendations (here https://kriesi.at/support/topic/store-sort-by-options-woocommerce/):

    
    /* 	Edit WooCommerce dropdown menu item of shop page
     	Options: menu_order, popularity, rating, date, price, price-desc */
    function my_woocommerce_catalog_orderby( $orderby ) {
    	
    	//check if we already did the resorting, otherwise skip it
    	if(isset($orderby["menu_order"]))
    	{
    		$orderby = str_replace("Default", "Recommended", $orderby);
    		$orderby = str_replace("Popularity (sales)", "Topseller", $orderby);
    		unset($orderby["menu_order"]);
    		unset($orderby["rating"]);
    		unset($orderby["date"]);
    		unset($orderby["relevance"]);
    		unset($orderby["rand"]);
    		unset($orderby["id"]);
        }
        
        return $orderby;
    }
    add_filter( "avf_wc_product_order_dropdown_frontend", "my_woocommerce_catalog_orderby", 20 );
    ---

    Something is not working right with the base theme it seems.

    • This reply was modified 6 months, 4 weeks ago by Yigit. Reason: To wrap the code in the Code tag
    #1440550

    Hi,

    Thank you for the inquiry.

    These lines are not valid because $orderby is an array, not a string.

    $orderby = str_replace("Default", "Recommended", $orderby);
    $orderby = str_replace("Popularity (sales)", "Topseller", $orderby);
    

    If you need to replace the labels of the sort items, please replace these lines with:

    $orderby["default"] = __( 'Recommended', 'avia_framework' );
     $orderby['popularity']	= __( 'Topseller', 'avia_framework' );
    

    Best regards,
    Ismael

    #1440564

    Appreciated. But that does not change the errors in the actual enfold files even if we comment all this out. There is some bug right in the Enfold WooCommerce filters itself:

    2024-04-23 07:33:39 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “rand” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 07:36:36 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “date” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 07:39:34 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “id” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 07:45:17 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “date” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 07:46:30 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “id” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 07:54:38 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “date” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 07:57:18 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “relevance” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 08:03:49 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “date” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 08:13:30 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “date” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’ Apache-Fehler
    2024-04-23 08:16:28 Warning AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “relevance” in /httpdocs/wp-content/themes/enfold/config-woocommerce/config.php on line 2061’

    #1440566

    Hi,

    Thank you for the update.

    What happens when you remove this condition?

    if(isset($orderby["menu_order"]))
    {
    .. more code here
    }
    

    Please post the WP and S/FTP login details in the private field so that we can check the issue properly. .

    Best regards,
    Ismael

    #1440573

    I found the issue. We get quite a lot of spam traffic and you do not check if the order types are even available.

    These spammers will hammer through all types of sorting and combinations if we have them or not:
    https://drive.google.com/file/d/1-vMxNlQ80lziJ76Ps7RPkZX9-oZA6511/view?usp=sharing

    Would be cool if you could test for validity first. Otherwise we try to intercept those calls but it is not a very generic solution.

    #1440655

    Hi,

    Thank you for the info.

    and you do not check if the order types are even available.

    What do you mean? The theme doesn’t really alter how WooCommerce sorts the products. We only added a function that renders a filter dropdown with more options, but the query is still handled by WooCommerce. You might want to install a security plugin if the site is experiencing traffic issues because of spammers.

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.