Item data.

@param ProductInterface $product Product.

@return array
176530
public function getData(ProductInterface $product)
    {
        $productItemData = [
            'id'          => $product->getId(),
            'sku'         => $product->getSku(),
            'name'        => $product->getName(),
            'price'       => $this->getProductPrice($product),
            'image'       => $this->getImageUrl($product),
            'score'       => $product->getDocumentScore(),
            'is_in_stock' => $this->isInStockProduct($product),
        ];

        return $productItemData;
    }
1211964
private function buildItems(iterable $products): array
    {
        $items = [];

        foreach ($products as $product) {
            $items[] = $this->buildItem($product);
        }

        return $items;
    }
1169556
protected function convertCookieToArray(CookieInterface $cookie)
    {
        return [
            'name' => $cookie->getName(),
            'value' => $cookie->getValue(),
            'path' => $cookie->getPath(),
            'domain' => $cookie->getDomain(),
            'secure' => $cookie->isSecure(),
            'httponly' => $cookie->isHttpOnly(),
            'expires' => $cookie->getFormattedExpires()
        ];
    }
73781
private function getUnsortedProductData()
    {
        $productCollection = $this->getProductCollection()->setPageSize($this->size);

        if (!in_array($this->search, [null, ''])) {
            $productCollection->setSearchQuery($this->search);
        }

        return ['products' => $productCollection->getItems(), 'size' => $productCollection->getSize()];
    }
543214
private function getItems(PropertyInterface $property)
    {
        $value = $this->getValue($property);
        if (!is_array($value['items']) || 0 === count($value['items'])) {
            return [];
        }

        return $value['items'];
    }
445785
public function collect($object)
    {
        $result = array();
        $products = $object->getLoadedProductCollection();
        foreach ($products as $product) {
            $result[] = $product;
        }
        return $result;
    }
122199
protected function getItemAttributes(ItemInterface $item)
    {
        $result = $item->getAttributes();

        $result['id'] = $item->getId();
        $result['content'] = $item->getContent();
        $result['collection'] = $item->getCollection();
        $result['path'] = $item->getPath(ItemInterface::SNAPSHOT_PATH_RELATIVE);

        return $result;
    }
532625
protected function getIDListFromCache() : array
    {
        $arElementIDList = parent::getIDListFromCache();

        //Get active product list
        $arActiveProductIDList = ProductListStore::instance()->active->get();
        if (empty($arActiveProductIDList) || empty($arElementIDList)) {
            return [];
        }

        $arResult = [];
        foreach ($arElementIDList as $iProductID => $iBrandID) {
            if (!in_array($iProductID, $arActiveProductIDList)) {
                continue;
            }

            $arResult[] = $iBrandID;
        }

        $arResult = array_unique($arResult);

        return $arResult;
    }
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);
        }
    }
138764
protected function getItemsFromDatabase()
    {
        $brandId = $this->repository->make('antares.memory')->make('primary')->get('brand.default');
        if (auth()->guest()) {
            return [];
        }
        $roleId = auth()->user()->roles->first()->id;
        $items  = $this->resolver()->where(['brand_id' => $brandId, 'role_id' => $roleId])->get();
        $return = [];

        foreach ($items as $item) {
            $form       = $item->form;
            $attributes = array_merge($item->getAttributes(), ['action_id' => $form->action_id, 'name' => $form->name]);
            array_push($return, $attributes);
        }
        return $return;
    }
693151
public function getProductCode(ProductInterface $product)
    {
        foreach ($this->products as $code => $productDescription) {
            $className = $productDescription->getManager()->getClass();
            if ($product instanceof $className) {
                return $code;
            }
        }
    }
66198
private function getSortedProducts()
    {
        $products   = [];
        $productIds = $this->getSortedProductIds();

        if ($productIds && count($productIds)) {
            $productCollection = $this->getProductCollection()->setPageSize(count($productIds));

            $idFilterParams = ['values' => $productIds, 'field' => 'entity_id'];
            $idFilter       = $this->queryFactory->create(QueryInterface::TYPE_TERMS, $idFilterParams);
            $productCollection->addQueryFilter($idFilter);

            $products = $productCollection->getItems();
        }

        $sortedProducts = [];

        foreach ($this->getSortedProductIds() as $productId) {
            if (isset($products[$productId])) {
                $sortedProducts[$productId] = $products[$productId];
            }
        }

        return $sortedProducts;
    }
25915
protected function attachFields(array &$product)
    {
        if (empty($product)) {
            return $product;
        }

        $product['field'] = $this->product_field->getList($product['product_id']);

        if (empty($product['field']['option'])) {
            return $product;
        }

        foreach ($product['field']['option'] as &$field_values) {
            $field_values = array_unique($field_values);
        }

        return $product;
    }
1150677
public function setProduct(ProductInterface $product)
    {
        $this->productId = $product->getId();
        $this->product = $product;
    }
228332
public function stockIncreaseAction(Product $product)
    {
        $em = $this->getDoctrine()->getManager();
        $warehouses = $em->getRepository(Warehouse::class)->findAll();
        return array(
            'warehouses' => $warehouses,
            'product' => $product,
        );
    }
408745
protected function serializeRelationship(RelationshipInterface $relationship): array
    {
        $data = [];

        foreach ($relationship->links()->all() as $link) {
            $data['links'][$link->name()] = $this->serializeLink($link);
        }

        if (!$relationship->metaInformation()->isEmpty()) {
            $data['meta'] = $relationship->metaInformation()->all();
        }

        if (!$relationship->related()->isEmpty()) {
            if ($relationship->shouldBeHandledAsCollection()) {
                $data['data'] = $this->createCollectionData($relationship->related());
            } else {
                $data['data'] = $this->serializeResource($relationship->related()->first());
            }
        } // only add empty data if links or meta are not defined
        elseif (\count($data) === 0 || $this->shouldKeepEmptyData()) {
            if ($relationship->shouldBeHandledAsCollection()) {
                $data['data'] = [];
            } else {
                $data['data'] = null;
            }
        }

        return $data;
    }
358263
public function getRawProduct(ProductInterface $product, $format = 'json')
    {
        return json_decode($this->serializer->serialize($product, $format), true);
    }