• Resolved svg2018

    (@svg2018)


    Hi, i used this code i found in a support thread a while ago. It replaces the standard search (including mobile)

    if ( class_exists( 'DGWT_WCAS_Search' ) ) {
    	if ( ! function_exists( 'storefront_product_search' ) ) {
    		function storefront_product_search() {
    			if ( storefront_is_woocommerce_activated() ) { ?>
                    <div class="site-search">
    					<?php echo do_shortcode( '[wcas-search-form]' ); ?>
                    </div>
    				<?php
    			}
    		}
    	}
    	add_action( 'wp_footer', 'asfwc_inverse_orientation_on_mobile' );
    	function asfwc_inverse_orientation_on_mobile() {
    		?>
            <script>
                jQuery(window).on('load', function () {
                    var $footerSearch = jQuery('.storefront-handheld-footer-bar .dgwt-wcas-search-input');
                    if ($footerSearch.length > 0) {
                        $footerSearch.dgwtWcasAutocomplete('setOptions', {
                                orientation: 'top',
                                forceFixPosition: true
                            }
                        );
                    }
                });
            </script>
    		<?php
    	}
    }

    However the update broke it so i reverted back to 1.7, could anyone help me get it fixed so i may use the updated version?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • macfan007

    (@krgauravit007)

    How did you revert back to 1.7? I did update to 1.2.0 and not auto suggestion is not working.
    Switcher inside plugin page is not working either to revert back .
    Any help.

    Plugin Author Damian Góra

    (@damian-gora)

    Hi,
    Thank you for updating.

    I’m working on full support for the Storefront theme. Soon it will work without pasting the code into functions.php.

    At the moment I paste the corrected code here:

    
    
    if ( ! function_exists( 'storefront_product_search' ) ) {
        function storefront_product_search() {
            if ( storefront_is_woocommerce_activated() ) { ?>
                <div class="site-search">
                    <?php echo do_shortcode( '[wcas-search-form]' ); ?>
                </div>
                <?php
            }
        }
    }
    add_action( 'wp_footer', 'tmp_dgwt_wcas_storefront_inverse_orientation' );
    
    function tmp_dgwt_wcas_storefront_inverse_orientation() {
        ?>
        <script>
            jQuery(window).on('load', function () {
                var $footerSearch = jQuery('.storefront-handheld-footer-bar .dgwt-wcas-search-input');
                if ($footerSearch.length > 0) {
    
                    $footerSearch.each(function(){
                        jQuery(this).dgwtWcasAutocomplete('setOptions', {
                                orientation: 'top',
                                positionFixed: true
                            }
    
                        );
                    });
    
                }
            });
        </script>
        <?php
    }
    

    The Version switcher inside plugin page:
    Sorry. I have not described this too clearly. The version switcher replace only frontend files like HTML partials, CSS and JS. The other plugin files are served from the latest version (in this case v1.2.0). So if you switch back to v1.1.7 using the version switcher inside plugin page, you will only load old (last working) assets.

    If you want to revert all plugin to v1.1.7, not just frontend assets, then download it from the archived versions: https://www.ads-software.com/plugins/ajax-search-for-woocommerce/advanced/ (at the bottom of the page)

    To-do list for you:
    1. Replace the old code with a new. I pasted it above.
    2. Switch to v1.2.0 (use the switcher on the plugins page)
    3. Check if works and let me know

    macfan007

    (@krgauravit007)

    I updated Storefront theme function file with your script and Live search is working on top bar on both version . 1.1.7 and 1.2.0 (using switch inside plugin page) . I am yet to finish step 3. Shall I Do ? pl advice.

    Thanks

    Plugin Author Damian Góra

    (@damian-gora)

    If the search form looks and works correct after switching to 1.2.0, click the “finish the update” button.
    That’s all

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Update breaks search replacement’ is closed to new replies.