cancel
Showing results for 
Search instead for 
Did you mean: 

Magento Issue; things are not auto-updating: currency/cart

Magento Issue; things are not auto-updating: currency/cart

Hey everyone;

on my site, when someone click the currency change button - CAD USD or AUS, it doesn't update unless you hit the refresh button.

when someone clicks to add any products to the cart, it doesn't update the cart stuff unless someone hits the refresh button.  the product does get added, just doesn't show unless refresh it hit.

The site is running in HTTPS with full SSL, and Its using the default cache settings. 

Any help would be greatly appreciated.

Damien D.

9 REPLIES 9

Re: Magento Issue; things are not auto-updating: currency/cart

Hi @damiende 

 

Apache depending on its configuration sometimes have a funny issue where it will cache allow some browsers to cache the HTML output.

 

If in  your apache settings have:

 

ExpiresActive On

 

And have ExpiresDefault on none static content like css/js/txt etc. set to anything other then A0, you should properly change it to be A0, and then reboot apache.

 

I hope this helps :-)

Re: Magento Issue; things are not auto-updating: currency/cart

@Theis Corfixen 

In my htaccess file I have the following code;

## EXPIRES CACHING ## 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 year" 
ExpiresByType image/jpeg "access 1 year" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 1 month" 
</IfModule> 
## EXPIRES CACHING ## 

 However, commenting this out to deactivate it did not fix the issue;

Other then that, I don't know where else I'd have any ExpireActive On  for Apache

Re: Magento Issue; things are not auto-updating: currency/cart

Hi @damiende 

 

Try changing it to

 

<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 year" 
ExpiresByType image/jpeg "access 1 year" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault A0
</IfModule> 

 

And do a hardrefresh on the pages, that may have an effect :-)

Re: Magento Issue; things are not auto-updating: currency/cart

@Theis Corfixen 

Changed the code and did a hard refresh, also cleared Var folder, and my own browser data afterwards,

unfortunately no affect - tested on IE9, Chrome, and Firefox.

Its still not refreshing that data on its own Smiley Sad


Re: Magento Issue; things are not auto-updating: currency/cart

Hi @damiende 

 

I ran through you post history and found your site, if you do a request to the swtching URL it redirects incorrectly, if you look at the Location:

 

curl --head https://gamergearguru.com/directory/currency/switch/currency/EUR/
HTTP/1.1 302 Moved Temporarily
Date: Wed, 08 Apr 2015 19:45:14 GMT
Server: Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
X-Powered-By: PHP/5.3.23
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Fpc: Miss
X-Fpc-Reason: no_cache
Set-Cookie: frontend=15fa9e9f29bc907475c6ef1c509e4381; expires=Wed, 08-Apr-2015 20:45:14 GMT; path=/
Set-Cookie: currency=EUR; expires=Wed, 08-Apr-2015 20:45:14 GMT; path=/; domain=gamergearguru.com
Set-Cookie: nocache=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=gamergearguru.com
Location: httpss://gamergearguru.com/
Content-Type: text/html; charset=UTF-8

 

Are you sure you configured your URL's correctly in the admin?

Re: Magento Issue; things are not auto-updating: currency/cart

@Theis Corfixen 

So in my admin,  under config, under web.

I have 3 store views;   example.com -- site2.example.com --    site3.example.com

I have forced HTTPS on all htaccess.  and for settings; I have the following;

Use Web Server Rewrites:    Yes

-Unsecure-

Base URL          https://example.com/
base Link URL     {{secure_base_url}}
base Skin URL     {{secure_base_url}}skin/
base Media URL    {{secure_base_url}}media/
base JS URL       {{secure_base_url}}js/

-Secure-

Base URL          https://example.com/
base Link URL     {{secure_base_url}}
base Skin URL     {{secure_base_url}}skin/
base Media URL    {{secure_base_url}}media/
base JS URL       {{secure_base_url}}js/


Use Secure URL in frontend:  yes


 Now I used to have the unsecure link to http:// and using {{unsecure_base_url}}  however, since i force everything secure, I didn't think it mattered

Re: Magento Issue; things are not auto-updating: currency/cart

Hmm, seems weird. Either you configured your htacces files https redirecing wrong, or you should check the response from Mage::getBaseUrl(), in the Mage_Directory_CurrencyController object (app/code/core/Mage/Directory/controllers/CurrencyController.php).

Re: Magento Issue; things are not auto-updating: currency/cart

@Theis Corfixen 

This is the rewrite (i think) in the htaccess:

#Force all traffic to HTTPS
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

 The above rewrite is what I added to the htaccess,  the below came default with the installation.

## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    #RewriteBase /magento/

############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>

 There seems to be a lot of rewrites, they may be a conflict.



This is the currencycontroller.php::

class Mage_Directory_CurrencyController extends Mage_Core_Controller_Front_Action
{
    public function switchAction()
    {
        if ($curency = (string) $this->getRequest()->getParam('currency')) {
            Mage::app()->getStore()->setCurrentCurrencyCode($curency);
        }
        $this->_redirectReferer(Mage::getBaseUrl());
    }
}

 
and this is the currency control buttons;

    <div class="block-currency">
     <ul id="currency">
       <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
               <li>
           <a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" onclick="setLocation(this.value)">
                   <img src="<?php echo Mage::getBaseUrl('media').'flag/'.$_code.'.jpg'; ?>" title="<?php echo $_name ?> - <?php echo $_code ?>" alt="<?php echo $_name ?> - <?php echo $_code ?>" width="20" height="15"  />
       </a>
               </li>
            
       <?php endforeach; ?>
       </ul>     
    </div>

 

Re: Magento Issue; things are not auto-updating: currency/cart

@Theis Corfixen 

Could it be caused by ajax calls/scripts not being auto-refreshed after certain actions have been done?