How to Speed Up and Optimise CS-Cart Version 4?

This also works and you don't have to manually change the dates…


```php


Enable expirations

ExpiresActive On

Default directive

ExpiresDefault “access plus 1 month”

My favicon

ExpiresByType image/x-icon “access plus 1 year”

Images

ExpiresByType image/gif “access plus 1 month”

ExpiresByType image/png “access plus 1 month”

ExpiresByType image/jpg “access plus 1 month”

ExpiresByType image/jpeg “access plus 1 month”

CSS

ExpiresByType text/css “access 1 month”

Javascript

ExpiresByType application/javascript “access plus 1 year”



```

[quote name='grafis' timestamp='1389537874' post='174963']

config.local.php has one option in 4.x - when set to true it did nothing to my GtMetrix scores of 70 page speed, 77 yslow - 'gzip_css_js' => true // gzip compiled css/js files



With 4.x do make sure you have Development Settings OFF in Design > Template Editor > Development Settings. The admin nags you if you leave them on so I doubt it's issue for anyone.



Major speed increase - I added the compression and header expire code below to my .htaccess and my score went to 99 page speed, 89 Yslow. Expires date needs to manually changed. Feels good but the question would be what impact could this have on site features and functionality?




#Expires

Header set Expires "Thu, 15 Apr 2015 20:00:00 GMT"
Header unset ETag
FileETag None


#Gzip

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript


[/quote]Will this work for v4.1.4 ?

Hello!



We have done a modification for several CS-Cart users that have 100% proven effect in site speed optimization. This is the optimization with Memcache. If someone is interested the details are here CS-Cart "Page Load Speed Optimizer" modification



Best regards, Alt-team

Changing my thumbnail sizes to 167 x 125 greatly increased my GTmetrix Page Speed score for the Responsive Theme. The Responsive Theme apparently strips out image sizes, so setting the thumbnail sizes to the theme's predefined sizes seems to be necessary.

I upgraded my site from version 3.0.6 to 4.1.4 today. Here are my GTMetrix scores. How can I change the "B"s to "A"s?

[attachment=8048:Screen Shot 2014-05-09 at 9.24.34 PM.png]

Screen Shot 2014-05-09 at 9.24.34 PM.png

[quote name='kingsleypress' timestamp='1399685441' post='183224']

I upgraded my site from version 3.0.6 to 4.1.4 today. Here are my GTMetrix scores. How can I change the "B"s to "A"s?

[attachment=8048:Screen Shot 2014-05-09 at 9.24.34 PM.png]

[/quote]



Add Expired Headers as shown above…

[quote name='CarStickersDecals' timestamp='1399689967' post='183226']

Add Expired Headers as shown above…

[/quote]



OK that cut my load time down to 3.25 seconds and gave me a page speed of A. Still a B on Yslow though.



[attachment=8049:Screen Shot 2014-05-10 at 8.07.44 AM.png]

Screen Shot 2014-05-10 at 8.07.44 AM.png

I also added the Gzip code earlier in this thread and that brought my page load down to 2.9 secs. Still a B on Yslow though.

[quote name='CarStickersDecals' timestamp='1398726272' post='182565']

This also works and you don't have to manually change the dates…


```php


Enable expirations

ExpiresActive On

Default directive

ExpiresDefault “access plus 1 month”

My favicon

ExpiresByType image/x-icon “access plus 1 year”

Images

ExpiresByType image/gif “access plus 1 month”

ExpiresByType image/png “access plus 1 month”

ExpiresByType image/jpg “access plus 1 month”

ExpiresByType image/jpeg “access plus 1 month”

CSS

ExpiresByType text/css “access 1 month”

Javascript

ExpiresByType application/javascript “access plus 1 year”



```

[/quote]CarStickerDecals,

Sorry, but I am not a programmer. Do I just copy this code and paste at the bottom of .htaccess ?

I got the YSlow grade up to an A (90%) with SmartOptimizer. It minified some js.

I also commented out the google font in the styles.less file which wouldn't cache and disabled etags.



BTW, when you set “ExpiresDefault” to 1 month, you don't have to define anything else as 1 month because you just made 1 month default.

Those mod_expires module settings could be optimized to read:



ExpiresActive On

ExpiresDefault “access plus 1 month”

ExpiresByType image/x-icon “access plus 1 year”

ExpiresByType application/javascript “access plus 1 year”

Hey Magpie Don, were you able to get SmartOptimizer to work with version 4? I can't remember what it was, but I kept getting errors and could not get it to work.

Jimmyod. I added it at the bottom of the file. There was only one line in there anyway. Really helped the load time.



When i did gzip = true nothing seemed to happen.



Also turned off all unnecessary addons…Or should I uninstall as I heard disabled addons still take some juice?



Another thing that seemed to work and I tried it because someone had mention it in a different thread was to optimise the database. The person was trying to get this done on a cron job. When I tried it initally it did seem to help the load time.



Gmetrix does say something about adding image sizes (that's what it marks me low on).Can I /should I change something?

Dont know if this relates to what magpie don said earlir about his thumbnail size. I'm on responsive as well.

[quote name='clips' timestamp='1399778844' post='183272']

Hey Magpie Don, were you able to get SmartOptimizer to work with version 4? I can't remember what it was, but I kept getting errors and could not get it to work.

[/quote]

Yes, SmartOptimizer is copied to the v4.1.4 root directory and here is the entire contents of my .htaccess file. I'm not using the Multi-vendor version if it matters. Nothing here is specific to my domain. The code has been cleaned up, but anyone thinks there is something out of place, please do tell:

```php

DirectoryIndex index.html index.php

php_flag zlib.output_compression Off

php_flag output_buffering Off

php_value output_handler NULL





RewriteEngine on

Options -MultiViews

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



AddEncoding gzip .gz

RewriteCond %{REQUEST_FILENAME} .(js|css)$

RewriteCond %{HTTP:Accept-encoding} gzip

RewriteCond %{REQUEST_FILENAME}.gz -f

RewriteRule ^(.)$ $1.gz [QSA,L]



RewriteCond %{REQUEST_URI} ^api/(.
)$ [or]

RewriteCond %{REQUEST_URI} ./api/(.)$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .api/(.)$ api.php?_d=$1&ajax_custom=1 [L,QSA]



RewriteCond %{REQUEST_URI} .(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff)$ [or]

RewriteCond %{REQUEST_URI} store_closed.html$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.?)/(.)$ $2 [L]



RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php [L,QSA]



RewriteCond %{REQUEST_FILENAME} -f

RewriteRule ^(.*.(js|css|html?|xml|txt))$ smartoptimizer/?$1


RewriteCond %{REQUEST_FILENAME} -f

RewriteRule ^(.*.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|ico))$ smartoptimizer/?$1









Header append Vary: Accept-Encoding

Header unset ETag

FileETag None

ExpiresActive On

ExpiresDefault “access plus 1 month”

ExpiresByType text/html “access plus 1 day”

ExpiresByType image/x-icon “access plus 1 year”

.css.gz$>

Header unset ETag

FileETag None

ExpiresActive On

ExpiresDefault “access plus 1 year”

ForceType text/css

Header set Content-Encoding: gzip

Header set Cache-control: private



.js.gz$>

Header unset ETag

FileETag None

ExpiresActive On

ExpiresDefault “access plus 1 year”

ForceType text/javascript

Header set Content-Encoding: gzip

Header set Cache-control: private







Header set Access-Control-Allow-Origin “*”





```

No luck with Smartoptimizer for us. I just tried to install again and at first i was working fine. Then when I did the gts scan all of the a sudden the page was messed up. I even tried to use just the htaccess that you showed above and at that point it gave me an internal error and nothing worked. I'm not using the multi vendor either.

Well…I seem to have it working…for now anyway. I'm not for sure what I did. I have the cached folder set to 755 (it won't let me do 777). I just tested and it jumped the score up to 97/81. The yslow score seems to be more difficult for me to get up.

I also got rid of AddThis addon and commented out the Google font in the styles.less file. Both of those elements were dragging down the YSlow score on account of no eTags and no Expires headers. I can survive without either of those 3rd party services.

clips, I updated my .htaccess code - smartoptimizer only needs to be run on the text files, it's redundant to run it on the images. And I had to add back in the cache validators for the .css.gz and .js.gz files. My score is now: 98/90 on v4 and 97/90 on v3. The only way for me to really increase the YSlow speed is to use a CDN. I'm not willing.

I have thought about the cdn part myself. We've been on a dedicated server for a couple of years now but we may have to wait for that level. I just do not think I have enough traffic quite yet to justify it yet.



On the Google font, I'm not so sure what this does. Does this make the font server side instead of client side? Also, if we are using a normal font do we really need it?

Not sure what happened but my site now gets a C on Yslow.



Any ideas on how to improve that?

[attachment=8059:Screen Shot 2014-05-14 at 7.43.23 AM.png]

Screen Shot 2014-05-14 at 7.43.23 AM.png

@Edward, Show the contents of the YSlow tab. Maybe I can help.

@Clips, the Google font is pulled from google. If you don't use any of the fonts from Google, you don't need the link in you styles.less file.