public function getTableAttributeHtml(BaseElementModel $element, $attribute) { $infinity = "<span style=\"color:#E5E5E5\">∞</span>"; $numbers = ['weight', 'height', 'length', 'width']; if (in_array($attribute, $numbers)) { $formatter = craft()->getNumberFormatter(); if ($element->{$attribute} == 0) { return "<span style=\"color:#E5E5E5\">" . $formatter->formatDecimal($element->{$attribute}) . "</span>"; } else { return $formatter->formatDecimal($element->{$attribute}); } } if ($attribute == 'stock' && $element->unlimitedStock) { return $infinity; } if ($attribute == 'price') { $formatter = craft()->getNumberFormatter(); return $formatter->formatCurrency($element->{$attribute}, craft()->market_settings->getSettings()->defaultCurrency); } if ($attribute == 'minQty') { if (!$element->minQty && !$element->maxQty) { return $infinity; } else { $min = $element->minQty ? $element->minQty : '1'; $max = $element->maxQty ? $element->maxQty : $infinity; return $min . " - " . $max; } } return parent::getTableAttributeHtml($element, $attribute); }
/** * @param BaseElementModel $element * @param string $attribute * @return mixed|string */ public function getTableAttributeHtml(BaseElementModel $element, $attribute) { if ($attribute == 'totalPrice') { $currency = craft()->market_settings->getOption('defaultCurrency'); return craft()->numberFormatter->formatCurrency($element->totalPrice, strtoupper($currency)); } if ($attribute == 'orderStatus') { if ($element->orderStatus) { return $element->orderStatus->printName(); } else { return sprintf('<span class="market status %s"></span> %s', '', ''); } } return parent::getTableAttributeHtml($element, $attribute); }
public function getTableAttributeHtml(BaseElementModel $element, $attribute) { return parent::getTableAttributeHtml($element, $attribute); }