Copys all data from a given product item.

@param MShop_Product_Item_Interface $product Product item to copy from
170253
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();
	}
1031571
public function saveItem( MShop_Common_Item_Interface $item, $fetch = true )
	{
		$iface = 'MShop_Locale_Item_Site_Interface';
		if ( !( $item instanceof $iface ) ) {
			throw new MShop_Locale_Exception(sprintf('Object is not of required type "%1$s"', $iface));
		}

		if( $item->getId() === null ) {
			throw new MShop_Locale_Exception( sprintf( 'Newly created site can not be saved using method "saveItem()". Try using method "insertItem()" instead.' ) );
		}

		if( !$item->isModified() ) { return	; }


		$context = $this->_getContext();

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$id = $item->getId();

			$path = 'mshop/locale/manager/site/default/item/update';
			$stmt = $this->_getCachedStatement( $conn, $path );

			$stmt->bind(1, $item->getCode(), MW_DB_Statement_Abstract::PARAM_STR);
			$stmt->bind(2, $item->getLabel(), MW_DB_Statement_Abstract::PARAM_STR);
			$stmt->bind(3, json_encode($item->getConfig()), MW_DB_Statement_Abstract::PARAM_STR);
			$stmt->bind(4, $item->getStatus(), MW_DB_Statement_Abstract::PARAM_INT);
			$stmt->bind(5, $context->getEditor() );
			$stmt->bind(6, date( 'Y-m-d H:i:s', time() ) ); // mtime
			$stmt->bind(7, $id, MW_DB_Statement_Abstract::PARAM_INT);

			$stmt->execute()->finish();
			$item->setId( $id ); // set Modified false

			$dbm->release( $conn, $dbname );
		}
		catch ( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
929115
public function getLineItemForProduct(Product $product)
    {
        // Find the Order within this OrderCollection for the Product's Seller
        $order = $this->getOrderForSeller($product->getSeller());

        $lineItem = $order->getLineItemForProduct($product);

        return $lineItem;
    }
57263
public function saveItem( MShop_Common_Item_Interface $item, $fetch = true )
	{
		$manager = $this->_getManager();

		$manager->saveItem( $item, $fetch );
		$new = $manager->getItem( $item->getId() );

		$this->_getContext()->getLogger()->log( json_encode( $new->toArray() ), MW_Logger_Abstract::NOTICE, 'changelog' );
	}
514155
protected function unshiftSelectedImageProduct($selected, &$product)
    {
        if (isset($selected['combination']['file_id']) && isset($product['images'][$selected['combination']['file_id']])) {
            $image = $product['images'][$selected['combination']['file_id']];
            unset($product['images'][$selected['combination']['file_id']]);
            $product['images'] = array($image['file_id'] => $image) + $product['images'];
        }
    }
765728
protected function setItemSupplier(ApiItemInterface $item, ProductInterface $product)
    {
        $supplier = null;
        $supplierName = '';
        // Get products supplier.
        if ($product->getSupplier()) {
            $supplier = $product->getSupplier();
            $supplierName = $product->getSupplier()->getName();
        }
        $item->setSupplier($supplier);
        $item->setSupplierName($supplierName);
    }
162005
public function saveItem( MShop_Common_Item_Interface $item, $fetch = true )
	{
		$iface = 'MShop_Catalog_Item_Interface';
		if( !( $item instanceof $iface ) ) {
			throw new MShop_Catalog_Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
		}

		$siteid = $this->_getContext()->getLocale()->getSiteId();
		$node = $item->getNode();
		$this->begin();

		try
		{
			$this->_createTreeManager( $siteid )->saveNode( $node );
			$this->_updateUsage( $node->getId(), $item );
			$this->commit();
		}
		catch( Exception $e )
		{
			$this->rollback();
			throw $e;
		}
	}
879206
private function addAllCurrencies(ProductInterface $product)
    {
        $currencies = $this->currencyRepository->findAll();

        foreach ($product->getPrices() as $price) {
            if (($key = array_search($price->getCurrency(), $currencies)) !== false) {
                unset($currencies[$key]);
            }
        }

        foreach ($currencies as $currency) {
            $price = new ProductPriceEntity();
            $price->setCurrency($currency);

            $product->addPrice($price);
            $price->setProduct($product);
        }
    }
126214
public function store( MShop_Order_Item_Base_Interface $basket )
	{
		$this->saveItem( $basket );

		$this->_storeProducts( $basket );
		$this->_storeCoupons( $basket );
		$this->_storeAddresses( $basket );
		$this->_storeServices( $basket );
	}
942402
public function createLineItemForProduct(Product $product)
    {
        $lineItem = new OrderLineItem();
        $lineItem->setProduct($product);

        // Don't assume any quantity here
        // We will add it later
        $lineItem->setQuantity(0);

        $this->addLineItem($lineItem);

        // Copy SellerWindow
        if ($this->getSellerWindow()) {
            $lineItem->setSellerWindow($this->getSellerWindow());
        }

        return $lineItem;
    }
1112721
protected function _getProductData(Product $product, ProductIterator $children)
    {
        $categoryIds = $this->categoryRepository->getCategoryIds($product);
        $productData = new IndexDocument(array(
            'id' => $product->getSolrId(), // primary identifier, must be unique
            'product_id' => $product->getId(),
            'category' => $categoryIds, // @todo get category ids from parent anchor categories as well
            'category_name_t_mv' => $this->categoryRepository->getCategoryNames($categoryIds, $product->getStoreId()),
            'store_id' => $product->getStoreId(),
            'content_type' => self::CONTENT_TYPE,
            'is_visible_in_catalog_i' => intval($product->isVisibleInCatalog()),
            'is_visible_in_search_i' => intval($product->isVisibleInSearch()),
            'has_special_price_i' => intval($product->hasSpecialPrice()),
            'is_in_stock_i' => intval($product->isInStock()),
        ));

        $this->_addBoostToProductData($product, $productData);

        $this->_addFacetsToProductData($product, $productData, $children);

        $this->_addSearchDataToProductData($product, $productData, $children);

        $this->_addSortingDataToProductData($product, $productData);

        $this->_addResultHtmlToProductData($product, $productData);

        $this->_addCategoryProductPositionsToProductData($product, $productData);

        $this->eventDispatcher->dispatch('integernet_solr_get_product_data', array(
            'product' => $product,
            'product_data' => $productData,
            'children' => $children,
        ));

        return $productData;
    }
36930
public function setProduct($product)
    {
        $this->setSku($product->getSku());
        $this->setName($product->getName());

        return $this;
    }
495315
public function deleteItem( $id )
	{
		$actual = $this->_getManager()->getItem( $id );
		$siteId = $this->_getContext()->getLocale()->getSiteId();

		if( $actual->getSiteId() != $siteId ) {
			throw new MShop_Exception( sprintf( 'Item can not be deleted. Site ID of item differs from present site ID.' ) );
		}

		parent::deleteItem( $id );
	}
1182378
protected function prepareProductItem(array &$product, array $options)
    {
        $this->setItemProductInComparison($product, $this->product_compare);
        $this->setItemPriceCalculated($product, $this->product);
        $this->setItemProductInWishlist($product, $this->wishlist);
        $this->setItemPriceFormatted($product, $this->price, $this->current_currency);
        $this->setItemProductBundle($product, $this->product, $this->image);
        $this->setItemRenderedProduct($product, $options);
    }
33856
public function addProduct(Product $product)
    {
        $this->products->add($product);

        $this->setOwningSideRelation($product);

        return $this;
    }
1261500
public function addItem( MShop_Price_Item_Interface $item, $quantity = 1 )
	{
		if( $item->getCurrencyId() != $this->getCurrencyId() )
		{
			throw new MShop_Price_Exception( sprintf( 'Price can not be added. Currency ID "%1$s" of price item and currently used currency ID "%2$s" does not match.', $item->getCurrencyId(), $this->getCurrencyId() ) );
		}

		$this->_values['value'] = $this->_formatNumber( $this->getValue() + $item->getValue() * $quantity );
		$this->_values['costs'] = $this->_formatNumber( $this->getCosts() + $item->getCosts() * $quantity );
		$this->_values['rebate'] = $this->_formatNumber( $this->getRebate() + $item->getRebate() * $quantity );
	}
718793
public function deleteProduct( $position )
	{
		if( !array_key_exists( $position, $this->_products ) ) {
			throw new MShop_Order_Exception( sprintf( 'Product with array key "%1$d" not available', $position ) );
		}

		$this->_notifyListeners( 'deleteProduct.before', $position );

		unset($this->_products[$position]);
		$this->_modified = true;

		$this->_notifyListeners( 'deleteProduct.after', $position );
	}