Help - Site offline because of Custom CSS error

I currently have a live web site version 4.0.3



Unfortunately when adding some code to the Custom CSS area (via Use Themes → Customize Theme) I forgot to add a closing bracket.



Now my web site is completely offline and shows the following error …



Fatal error: Uncaught exception 'Exception' with message 'parse error: unclosed block' in /home/xxx/public_html/app/lib/other/lessphp/lessc.inc.php:2449 Stack trace: #0 /home/xxx/public_html/app/lib/other/lessphp/lessc.inc.php(1938): lessc_parser->parse('?// GRID variab…') #1 /home/xxx/public_html/app/lib/other/lessphp/lessc.inc.php(2085): lessc->compile('?// GRID variab…') #2 /home/xxx/public_html/app/Tygh/Less.php(84): lessc->parse('?// GRID variab…') #3 /home/adhocflo/public_html/app/functions/fn.common.php(5120): Tygh\Less->customCompile('?// GRID variab…', '/home/xxx/…', Array, '') #4 /home/xxx/public_html/app/functions/smarty_plugins/block.styles.php(50): fn_merge_styles(Array, '', '', Array) #5 /home/xxx/public_html/var/cache/templates/design/themes/basic/templates/c2eaf6b0d44f4e8582adda77554f87894f440b0d.tygh.styles.tpl.php(105): smarty_block_styles(Array, '?? #6 /home/xxx/public_html/app/lib/other/smarty/s in /home/xxx/public_html/app/lib/other/lessphp/lessc.inc.php on line 2449



Does anyone know how I can resolve this as I can no longer access my site directly to use the template editor. I only have admin access.



Thanks

bart

First I'd start by downloading the V4.0.3 file package and overwriting the damages CSS file. At least that will get your site back up.

Thanks



… but which “overwriting the damages CSS file” am I overwriting.

If I knew which CSS file to look for and where via ADMIN Id just go and remove the code I wrongly added.



bart

I also tried removing 4.0.3 upgrade back to 4.0.2 but still have same error.

[quote name='bart' timestamp='1384607283' post='171734']

Thanks



… but which “overwriting the damages CSS file” am I overwriting.

If I knew which CSS file to look for and where via ADMIN Id just go and remove the code I wrongly added.



bart

[/quote]



He means upload the complete new css file…save the olad amended one as soemthing else then you can still fix it and put it back when you are ready



John

Yes … but how do I know which CSS file I should be replacing. I have just downloaded CS Cart v4.0.3 to my hard drive and there are 143 CSS files.



bart

Snap1.jpg

In design/themes/basic/css replace the .css files one by one. After each one …clear the cache in site and browser each time and see if it fixes it.

What particular part of the site were you editing at the time, this may give you a clue as to which .css file to do first.

remember to save copies of all the ones on the site first

John

Thanks John.



I added code via the theme editor (see attachment) but forgot to add a closing }

Its for this reason I dont know which .css file is affected.



bart

Snap5.jpg

Do you have FTP access?



If so, FTP to the following directory:

var/cache/misc/statics/design/themes/basic/css/ and look for the standalone css file that is stored there.



Download it and open it in a code editor (not notepad, or wordpad) like notepad ++ and scroll all the way down to the bottom.



Remove the custom css code that you added through the theme editor (or add the closing curly brace ( }) and save it.



Upload it back to overwrite the existing standalone file.



Reload your page in your browser and go back into theme Editor and add the closing curly brace and save changes. Clear your cache

Hi requincreative



Thanks for your detailed reply.



Using FTP i found the following directory

www/var/cache/misc/statics/design/backend/css and the standalone css file stored there (see attachments)



But unfortunately I did not find the custom css code at the bottom of the file (nor when I did a search)



bart

Snap6.jpg

Snap7.jpg

Is it the frontend or backend that is inaccessible?



If frontend then you need to edit the var/cache/misc/statics/design/themes/basic/css/standalone.xxxxxxxxxxxxxxxxxxxx.css file and not the the file in the backend cache

I did exactly the same thing, added some custom CSS via the theme editor and this crashed my site and the admin so I could not get back in to remove the offending CSS.I think I just had a “;” in the wrong spot at the end of a line after the “}”. To fix I just found the CSS file where this custom code is added and deleted it and put the file back on the server.

/var/cache/misc/statics/design/themes/basic_clone/css/addons/discussion/scheme.less-2.css this is where I found my custom css that needed to be deleted, the “basic_clone” path may differ if you have a different theme name. Also under Template editor - CSS debug mode was turned off so I could see the actual css file using Firefox Inspect Element (right click). May also need to clear the cache.

Getting ready to throw laptop out of window … still havent resolved this


[quote name='requincreative' timestamp='1384656143' post='171760']

Is it the frontend or backend that is inaccessible?



If frontend then you need to edit the var/cache/misc/statics/design/themes/basic/css/standalone.xxxxxxxxxxxxxxxxxxxx.css file and not the the file in the backend cache

[/quote]



I cant access the frontend via web browser. CS cart backend (admin) is ok.



When using ftp i dont have this folder

… var/cache/misc/statics/design/themes/



Only this

public_html/var/cache/misc/statics/design/backend/css/standalone.xxxxxxxxxxxxxxxxxxxx.css




[quote name='Pbraz' timestamp='1384657940' post='171762']

/var/cache/misc/statics/design/themes/basic_clone/css/addons/discussion/scheme.less-2.css this is where I found my custom css that needed to be deleted, the “basic_clone” path may differ if you have a different theme name. Also under Template editor - CSS debug mode was turned off so I could see the actual css file using Firefox Inspect Element (right click). May also need to clear the cache.

[/quote]



Did you find the bad .css file via FTP … or using cscart admin?

And did the wrong code you added appear at the bottom of the .css file?



Thanks

bart

via FTP and the added code was at the bottom

Thanks Pbraz and requincreative,



I was able to resolve this by ‘cloning a theme’ via CS Cart admin. Once I did that I was able to access CS Cart theme editor via firefox and simply deleted the theme that contained the dodgy piece of CCS code. I then added correct code to a new theme vis CSS custom.



bart :mrgreen:

The error should be trapped in software for minor syntax problems and not crash the system completely. Many people will get caught by this and have problems recovering. An opportunity for CScart to make their software more robust ?

check the presets/data folder in your theme, the custom css is in your [preset].css file



jorden