Magento – Current display inventory in the frontend:

Addendum dated 14.07.2017

We have implemented this just for a 1.7er Store (Thus the variant with the code change and wanted to say briefly, that it is now that is no longer simple.phtml, the need to be adjusted, but default.phtml in the folder app / design / frontend /[own theme]/[own theme]/template/catalog/product/view/type.

If you want to display the stock in the category have, this is about the list.phtml in the folder app / design / frontend /[own theme]/[own theme]/template/catalog/product erreicht. Here at the desired locations to u.g. insert code.

Addendum dated 09.12.2014

Mit einem kleinen Trick ist es auch ohne Anpassung des Quellcodes möglich sich den aktuellen Bestand im Frontend anzeigen zu lassen. Hierzu wird einfach im Backend unter System > Configuration > Catalog / Warehouse Management / Lageroptionen bei “Nur noch X auf Lager ab” e.g.. 1000 registered. Nun wird bei allen Produkten mit Bestand >=1000 der Bestand im Frontend angezeigt. Damit dort aber nicht “Only 999 left” or “Only 999 auf Lager” is, sollte noch die Übersetzung angepasst werden. Hier kann man in seiner Template translate.csv z.B. “Only %s left”,”%s Stück auf Lager” insert.

Original Article

In Magento frontend should the current stock of the article are displayed (in figures), the following code must be inserted:

<p class="availability"><?php echo $this->__('Quantity Available') ?>: <?= (int) Magus::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?></p>

This belongs in / app / design / frontend /[base or default etc.]/[Ihr Template]/template/catalog/product/view/type/simple.phtml

He comes “In Stock”

So that it looks something like this:

<p><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('In stock') ?></span></p>
<p class=”availability”><?php echo $this->__('Quantity Available') ?>: <?= (int) Magus::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?></p>
<?php else: ?>

Then it still makes sense, “Quantity Available”,”Availability” (important: be careful, that when you insert the code, the quotation marks around Quantity Available safe or similar simple lines and no apostrophes. are. Selbes gilt für cataloginventory/stock_item)
entered in the occupied translate.csv.

Used in Magento 1.4.1.1
Found in http://www.magentocommerce.com/boards/viewthread/28146/

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *