Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [registry]

The tag has no usage guidance.

0
votes
2answers
29 views

How to use registry in block?

I'm trying to get registry value in my block. Here's how block looks like, <?php namespace Vendor\Dunning\Block\Adminhtml\Dunning\Edit\Tab; class PartPayments extends \Magento\Backend\Block\...
4
votes
2answers
198 views

How to get current product in phtml without registry?

I would like to get my current product in my phtml. I saw lot of examples with registry in the Block file, but now, in M2.3, it's deprecated. Someone have an idea how to do ?
2
votes
0answers
32 views

Using Registry and data providers

I want to use Registry class (vendor/magento/framework/Registry.php) But above file mentioned something like this It's usage should be avoid. Use service classes or data providers instead. Can ...
0
votes
0answers
20 views

Magento 2: Get category in product list

In my product list template I need the current category. I was searching around and the recommended way is to inject the registry into the current block's constructor. Example: https://magento....
6
votes
1answer
839 views

\Magento\Framework\Registry deprecated in magento 2.3, How to create instance with Registry?

/** * Registry model. Used to manage values in registry * * Registry usage as a shared service introduces temporal, hard to detect coupling into system. * It's usage should be avoid. Use service ...
0
votes
3answers
107 views

Custom registry is not retrieved in block magento2

I am setting custom registry in my module like below. here is my controller file code. use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Model\Category; use Magento\Framework\...
0
votes
2answers
92 views

Registry not working in magento 2

I need to call the controller function from block . in magento 2 i use the registry. In my block i wrote public function __construct( Template\Context $context, \Magento\Catalog\...
-1
votes
2answers
37 views

What is Registry in Magento2 and Why use? [duplicate]

What is Registry in Magento2? Why use this. I want to know more detail about Registry. When we can use Registry in Magento2.
2
votes
1answer
344 views

Magento 2 : How to get current product programmatically in a helper?

Could someone advise what's the best way to get the current product in a custom helper? Basically if I am a product page I need to get it's sku
0
votes
0answers
86 views

Troubleshooting registry is null in Magento 2

I am trying to figure out how registry values are unset. My understanding is that the registry must behave as a singleton in order for the data to persist for the lifetime of the page request. My ...
3
votes
2answers
316 views

Getting current customer with registry in Magento2

below is my block file code class View extends \Magento\Framework\View\Element\Template { protected $_registry; protected $_customerSession; protected $_customer; public function __construct( ...
1
vote
1answer
356 views

Magento2 where state/regions are stored

Hello in Magento2 where is the xml file that stores the state/regions we believe "California" is being saved when customers place an order as "Cal" and we need to confirm if this is how Magento has ...
2
votes
0answers
23 views

How to create custom grid in admin using js

I want to create custom admin grid using jquery, I have search a lot but felt to get proper way. Can anyone suggest me the correct way.
0
votes
2answers
192 views

How to set value for existing registry variable?

I want to set value for an already existing registry variable. E.g. current_category I need to set some different value for this registry variable. Could someone kindly elaborate how to do it.
2
votes
2answers
73 views

How to give condition for Contact Form Only For Registered Customer?

Below is my Contact Form Email id Box : <div class="field"> <label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('...
0
votes
1answer
483 views

Mage registry key already exists Error

I keep getting an error stating " There has been an error processing your request Mage registry key "em_current_theme" already exists Then a bunch of Trace: numbers" It happens on the mobile version ...
1
vote
1answer
107 views

Why registry class in my controller breaks my page?

I tried to inject a registry class in my controllers constructor, without this registry class, it works (the die('Ok') is displayed ) but when I add the class, it breaks my page, I mean (I have a ...
2
votes
4answers
5k views

Magento 2 set & get Registry values

I want to set an array in registry in controller_action_predispatch_checkout_cart_add event observer and read this in a phtml page. The following code will give blank result . => Code : namespace ...
3
votes
1answer
3k views

what is the use of core registry in magento 2?

while trying to perform crud operation i came across $this->coreRegistry->register(RegistryConstants::CURRENT_AUTHOR_ID, $authorId); to perform edit action they got the id param and ...
1
vote
1answer
406 views

When we need to use product and current_product from Registry?

In Magento2, if we want the current category detail then we can retrieve it from Registry as below: $currentCategory = $this->_registry->registry('current_category'); For Getting current product ...
1
vote
1answer
3k views

Registry in Magento 2

I know how to register, how to get the value from registry and how to unregister. for register $this->_coreRegistry->register('customer_save_observer_executed_' . $customer_Data->getId(),...
0
votes
1answer
245 views

How to pass very big variable with a redirect in the backend?

I will create a redirect with a very big custom variable in the Magento 2 backend. Now I use this method: $resultRedirect->setPath('custom/url/index',array('_query'=>array('very_big_array'=>...
3
votes
1answer
2k views

Magento 2 : How to access the registry in controller defined in template fiile

I have registered a variable in customer checkout view template link.phtml with code: <?php $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $registry = $_objectManager->...
2
votes
1answer
204 views

Magento 2 - nearly empty registry when trying to get current category in top menu

I want to get the current shown category in \Magento\Theme\Block\Html\Topmenu. When using the anti-pattern Objectmanager approach in phtml via: $objectManager = \Magento\Framework\App\...
0
votes
0answers
116 views

Magento 2: registry() content missing while page refreshing

When loading a product detail page, at first $this->_registry->registry() gets an output content. But, while refreshing the same page, $this->_registry->registry() content missing. ...
0
votes
4answers
748 views

not stored value in Mage::registry after admin session expire

I have added this code Mage::register('test_checking_login', 1); after admin login and when expire session or delete session directory from var/ folder so Mage::registry('test_checking_login') ...
3
votes
3answers
3k views

Magento 2 - How to get product in a block

I'm trying to insert a block in default.xml layout so I created my app/code/Mainf/Stickers/view/frontend/layout/default.xml file: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/...
1
vote
1answer
250 views

Set registry data only for the custom page

I have a custom page created by our module. I am registering a registery in our controller as below Mage::register('customPage', 'customPage'); After the visit to this page, while go to the other ...
3
votes
1answer
1k views

Magento 2 - Core registry is empty

I created my custom controller that perform a post action, when there are some errors I need to send a param with a message to the view, but I can't use the messageManager class, because I need to put ...
1
vote
1answer
1k views

magento 2 how to get object from selected product (then get attributes)

When a product gets clicked on -> the product details page opens and shows detailed information and images of the product. I want to display (programmatically) some custom product attributes(which I ...
1
vote
1answer
868 views

How to pass data to UiComponent Area

I have try to use register to save value and call it in some place of UiComponent such as ButtonProvider or Field OptionSource but seem it doesn't work. Is that a right way to do it or i am doing ...
4
votes
2answers
333 views

Difference when to declare an object via Magento\Framework\ObjectManagerInterface and inject via the constructor

I'm initializing an object \Magento\Framework\Registry via a function create() of Magento\Framework\ObjectManagerInterface in Controller. After, I try to register a value to Registry Class. $registry ...
0
votes
2answers
197 views

Alternate method of getting product_id without using registry()

How to get the current product id. I don't want to get the product information from id (I want to get only the current id dynamically, not by assigning some value and get through object manager). ...
1
vote
0answers
74 views

Alternate for getting the product id instead of registry()

Unable to get the registry for current product by selecting the product in magento 2. Im trying to update the product id of the product which gets deleted from below code during the delete event ...
2
votes
1answer
156 views

Refactoring Mage::registry('current_shipment')

I'm working on refactoring a backend extension which uses the global Mage::registry('current_shipment') to retrieve the current shipment for printing. I'd like to change this line to something that ...
3
votes
1answer
1k views

Updating the Mage registry

I was just wondering if it was possible to update the value of a key in the Mage::registry without unsetting and resetting the item in the registry. e.g. $ids = array('1', '2', '3'); Mage::register('...
1
vote
1answer
191 views

Mage Register is Cleared by Grid Search Button No Page Reload

Even though there is no page reload, and grid ajax is set to true, the Mage::registry gets cleared when the grid search button is clicked. I am using a registry variable related to an option type in ...
1
vote
0answers
488 views

Configurable items in related and upsell areas

I have been following a tutorial - http://catgento.com/2012/02/09/adding-configurable-product-options-to-category-list-in-magento/ - to add configurable products dropdowns to the configurable products ...
0
votes
1answer
105 views

Magento registry in widget's template returns null

I'm trying to pass some data from controller thru redirection to widget's .phtml file. In sampleController.php: Mage::register('demo_access', (isset($request['paragraphText']) ? 2 : 1)); Mage::log(...
12
votes
5answers
21k views

Magento 2 get current category Id using registry

Any one know how I can get the category id using current category registry in Magento 2?
2
votes
2answers
827 views

Magento Admin Error

Starting yesterday, whenever I try to go to admin I get the following error: There has been an error processing your request Mage registry key "_singleton/all/update" already exists Any idea why?...
2
votes
1answer
1k views

Magento Observer already exists error

I'm, trying to define and implement observers to catch comments on the checkout page and write them into the database. But when I want to place an order I get the following exception: Mage registry ...
1
vote
1answer
595 views

Mage registry key “_resource_singleton/newsletter/subscriber” already exists [closed]

i get this error since i upgraded to 1.8.1.0 when i click on a customer to edit. Fatal error: Call to a member function loadByCustomer() on a non-object in app/code/core/Mage/Newsletter/Model/...
3
votes
3answers
11k views

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

I am building a magento B2B webshop and now I cant do anything with it because of some error a:5:{i:0;s:69:"Mage registry key "_singleton/rkt_jscssforsb/observer" already exists";i:1;s:3637:"#0 app/...
2
votes
2answers
1k views

Mage::registry not updating

From the info template in the wishlist I have added the following code Mage::unregister('product'); Mage::register('product', $item->getProduct()); echo $item->getProduct()->getName(); $...
1
vote
1answer
2k views

Fatal error: Call to a member function getId() on a non-object [closed]

how to solve this problem Fatal error: Call to a member function getId() on a non-object in F:\wamp\www\magento\app\code\local\company\module\Block\Customer\Sales\Order\View\block.php on line 18 my ...
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...') #...
2
votes
1answer
2k views

What is __prepareLayout Function Return and what is hasData and setData perform ?

public function _prepareLayout() { return parent::_prepareLayout(); } And public function getVire() { if (!$this->hasData('vire')) { $this->setData('vire', Mage::...
0
votes
0answers
112 views

Mage registry key “_singleton/core/resource” already exists - need fixes without clearing cache [duplicate]

We cleared the cache via the magento admin which then appeared to stop part way through and the site died. Have cleared the cache via ssh, changed the database cache options to 0. Tried adding the ...
13
votes
3answers
12k 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 ...