Forum Replies Created

Viewing 15 replies - 106 through 120 (of 146 total)
  • Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ankur Prem OK +1

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ankur Perm the problem does not happens on my local server , it may be my server only , but I’ve could you please do the following and tell me if that helped :

    from polylang settings page disable the following options :

    Detect browser language
    Hide URL language information for default language

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ankur Prem I am afraid you are write , it is not a complete solution and some extra works need to be done here , the problem with search query in general I will try to solve this tomorrow.

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    You are welcome and thank for your support

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    Thanks for support

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ankur Prem I belive the Search By Product tag – for Woocommerce plugin is your problem here , cause it modifies the search query , please try the solution first , to see if it worked for you

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ankur Prem I think I’ve got your point here , so let’s break it up :

    1 – woocommerce search widget

    The widget uses the wordpress functions to display products and that’s what allowed polylang to display the correct products according to active langauge , and that’s what we expect , so as you said It is OK

    2 – Search By Product tag – for Woocommerce plugin

    I’ve just installed the plugin and made some tests , as it seems the plugin is using its own query to achive its goal , here is a snippet :

    $query = "
                select p.ID as post_id from $wpdb->terms t
                join $wpdb->term_taxonomy tt
                on t.term_id = tt.term_id
                join $wpdb->term_relationships tr
                on tt.term_taxonomy_id = tr.term_taxonomy_id
                join $wpdb->posts p
                on p.ID = tr.object_id
                join $wpdb->postmeta visibility
                on p.ID = visibility.post_id
                and visibility.meta_key = '_visibility'
                and visibility.meta_value <> 'hidden'
                ";

    thats make it impossible for polylang or WooPoly to to correct the results plus it does not provider any filter for its query to add support ,

    But guess what I still have the solution but you have add a two or three lines to the plugin , here is the modified version :

    <?php
    
    /*
      Plugin Name: Search By Product tag - for Woocommerce
      Plugin URI: https://www.mattyl.co.uk/2012/12/14/woocommerce-wordpress-plugin-to-search-for-products-by-tag/
      Description: The search functionality in woocommerce doesn't search by product tags by default. This simple plugin adds this functionality to both the admin site and regular search
      Author: Matthew Lawson
      Version: 0.3.1
      Author URI: https://www.mattyl.co.uk/
     */
    
    add_filter('the_posts', 'search_by_product_tag');
    
    function search_by_product_tag($posts, $query = false) {
        if (is_search()) {
            //get_search_query does sanitization
    
            $tags = explode(',', get_search_query());
            //var_dump($tags);
            foreach($tags as $tag)
            {
                //Ignore already found posts from query..
                $ignoreIds = array(0);
                foreach($posts as $post)
                {
                    $ignoreIds[] = $post->ID;
                }
    
                $matchedTags = get_post_by_tag(trim($tag), $ignoreIds);
                //var_dump($ignoreIds,$matchedTags);
                //die();
                if ($matchedTags)
                {
                    foreach($matchedTags as $product_id)
                    {
                        $posts[] = get_post($product_id->post_id);
                    }
    
                }
            }
    
            //var_dump($posts);
            return $posts;
        }
    
        return $posts;
    }
    
    function get_post_by_tag($tag, $ignoreIds) {
        //Check for
        global $wpdb, $wp_query;
    
        //$ordering_args = WC()->query->get_catalog_ordering_args( $orderby, $order );
    
        /**
         * Special code for removing duplicates if WPML plugin is installed
         * Its popular translation plugin that causes lots of product duplicate products that have different product ids
         * We need to check the wpml meta data of the product to work out the duplicates
         */
    
        $wmplEnabled = false;
    
        if(defined('WPML_TM_VERSION') && defined('WPML_ST_VERSION') && class_exists("woocommerce_wpml")){
            $wmplEnabled = true;
            //What language should we search for...
            $languageCode = ICL_LANGUAGE_CODE;
        }
       //  $wmplEnabled = false;
        $ignoreIdsForMySql = implode(",", $ignoreIds);
        //var_dump($ignoreIdsForMySql);
    	global $polylang;
    	$join = $polylang->model->join_clause('post');
        $where = $polylang->model->where_clause($lang, 'post');
        $query = "
                select p.ID as post_id from $wpdb->terms t
                join $wpdb->term_taxonomy tt
                on t.term_id = tt.term_id
                join $wpdb->term_relationships tr
                on tt.term_taxonomy_id = tr.term_taxonomy_id
                join $wpdb->posts p
                on p.ID = tr.object_id
                join $wpdb->postmeta visibility
                on p.ID = visibility.post_id
                and visibility.meta_key = '_visibility'
                and visibility.meta_value <> 'hidden'
    			{$join}
                ";
        //IF WPML Plugin is enabled join and get correct language product.
        if($wmplEnabled)
        {
            $query .=
            "join ".$wpdb->prefix."icl_translations trans on
             trans.element_id = p.ID
             and trans.element_type = 'post_product'
             and trans.language_code = '$languageCode'";
             ;
        }
    
        $query .= "
                WHERE
                tt.taxonomy = 'product_tag' and
                t.name LIKE '%$tag%'
                and p.post_status = 'publish'
                and p.post_type = 'product'
                and (p.post_parent = 0 or p.post_parent is null)
                and p.ID not in ($ignoreIdsForMySql)
                group by p.ID
    			{$where}
                 ;
    ";
    
        //Search for the sku of a variation and return the parent.
        $matchedProducts = $wpdb->get_results($query) ;
    
        //var_dump($matchedProducts);
        if(is_array($matchedProducts) && !empty($matchedProducts))
        {
            //var_dump($matchedProducts);
            $wp_query->found_posts += sizeof($matchedProducts);
            //var_dump($wp_query->found_posts, sizeof($matchedProducts));
            return $matchedProducts;
    
        }
    
        //return get_post($product_id);
    
        return null;
    }
    
    ?>

    please note that I am not adding support for my plugin here but a support for polylang in general , maybe you can ask the plugin author to add support for polylang as it is really easy .

    3 – user getting redirected for an english version

    That is the default behavior for woocommerce when there is only one result for your search terms .

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ewape thanks for sharing , the plugin requires PHP5.3 at least

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ewape Are you really using wordpress 4.2.2 , cause the error is really strange , the class is already defined here in wordpress under the following path : wp-includes/locale.php/ maybe your are facing plugin conflict , deactivate all your plugins and keep this plugin with woocommerce and polylang only . and see if the problem still exists.

    Although I think it is not the plugin issue here , cause the class issue is only constructed when new Email’s order is being sent.

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ewape Good for your , I am happy you solved the problem , before I even look at it .
    could you please explain your issue a little and how you have solved , in order to let people who are using this plugin know how you did in case they are facing the same issue

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @leemon , thanks a lot for your review , I am happy cause you find this plugin useful. that encourages me to keep updating .

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @king-a-s you are welcome ??

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @pino_nl thank you for your help , I am surprised , something went wrong with my deploy step I think.
    The file is not missing in the Github Repo Here :
    https://github.com/hyyan/woo-poly-integration/tree/0.18/src/Hyyan/WPI

    Anyway I’ve solved the problem , you can re install the plugin safely now

    Thanks again for feedback

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @king-a-s am not sure what the problem might be , I need some feedbacks here.
    can you please add the following lines to your config.php file :

    define('SAVEQUERIES', true);
    define('WP_DEBUG', true);
    define('SCRIPT_DEBUG', true);
    define('WP_DEBUG_LOG', true);

    if you still getting a blank screen check the debug.txt in your wp-content folder .

    then paste the result here please.

    Plugin Author Hyyan Abo Fakher

    (@hyyan)

    @ksawery , Yes my first name is Hyyan ??

    to answers your questions :

    [1] So that means that if someone orders with the french ‘tag’, he will get the email “Thank you for your order” in french?

    You are correct

    [2] Will we have the possibility to translate each version of the email, or is that automatic?

    It will be automatic

    [3] You said ‘will’, do you know how much time before the plugin can do it?
    Instantly , whenevery woocommerce fires its actions for emails

    At this time , I dont have a way to accept any donation , but I will keep adding new features in the long terms , I have big plans for this plugin.

    But given me a star on Github or WordPress Repo will make day ??

    Thank you for your questions

Viewing 15 replies - 106 through 120 (of 146 total)