Q:

Dividing two attributes together with the result showing as a third attribute

trying to divide two attributes by each other to get the value of Price Per unit.
 <?php echo $this->escapeHtml( $_item->getFinalPrice() / $_item->getPackSize()) ?>

Not sure what im missing but it shows blank on the frontend. any help is appreciated.
Simplified: When i enter a Price and I enter the custom attribute "Pack Size" and save the Price per piece should populate automatically.
Price / Packsize = price per piece

A:

Probably one of the factors are not a number so the division can not be done. First of all, check that these two lines return the numbers you expect:
echo $_item->getFinalPrice()
echo $_item->getPackSize()

You'll probably find the second one is empty. Maybe because the pack_size attribute is not loaded in the page you are looking at.
Also, notice that you don't need to call $this->escapeHtml here. It is supposed that you are passing a number to escapeHtml, so there should be no html to escape.

