setUpdateAvailable example

$localPlugin = $this->getPluginModel($plugin->getTechnicalName());

        if ($localPlugin) {
            $struct->setId($localPlugin->getId());

            preg_match('/(\d\.\d\.\d)/', $localPlugin->getVersion()$matches);

            $localVersion = array_shift($matches);
            if ($localVersion) {
                $updateAvailable = version_compare($plugin->getBinaryVersion()$localVersion);

                $struct->setUpdateAvailable($updateAvailable === 1);
                $struct->setVersion($localVersion);
            }
        }

        return $struct;
    }

    /** * @param string $technicalName * @param string $version * * @return PluginStruct|null */
public function assignStorePluginStruct(PluginStruct $localPlugin, PluginStruct $storePlugin)
    {
        $localPlugin->setExampleUrl($storePlugin->getExampleUrl());
        $localPlugin->setCode($storePlugin->getCode());

        $updateAvailable = version_compare(
            $storePlugin->getVersion(),
            $localPlugin->getVersion()
        );

        $localPlugin->setUpdateAvailable((bool) ($updateAvailable == 1));

        if ($storePlugin->getDescription()) {
            $localPlugin->setDescription($storePlugin->getDescription());
        }
        if ($localPlugin->isUpdateAvailable()) {
            $localPlugin->setAvailableVersion($storePlugin->getVersion());
        }

        $localPlugin->setLink($storePlugin->getLink());
        $localPlugin->setRedirectToStore($storePlugin->isRedirectToStore());
        $localPlugin->setLowestPrice($storePlugin->getLowestPrice());
        
Home | Imprint | This part of the site doesn't use cookies.