Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Thanks that makes perfect sense.

    We have no problem updating to premium. What kind of response time can we expect once we are premium provided it would probably involve hands on digging into our theme settings and possibly code?

    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Hey,

    Our pagination is working but the problem is that the results are not what we expect.
    Is there any chance we grant you access (it is a blocked site) and you have a look?

    Thanks!

    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Wow thanks for the quick response! And that pointed me in the right direction and I fixed it.
    Actually I found in the wp-content/cache folder an htaccess file with the following. I wonder where it came from as after deleting and resaving wpsupercache it did not return this bothersome code:

    # BEGIN supercache
    <IfModule mod_mime.c>
    <FilesMatch “\.html\.gz$”>
    ForceType text/html
    FileETag None
    </FilesMatch>
    AddEncoding gzip .gz
    AddType text/html .gz
    </IfModule>
    <IfModule mod_deflate.c>
    SetEnvIfNoCase Request_URI \.gz$ no-gzip
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary “Accept-Encoding, Cookie”
    Header set Cache-Control ‘max-age=3, must-revalidate’
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html A3
    </IfModule>
    Options -Indexes

    # END supercache

    Allon Sacks

    (@allonsacksgmailcom)

    After much searching I was surprised this is not something that is standard.
    Here was my solution but mind you I did not test it for variations only for a normal product plus quantity in the single product page, so it might not work for variations though probably the same logic as in the js below would work for that:

    Either use a hook like “woocommerce_single_product_summary”

    Or copy the wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php to your child theme like:
    wp-content/themes/child-theme/woocommerce/single-product/add-to-cart/simple.php

    Edit the file and add the following code where you want the button to appear:

    <div class="express-checkout-wrapper">
                    <a id="dc_express_checkout" href="/checkout/?add-to-cart=<?php echo get_the_ID(); ?>">
                        Purchase
                    </a>
                </div>

    Now the only problem is the button will take you to checkout and add the correct product but without the correct quantity if you changed it so I used js in my custom.js file that is queued in the footer:

    // Add and change quantity to express checkout button when the quantity is updated
        if($('.cart .qty').length){
            var originalUrl = $('#dc_express_checkout').attr('href');
            $('.cart .qty').change(function(){
                var url = originalUrl + '&quantity=' + $(this).val();
                $('#dc_express_checkout').attr('href', url);
            });
        }

    You can change the url from:

    href="/checkout/?add-to-cart=<?php echo get_the_ID(); ?>"

    to:

    href="/cart/?add-to-cart=<?php echo get_the_ID(); ?>"

    If you want the button to direct to the cart instead of the checkout page.

    • This reply was modified 8 years, 11 months ago by Allon Sacks.
    • This reply was modified 8 years, 11 months ago by Allon Sacks.
    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Thanks!

    Regarding the second question I got it done already I forgot it has been time since I set it up 🙂

    Regarding the first I appreciate your input.

    I got it done, seems not to slow things down too much.
    Pasting the code if anyone wants it below but first another question.

    It seems if the text in the h2 is in quotes or with hyphens it gets completely overlooked. So in my function below, match does not even return posts where the query has quotes or hyphens inside it. Any idea why this is happening or what to do about it?

    Thanks! and here is my code:

    function getTextBetweenTags($string, $tagname) {
    	$pattern = "/<$tagname>(.*?)<\/$tagname>/";
    	preg_match_all($pattern, $string, $matches);
    	return $matches[1];
    }
    add_filter( 'relevanssi_match', 'h2_match' );
    function h2_match($match) {
    	$searchQuery = strtolower(get_search_query());
    	$content_post = get_post($match->doc);
    	$content = strtolower($content_post->post_content);
    	$content = apply_filters('the_content', $content);
    	$content = str_replace(']]>', ']]>', $content);
    	$content2 = getTextBetweenTags($content, 'h2');
    	foreach($content2 as $key=> $value) {
    		if (strpos($value,$searchQuery) !== false) {
    			$match->weight = $match->weight * 30;
    		}
    	}
    	return $match;
    }
    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Ok so I tested and the following code works by simple dropping it into the functions.php.
    This means that instead of using wp-cron and clearing on set days regardless of cache size, the cache this way is cleared when it reaches the size you define.

    $myMaxSize = 350000;
    $statArr=autoptimizeCache::stats();
    $cacheSize=round($statArr[1]/1024);
    if (($cacheSize>$myMaxSize)){
    	autoptimizeCache::clearall();
    }
    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Thanks! I will try it out, looks like I actually got the solution while writing you the question… I actually started writing the question before I had finished and by the time I posted it was kinda I could just test this instead of asking but anyway I appreciate your input and this can help others…

    TTLY agree with you about the canary but some clients are small and do not have the budget for me to sort out all the issues to have standardized js and css across the site so emptying the cache every few days is a viable solution. In any case I try to use cache preload and changes in the background require the cache refresh itself every few days.

    Are you thinking of adding preload and cache timeout at any point?

    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Hey, so I have been digging around a bit in the code, I want to clear the cache once it reaches a certain size.
    Is there a good way to check I think I have it something like this:

    $myMaxSize = 256000;
    $statArr=autoptimizeCache::stats(); 
    $cacheSize=round($statArr[1]/1024);
    if (($cacheSize>$myMaxSize){
       autoptimizeCache::clearall()
    }

    Thanks!

    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Thanks you rock!

    Allon Sacks

    (@allonsacksgmailcom)

    Allon Sacks

    (@allonsacksgmailcom)

    I went to the svn (debelopers link above) and downloaded the previous version and got my hebrew back.

    Hope this helps people with the same issue who don’t think of this simple solution. it did not occur to me until I spent quite a lot of time trying to solve this 😉

    Allon Sacks

    (@allonsacksgmailcom)

    Same problem here.
    Using wpml.
    Even in wpml string translations it shows the correct translation but on the site it shows the wrong language i.e in the error messages. Always shows in english even when on a page set to a different language.

    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Thanks. It was translated not long ago.
    All my other site show the translation. Not possible to use what exists?

    Thanks

    Thread Starter Allon Sacks

    (@allonsacksgmailcom)

    Ok, I see you removed the language options but still I should see hebrew error messages. I tried changing in the admin to hebrew but it did not help.

    Allon Sacks

    (@allonsacksgmailcom)

    I grabbed it. Will hope to have a look at the code soon!

Viewing 15 replies - 1 through 15 (of 20 total)