Fatal error: Class 'Config' not found in opencart - opencart

I have taken a copy of an OpenCart installation (version 2.0.3.1) and put on to Windows localhost.
I've fixed a couple of the issues, but I've now come up against an error that I can't resolve:
Fatal error: Class 'Config' not found in ..\index.php on line 31
I've searched Google, but no-one else seems to have come across the same problem.
Can someone tell me where this class resides?
The relevant lines in the index.php file are:
CODE:
23 // Registry
24 $registry = new Registry();
25
26 // Loader
27 $loader = new Loader($registry);
28 $registry->set('load', $loader);
29
30 // Config
31 $config = new Config(); // HERE
32 $registry->set('config', $config);

I got this error - but it was due to me adding config.php to my .gitignore file.
I only wanted to ignore my settings files but this caused the config.php class file to also be ignored from the /system/library folder (same name!)
just make sure that config.php exists in the library folder - but make sure it contains config class - not your oc settings!

I faced the same issue while integrating it on the local machine. Follow these steps, it might help:-
Download the opencart package of version 2.0.3.1 from the website or download from this link: https://www.opencart.com/index.php?route=download/download/success&download_id=41
Open the downloaded folder and navigate to System/library folder.
Copy config.php file from there and paste in your project location in the same folder System/library.
It will ask to replace the file, do that and it should solve the problem.
Also, make sure you have written something like this on top of index file or not require_once('config.php');
I hope this helps.

Related

direnv cannot find .envrc file even it does exist

I set up a virtual environment for a Django-React project. I have created the .bashrc in the user home directory, and .envrc file in the root folder of the project repo. But when I tried 'direnv allow' it always return '.envrc does not exit' with a weird referenced folder path. Can someone please help?
direnv allow error
direnv status
I'm doing it on Windows 11.
I tried to re-install everything and change the position of the folder from E to C driver. I also tried to rename the folder to anything else to see if any of it results in the weird folder path. But the error message remains.

Creation of the virtual directory failed with error: cannot write configuration file applicationhost.config

I'm just simply trying to open up a VS 2017 project. When I open the solution, I get the following error message:
Creation of the virtual directory http://localhost:58051/failed with the error: Filename: \?\C:\Users\Visual Studio 2017\Projects\Testing\Version 2.0.vs\config\applicationhost.config Error: Cannot write configuration file
I've checked the folders along the file path and they are not encrypted. All the folders along the file path have a black box for the Read Only attribute. When I go to the config folder and clear out the black box for the Read Only attribute and Apply the setting, I find if I exit and go back to the same folder, the black box reappears for the Read Only attribute. I've read that the black box doesn't really mean the Read Only attribute has been turned on. If the Read Only attribute was actually turned on, I should expect to see a check mark instead. However, this doesn't explain why I can't open the solution.
After I click the OK Button to the VS Error message, VS just says the solution is "(unavailable)" in the Solution Explorer.
Any help would be greatly appreciated.
I too had this problem with my project files located on OneDrive. The way I resolved it was I renamed the applicationhost.config file located in the ".vs\config" directory of your root project directory then reloaded the web project. This will create a new applicationhost.config file.
I had the same error message sharing a project between 2 machines via OneDrive and fixed it as follows:
1 - Closed VS.Net
2 - Opened [myappnamefolder].vs\config\applicationhost.config in Notepad
3 - Searched the open file for the filename in my error message (In your case C:\Users\Visual Studio 2017\Projects\Testing\Version 2.0.vs\config\applicationhost.config ).
It was found under system.applicationHost, sites, site name, application path, virtualDirectory - physicalPath
4 - Amended the physicalPath value to point to the valid path of the project's config file as above.
5 - Saved the applicationhost.config file
My paths were different because I had different home user directories on each machine. (User A & User B)
I have resolved this error with this way mention as below:
STEP 1:
Go to on that path
C:\Users\navz\OneDrive\Documents\IISExpress\config
STEP2:
When you reach on this folder "config"
in this folder we can see "applicationhost" file
STEP3:
Close the Visual studio existing project and delete the applicationhost file(see on Step 2 path)
Then open the existing project again, it will be reloaded automatically and work properly.
Had same problem then looked into vs\config\applicationhost.config and it was encrypted. I unencrypted file and solution loaded with no problems.
I've had this problem several times using VS 2017 with Onedrive. Resolved it by renaming the application.config and having VS recreate it. Just as well could have edited line in the file. See the Diff below as an example.
The config file is located in something like C:\Code\MyProject\.vs\config\.
I just encountered this error. I followed the steps in this answer: https://stackoverflow.com/a/50508207/1166163
When I tried to save my changes I realised TFS had marked the file as read-only, preventing VS from updating the value. Removing the read-only attribute fixed the problem.
None of the above worked for me. I ended up deleting and recloning the repo that was giving me problems. It then opened up just fine.
Windows 10 Defender was causing this for me. When I disabled control folder access it worked again. Odd, because it had been working with that setting on for a while.
my drives were different - but the main codebase was shared between the two machines - so on one it was in the d drive - so i mapped the parent subdirectory on the second machine to be the d drive ... which resulted in the same paths then on both ... i just had to open the solution from the d drive on the second machine

Django CompileError: File to import not found or unreadable: bootstrap-sass/assets/stylesheets/bootstrap/variables

I am currently working on the cadasta - an open source organisation's - Django project.
They require you to run their platform in a virtual machine (virtualbox) using vagrant.
As I enter their repository, and run their server using ./runserver, I am all of a sudden getting a CompileError which says:
File to import not found or unreadable: bootstrap-sass/assets/stylesheets/bootstrap/variables. Parent style sheet: /vagrant/cadasta/core/static/css/_variables.scss.
on line 74 of core/static/css/_variables.scss
#import "bootstrap-sass/assets/stylesheets/bootstrap/variables";
Following this link: https://github.com/jrief/djangocms-cascade/issues/130,
I found that libsass is already installed, and so I tried installing bootstrap-sass inside the VM, but it did no good. Everything was working fine until I renamed the cadasta-platform directory (i.e their github repo that I cloned, and so the main project is included inside this folder only.) and refreshed. I even tried running the server again, but couldn't get through this error. I suppose renaming the directory shouldn't be the cause?
I have no clue on how to proceed. Please help.
EDIT: After renaming the project folder to the same name solved this error. If anyone would ever like to answer this question, please explain why renaming the project directory produces an error like this? As I believe, I think renaming should not be an issue?

Moving OpenCart Extensions

I have an old OpenCart set up but not the extension source files.
I need to copy all OpenCart extensions from my first installation to a new one.
Both OpenCart installations have the same version. The extensions include some vQmod scripts as well.
Open Cart installation has multiple extensions installed. We have to move them to another open cart store.
We do not have the zip files for extensions so we can not find out which files we have to move for each extension.
is there any way to identify the files for each extension or download them from the first opencart setup ?
admin(remove config.php)
catalog
download
image
system
vqmod
index.php
copy all files to your new opencart excpet the config.php and admin/config.php
which openCart version you are using???
Actually there is no way to find it automatically But there is a way manually but it took too much time
compare your exiting opencart version files with same version default opencart files(Remaining Files are your Extension Files )Here you can find defaul OpenCart versions Files, Download and compare with your relevant version
Secondly go into Admin side there in modification there you will find modification log there you can find where and to which files to some specify extent-on are effected For Example
`----------------------------------------------------------------
MOD: NitroPack
FILE: system/library/db.php
CODE: if (class_exists($class)) {
LINE: 37
FILE: system/engine/front.php
CODE: require_once(DIR_SYSTEM . 'journal2/startup.php');
LINE: 52
FILE: system/engine/router.php
CODE: require_once(DIR_SYSTEM . 'journal2/startup.php');
LINE: 52
FILE: system/library/image.php
CODE: public function save($file, $quality = 90) {
LINE: 117
CODE: if ($width_orig != $width || $height_orig != $height) {
LINE: 34
CODE: if ($width_orig != $width || $height_orig != $height) {
LINE: 34
FILE: system/library/document.php
CODE: return $this->styles;
LINE: 125
CODE: return $this->scripts[$postion];
LINE: 153
----------------------------------------------------------------`
This is the log for my installed Extension (module NitroPAck) here you can see that every trace and modification is described

PyAIML not loading startup

I am beginning a project on Python that implements PyAIML and I wrote the following code to create a brain for my project:
import aiml
k=aiml.Kernel()
k.learn("std-startup.xml")
k.respond("LOAD AIML B")
k.saveBrain("jarvis.brn")
When I run the program I get this error: WARNING: No match found for input: LOAD AIML B
I understand that I needed to download an AIML set to begin development. So I did, but I'm stuck there.
Please help. I'm a noob programmer so don't be rough on me for this dumb mistake.
Thanks in advance!
The .learn() method will not throw an error if the file you pass it does not exist, and I'm guessing that you are trying to learn patterns from "std-startup.xml" without having this file in your directory.
Make sure the file std-startup.xml is in the directory you are running your script from. You should also have a directory called standard in your working directory that contains the standard set of aiml files. Basically your directory should look like this:
mydir/my_script.py
mydir/std-startup.xml
mydir/standard/a-bunch-of-std-aiml-files.aiml
These files can be found in the "Other Files/Standard AIML Set/" folder on the pyaiml source forge site. Go to that folder and download the one of the tarballs or the zip.
A few things:
If your AIML is loading properly, pyAIML will respond with a line that will read something like:
Loading std-startup.aiml... done (1.00 seconds)
It will not necessarily throw an error if it does not find a file to load, so if you don't see this line, pyAIML has not loaded the AIML file.
I don't see 'std-startup.xml' in the sourceforge directory either, but this shouldn't matter. All that you're loading is any AIML file that will allow you to test the kernel. Try loading the 'self-test.aiml' file in the /aiml directory instead. (Double-check to make sure the file suffix in your code is .aiml and not .xml)
k.respond() is for giving the bot some input and 'LOAD AIML B' is just a test phrase. Once you've loaded 'self-test.aiml' try k.respond('test date') and you should get
The date is Wed Mar 13 01:37:07 2013 in response.