This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 15 posts - 1,246 through 1,260 (of 18,418 total)
  • Author
    Posts
  • in reply to: Elementor Loop Item link not working #53288
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Thanks for the feedback!

    Are you using a custom plugin to make the whole elementor columns clickable? It does not seem like a core Elementor behavior. I suspect their script does not recognize the change in the content and does not make it clickable.
    If it’s a 3rd party plugin, can you let me know which one it is?

    in reply to: Elementor Loop Item link not working #53285
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    It is a known issue with some specific loop grid setups, that has being addressed in the upcoming release.

    I’m attaching a patched version to this reply, please install it. After updating and clearing the cache the issue should be resolved.

    in reply to: ASP to search within a range of dates #53283
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    For this type of filter to work the dates must be in a completely separate field I’m afraid, otherwise it’s going to be extremely complicated. During the search the plugin compares the dates of the field. It is not possible to simply compare parts of the string as the comparision is done within the SQL query and it can’t split the field by commas, as it expect as date value, not a comma separated list of dates.

    I usually suggest a custom code snippet where I can, but this is much more complicated than that. The only possible solution I can see to this is by modifying the query arguments via asp_query_args to actually remove the date filter (or modify it so it does not apply during search). Then hook into asp_results to programmatically check the dates via a foreach loop and unset (remove) the unwanted results that does not fit the criteria.

    If you need professional help with that, I recommend our affiliates at wpkraken. I get asked for custom jobs a lot, but unfortunately I already have 10+ hours of work every day, 7 days a week, so I recommend them 🙂

    in reply to: Search results content #53278
    Ernest MarcinkoErnest Marcinko
    Keymaster

    All right, the setup seems to be okay, all you need the the excerpt.

    Make sure that this custom code is also applied with the previous ones. I can’t check as I can only see the development environment:

    add_filter( 'asp_results', 'asp_get_attachment_to_product_content', 10, 4 );
    function asp_get_attachment_to_product_content( $results, $search_id, $is_ajax, $args ) {
    	// --- DO NOT CHANGE ANYTHING BELOW ---
    	foreach ( $results as $k =>&$r ) {
    		if ( $r->post_type !== 'product' ) {
    			continue;
    		}
    		$product = wc_get_product( $r->id);
    
    		if ( $product->is_downloadable() ) {
    			// Loop through WC_Product_Download objects
    			foreach ( $product->get_downloads() as $key_download_id => $download ) {
    				$download_link = $download->get_file(); // File Url
    				$id            = asp_get_file_id_from_url($download_link);
    				if ( $id !== '' ) {
    					$field_value = get_post_meta( $id, '_asp_attachment_text', true );
    
    					if ( $field_value !== '' ) {
    						$r->content = wd_substr_at_word($field_value, 130);
    						break;
    					}
    				}
    			}
    		}
    	}
    
    	return $results;
    }

    This fetches the attachment text and replaces it in the live product results.

    in reply to: No search results in secondary language using Polylang #53277
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Search results content #53266
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Yes – you need both of those settings and the files have to be uploaded to the media library, otherwise the plugin can’t access it (it has to have a valid ID in the database).

    So the best course of action is to uplod the file via the Media menu, then on the product editor add it from the library. I think when you only upload it via the product editor, it may not be registered in the media library.

    in reply to: Search results content #53263
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Well, that will need another bit of custom code for sure, as the media file ID needs to be fetched, but I think it’s possible. Try the snippet below. Make sure that the custom code I provided in my previous reply is also active, it contains a function that is needed for this code as well:

    add_filter( 'asp_results', 'asp_get_attachment_to_product_content', 10, 4 );
    function asp_get_attachment_to_product_content( $results, $search_id, $is_ajax, $args ) {
    	// --- DO NOT CHANGE ANYTHING BELOW ---
    	foreach ( $results as $k =>&$r ) {
    		if ( $r->post_type !== 'product' ) {
    			continue;
    		}
    		$product = wc_get_product( $r->id);
    
    		if ( $product->is_downloadable() ) {
    			// Loop through WC_Product_Download objects
    			foreach ( $product->get_downloads() as $key_download_id => $download ) {
    				$download_link = $download->get_file(); // File Url
    				$id            = asp_get_file_id_from_url($download_link);
    				if ( $id !== '' ) {
    					$field_value = get_post_meta( $id, '_asp_attachment_text', true );
    
    					if ( $field_value !== '' ) {
    						$r->content = wd_substr_at_word($field_value, 130);
    						break;
    					}
    				}
    			}
    		}
    	}
    
    	return $results;
    }
    in reply to: Live search not triggering #53262
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Searching custom Taxonomies #53260
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Live search not triggering #53257
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Problem with the Back End of the plugin #53255
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Searching custom Taxonomies #53252
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Problem with the Back End of the plugin #53249
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Refind #53241
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Search results content #53240
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Thank you very much! I have tried, but I get a refused key message: https://i.imgur.com/pwZs7Fe.png

    However, I didn’t need the SFTP access after all, I was able to create and test a custom code snippet that fetches the PDF attachments from the products and indexes them with the products as well. I have applied the custom code to the functions.php file in your theme directory.

    The way it works is, that you can set up a widget to search for products. If there are any PDFs attached to the product, the code will check and will try to find it in the media library. If it’s in the media library, then it will index it’s contents with the product contents. Therefore searching parts from the PDF contents will return the product as the results as well. Just make sure that he attached PDF exists in the Media library as well.

    The code that I applied below, for archive purposes:

    function asp_get_file_id_from_url($file_url) {
        $file_path = ltrim(str_replace(wp_upload_dir()['baseurl'], '', $file_url), '/');
    
        global $wpdb;
        $statement = $wpdb->prepare("SELECT <code>ID</code> FROM <code>wp_posts</code> WHERE guid='%s';",
            $file_url,
            $file_path);
    
        $attachment = $wpdb->get_col($statement);
        if (count($attachment) < 1) {
            return '';
        }
    
        return $attachment[0]; 
    }
    add_filter(
    	'asp_post_content_before_tokenize',
    	function ( $content, $post ) {
    		if ( $post->post_type !== 'product' ) {
    			return $content;
    		}
    		$product = wc_get_product( $post->ID );
    
    		if ( $product->is_downloadable() ) {
    			// Loop through WC_Product_Download objects
    			foreach ( $product->get_downloads() as $key_download_id => $download ) {
    				$download_link = $download->get_file(); // File Url
    				$id            = asp_get_file_id_from_url($download_link);
    				var_dump($id, $download_link);
    				if ( $id !== '' ) {
    					$field_value = get_post_meta( $id, '_asp_attachment_text', true );
    
    					if ( $field_value !== '' ) {
    						$content .= ' ' . $field_value;
    					}
    				}
    			}
    		}
    
    		return $content;
    	},
    	10,
    	2
    );
Viewing 15 posts - 1,246 through 1,260 (of 18,418 total)