Check if we should load the notification module.

@param Product $product Product to check.

@return bool Should we load this?
482085
public function can_load( $product ) {

		if ( $this->is_from_partner( $product ) ) {
			return false;
		}
		if ( ! current_user_can( 'manage_options' ) ) {
			return false;
		}
		if ( ( time() - $product->get_install_time() ) < ( self::MIN_INSTALL_TIME * HOUR_IN_SECONDS ) ) {
			return false;
		}

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

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

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

	}
987775
public function hasFeature($feature)
    {
        return (isset($this->_aFeatures[$feature]) && !is_null($this->_aFeatures[$feature]));
    }
460933
public function addProductToHuskyItemTable($product)
    {
        $itemTableFormElement = $this->getSession()->getPage()->find('css', '#item-table-form');

        if (null === $itemTableFormElement) {
            throw new ElementNotFoundException($this->getSession(), '#item-table-form');
        }

        // Press add button in table.
        $addButtonElement = $itemTableFormElement->find('css', '.toolbar-item.add-row');

        if (null === $addButtonElement) {
            throw new ElementNotFoundException($this->getSession(), '#item-table-form .toolbar-item.add-row');
        }

        $addButtonElement->click();

        // Now wait for the new table row.
        $this->waitForSelector('#item-table-form .item-table-row.new');

        // Fill in auto complete product.
        $this->iSelectFromTheHuskyAutoComplete($product, '.item-table-row.new .product-search');

        // Wait until loading is finished.
        $this->spin(function (RawMinkContext $context) {
            $spinnerElement = $context->getSession()->getPage()->find(
                'css',
                '.item-table-row.new .product-search .spinner'
            );

            if ($spinnerElement && $spinnerElement->isVisible()) {
                return false;
            }

            return true;
        });
    }
169126
public function hasModule($module)
    {
        return $module instanceof ModuleInterface
            ? in_array($module, $this->modules)
            : isset($this->modules[$module]);
    }
575841
private function isInStockProduct(ProductInterface $product)
    {
        $isInStock = false;
        $document = $this->getDocumentSource($product);
        if (isset($document['stock']['is_in_stock'])) {
            $isInStock = (bool) $document['stock']['is_in_stock'];
        }

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

        return $delivery;
    }
443389
public function create(Product &$product)
    {
        $data = $product->exportData();
        $endpoint = '/admin/products.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'product' => $data
            )
        );
        $product->setData($response['product']);
    }
1345067
public function versions($language, $product)
    {
        return $this->request(sprintf('products/%s/%s/versions', $language, $this->transform($product)));
    }
303467
function hasLoaded($moduleName)
    {
        if (!is_string($moduleName))
            throw new \InvalidArgumentException(sprintf(
                'Invalid module name, "%s".'
                , \Poirot\Std\flatten($moduleName)
            ));

        return in_array($moduleName, $this->listLoadedModules());
    }
902285
protected function checkProduct($productId)
    {
        $this->product = ProductQuery::create()
            ->findPk($productId)
        ;

        if (null === $this->product) {
            return new JsonResponse(
                [
                    "error" => sprintf(
                        "The product id '%d' doesn't exist",
                        $productId
                    )
                ],
                404
            );
        }

        return null;
    }
125872
protected function js_module_loaded($module) {
        if (is_string($module)) {
            $modulename = $module;
        } else {
            $modulename = $module['name'];
        }
        return array_key_exists($modulename, $this->YUI_config->modules) ||
               array_key_exists($modulename, $this->extramodules);
    }
259147
public function isModuleCurrent(string $module): bool
	{
		return strpos($this->getAction(true), $module) !== false;
	}
790954
public function setParent(Product $parent = null)
    {
        if ($parent != null) {
            $this->entity->setParent($parent->getEntity());
        } else {
            $this->entity->setParent(null);
        }
    }
632511
public function isModulesLoaded( $modules )
    {
        if ( $modules instanceof Traversable )
        {
            $modules = ArrayUtils::iteratorToArray( $modules );
        }

        if ( ! is_array( $modules ) )
        {
            $modules = preg_split( '/\|{1,2}/', (string) $modules );
        }

        foreach ( $modules as $module )
        {
            if ( ! is_array( $module ) )
            {
                $module = preg_split( '/&{1,2}/', (string) $module );
            }

            if ( $this->isAllModulesLoaded( $module ) )
            {
                return true;
            }
        }

        return false;
    }
1192342
public function sendNewProductToManagerAndOwner(Product $product)
    {
        $productOwner = $product->productOwner;
        $mailVars = [
            '{productId}' => $product->id,
            '{title}' => $product->translation->title,
            '{ownerId}' => $productOwner->id,
            '{ownerEmail}' => $productOwner->email,
            '{owner}' => !(empty($productOwner->profile->name . ' ' . $productOwner->profile->surname)) ?
                $productOwner->profile->name . ' ' . $productOwner->profile->surname : $productOwner->profile->info,
            '{link}' => Html::a(
                $product->translation->title,
                Url::toRoute('/shop/product/save?id=' . $product->id . '&languageId=' . Language::getCurrent()->id, true)),

        ];

        //Send mail to manager
        $mailTemplate = $this->createMailTemplate('new-product-to-manager', $mailVars);
        $partnerManagerEmail = \Yii::$app->getModule('shop')->partnerManagerEmail;

        if (!empty($mailTemplate) && !empty($partnerManagerEmail)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $partnerManagerEmail, $subject, $bodyParams);
        }

        //Send mail to partner
        $mailTemplate = $this->createMailTemplate('new-product-to-partner', $mailVars);
        if (!empty($mailTemplate) && !empty($productOwner->email)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $productOwner->email, $subject, $bodyParams);
        }
    }
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;
	}