/** * Return extended item description * * @return string */ public function getExtendedDescription() { $result = ''; if ($this->getVariant()) { $attrs = $variantsAttributes = array(); foreach ($this->getProduct()->getVariantsAttributes() as $a) { $variantsAttributes[$a->getId()] = $a->getId(); } foreach ($this->getAttributeValues() as $v) { $av = $v->getAttributeValue(); if ($av->getAttribute()->isVariable($this->getProduct())) { $attrs[] = $av->getAttribute()->getName() . ': ' . $av->asString(); } } $result = '(' . implode(', ', $attrs) . ')'; } return $result ?: parent::getExtendedDescription(); }
/** * Show message about wrong product amount * * @param \XLite\Model\OrderItem $item Order item * * @return void */ protected function processInvalidAmountError(\XLite\Model\OrderItem $item) { \XLite\Core\TopMessage::addWarning('You tried to buy more items of "{{product}}" product {{description}} than are in stock. We have {{amount}} item(s) only. Please adjust the product quantity.', array('product' => $item->getProduct()->getName(), 'description' => $item->getExtendedDescription(), 'amount' => $item->getProductAvailableAmount())); }
/** * {@inheritDoc} */ public function getExtendedDescription() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getExtendedDescription', array()); return parent::getExtendedDescription(); }