Hmm, it might be a little late, but anyway, I had a similar problem today and it was solved in the following intuitive way:
My problem first: how do I get attributes on a custom search page in custom order?
for this i found something here: http://www.magentocommerce.com/boards/viewthread/11782/ - they say: U can use the custom field'note 'from the mysql table:' eav_attribute 'so you can change the Application \ code \ core \ Mage \ CatalogSearch \ Model \ Advanced.php order i.e.
from: ->setOrder('main_table.attribute_id', 'asc')
to: ->setOrder('main_table.note', 'asc')
But then you still have a problem on how to edit things correctly without editing anything directly in the mysql client; from now on I had your problem, my solution:
Model : get / set
- in the application /code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php
- grep: class Mage_Eav_Model_Entity_Attribute_Abstract ex
- add: best after search: "n getName"
/** * Get attribute note * * @return string */ public function getNote() { return $this->_getData('note'); } /** * Set attribute note * * @param string $name * @return Mage_Eav_Model_Entity_Attribute_Abstract */ public function setNote($note) { return $this->setData('note', $note); }
Controller : install
- in app / code / core / Mage / Adminhtml / controllers / Catalog / Product / AttributeController.php
- (ok this is a shortcut, I think you can add some attributes to the "note_text" somewhere, but I don't have a plan from magento)
- search: "default" and extension:
- from:
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']); if ($defaultValueField) { $data['default_value'] = $this->getRequest()->getParam($defaultValueField); }
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']); if ($defaultValueField) { $data['default_value'] = $this->getRequest()->getParam($defaultValueField); $data['note'] = $this->getRequest()->getParam('note_text'); }
View :
- in./app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php
after
$fieldset->addField('default_value_text', 'text', array(
add:
$fieldset->addField('note_text', 'text', array( 'name' => 'note_text', 'label' => Mage::helper('eav')->__('Note Value'), 'title' => Mage::helper('eav')->__('Note Value'), 'value' => $attributeObject->getDefaultValue(), ));
Finally, I initialized the note field in the mysql table:
update eav_attribute set note=lpad(attribute_id,10,'0000000000') where attribute_id not in(84,100);
where attributes with identifiers 84 and 100 already have some notes.
source share