Skip to content
Code-Schnipsel Gruppen Projekte
Commit 1d3c5b21 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: custom field passing had a mega error :-/

Übergeordneter 93842fc8
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -490,18 +490,6 @@ public function toArray()
$discount = $this->Discount->toJSON();
}
$customFields = array_filter($this->customFields, function ($v) {
if (is_string($v)) {
return true;
}
if (is_numeric($v)) {
return true;
}
return false;
});
return [
// article data
'id' => $this->getId(),
......@@ -515,7 +503,7 @@ public function toArray()
'discount' => $discount,
'control' => $this->attributes['control'],
'class' => self::class,
'customFields' => $customFields,
'customFields' => $this->customFields,
// calculated data
'calculated' => [
......@@ -558,6 +546,5 @@ public function getCustomFields()
return $this->customFields;
}
//endregion
}
......@@ -13,6 +13,15 @@
<div class="articles-article-information-description">
{$this->getAttribute('description')}
</div>
<ul class="quiqqer-order-basket-articles-article-fields">
{foreach $customFields as $field}
<li class="quiqqer-order-basket-articles-article-fields-field">
<span>{$field.title}:</span>
<span>{$field.custom_calc.valueText}</span>
</li>
{/foreach}
</ul>
</td>
{if $this->getAttribute('quantity') !== false}
......
......@@ -83,11 +83,28 @@ public function toHTML()
$Engine = QUI::getTemplateManager()->getEngine();
$Currency = $this->getCurrency();
$article = $this->Article->toArray();
$calc = $article['calculated'];
$customFields = [];
$article = $this->Article->toArray();
$calc = $article['calculated'];
$this->setAttributes($article);
foreach ($article['customFields'] as $field) {
if (!isset($field['title'])) {
continue;
}
if (!isset($field['custom_calc']['valueText'])) {
continue;
}
if (!isset($field['custom_calc']['value'])) {
continue;
}
$customFields[] = $field;
}
$Engine->assign([
'this' => $this,
'position' => $this->position,
......@@ -96,7 +113,8 @@ public function toHTML()
'calculated_basisPrice' => $Currency->format($calc['basisPrice']),
'calculated_price' => $Currency->format($calc['price']),
'calculated_sum' => $Currency->format($calc['sum']),
'calculated_nettoSum' => $Currency->format($calc['nettoSum'])
'calculated_nettoSum' => $Currency->format($calc['nettoSum']),
'customFields' => $customFields
]);
return $Engine->fetch(dirname(__FILE__).'/ArticleView.html');
......
......@@ -300,7 +300,8 @@ public function getAttributes()
$attributes['firstname'] = $this->getAttribute('firstname');
$attributes['lastname'] = $this->getAttribute('lastname');
$attributes['username'] = $this->getAttribute('username');
$attributes['isCompany'] = $this->getAttribute('isCompany');
//$attributes['isCompany'] = $this->getAttribute('isCompany');
return $attributes;
}
......
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