Magento: How do I debug if class_exist - magento

In Magento I am getting the error
'Model class does not exist: Cerulean_School_Model_Observer'
However I clearly have the file:
$ ls -l app/code/local/Cerulean/School/Model/Observer.php
-rw-r--r-- 1 vyom webuser 877 Oct 24 02:27 app/code/local/Cerulean/School/Model/Observer.php
I have no idea on how to debug this.

Open up that file and see if it really states
<?php class Cerulean_School_Model_Observer
and if it really exists then you can do for testing
<?php $test = new Cerulean_School_Model_Observer();
and every time you encounter a new framework , app with a structure you should familiarize with naming conventions as a first step that helps you understand the structure
you should follow http://framework.zend.com/manual/en/coding-standard.naming-conventions.html

Related

How could I do a massive install of a PrestaShop module?

I have a problem, I have to do a massive install of a custom PrestaShop module on 1500 e-commerce, but I don't know if this is possible, I was thinking to include a file called install.php and run through a.sh, this file may contain the next.
For example:
<?php
include "meli.php";
$meli = new Meli();
$meli->install();
?>
I called this file and initially, nothing happened so I check the possible reason and was:
if (!defined('_PS_VERSION_'))
exit;
So I commented this and run it again but this show me this error:
Fatal error: Class 'Module' not found in /home/dev2al5/public_html/modules/meli/meli.php on line 7
Does someone know how I can do this process?
Indeed I would do 3 things in the SH script:
Copy of the modules files in each site in the modules folder
Copy of a sql file containing the instructions to be executed
Calling a URL present in each module that would execute the SQL and then delete the SQL file in question
Regards

Ruby webpage shows only source code

I am trying to use Ruby to set up a home page. I currently have this code:
#!/usr/bin/ruby -w
puts "Hello, Ruby!";
It is saved as testing.rb. I am able to host files onto my school's public server so I had it in my school's directory such as school.ca/myname/public_html/testing.rb.
This has worked for previous HTML, CSS, Perl, ASP, and PHP programs. Now I am trying to set up Ruby and I'm having trouble. All it displays on the URL is my source code from above.
I changed the file permissions to 644.
You need a Ruby aware web server. There is one solution that makes running Ruby almost as easy as running PHP: Phusion Passenger. It can be installed as an Apache or Nginx plugins, two very common web servers. However, in order to install these plugins you usually require root access to your server, which I assume you don't have.
An entirely different solution would be to use a cloud service provider such as Heroku. They offer free plans as long as you are ok with your app not running 24h/day. In order to use this service, you have to be familiar with git though, but then it is as easy as uploading your code through git to run your application.
As for building your first Ruby web application, you should check out Sinatra. A simple hello world application would look as follows:
require "sinatra"
get "/" do
"Hello World!"
end
Sinatra is a Ruby Gem. You can install those libraries from the command line using a tool called gem:
gem install sinatra
I changed the file permissions to 644.
~/ruby_programs$ chmod 644 cgi.cgi
~/ruby_programs$ ls -al cgi.cgi
-rw-r--r-- 1 7stud staff 102 Nov 13 15:50 cgi.cgi
File permissions are displayed as follows:
First character is - or d: - means file, d means directory
Then there are three sets of three characters indicating permissions for owner, group and other:
r = readable
w = writable
x = executable
644 produces the permissions:
rw-r--r--
which are equivalent to:
owner: rw- (read, write)
group: r-- (read only)
other: r-- (read only)
You don't have to know who is an owner, or who is part of a group, or who falls in the other category to recognize that no one has permission to execute the file. You need to do this:
~/ruby_programs$ chmod a+x cgi.cgi #=>all + x => give execute permissions to everyone
~/ruby_programs$ ls -al cgi.cgi
-rwxr-xr-x 1 7stud staff 102 Nov 13 15:50 cgi.cgi
Now the permissions are:
owner: rwx
group: r-x
other: r-x
which means that now anyone can execute the file.
All it displays on the URL is my source code from above.
If you haven't already done so, try giving your ruby file a .cgi extension. Then use this code:
#!/usr/bin/env ruby
puts "Content-type: text/html\n\n"
puts "<html><body>Hello, Ruby!</body></html>"
Are you sure ruby is installed on your school's server?
Ruby is not a language that browsers can really interpret on their own without help - you need to either set up a server and have it print out an HTML webpage yourself, or use a framework that does so for you(i.e. Sinatra, Rails).

How to use package manager, gopm

I am in the process of experimenting with the various package manager offerings on, well, offer for Go. I like what I read in gopm - simple. However, thus far I cannot get past the very first hurdle. Here is what I am doing
Install gopm from source via go get github.com/gpmgo/gopm
Check that it did install. whereis gopm returns /opt/gopkg/bin/gopm
For good measure check my environment variables. echo $GOPATH returns /opt/gopkg.
Create main.go under /var/www/html/rest. The code reads
package main
import("github.com/astaxie/beego")
func main(){
println("Beego version:beego.VERSION)
}
Create the .gopmfile. It reads
[target]
path=rest
Switch to the /var/www/html/rest folder. At this point it contains
root root 20 Jun 25 09:13 .gopmfile
root root 107 Jun 25 09:13 main.go
Now issue a gopm build. which comes back with
[GOPM] 15-06-25 09:28:13 [FATAL]: package not installed github.com/astaxie/beego
Examine the /var/www/html/rest folder. It now contains an additional folder .vendor which in turn contains the folder src which in turn has a symlink to the /var/www/html/rest folder.
What am I doing wrong here?
You did not include the dependencies section in your .gopmfile file, which should look something like this:
[target]
path = rest
[deps]
github.com/astaxie/beego = tag:v0.9.0

Magento cache_dir is not writable and throws an error

I am new to Mangento. Any operation i do like navigation in the admin panel i am getting the following error.
Can someone tell me where can i find the cache_dir directory in a Magento Installation ?
Also it was working perfectly fine until 3 days. what could have made this error ?
http://pastebin.com/jHcD82wv
The cache folder is by default here:
/var/www/html/var/cache
or here:
/var/www/html/<Magento installation dir>/var/cache
By the way, if you're not sure how to find a folder, you can always go to the root directory and do:
ls -R | grep -i cache
Update:
The name of the variable is cache_dir. It is taken from: app/code/core/Mage/Core/Model/Config/Options.php:
$this->_data['cache_dir'] = $this->_data['var_dir'].DS.'cache';

what is the difference between stensi & WanWizard datamaper versions?

I've tried stensi but I see it has some mistakes and unexpected output as mentioned in the user guide.
For example, when trying to delete a record it gives this error:
$p=new Per();
$p->where('id',1)->get();
$p->delete();
with an error message of:
undefined index id
when
echo $p->UserName;
outputs:
mhmd
and WanWizard has also this error:
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: array_key_exists() expects parameter 2 to be array, boolean given</p>
<p>Filename: libraries/datamapper.php</p>
<p>Line Number: 399</p>
How can I overcome these errors or what can I do to make it work properly?
I've changed the two lines of code at ../libraries/datamapper.php line 399 (WanWizard version):
$d = array($this->config->item('datamapper'));
DataMapper::$config = $d;
and the error message disappeared.
If anyone has tried DataMapper and has a better suggestion, please let us know.
just found out this error can occur if you autoload the datamapper config file
Stensi's original version hasn't been maintained since 2007, and only supports CI 1.4. Not really an option anymore these days. It was forked by Overzealous in 2008, and I took over maintenance of that fork in 2010.
I fixed this (in the CI spark version) by moving the config file from the sparks directory to the /application/config directory.
There's something strange happening in CI v2.1.4 where
$this->config->load('datamapper', TRUE, TRUE);
on line 391 of application/libraries/datamapper.php in Datamapper-ORM v1.8.2.1 isn't "namespacing" the config correctly. If you do
print_r ($this->config); die;
just after line 391, you'll see all of the config values are in the general CodeIgniter "namespace" inside the loaded config array. The least intrusive way to get around this is to manually namespace your application/config/datamapper.php file yourself, by changing all the references from
$config['prefix'] = '';
$config['join_prefix'] = '';
...
to
$config['datamapper']['prefix'] = '';
$config['datamapper']['join_prefix'] = '';
...
That's how I got around it. Though #Mhmdgomma's fix does work, I prefer not to hack the core of the system when there is a simpler solution available. Someone should probably get the maintainers to fix this, but I'm not sure where the issue lies. It looks more like it's a CI issue, rather than DM.

Resources