I bought an order attributes extension and as with all things Magento, I've been tweaking it to my tastes. They add in their
fieldset of the new form elements into an existing checkout step. Their backend lets you pick what step and dynamically declare the extra attributes, too. I've already successfully changed three of the elements from simple text inputs to instead be
<SELECT> dropdowns of attributes from our catalog.
Now I want to re-style the html so they go left to right and not in the generic order and layout of all Magento/Varien forms. I've done this dozens of times in various template
.phtml files, but this case is defying my attempts.
My problem is that if I alter the template
fields.phtml with my form (my usual practice), then the new order attributes show up on every checkout step, not just the one I want.
So I next think, ok, let's alter
fields.php. Now I have a chicken and egg problem in that this function starts off with calling
$html = parent::_toHtml(); which goes through the entire HTML building process.
The template file adds a bunch of stuff above my form, so it's not "easy" to just change the text string
Any ideas about getting hold of the
<SELECT> html at some point in the chain?
Their code flow is like this:
getFormElements(), which instantiates a
new Varien_Data_Form() and then creates the
fieldset adding their attributes to the form with
$fieldset->addField($attribute->getAttributeCode(), $fieldType, $elementOptions)
At no point is there any raw HTML in their code for making these input fields.
_toHtml() then executes:
$html = parent::_toHtml();
which goes to:
app/code/core/Mage/Core/Block/Template.php which executes this series of calls:
fetchView() simply does an
include() of the template file,
▄ The template file, fields.phtml then does
foreach ($this->getFormElements() as $element) ... and then does
echo $element->toHtml(); but, there's only one "element", which is the fieldset itself.
▄ Next stop I think is
lib/Varien/Data/Form/Element/Abstract.php where its
getHtml() then calls
getDefaultHtml() in file
lib/Varien/Data/Form/Element/Fieldset.php actually generates the HTML itself, adding in the
<div><h4 class="icon-head head-edit-form fieldset-legend"></h4> I'm seeing just above the fieldset itself in the page source.
▄ The fieldset is rendered via $this->getElementHtml() which in Fieldset.php, then does the and tags and for the actual elements in the fieldset, it runs