I do not know how long I've been trying to get the unit price in the transaction email from Magento.
By default, the system in the order confirmation email only
- Product Name (Name)
- Model (SKU)
- Quantity (Qty)
- Subtotal (Subtotal)
issued. A customer would like to but additionally the column “Price” or. Unit price have.
The (Ver-)Search was long and winding but ultimately crowned with success. For the output of the new column are two template files responsible. On the one hand, for the new column itself- the
items.phtml
in the folder
app / design / frontend /[base or default]/[IhrTemplate]/template/email/order
and on the other side for the filling of the column- the
default.phtml
in the folder
app / design / frontend /[base or default]/[IhrTemplate]/template/email/order/items/order
(The folder may have changed a little with the Magentoversionen, but the files are the same).
Order now in the email first insert a new column, Add the following line we ca. in line 33 in the items.phtml
<th align=”center” bgcolor=”#d9e5ee” style=”padding:3px 9px”><?php echo $this->__(‘Price’) ?></th>
Now, a new column appears. But still lacks the filling.
For this, the following code and open default.phtml ca. in line 49 copied
<td align=”right” valign =”top” style=”padding:3px 9px”><?php
if ($this->helper(‘tax’)->displaySalesPriceInclTax($_order->getStore())) {
$itemprice = $this->helper(‘checkout’)->getPriceInclTax($_item) ;
echo $this->helper(‘checkout’)->formatPrice($itemprice);
} else {
echo $this->helper(‘checkout’)->formatPrice($_item->getPrice()) ;
} ?>
</td>
This code provides for the filling and also for correct gross- and net presentation.
Now we still have the problem, that the sum is not right and therefore looks a little funny. For this we turn to open
sales.xml
from the folder
app / design / frontend /[base or default]/[IhrTemplate]/layout
and look for there
Email layouts section
Hier ca. in line 247 is then found
<action method=”setLabelProperties”><value>colspan =”3” align=”right” style=”padding:3px 9px”</value></action>
here the colspan on “4” change in and it works.
Used in Magento versions 1.4.1.1 and 1.5.1.0 Comments? Additions? Notes? Gladly!
Hallo,
super Anleitung – thank you! Ich habe es für Magento 1.7 umgesetzt und es funktioniert bis auf eine Klenigkeit auch:
Der letzte Schritt, in dem die Summe nach rechts verschoben wird, funktiert nicht. colspan habe ich auf 4 geändert in der sales-xml, aber die Summe steht trotzdem nicht rechtsbündig in der Tabelle. Hast du eine Idee, woran das liegen könnte? Ist hier der Aufbau gegenüber Magento 1.4 /1.5 anders?
Thank you very much!
Hi, das kann ich leider nicht per Ferndiagnose sagen. Da es -wie geschrieben- eine Spezialanpassung war, haben wir das seit dem nicht mehr gemacht. Müsste man sich einmal im Detail anschauen.
Hallöle,
hab das gerade auch in Magento 1.8.1 hinbekommen, allerdings bin ich am Ende auch an der sales.xml hängen geblieben, aber hab den Fehler schnell gefunden, da hat die sales.xml aus base/default die sales.xml aus default/meintheme überschrieben, obwohl das ja eigentlich anders rum sein sollte o_o
Danke für die tolle ausführliche Anleitung.