Jump to content

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!

 

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...