/** * Only display attribute when there actually are profiles. * @return mixed|string */ public function toHtml() { if ($this->getValue()) { return parent::toHtml(); } return ''; }
/** * This is a bit of a hack, the function below will set the template used * for this field to render it properly, however the renderer property is * used for all subsequent fields since the extending block is a singleton. * This means that we will need to set the template to our custom one, let * the block render, and then set the template back to the original one so * the same template isn't used for all subsequent fields. Ugly yes but * functional. * * @return mixed|string */ public function toHtml() { if ($this->getRenderer()) { $orig = $this->getRenderer()->getTemplate(); $this->getRenderer()->setTemplate('mageparts/ddq/catalog/product/form/renderer/opt.phtml'); $result = parent::toHtml(); $this->getRenderer()->setTemplate($orig); } else { $result = parent::toHtml(); } return $result; }