Return's the category product relations for the product with the passed SKU.

@param string $sku The product SKU to load the category relations for

@return array The category product relations for the product with the passed SKU
7249
public function findAllBySku($sku)
    {

        // prepare the params
        $params = array(MemberNames::SKU => $sku);

        // initialize the array for the category product relations
        $categoryProducts = array();

        // load and return the product category relation for the passed product SKU
        $this->categoryProductsBySkuStmt->execute($params);

        // prepare the result by using the category ID as key
        foreach ($this->categoryProductsBySkuStmt->fetchAll(\PDO::FETCH_ASSOC) as $categoryProduct) {
            $categoryProducts[$categoryProduct[MemberNames::CATEGORY_ID]] = $categoryProduct;
        }

        // return the category product relations
        return $categoryProducts;
    }
1345938
public static function getChildren(SKU $sku) {
    $children = [];

    foreach ($sku->get('field_configured_skus')->getValue() as $child) {
      if (empty($child['value'])) {
        continue;
      }

      $child_sku = SKU::loadFromSku($child['value']);
      if ($child_sku instanceof SKU) {
        $children[$child_sku->getSKU()] = $child_sku;
      }
    }

    return $children;
  }
167149
public function getProductCategories(bool $force = false) : CNabuCommerceProductCategoryList
    {
        if ($this->nb_commerce_product_category_list->isEmpty() || $force) {
            $this->nb_commerce_product_category_list->clear();
            $this->nb_commerce_product_category_list->merge(
                CNabuCommerceProductCategory::getCategoriesForCommerce($this)
            );
        }

        return $this->nb_commerce_product_category_list;
    }
377732
public function findEntitiesByCategoryId($categoryId, $locale)
    {
        $products = $this->productRepository->findByCategoryId($categoryId, $locale);

        return $products;
    }
1096225
public function getBySku(SKU $SKU): Product
    {
        if (isset($this->products[(string) $SKU])) {
            return $this->products[(string) $SKU];
        }

        throw ProductNotFound::bySku($SKU);
    }
903026
public function getLinkedskus($sku, $type = LINKED_SKU_TYPE_ALL) {
    // Without this we get following error:
    // 9006: Signature does not match expected signature.
    $sku = urlencode($sku);
    $endpoint = $this->apiVersion . "/agent/product/$sku/related/$type";

    $doReq = function ($client, $opt) use ($endpoint) {
      return ($client->get($endpoint, $opt));
    };

    $result = [];

    try {
      $result = $this->tryAgentRequest($doReq, 'linkedSkus', 'related');
    }
    catch (ConnectorException $e) {
      throw new RouteException(__FUNCTION__, $e->getMessage(), $e->getCode(), $this->getRouteEvents());
    }

    return $result;
  }
530196
protected function attachSku(array &$product)
    {
        if (empty($product)) {
            return $product;
        }

        $product['default_field_values'] = array();
        $codes = (array) $this->sku->getList(array('product_id' => $product['product_id']));

        foreach ($codes as $code) {

            if ($code['combination_id'] === '') {
                $product['sku'] = $code['sku'];
                $product['price'] = $code['price'];
                $product['stock'] = $code['stock'];
                continue;
            }

            $product['combination'][$code['combination_id']] = $code;

            if (!empty($code['is_default'])) {
                $product['default_field_values'] = $code['fields'];
            }
        }

        return $product;
    }
32581
protected function validateCartItemCheckout($sku, $item)
    {
        $item += array(
            'sku' => $sku,
            'increment' => false,
            'admin' => !empty($this->admin),
            'user_id' => $this->order_user_id,
            'store_id' => $this->order_store_id
        );

        $this->setSubmitted('update', $item);
        $this->setSubmitted("cart.items.$sku", $item);

        return $this->validateComponent('cart', array('parents' => "cart.items.$sku"));
    }
387976
protected function getRelatedProduct()
    {
        $options = array(
            'status' => 1,
            'store_id' => $this->store_id,
            'product_id' => $this->data_product['product_id'],
            'limit' => array(0, $this->config('related_limit', 12))
        );

        $product_ids = (array) $this->product->getRelated($options);

        $products = array();

        if (!empty($product_ids)) {
            $products = (array) $this->product->getList(array('product_id' => $product_ids));
        }

        $this->prepareEntityItems($products, array('entity' => 'product'));
        return $products;
    }
1090930
public function getCartSkus() {
    $items = $this->items();
    if (empty($items)) {
      return [];
    }

    $skus = [];
    foreach ($items as $item) {
      $skus[] = $item['sku'];
    }

    return $skus;
  }
528700
private function loadCategoryDetails($category)
    {
        if (is_array($category) && is_array(array_values($category)[0])) {
            return $category;
        }

        if (!is_array($category)) {
            $tmp = $category;
            $category = [];
            $category[] = $tmp;
        }

        $categorys = [];
        foreach ($category as $catKey) {
            if (isset($this->category[$catKey])) {
                $key = $this->category[$catKey];
                $categorys[$catKey] = $this->meta[$key];
            } else {
                $categorys[$catKey]["key"] = $catKey;
            }
        }

        return $categorys;
    }
1289581
public function getCategorySkuList($cateId)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_CATEGORY_SKU_LIST_PREFIX, [
            'cate_id' => $cateId
        ], [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['sku_table'] : false;
    }
1037874
public function getRelations():array
    {
        $relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations));

        return array_filter($relations, function($relation) {
            return $relation !== '*';
        });
    }
973589
public static function getListByPackage($pkg)
    {
        if (is_object($pkg)) {
            $pkgID = $pkg->getPackageID();
        } else {
            $pkgID = (int) $pkg;
        }
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $libraries = [];
        foreach ($db->fetchAll('select sclHandle from SystemCaptchaLibraries where pkgID = ? order by sclHandle asc', [$pkgID]) as $row) {
            $scl = static::getByHandle($row['sclHandle']);
            $libraries[] = $scl;
        }

        return $libraries;
    }
587031
private function getRelationships(Item $item)
    {
        if ($include_params = $this->resource->getIncludeParams()) {
            $item->setIncludeParams($include_params);

            return $item->getIncluded();
        }

        return [];
    }
1261747
public function getConfiguredOptions(SKU $child) {
    $sku_type = SKUType::load($this->getPluginDefinition()['id']);
    $groups = $sku_type->getThirdPartySetting('acm_sku__variant', 'attribute_groups', []);
    $configured_options = [];
    $attributes = $child->attributes->getValue();
    foreach ($attributes as $attribute) {
      if (empty($groups[$attribute['key']]['enabled'])) {
        continue;
      }
      $configured_options[] = $attribute['value'];
    }
    return $configured_options;
  }
1103916
public function AllProducts($sort = [])
    {
        // Setup the default sort for our products
        if (count($sort) == 0) {
            $sort = array(
                "SortOrder" => "ASC",
                "Title" => "ASC"
            );
        }
        
        $ids = array($this->ID);
        $ids = array_merge($ids, $this->getDescendantIDList());

        $products = CatalogueProduct::get()
            ->filter(array(
                "Categories.ID" => $ids,
                "Disabled" => 0
            ))->sort($sort);

        return $products;
    }