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,231 through 1,245 (of 18,418 total)
  • Author
    Posts
  • in reply to: license activation #53338
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Can you please add temporary back-end details so I can take a look at the issue? Thank you!

    in reply to: New to Ajax search pro #53329
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Sure!

    There are no exact tutorials as each and every theme is very different. But you can check out some of the video tutorials from this page, as well as from our official youtube channel.

    in reply to: Indexing TablePress shortcodes not working #53327
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Need help create filters for custom post #53325
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    If you are planning to use elementor loop grid, here is a very extensive video tutorial on how to do that.

    in reply to: Indexing TablePress shortcodes not working #53324
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: New to Ajax search pro #53321
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Thank you for choosing our search engine, you won’t regret it!

    Usually most themes have a theme editor. Have you tried to use the theme editor to replace the search with the ajax search pro shortcode?

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

    You are very welcome!

    This I probably can’t integrate, as it would require a lot of settings to configure correctly.

    Keep the code snippets, they will work even after update. The best place to have them is by using the Code Snippets plugin. It keeps them active inbetween updates as well.

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

    You cannot access this content.

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

    You cannot access this content.

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

    Thank you!

    I think I actually got it. There was a tiny mistake in the last code snippet, I fixed it, now it seems to show the context correctly. Please note that this is not perfect, but it should work in most cases. I can’t guarantee anything though, as this is beyond normal support, but I think it should work all right.

    For future reference, the complete current solution is:

    
    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 = \WPDRMS\ASP\Utils\Str::getContext($field_value, 200, 9999999, $args['s'], explode(' ', $args['s']));
    						break;
    					}
    				}
    			}
    		}
    	}
    
    	return $results;
    }
    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
    );
    
    
    in reply to: No search results in secondary language using Polylang #53306
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

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

    I see, I’m not sure if that’s possible, but let’s try to correct the code on site.

    Can you please check the back-end access details? I tried to log-in but username/pass is incorrect. Thank you!

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

    You cannot access this content.

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

    Yea, okay. I checked the event handler, it does not re-attach when the items are reloaded unfortunately. I have extracted their code to re-attach the event listener, I hope they can fix it in the future. For now, use this custom code:

    add_action(
    	'wp_footer',
    	function () {
    		?>
    		<script>
    			jQuery(function() {
    				const handler = function(e) {
    					var wrapper = jQuery(this)
    						, url = wrapper.data('column-clickable');
    					if (url) {
    						if (jQuery(e.target).filter('a, a *, .no-link, .no-link *').length) {
    							return true;
    						}
    						if (url.match("^#elementor-action")) {
    							let hash = url;
    							hash = decodeURIComponent(hash);
    							if (hash.includes("elementor-action:action=popup:open") || hash.includes("elementor-action:action=lightbox")) {
    								if (0 === wrapper.find('#make-column-clickable-open-dynamic').length) {
    									wrapper.append('<a id="make-column-clickable-open-dynamic" style="display: none !important;" href="' + url + '">Open dynamic content</a>');
    								}
    								wrapper.find('#make-column-clickable-open-dynamic').click();
    								return true;
    							}
    							return true;
    						}
    						if (url.match("^#")) {
    							let hash = url;
    							jQuery('html, body').animate({
    								scrollTop: jQuery(hash).offset().top
    							}, 800, function() {
    								window.location.hash = hash;
    							});
    							return true;
    						}
    						window.open(url, wrapper.data('column-clickable-blank'));
    						return false;
    					}
    				}
    				document.querySelectorAll(".asp_main_container").forEach((el) => {
    					el.addEventListener("asp_search_end", (event) => {
    						jQuery(document).on('click', 'body:not(.elementor-editor-active) .make-column-clickable-elementor', handler);
    					});
    				});
    			});
    		</script>
    		<?php
    	},
    	999
    );

    Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

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

    I see. On the screenshot however it seems to be the first 130characters of the PDF content though, so that is correct. I guess you want like the context around the search keyword? For that maybe try this variation, but I’m not sure if that’s even possible:

    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 = \WPDRMS\ASP\Utils\Str::getContext($field_value, 130, 9999999, $args['s'], explode($args['s']));
    						break;
    					}
    				}
    			}
    		}
    	}
    
    	return $results;
    }
Viewing 15 posts - 1,231 through 1,245 (of 18,418 total)