Loads product object.

@param Product $product Product object.

@return bool Should we load the module?
187601
public function can_load( $product ) {
		if ( $this->is_from_partner( $product ) ) {
			return false;
		}
		if ( $product->is_theme() && ! current_user_can( 'switch_themes' ) ) {
			return false;
		}

		if ( $product->is_plugin() && ! current_user_can( 'install_plugins' ) ) {
			return false;
		}

		return true;
	}
584513
protected function getDefaultCategoryId($product)
    {
        $defaultCategoryId = null;
        if ((bool) $product->getVirtualColumn('is_default_category')) {
            $defaultCategoryId = $product->getVirtualColumn('default_category_id');
        } else {
            $defaultCategoryId = $product->getDefaultCategoryId();
        }
        return $defaultCategoryId;
    }
1136504
public function show($language, $product)
    {
        return $this->request(sprintf('products/%s/%s', $language, $this->transform($product)));
    }
1013358
public function loadById($productId)
    {
        return $this->productRepository->getById($productId, false, $this->storeManager->getStore()->getId(), true);
    }
1234425
def load_product_class(self, mode):
        """"""

        product_entry = self.products[mode]

        return self._get_base_class(product_entry)
667753
public function can_load( $product ) {
		if ( $this->is_from_partner( $product ) ) {
			return false;
		}
		if ( $product->is_theme() && ( false !== get_transient( 'ti_sdk_pause_' . $product->get_key(), false ) ) ) {
			return false;
		}

		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			return true;
		}
		global $pagenow;

		if ( ! isset( $pagenow ) || empty( $pagenow ) ) {
			return false;
		}

		if ( $product->is_plugin() && 'plugins.php' !== $pagenow ) {
			return false;

		}
		if ( $product->is_theme() && 'theme-install.php' !== $pagenow ) {
			return false;
		}

		return true;
	}
1333697
private function getAttributesArrayFromLoadedProduct($product)
    {
        //attributes array from loaded product
        $attributes = $this->config->getEntityAttributes(
            \Magento\Catalog\Model\Product::ENTITY,
            $product
        );

        return array_keys($attributes);
    }
888294
public function index($product)
    {
        if (is_numeric($product)) {
            $product = $this->product->get($product);
        }

        if (empty($product)) {
            return false;
        }

        $indexed = 0;
        $indexed += (int) $this->indexProduct($product);
        $indexed += (int) $this->indexProductTranslations($product);

        return $indexed > 0;
    }
22730
public function update($product)
    {
        $productId = "";

        if (is_array($product)) {
            $productId = $product["id"];
            unset($product["id"]);
        }
        elseif (is_object($product)) {
            $productId = $product->id;
            unset($product->id);
        }

        return $this->client->put("/products/" . rawurlencode($productId), $product);
    }
674331
public function setStatusForProduct(ProductInterface $product, $statusId)
    {
        // Check if status has changed.
        if ($product->getStatus() && $product->getStatus()->getId() === $statusId) {
            return;
        }

        $status = $this->statusRepository->find($statusId);
        if (!$status) {
            throw new ProductDependencyNotFoundException(self::$productStatusEntityName, $statusId);
        }

        // Set new status to product.
        $product->setStatus($status);

        // If product has variants, set status for all variants as well.
        if ($product->getType()
            && $product->getType()->getId() === (int) $this->productTypesMap['PRODUCT_WITH_VARIANTS']
        ) {
            $variants = $this->productRepository->findByParent($product);
            foreach ($variants as $variant) {
                $variant->setStatus($status);
            }
        }
    }
431608
public function item(Array $product) : Bool
    {
        if( ! isset($product['quantity']) )
        {
            $product['quantity'] = 1;
        }

        array_push(Properties::$items, $product);

        $this->driver->insert($this->key, Properties::$items);

        Properties::$items = $this->driver->select($this->key);

        return true;
    }
1140849
public function findProductPrice(PriceProduct $product)
    {
        $priceConfigurationFilter = new PriceConfigurationFilter();
        $priceConfigurationFilter->addProduct($product);

        $result = $this->findPrice($priceConfigurationFilter);
        if (isset($result[0])) {
            return $result[0];
        }

        return null;
    }
828051
private function processProductOptions($product)
    {
        //bundle product options
        if ($product->getTypeId()
            == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
        ) {
            $optionCollection = $product->getTypeInstance()
                ->getOptionsCollection($product);
            $selectionCollection = $product->getTypeInstance()
                ->getSelectionsCollection(
                    $product->getTypeInstance()->getOptionsIds($product),
                    $product
                );
            $options = $optionCollection->appendSelections(
                $selectionCollection
            );
            foreach ($options as $option) {
                $trimmedTitle = str_replace(' ', '', $option->getDefaultTitle());
                if (!$this->textIsValidForInsightDataKey($trimmedTitle)) {
                    continue;
                }

                $count = 0;
                $selections = $option->getSelections();
                $sOptions = [];
                foreach ($selections as $selection) {
                    $sOptions[$count]['name'] = $selection->getName();
                    $sOptions[$count]['sku'] = $selection->getSku();
                    $sOptions[$count]['id'] = $selection->getProductId();
                    $sOptions[$count]['price'] = (float)number_format(
                        $selection->getPrice(),
                        2,
                        '.',
                        ''
                    );
                    ++$count;
                }
                $this->$trimmedTitle = $sOptions;
            }
        }

        //configurable product options
        if ($product->getTypeId() == 'configurable') {
            $productAttributeOptions = $product->getTypeInstance()
                ->getConfigurableAttributesAsArray($product);

            foreach ($productAttributeOptions as $productAttribute) {
                $trimmedLabel = str_replace(' ', '', $productAttribute['label']);
                if (!$this->textIsValidForInsightDataKey($trimmedLabel)) {
                    continue;
                }

                $count = 0;
                $options = [];
                foreach ($productAttribute['values'] as $attribute) {
                    $options[$count]['option'] = $attribute['default_label'];
                    if (isset($attribute['pricing_value'])) {
                        $options[$count]['price'] = (float)number_format(
                            $attribute['pricing_value'],
                            2,
                            '.',
                            ''
                        );
                    }
                    ++$count;
                }
                $this->$trimmedLabel = $options;
            }
        }
    }
33856
public function addProduct(Product $product)
    {
        $this->products->add($product);

        $this->setOwningSideRelation($product);

        return $this;
    }
1218747
public function can_load( $product ) {

		if ( $product->is_wordpress_available() ) {
			return false;
		}

		return ( apply_filters( $product->get_key() . '_enable_licenser', true ) === true );

	}
871499
public function viewVariationsAction($product)
    {
        if (!\is_object($product)) {
            throw new NotFoundHttpException('invalid product instance');
        }

        $provider = $this->get('sonata.product.pool')->getProvider($product);

        return $this->render(sprintf('%s:view_variations.html.twig', $provider->getBaseControllerName()), [
            'product' => $product,
        ]);
    }
659826
protected function prepareProduct(array &$product)
    {
        $options = array(
            'store_id' => $product['store_id'],
            'product_id' => $product['product_id']
        );

        $product['related'] = $this->product->getRelated($options);
        $product['price'] = $this->price->decimal($product['price'], $product['currency']);

        $this->setSkuCombinationProduct($product);
        $this->setItemAlias($product, 'product', $this->alias);
        $this->setItemImages($product, 'product', $this->image);
        $this->setItemTranslation($product, 'product', $this->translation_entity);

        if (!empty($product['images'])) {
            foreach ($product['images'] as &$file) {
                $this->setItemTranslation($file, 'file', $this->translation_entity);
            }
        }
    }