/** * Copys all data from a given product item. * * @param MShop_Product_Item_Interface $product Product item to copy from */ public function copyFrom(MShop_Product_Item_Interface $product) { $this->setName($product->getName()); $this->setType($product->getType()); $this->setSupplierCode($product->getSupplierCode()); $this->setProductCode($product->getCode()); $this->setProductId($product->getId()); $items = $product->getRefItems('media', 'default', 'default'); if (($item = reset($items)) !== false) { $this->setMediaUrl($item->getUrl()); } $this->setModified(); }
/** * Create new product item object initialized with given parameters. * * @param MShop_Product_Item_Interface $item Product item object * @return array Associative list of key/value pairs suitable for product item constructor */ protected function _createArray(MShop_Product_Item_Interface $item) { return array('id' => $item->getId(), 'typeid' => $item->getTypeId(), 'type' => $item->getType(), 'status' => $item->getStatus(), 'label' => $item->getLabel(), 'start' => $item->getDateStart(), 'end' => $item->getDateEnd(), 'code' => $item->getCode(), 'suppliercode' => $item->getSupplierCode(), 'ctime' => $item->getTimeCreated(), 'mtime' => $item->getTimeModified(), 'editor' => $item->getEditor()); }