Пример #1
0
 public function getKitProductInfo()
 {
     $html = '<div class="kit-product">';
     $html .= '<h4>' . $this->kit->getBarcode() . '</h4>';
     $html .= '<div>[' . $this->kit->getProduct()->getSku() . ']' . $this->kit->getProduct()->getName() . '</div>';
     $html .= '</div>';
     return $html;
 }
Пример #2
0
 /**
  * a product is created as a kit
  *
  * @param string             $comments
  * @param BaseEntityAbstract $entity
  */
 public function createAsAKit($comments, Kit $entity)
 {
     $task = $entity instanceof Kit ? $entity->getTask() : null;
     return $this->setStockOnHand(($originalStockOnHand = $this->getStockOnHand()) + 1)->setTotalOnHandValue(($originalTotalOnHandValue = $this->getTotalOnHandValue()) + $entity->getCost())->snapshotQty($entity instanceof BaseEntityAbstract ? $entity : $this, ProductQtyLog::TYPE_WORKSHOP, 'Created a Kit[' . $entity->getBarcode() . '] with value(cost=' . StringUtilsAbstract::getCurrency($entity->getCost()) . ')' . ($task instanceof Task ? ' generated from Task[' . $task->getId() . ']' : '') . (trim($comments) === '' ? '.' : ': ' . $comments))->save()->addLog('StockOnHand(' . $originalStockOnHand . ' => ' . $this->getStockOnHand() . '), StockOnHandValue(' . $originalTotalOnHandValue . ' => ' . $this->getTotalOnHandValue() . ')' . (trim($comments) === '' ? '.' : ': ' . $comments), Log::TYPE_SYSTEM, 'STOCK_QTY_CHG', __CLASS__ . '::' . __FUNCTION__);
 }