Jump to content

Archived

This topic is now archived and is closed to further replies.

Dirty Butter

Forcing Customer refresh

Recommended Posts

3 hours ago, bsandall said:

To force your customers' browsers to refresh the CSS, you can do this simple trick:

Open the /skins/foundation/templates/main.php file (or the equivalent for your skin)

Find the <head> link to 'cubecart.css'

Add '?v=1' to that link.

In the end it should look like this:

<link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.css?v=1" rel="stylesheet">

Whenever you make a major change to your CSS that will cause the store to look crappy for customers if they have a cached version, change the v=1 to v=1.1 or whatever.

GOOD TO KNOW!

 

Share this post


Link to post
Share on other sites

Note that JavaScript is also cached and, with the changes that have been / are being made to the way images display, it can negatively impact the customer experience.

You can apply the same trick to JS files, notably in main.php toward the bottom, you'll find:

{foreach from=$JS_SCRIPTS key=k item=script}
<script src="{$STORE_URL}/{$script|replace:'\\':'/'}" type="text/javascript"></script>
{/foreach}

Add the same thing '?v=1' to that so it looks like:

{foreach from=$JS_SCRIPTS key=k item=script}
<script src="{$STORE_URL}/{$script|replace:'\\':'/'}?v=1" type="text/javascript"></script>
{/foreach}

Note that according to some answers on StackOverflow, adding this query parameter will not negatively impact the browser's ability to cache the file, it will just force it to refresh any time the parameter changes.

Share this post


Link to post
Share on other sites

×
×
  • Create New...