The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [singleton]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
96 views

Magento 1 EE 1.14.3.10 - Mage::getSingleton('core/resource')->getConnection('core_read') is returning null sometimes

We have Magento 1 EE 1.14.3.10. In the production, I tried to deploy some of the updates, took a code pull from GIT and cleared the cache. Since then it started throwing this error. No error if Amasty ...
1
vote
1answer
819 views

Error: Mage registry key “_singleton/mage_gextorshop/observer” already exists

(Sorry if my english is bad, but is not my language) My Magento version is 1.9.3.8 I tried to solved this error whit this in SSH: php -f shell/compiler.php disable php -f shell/compiler.php clear ...
1
vote
5answers
780 views

When to use Mage::getSingleton() in my custom module/Ext

theoretically i know about Mage::getSingleton() & differences b/w Mage::getSingleton() and Mage::getModel() but my question is that in my custom module when to use Mage::getSingleton(){Normally ...
0
votes
2answers
282 views

500 PHP error on Mage:getSingleton('admin/session') after separating admin and frontend servers

Working with Magento CE v1.9.2.3 with Redis Doing development for a website that makes use of a separate frontend and admin server in their production environment. I'm attempting to deploy TaxJar and ...
0
votes
1answer
779 views

magento 2 version of getSingleton

In Magento 2 we are using dependency injection in replace of old style getModel, getHelper etc I have a particular class that i find i am injecting in a lot of places which holds some general ...
1
vote
3answers
1k views

Convert getSingleton(“core/resource”)->getConnection($type) from Magento 1 to Magento 2

I need to convert some singleton method calls from Magento 1 to Magento 2. Specifically Mage::getSingleton('core/resource')->getConnection($type); How can I do this in M2? I know that I should ...
0
votes
1answer
33 views

How to instantiate a custom session

I'm working on a module with a custom namespace session. I extended the Session class and created a new object, but every time I use the new object it overwrites the parent one while I need 2 ...
0
votes
2answers
52 views

Magento 2 - how to get models, config(s), and order info similar to Magento 1 style (Mage::getBaseUrl, Mage::getModel, etc…)) [duplicate]

I am a complete Magento 2 noob. I know a lot of things changed, one of which is how to get the Singleton Mage:: instance and its methods. I know it is moved to vendor/ directory from Mage/Code/Core, ...
0
votes
1answer
201 views

Difference between Mage::getSingleton('core/layout') and $this->getLayout()

I've been reading some tutorials and some use: $this->getLayout() To get the current layout, while others use: Mage::getSingleton('core/layout'); I was wondering if there's any difference ...
3
votes
2answers
2k views

What's the difference between getLastOrderId() and getLastRealOrderId()?

Does anyone have a quick and dirty explanation of the differences? Mage::getSingleton('checkout/session')->getLastOrderId() Mage::getSingleton('checkout/session')->getLastRealOrderId() I ...
0
votes
1answer
627 views

Mage::getSingleton()

I am trying to learn Magento Admin Modue Development. In this regard I am following this tutorial. Here I got the below line. $statuses = Mage::getSingleton('web/status')->getOptionArray(); Now ...
-1
votes
1answer
3k views

What is the difference between Mage::getSingleton() and Mage::getModel() in Magento [duplicate]

Mage::getSingleton() always finds for an existing object if not then create that a new object but Mage::getModel() always creates a new object.
1
vote
0answers
83 views

How to instantiate my new class and methods

I'm looking to trigger anything on a /admin/customer/edit just to know it's working.. an echo or print.. I have this code below. app/code/community/YourModule/etc/config.xml <global> <...
0
votes
1answer
55 views

Cannot access the Admin section to perform edits on webpage

Each time I try to access the Admin control panel of my site, I get an error message saying There has been an error processing your request Mage registry key "_singleton/...
4
votes
2answers
334 views

Helper's scope (when getting via Mage::helper())

I'm trying to understand couple of things about helper classes scope and lifetime. I think I got it but it's critical for me to be sure. So can you please tell me if I'm right about the following ...
1
vote
0answers
745 views

Mage registry key “_singleton/belvgall/observer” already exists [closed]

Mage registry key "_singleton/belvgall/observer" already exists Trace: #0 app\Mage.php(223): Mage::throwException('Mage registry k...') #1 app\Mage.php(477): Mage::register('_singleton/belv...', ...
0
votes
2answers
133 views

Pass data from view to block

I'm trying to pass a message from view to layout by using a model. This does not work when using _redirect(); I know there is a magento core functionality, but I'd like to understand why my custom ...
0
votes
1answer
591 views

problem after install of an extension: Mage registry key “_singleton/aw_layerednavigation/observer” already exists [closed]

After intalling this extension, I can not acess to the front-end or admin.. I'm having this error: Mage registry key "_singleton/aw_layerednavigation/observer" already exists Trace: #0 /...
0
votes
2answers
2k views

How is getContinueShoppingUrl() called by Mage::getSingleton('checkout/session')?

I'm using Magento 1.9 and am trying to gain a better understanding of the method, getContinueShoppingUrl(), when called by Mage::getSingleton('checkout/session') but can't seem to find the file that ...
1
vote
1answer
1k views

Mage registry key “_singleton/ambase/feed” already exists

One of the extension from Amasty was already installed in my website. I've installed another extension OPC and now I'm getting the error Mage registry key "_singleton/ambase/feed" already exists. I'...
1
vote
1answer
346 views

_getsingleton/customer/session registry already exists [closed]

I have used this code in observer function and event i am using is "controller_front_init_before". Problem is due to first line. Please help me to resolve this issue $customer_session = Mage::...
5
votes
2answers
318 views

What is the life span of a helper in Magento 1?

As I understand, helpers are singletons in Magento. I was wondering what the life span of the singleton is in Magento. Is only 1 instantiated for the life of the app (web server process start to ...
13
votes
5answers
13k views

Mage registry key “_singleton/weee/observer” already exists

When I try to add or edit a product I receive the following error: Mage registry key "_singleton/weee/observer" already exists Trace: #0 app/Mage.php(222): Mage::throwException('Mage registry k...') #...
0
votes
1answer
280 views

Accessing singleton model properties in another controller

I have a controller from which I am setting a property of my model $model = Mage::getSingleton('foo/bar'); $model->setData('name', 'somename'); echo $model->getData('name'); This outputs the ...
0
votes
1answer
1k views

Getting New Session Id before session expires,checkout/session car is empty even cart has item

I have a local module, which adds product to cart.To add to cart i have some conditional check before adding to cart,and i am using getSingleton('checkout/session')->getQuote() object for getting ...
13
votes
3answers
13k views

Understanding Magento Registry

I have been wondering always, where is all the registry data stored in Magento ? I know that even singleton objects are stored in the registry. And registry is just a static array variable of the ...
0
votes
2answers
953 views

Can't share data across modules with Mage::getSingleton

I have used Mage::getSingleton to share data across and within Modules before, but I'm coming across a problem where its not working in this specific scenario. My module asks questions at checkout ...
0
votes
3answers
189 views

Query regarding the file Mage.php

I need to understand what the code below actually does? I found this in Mage.php public static function getSingleton($modelClass='', array $arguments=array()) { $registryKey = '_singleton/'.$...