Skip to content
Code-Schnipsel Gruppen Projekte
Commit 34a3fd49 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen
Übergeordneter d78492cd
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -491,6 +491,38 @@ public function getQuantity()
return 1;
}
/**
* Returns the article quantity
*
* @param null|QUI\Locale $Locale
* @return string
*/
public function getQuantityUnit($Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
}
try {
// @todo cache unit field entries
$current = $Locale->getCurrent();
$unitId = $this->attributes['quantityUnit']['id'];
$UnitField = QUI\ERP\Products\Handler\Fields::getField(QUI\ERP\Products\Handler\Fields::FIELD_UNIT);
$options = $UnitField->getOptions();
if (isset($options['entries'][$unitId])) {
$titles = $options['entries'][$unitId]['title'];
if ($titles[$current]) {
return $titles[$current];
}
}
} catch (QUI\Exception $Exception) {
}
return $this->attributes['quantityUnit']['title'];
}
/**
* Return the price from the article
*
......
......@@ -43,7 +43,7 @@
{$this->getAttribute('quantity')}
</td>
<td class="articles-article-quantityUnit">
{$this->getAttribute('quantityUnit')}
{$this->getQuantityUnit()}
</td>
{/if}
......
......@@ -40,6 +40,14 @@ public function __construct(Article $Article)
$this->setAttributes($this->Article->toArray());
}
/**
* @return string
*/
public function getQuantityUnit(): string
{
return $this->Article->getQuantityUnit();
}
/**
* Set the currency
*
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren