Get the regex for banning a product page from the cache, including
any parent products for configurable/group products

@param  Mage_Catalog_Model_Product $product
@return string
439343
public function getProductBanRegex($product) {
        $urlPatterns = array();
        foreach ($this->getParentProducts($product) as $parentProduct) {
            if ($parentProduct->getUrlKey()) {
                $urlPatterns[] = $parentProduct->getUrlKey();
            }
        }
        if ($product->getUrlKey()) {
            $urlPatterns[] = $product->getUrlKey();
        }
        if (empty($urlPatterns)) {
            $urlPatterns[] = "##_NEVER_MATCH_##";
        }
        $pattern = sprintf('(?:%s)', implode('|', $urlPatterns));
        return $pattern;
    }
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;
            }
        }
    }
122824
public function unfollow($language, $product)
    {
        return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'DELETE');
    }
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;
    }
1188795
public function isPremium( $product ) {
		$isPremium = isset( $this->getData()->$product );

		$this->licenseString = $isPremium ?
			__( 'Premium', 'boldgrid-connect' ) : __( 'Free', 'boldgrid-library' );

		return $isPremium;
	}
94349
public function create(Product $product)
    {
        $this->getEm()->persist($product);
        $this->getEm()->flush();

        return $product;
    }
687996
public function getAllRoutesOfProduct(ProductInterface $product)
    {
        $urls = [];
        /** @var ProductTranslation $productTranslation */
        foreach ($product->getTranslations() as $productTranslation) {
            if ($productTranslation->getRoute()) {
                $urls[$productTranslation->getLocale()] = $productTranslation->getRoute()->getPath();
            }
        }

        return $urls;
    }
508393
public function getProducts()
    {
        return $this->filterDuplicates(array_merge([
            $this->originProduct,
            $this->product,
            preg_replace('/[^A-Za-z0-9]/', '', $this->product), // in case of special characters
        ],
            $this->explode($this->product, '-')
        ));
    }
477929
public function load( $product ) {
		$this->product = $product;
		$this->show_link();
		$this->add_hooks();

		return $this;
	}
976203
public function findAttributeValues($product)
    {
        // select
        $qb = $this->getQueryBuilder()
            ->select('a.name attributeName, av.name, i.path imagePath');

        // join
        $qb->join('p.attributeValues', 'av')
            ->join('av.attribute', 'a')
            ->leftJoin('av.image', 'i');

        // where
        $qb->andWhere('p = :product')
            ->setParameter('product', $product);

        // order by
        $qb->orderBy('a.order', 'asc');

        return $qb->getQuery()
            ->getResult();
    }
800776
public function is_from_partner( $product ) {

		foreach ( Module_Factory::$domains as $partner_domain ) {
			if ( strpos( $product->get_store_url(), $partner_domain ) !== false ) {
				return true;
			}
		}

		return array_key_exists( $product->get_slug(), Module_Factory::$slugs );
	}
962863
protected function indexProduct(array $product)
    {
        $snippet = $this->search->getSnippet($product, 'und');
        return $this->search->setIndex($snippet, 'product', $product['product_id'], 'und');
    }
632024
private function getFilterArray(array $request, \Magento\Catalog\Model\Product $product)
    {
        $filterArray = [];
        $attributes = $this->eavConfig->getEntityAttributes(\Magento\Catalog\Model\Product::ENTITY, $product);

        foreach ($request as $code => $value) {
            if (array_key_exists($code, $attributes)) {
                $attribute = $attributes[$code];
                if ($this->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code] = $value;
                }

                if (isset($filterArray[$code]) && !is_array($filterArray[$code])) {
                    $filterArray[$code] = [$filterArray[$code]];
                }

                if ($attribute->getId() && $this->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code][] = $this->swatchHelperData->getOptionIds($attribute, $value);
                }
            }
        }

        return $filterArray;
    }
256007
private function get_translations( $product ) {
		$cache_key    = $product->get_key() . '_all_languages';
		$translations = get_transient( $cache_key );

		if ( false === $translations ) {
			require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
			$translations = translations_api(
				$product->get_type() . 's',
				array(
					'slug'    => $product->get_slug(),
					'version' => $product->get_version(),
				)
			);
			set_transient( $cache_key, $translations, WEEK_IN_SECONDS );
		}

		return $translations;

	}
641813
public function getProductHistoricRates(RequestProduct $product) {
        return $this->get(['products', $product->getProductId(), 'candles'], ResponseProductHistoricRate::class, $product->toArray());
    }
976035
private function blockWord($word)
    {
        if ($this->strictClean) {
            return str_repeat($this->blocker[0], strlen($word));
        }

        return $this->blocker;
    }
712100
public function delivery(Product $product)
    {
        $delivery = $product->delivery->multiply($product->quantity);

        return $delivery;
    }