Returns an array of related products for the given product ID
@param array $options
@return array
18523
public function getList(array $options)
    {
        $result = null;
        $this->hook->attach('product.related.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $result = array();

        if (isset($options['product_id'])) {

            $sql = 'SELECT item_product_id FROM product_related WHERE product_id=?';

            if (!empty($options['limit'])) {
                $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
            }

            $result = $this->db->fetchColumnAll($sql, array($options['product_id']));
        }

        $this->hook->attach('product.related.list.after', $options, $result, $this);
        return $result;
    }
1368013
public function toArray(array $options = [])
    {
        $childrenIds = [];

        /** @var NodeInterface $child */
        foreach ($this->getChildren() as $child) {
            $childrenIds[] = $child->getId();
        }

        return [
            'id'                => $this->getId(),
            'name'              => $this->getName(),
            'type'              => $this->getType(),
            'metadata'          => $this->getMetadata()->getData(),
            'parentId'          => $this->getParent() ?
                $this->getParent()->getId() :
                null,
            'childrenIds'       => $childrenIds
        ];
    }
724662
public function invoices(array $options = [])
    {
        if (!isset($this->invoices)) {
            $options['customer_uuid'] = $this->uuid;
            $this->invoices = CustomerInvoices::all($options)->invoices;
        }
        return $this->invoices;
    }
481694
public function getData(array $options)
    {
        $provider = $this->getProvider();

        $ownerDetails = $provider->getResourceOwner($this->accessToken);
        $data = $ownerDetails->toArray();

        return new Result([
            'externalId' => $data['id'],
            'name'       => $data['name'],
            'profileUrl' => $data['html_url'],
            'photoUrl'   => $data['avatar_url']
        ]);
    }
336386
public function getAllParents(array $options = []): array
    {
        $options = array_replace(
            [
                'indexById'     => false,
                'skipIds'       => []
            ],
            $options
        );
        $parents = [];
        $ids = [$this->getId()];

        /** @var NodeInterface $parent */
        foreach ($this->getParents() as $id => $parent) {
            if (in_array($id, $options['skipIds'])) {
                continue;
            }

            $ids[] = $id;

            if ($options['indexById']) {
                $parents[$id] = $parent;
            } else {
                $parents[] = $parent;
            }

            $parents = array_merge(
                $parents,
                $parent->getAllParents(array_merge($options, ['skipIds' => $ids]))
            );
        }

        return $parents;
    }
567686
public function getList(array $options = array())
    {
        $result = null;
        $this->hook->attach('sku.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT ps.*, p.title, p.currency';

        if (!empty($options['count'])) {
            $sql = 'SELECT COUNT(ps.product_sku_id)';
        }

        $sql .= ' FROM product_sku ps LEFT JOIN product p ON(ps.product_id = p.product_id)';

        $conditions = array();

        if (isset($options['product_sku_id'])) {
            $sql .= ' WHERE ps.product_sku_id = ?';
            $conditions[] = $options['product_sku_id'];
        } else {
            $sql .= ' WHERE ps.product_sku_id IS NOT NULL';
        }

        if (isset($options['sku'])) {
            $sql .= ' AND ps.sku=?';
            $conditions[] = $options['sku'];
        }

        if (isset($options['store_id'])) {
            $sql .= ' AND p.store_id=?';
            $conditions[] = $options['store_id'];
        }

        if (isset($options['title_sku'])) {
            $sql .= ' AND (p.title LIKE ? OR ps.sku LIKE ?)';
            $conditions[] = "%{$options['title_sku']}%";
            $conditions[] = "%{$options['title_sku']}%";
        }

        if (isset($options['product_id'])) {
            $sql .= ' AND ps.product_id=?';
            $conditions[] = $options['product_id'];
        }

        if (isset($options['combination_id'])) {
            $sql .= ' AND ps.combination_id=?';
            $conditions[] = $options['combination_id'];
        }

        if (isset($options['status'])) {
            $sql .= ' AND ps.status=?';
            $conditions[] = (int) $options['status'];
        }

        $sql .= " ORDER BY ps.sku ASC";

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        if (empty($options['count'])) {
            $list = $this->db->fetchAll($sql, $conditions, array('index' => 'product_sku_id'));
            $result = $this->prepareList($list);
        } else {
            $result = (int) $this->db->fetchColumn($sql, $conditions);
        }

        $this->hook->attach('sku.list.after', $options, $result, $this);
        return $result;
    }
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;
    }
1347861
public function fromArray(array $options)
    {
        if (isset($options['Id'])) {
            Validate::isString($options['Id'], 'options[Id]');
            $this->_id = $options['Id'];
        }

        if (isset($options['Name'])) {
            Validate::isString($options['Name'], 'options[Name]');
            $this->_name = $options['Name'];
        }

        if (isset($options['Description'])) {
            Validate::isString($options['Description'], 'options[Description]');
            $this->_description = $options['Description'];
        }

        if (isset($options['Sku'])) {
            Validate::isString($options['Sku'], 'options[Sku]');
            $this->_sku = $options['Sku'];
        }

        if (isset($options['Vendor'])) {
            Validate::isString($options['Vendor'], 'options[Vendor]');
            $this->_vendor = $options['Vendor'];
        }

        if (isset($options['Version'])) {
            Validate::isString($options['Version'], 'options[Version]');
            $this->_version = $options['Version'];
        }
    }
103617
public function getIdFromOptions(array $options) : string
    {
        $optionsResolver = new OptionsResolver();
        $optionsResolver->setRequired('id');

        $options = $optionsResolver->resolve($options);

        return $options['id'];
    }
259063
protected function getMagentoOptions(array $options)
    {
        $result = array();
        foreach ($options as $value => $label) {
            $result[] = array(
                'value' => $value,
                'label' => $label,
            );
        }
        return $result;
    }
1322756
protected function getPrestaShopOptions(array $options)
    {
        $result = array(
            'query' => array(),
            'id' => 'id',
            'name' => 'name',
        );

        foreach ($options as $value => $label) {
            $result['query'][] = array(
                'id' => $value,
                'name' => $label,
            );
        }

        return $result;
    }
183375
protected function getProductsSelectCompare()
    {
        $conditions = array(
            'product_id' => $this->getProductComparison());

        $options = array(
            'view' => $this->configTheme('compare_view', 'grid'),
            'buttons' => array('cart_add', 'wishlist_add', 'compare_remove')
        );

        $products = $this->getProducts($conditions, $options);
        return $this->reindexProductsCompare($products);
    }
612499
public function getList(array $options = array())
    {
        $uri = $this->buildListResourceUri($this->listId);
        $response = $this->makeApiRequest($uri, $options);
        return $response->list;
    }
1029293
protected function optionsToAjax($options)
    {
        $processed = [];
        foreach ($options as $id => $result) {
            $processed[] = ['id' => $id, 'name' => trans($result)];
        }
        return $processed;
    }
916327
public function getProductsToDisplay($items, $mode, &$productsToDisplayCounter, $limit, $maxPerChild)
    {
        $productsToDisplay = [];

        foreach ($items as $item) {
            //parent product
            $productModel = $item->getProduct();
            //check for product exists
            if ($productModel->getId()) {
                //get single product for current mode
                $recommendedProductIds = $this->getRecommendedProduct($productModel, $mode);
                $recommendedProducts = $this->catalog->getProductCollectionFromIds($recommendedProductIds);

                $this->addRecommendedProducts(
                    $productsToDisplayCounter,
                    $limit,
                    $maxPerChild,
                    $recommendedProducts,
                    $productsToDisplay
                );
            }
            //have reached the limit don't loop for more
            if ($productsToDisplayCounter == $limit) {
                break;
            }
        }

        return $productsToDisplay;
    }
126907
public function selectCombination(array $product, array $field_value_ids)
    {
        $result = array();
        $this->hook->attach('sku.select.combination.before', $product, $field_value_ids, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        $access = !empty($product['stock']) || empty($product['subtract']);

        $result = array(
            'modal' => '',
            'severity' => '',
            'cart_access' => $access,
            'combination' => array(),
            'sku' => $product['sku'],
            'price' => $product['price'],
            'currency' => $product['currency'],
            'message' => $access ? '' : $this->translation->text('Out of stock')
        );

        if (empty($field_value_ids)) {
            $this->hook->attach('sku.select.combination.after', $product, $field_value_ids, $result, $this);
            return (array) $result;
        }

        if (empty($product['status'])) {
            $result['severity'] = 'danger';
            $result['message'] = $this->translation->text('Unavailable');

            $this->hook->attach('sku.select.combination.after', $product, $field_value_ids, $result, $this);
            return (array) $result;
        }

        $combination_id = $this->getCombinationId($field_value_ids, $product['product_id']);

        if (empty($product['combination'][$combination_id]['status'])) {

            $result['not_matched'] = true;
            $result['cart_access'] = false;

            $result['severity'] = 'danger';
            $result['message'] = $this->translation->text('Unavailable');
            $result['related'] = $this->getRelatedFieldValues($product, $field_value_ids);

            $this->hook->attach('sku.select.combination.after', $product, $field_value_ids, $result, $this);
            return (array) $result;
        }

        $result['combination'] = $product['combination'][$combination_id];
        $result['combination']['currency'] = $product['currency'];

        $result['sku'] = $result['combination']['sku'];
        $result['price'] = $result['combination']['price'];

        if (empty($result['combination']['stock']) && $product['subtract']) {
            $result['cart_access'] = false;
            $result['severity'] = 'warning';
            $result['message'] = $this->translation->text('Out of stock');
        }

        $this->hook->attach('sku.select.combination.after', $product, $field_value_ids, $result, $this);
        return (array) $result;
    }
531980
public static function getProducts($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/products' . $filter->toQuery(), 'Product');
    }