/** * Copys all data from a given product item. * * @param \Aimeos\MShop\Product\Item\Iface $product Product item to copy from */ public function copyFrom(\Aimeos\MShop\Product\Item\Iface $product) { $this->setSiteId($product->getSiteId()); $this->setProductCode($product->getCode()); $this->setProductId($product->getId()); $this->setType($product->getType()); $this->setName($product->getName()); $items = $product->getRefItems('supplier', 'default', 'default'); if (($item = reset($items)) !== false) { $this->setSupplierCode($item->getCode()); } $items = $product->getRefItems('media', 'default', 'default'); if (($item = reset($items)) !== false) { $this->setMediaUrl($item->getPreview()); } $this->setModified(); return $this; }