Я занимаюсь своим модулем сетью продаж, чтобы получать разные отчеты, и я пытался установить другой цвет, если статус заказа «завершен» и т. Д. Вот мой подход , он не дает ошибок, но, похоже, не работает.Magento Sales/Order/Grid change color в зависимости от статуса
class Mycustom_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Order
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
$value = $row->getData($this->getColumn()->getIndex());
$html ='<a href="' . $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getData('order_id'), 'key' => $this->getCacheKey())) . '" target="_blank" title="' . $value . '" >' . $row->getData($this->getColumn()->getIndex()) . '</a>';
return $html;
// here i am trying to add the color to mass status, after finding solution i will add seperate colors based on status
$truncateLength = 255;
// stringLength() is for legacy purposes
if ($this->getColumn()->getStringLimit()) {
$truncateLength = $this->getColumn()->getStringLimit();
}
if ($this->getColumn()->getTruncate()) {
$truncateLength = $this->getColumn()->getTruncate();
}
$text = Mage::helper('core/string')->truncate(parent::_getValue($row), $truncateLength);
if ($this->getColumn()->getEscape()) {
$text = $this->escapeHtml($text);
}
if ($this->getColumn()->getNl2br()) {
$text = nl2br($text);
}
if ($this->getColumn()->getStatusLabel() == array('processing', 'waiting', 'pending', 'almost', 'telephone')) {
$yesterday = strtotime("-24 hours", Mage::getModel('core/date')->gmtTimestamp());
$yesterday = Mage::getModel('core/date')->date(null, $yesterday);
if ($row->getCreatedAt() > $yesterday) {
$text = '<span style="color: red !important; font-weight: bold;">' . $text . '</span>';
};
}
return $text;
}
}
Вы получаете значение в обмен $ text? –
Я так не думаю о текущем коде. Как я могу проверить? Если я немного изменю этот код, я могу заставить его работать и изменить, например, цвет идентификатора строк в течение последних 24 часов, но я пытаюсь заставить его работать с статусом заказа. Какие-либо предложения? – spanakorizo