Speed Up Your CS-Cart eCommerce Website - Step 2

Hello All,



Here is step number two, where it’s discussed about the installation and use of Smartoptimizer.



The installation and use of Smartoptimizer, were summarized and commented extensively on this forum, I urge you to read and put into practice the advice given, for example, on this thread:



[url]http://forum.cs-cart.com/showthread.php?p=63685#post63685[/url]



Why I recommend using Smartoptimizer, rather than gzip?



Because Smartoptimizer serves the CSS and Javascript files a static manner, while Gzip compress these files for each request, each page downloaded.



In terms of performance, static files are always faster than dynamic ones, so I encourage you to use Smartoptimizer, although I don’t understand why SO doesn’t work for The Tool:


[quote name=‘The Tool’]I used the Smart Optimizer for a couple of days but I did not see any difference in page loading times. My pages already load in under 2 seconds without it anyway but the reason I removed it is because it was causing such a load on my server that my account was suspended.[/QUOTE]





Lee Li Pop



Important!



Upgrade your copy of SmartOptimizer to 1.8!



[url]http://farhadi.ir/works/smartoptimizer[/url]



Read more:



[url]http://forum.cs-cart.com/showthread....832#post100832[/url]

[quote name=‘Lee Li Pop’]although I don’t understand why SO doesn’t work for The Tool:









Lee Li Pop[/QUOTE]



I have been able to get it to work. I believe the problem was that I already had gzip enabled and then SO was enabling it as well. I guess they were conflicting.?

This one I already have, but, as all of you guys scared me (unintentioned of course), I turned off the gzip compression after reading this potencial conflict with smartoptimizer :sad: I really don’t want to mess up my shop neither to be kicked out of my server, but maybe I’m just being paranoid :rolleyes: (please don’t comment on this one…).

About smartoptimizer I can say it rocks!

Oh, and thanks again Lee for all your advices, very very usefull and needed :wink: .

I have both turned on and so far so good.

Thanks Noman, and do you have it for a long time like that? what’s your host?

Sorry for the questions

Hello E.Qi.Librium,


[quote name=‘E.Qi.Librium’]I turned off the gzip compression after reading this potencial conflict with smartoptimizer :sad: [/QUOTE]



Please, remember:


[quote name=‘Lee Li Pop’]

Please, note this:



If you have Smartoptimizer, add this code:




SetOutputFilter DEFLATE





Nota Bene:



Smartopitimizer is faster on JS and CSS than “mod_deflate” because it manages JS and CSS in static way. So, don’t put these files on “mod_deflate” if you have Smartoptimizer![/QUOTE]





Lee Li Pop

I’ve tried using SO for my site and it works great, but the only problem is it breaks the css in my other domains. Any ideas on this? Thanks.

I suppose I should have clarified that I had gzip enabled via php.ini and not .htaccess.

I have it for quite a long time with modifications in .htaccess as per Lee’s email. I run on it on my own VPS with Apache tweaked a bit for speed. No default settings. I couldn’t spot any problems.


[quote name=‘E.Qi.Librium’]Thanks Noman, and do you have it for a long time like that? what’s your host?

Sorry for the questions[/QUOTE]

Hello Moka,


[quote name=‘moka’]I’ve tried using SO for my site and it works great, but the only problem is it breaks the css in my other domains. Any ideas on this? Thanks.[/QUOTE]



First of all, clear your browser[COLOR=“Red”]s[/COLOR] cache with CCleaner, or better, with CyberScrub Privacy Suite and try again.



Try this:



1 - Go to this directory on your server:



/smartoptimizer/cache



2 - Delete everything



3 - Clear your browser[COLOR=“Red”]s[/COLOR] cache with CCleaner, or better, with CyberScrub Privacy Suite



4 - Try again your website in your browser[COLOR=“Red”]s[/COLOR]



Your CSS is broken yet?



Try this:



1 - Download your UNZIPPED CSS file on your own desktop



2 - Gzip it with 7zip with these setting: GZip - Ultra - Deflate - 32 KB - 128



3 - Name it “example.css.gz



4 - Upload your “example.css.gz” gzipped on this directory on your server:



/smartoptimizer/cache



4 - Copy (CTRL + C) the whole name of your actual CSS Gzipped file (for example: so_e90e15fd2e4f7d7a73df5075d9eaf454.css.gz)



5 - Rename your actual CSS Gzipped file (for example: from so_e90e15fd2e4f7d7a73df5075d9eaf454.css.gz to so_e90e15fd2e4f7d7a73df5075d9eaf454.css.gz.old)



6 - Rename your new CSS file, Gzipped on your desktop, from “example.css.gz” to the previous CSS Gzipped file name (for example: from example.css.gz to so_e90e15fd2e4f7d7a73df5075d9eaf454.css.gz)



7 - Do this for each CSS file.



8 - Clear the cache of your CS-Cart templates



9 - Clear your browser[COLOR=“Red”]s[/COLOR] cache with CCleaner, or better, with CyberScrub Privacy Suite



10 - Try again your website in your browser[COLOR=“Red”]s[/COLOR]





Lee Li Pop

Hello The Tool,


[quote name=‘The Tool’]I suppose I should have clarified that I had gzip enabled via php.ini and not .htaccess.[/QUOTE]



Could you give us your gzip settings in your php.ini?



Which could be faster? Gzip in php.ini or Gzip in .htaccess?





Lee Li Pop

[quote name=‘Lee Li Pop’]Hello The Tool,







Could you give us your gzip settings in your php.ini?



Which could be faster? Gzip in php.ini or Gzip in .htaccess?





Lee Li Pop[/QUOTE]





I haven’t noticed a difference between enabling gzip via php.ini vs. .haccess other than it does not create a load on the server. It has also been noted that enabling gzip via .htaccess is better than enabling gzip via php.ini.



I will have to contend that using the following will allow gzip, with the certain browsers, work more effectively. I have not determined whether it does or not compared to the gzip that you described in your other post.




SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
# SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary



# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

Thank you The Tool,



In fact, I forget the “cavemen browsers” as Netscape, IE < 6 and nano niche browsers as Konqueror whom can’t understand, or can’t handle (or badly) Gzip.



Their share market is too low (under 0.15% in my case).





Lee Li Pop

Here’s our results before and after SO.



BASE: CSC 2.0.15 on a VPS using Litespeed with PDO SqlLite caching ([url]CS-Cart Documentation — CS-Cart 4.15.x documentation)



BEFORE SO


YSlow: C (77%)

Pingdom:

Total loading time:

9.5 seconds

Total objects:

133 (951.3 KB)

External objects:

1 (7.3 KB)

HTML (X)HTML:

1 (101KB)

RSS RSS/XML:

0

CSS CSS:

9 (109.4KB)

Scripts Scripts:

11 (158.2KB)

Images Images:

112 (582.7KB)



AFTER SO:

YSLOW B (86%)

Pingdom:

Total loading time:

5.9 seconds

Total objects:

37 (892.2 KB)

External objects:

1 (7.3 KB)

HTML (X)HTML:

1 (101KB)

RSS RSS/XML:

0

CSS CSS:

9 (123.4KB)

Scripts Scripts:

11 (133.6KB)

Images Images:

16 (534.2KB)



A page load savings of 3.6 seconds or about 38%. What’s more impressive are the number of objects and images that were reduced using SO. We used to have “white flashes” on our site when the pages loaded, no longer with SO.



Our .htaccess and SO config.php are exactly as mentioned by Struck in the forum link on SO Lee Li posted. We did add Lee Li’s modeflate suggestion above.



The install was about as easy as it gets, unpack the SO archive, change .htaccess and config.php and away we went. I did not clear our cache as we are using SQLLite.



Great utility, highly recommended!

Took me a while to find the download, but Lee Li Pop sent it to me and I was on my way.



If you need, you can find smartoptimizer at…

[url]http://www.downloadplex.com/Scripts/PHP/Miscellaneous/smartoptimizer_311062.html[/url]



We have now bumped our performance at gtmetrix.com from C’s (about 73% on both) up to 87% on yslow and 77% on page speed.



Great suggestions and a must. Thanks for the help!



Our current host must be okay as everything so far has worked.

Hello all, Tried to install SmartOptimizer but having issues… When installed… my page takes way longer to load and loads some non css, non skin version.???

Copied the instructions perfectly… I think… Let me know if anyone might know what Im doing wrong… Thanks…



CS-Cart 2.1.2

I did turn on gzip thru the .htaccess… ?

Remove /smartoptimizer/.htaccess

smartoptimizer is working for my 1.3.5 site on server “A” but it does not working on 2.1.12 server “B”



i have made all the changes to .htaccess

i add or not add the

[HTML]



SetOutputFilter DEFLATE



[/HTML]

but still nothing

i use this code

[HTML]DirectoryIndex index.html index.php





SetOutputFilter DEFLATE









ExpiresActive On

ExpiresDefault “access plus 10 years”







RewriteEngine On



RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(..(js|css))$ smartoptimizer/?$1





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))$ smartoptimizer/?$1







FileETag none







RewriteEngine on

Some hostings require RewriteBase to be uncommented

Example:

Your store url is http://www.yourcompany.com/store/cart

So “RewriteBase” should be:

RewriteBase /store/cart

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !.(png|gif|ico|swf|jpe?g|js|css)$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php?sef_rewrite=1 [L,QSA]



RewriteCond %{REQUEST_FILENAME} ./catalog/.

RewriteCond %{REQUEST_FILENAME} -d

RewriteCond %{REQUEST_FILENAME}/index.html !-f

RewriteRule . index.php?sef_rewrite=1 [L,QSA]



[/HTML]

i use the same code for 1.3.5 ver and it is working

it is not a cache problem as when i press ctlr+F5 it shows me the results



with smartoptimizer the ajax (“js”) is not working and the template(“css”) is meshed up. only when i remove the “js|css” from is working but i think this deactivates the smartoptimizer because i get the same results in gtmetrics (or other page load tester)



my site is in main root (public_html). i am using electro.i also check by add/remove the ob_start(“ob_gzhandler”) from index.php but still nothing



any idea please?

forget it. i fix it

the problem was that it couldn’t create a file into cache dir even if i had changed permission of the cache dir (and smartpotimizer dir too) to 755 and even to 777 (from both cuteftp and my cpanel).



so finally i edit the config.php at smartoptimizer and set cachedir to ‘’ (means to root folder)



But i still don’t understand the reason it couldn’t write to folder. same files, same method, different server…

just a thought

at the file config.php at smartoptimizer, if i change the value from false to true at the var $settings[‘clientCacheCheck’] then i get different page speed results but i am not sure which one to select. YSlow or Page Speed? i think page speed



so, with $settings[‘clientCacheCheck’]=false i get at gtmetrix:

yslow/page speed : 76% / 78%



with $settings[‘clientCacheCheck’]=true i get at gtmetrix:

yslow/page speed : 72% / 86%



see images 1 & 2

SO_ccc-true_false_pagespeed.JPG

SO_ccc-true_false_yslow.JPG