I am currently modifying the Magento front end printable order page (the page a customer can print when they view an order and click "print order"), specifically the items table. I removed a column from the table ("Product Name"), and now the table is screwed up because the totals rows labels span a certain number of columns (4). I have found the specific template that deals with the order totals:
/app/design/frontend/base/default/template/sales/order/totals.phtml
I thought I would be able to just copy that file to my template directory, go in and change the colspan attribute value from 4 to 3. But where the class and the colspan attributes should be is a call to $this->getLa开发者_如何学编程belProperties(). getLabelProperties returns 'class="a-right" colspan="4"'. I've traced it through and found that getLabelProperties is one of those magic getters that calls getData('label_properties') in /lib/Varien/Object.php.
I'm probably missing something embarrassingly obvious, but I can't tell where the value of 'label_properties' is set or stored. When I step through the code using xdebug and Notepad++ I see everything to the point of it gleaning the getData key from the method that was called, it passing that key to getData, and down to line 285 of /lib/Varien/Object.php:
return $this->_data[$key];
... and then magically the 'class="a-right" colspan="4"' has populated the $data variable to be returned to the template. I don't see a $this->_data array in the debug var list, so how is the key being used to retrieve data from it. And if it exists (I know it has to), what is populating the $this->_data array in the first place. I know it's not magic, so I'm sure I've just missed something somewhere. Can someone enlighten me? Push me in the right direction?
You can update the values of the colspan in your layout file:
app/design/frontend/base/default/layout/sales.xml
Just copy the sales.xml in your custom theme and search for "setLabelProperties".
Let me know if you need further explanations.
精彩评论