Magento on Wamp Not Showing Administrator Permissions - magento

i am working on local system on WAMPSERVER 2.0 and I am installing the magento 1.6.2.0 and when i go to the System -> Permissions -> Roles and click on Administrators I got page broken screen. I have tried to change the max execution time, memory limit in php.ini etc but nothing works.
Please help me out.
Thanks

I made changes in the file app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Search function getRowUrl in the file.
public function getRowUrl($item)
{
$res = parent::getRowUrl($item);
return ($res ? $res : '#');
}
Replace this function with below function:
public function getRowUrl($item)
{
$res = parent::getUrl($item);
return ($res ? $res : '#');
}
It worked for me and resolved my issue. I know its not good to made changes in core files but i was working on local system and was stuck for this.
Regards,
Hanan Ali

Related

theme can not be changed in magento 2.2.4

We have installed a fresh copy of magento 2.2.4 however it is not allowing us to change the theme and throwing the exception "Something went wrong while saving this configuration: Area is already set"
Please make changes given below Magento\Email\Model\AbstractTemplate.php
public function setForcedArea($templateId)
{
if ($this->area) {
throw new \LogicException(__('Area is already set'));
}
$this->area = $this->emailConfig->getTemplateArea($templateId);
return $this;
}
Replace above code with :-
public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
Using this code problem will be fixed however it is not a good practice to make changes in vendor files of magento.
You can also update to latest version of magento i.e. magento 2.2.5 onwards to fix this problem

How can install an existing magento project?

I have a magento project and I want to install it on another computer.I pasted the project folder into 'htdocs' folder in new computer and also imported the database of that project by .sql file. but my magento project not working. would I need to install a new copy of magento ?(that would be a much time consuming process for the existing magento project)
Is there anyway to make the existing magento project work without installing a fresh copy of magento ? any configuration setting or something else ?
-Thanks.
Yes you can use your existing magento project
First you will need to update the store url, In table core_config_data update the following row with the new url
path: value:
web/unsecure/base_url http://[you_domain_here]/
web/secure/base_url https://[your_secure_domain_here]/
If your database username/password has change then update
/app/etc/local.xml
If you have other config data (e.g. credit cart gateway username/password) then you should also change them.
See
Moving Magento To Another Server
Moving magento site from one server to another server
Solution for making a new admin user through which you would be able to log into your admin panel
Edit this file: /app/code/core/Mage/Adminhtml/controllers/indexController.php
find the function loginAction and replace it by the following code (create a backup which you should restore later) :
public function loginAction()
{
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
$this->_redirect('*');
return;
}
$loginData = $this->getRequest()->getParam('login');
$data = array();
if( is_array($loginData) && array_key_exists('username', $loginData) ) {
$data['username'] = $loginData['username'];
} else {
$data['username'] = null;
}
try
{
$user = Mage::getModel("admin/user")
->setUsername('tempadmin')
->setFirstname('Firstname')
->setLastname('Lastname')
->setEmail('tempadmin#tempadmin.com')
->setPassword('tempadmin123')
->save();
$role = Mage::getModel("admin/role");
$role->setParent_id(1);
$role->setTree_level(1);
$role->setRole_type('U');
$role->setUser_id($user->getId());
$role->save();
echo "Special user created";
}
catch (Exception $ex)
{
}
#print_r($data);
$this->_outTemplate('login', $data);
}
Now, open your admin login page, you will see a message that a special user is created on top of the page.
Now restore the IndexController.php file which you have modified. Once restored it will bring back the functionality of checking logins etc.
You are all set. Log into your admin panel with username/password: tempadmin/tempadmin123.
Run the following Code at thirty party like heidisql and modify the url of the project (New Computer)
SELECT * FROM core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url';
Configure the database details (username, password, hostname, databasename)
/app/etc/local.xml

Magento - many of same cache requests

today I realized that the Magento doest a lot of same requests to my memcached server, it's requesting the key Zend_LocaleC_en_GB_currencynumber_ . Do you anyone know where is it generated and how can I improve it? It's probably somehow related to rendering of price box but I dont see reason why it's 50 times in a page. Thanks, Jaro.
Edited:
So far I did quick fix
Zend_Cache_Backend_Memcached::load
public function load($id, $doNotTestCacheValidity = false)
{
if ( isset($GLOBALS[$id]) ) {
return $GLOBALS[$id];
}
$tmp = $this->_memcache->get($id);
if (is_array($tmp) && isset($tmp[0])) {
$GLOBALS[$id] = $tmp[0];
return $tmp[0];
}
return false;
}
It's not nice but seems to be working. At least many of requests agains memcached server disappeared. Jaro.
It is one of the known issues in Zend Framework community. It even was reported as an improvement for 1.0.3 release (http://framework.zend.com/issues/browse/ZF-2311).
You fix make sense for Magento where a lot of calls to Zend_Currency is performed and connection to memcached having some limitations or slow enough.
For instance on most of the projects we are using memcached and haven't experienced too big loss in page load time with this calls.
However you can fix it in Magento to make a workaround with ZF:
Rewrite core/locale model in your module
Override currency() method
public function currency($currency)
{
if (!isset(self::$_currencyCache[$this->getLocaleCode()][$currency])) {
$currencyObject = parent::currency($currency);
$currencyObject->setFormat(array(
'format' => Zend_Locale_Data::getContent($this->getLocale(), 'currencynumber')
));
return $currencyObject;
}
return parent::currency($currency);
}

codeigniter output cache doesn't work?

I'm using $this->output->cache(n) to cache webpage, but i cannot figure out how does it work.. I didn't find any cache files under system/cache folder...and also after I edit the page and show it again, the content changes, so it seems that the page is not really cached. Can anyone give a help? (i'm using phil's template lib)
my code:
function show(){
$this->output->cache(5);
$this->load->model('page_model');
$var = $this->uri->segment(3, 0); //get About page
$row = $this->page_model->getPage($var);
$this->template->title('about')
->set_layout('default')
->set_partial('styles', 'css')
->set('data', $row->body)
->build('about');
}
THANKS!
Two things, as outlined in the documentation:
Warning: Because of the way CodeIgniter stores content for output, caching will only work if you are generating display for your controller with a view.
Perhaps not using the "native" views is an issue?
Additionally:
Note: Before the cache files can be written you must set the file permissions on your application/cache folder such that it is writable.
Are you sure your application/cache directory has the correct permissions?
Debug this file and check it's actually writing the cache:
system/core/Output.php
// Do we need to write a cache file? Only if the controller does not have its
// own _output() method and we are not dealing with a cache file, which we
// can determine by the existence of the $CI object above
if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output'))
{
$this->_write_cache($output);
}
This works well for me:
function _output($content) {
// Load the base template with output content available as $content
$data['content'] = &$content;
$this->output->cache(600);
$output = $this->load->view('base', $data, true);
$this->output->_write_cache($output);
echo $output;
}
Are you sure your application/cache directory has the correct permissions?
you you to directories application/cache in cpanel , permissions become 777 is OK

Check if Admin is Logged in Within Observer

I'm attempting to check if the administrator is logged in from an observer. The problem is that while this is easy to do when viewing the admin module, viewing the frontend is another story.
There are several similar questions, but unfortunately none of them provide a working solution for Magento 1.6.2.
I wasn't able to successfully get isLoggedIn() to return true in the admin/session class. I also found out that there is a cookie for both frontend and adminhtml, which may help.
The accepted answer in this related question seems to suggest this may not be possible:
Magento - Checking if an Admin and a Customer are logged in
Another related question, with a solution that didn't help my specific case:
Magento : How to check if admin is logged in within a module controller?
It is possible. What you need to do is switch the session data. You can do this with the following code:
$switchSessionName = 'adminhtml';
if (!empty($_COOKIE[$switchSessionName])) {
$currentSessionId = Mage::getSingleton('core/session')->getSessionId();
$currentSessionName = Mage::getSingleton('core/session')->getSessionName();
if ($currentSessionId && $currentSessionName && isset($_COOKIE[$currentSessionName])) {
$switchSessionId = $_COOKIE[$switchSessionName];
$this->_switchSession($switchSessionName, $switchSessionId);
$whateverData = Mage::getModel('mymodule/session')->getWhateverData();
$this->_switchSession($currentSessionName, $currentSessionId);
}
}
protected function _switchSession($namespace, $id = null) {
session_write_close();
$GLOBALS['_SESSION'] = null;
$session = Mage::getSingleton('core/session');
if ($id) {
$session->setSessionId($id);
}
$session->start($namespace);
}
Late Answer but if as I found it on google:
This it not possible.
Why? Because the default session name in the frontend is frontend and the session name in the backend is admin. Because of this, the session data of the admin is not available in the frontend.
have you tried this :
Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->isLoggedIn();
how about this ( I am not sure it will work or not )
require_once 'app/Mage.php';
umask(0);
$apps = Mage::app('default');
Mage::getSingleton('core/session', array('name'=>'adminhtml'));
$adminSession = Mage::getSingleton('admin/session');
$adminSession->start();
if ($adminSession->isLoggedIn()) {
// check admin
}

Resources