Magento - Adminhtml - The default site in the new client form

I am developing an online store for my client, and we have only one site in our Magento setup.

In the admin panel, when I go to the "Add Client" tab, in the "Link to Site" field, I see "Administrator" by default. I would like my site to be there by default.

I think one possible way would be to write code: Mage_Adminhtml_Block_Customer_Edit_Tab_Account :: initForm

+4
source share
3 answers

I took a hint from Lrrr’s answer and populated the drop-down list with only user-added websites, that is, “Please select” and “Admin” is no longer available as options by adding the following line:

$form->getElement('website_id')->setValues(Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm()); 

at the end of this function:

 Mage_Adminhtml_Block_Customer_Edit_Tab_Account::initForm 

The ideal way would, of course, be to override the above function in one native module, but in our case, overriding the above class creates a conflict for the other extension that we installed, so I did it this way.

+2
source

The cleanest way to do this is to simply set the default value in your database. This will not require any code changes.

 UPDATE eav_attribute SET default_value = 1 WHERE attribute_code = 'website_id' 

The example MySQL statement above sets your defaultsite_id to 1.

+3
source

Or you can simply edit the array in:

 Mage_Customer_Model_Customer_Attribute_Source_Website::getAllOptions() 
+2
source

Source: https://habr.com/ru/post/1337323/


All Articles