From af6849ae278c1e5ab5f68b2d8c607ac4ee911d42 Mon Sep 17 00:00:00 2001 From: Pim Ruiter Date: Tue, 30 Jan 2024 11:19:34 +0100 Subject: [PATCH] Deleted unused plugin --- Plugin/FixProductUrls.php | 92 --------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 Plugin/FixProductUrls.php diff --git a/Plugin/FixProductUrls.php b/Plugin/FixProductUrls.php deleted file mode 100644 index 5a913c1..0000000 --- a/Plugin/FixProductUrls.php +++ /dev/null @@ -1,92 +0,0 @@ -entitiesHelper = $entitiesHelper; - $this->storeHelper = $storeHelper; - $this->config = $config; - } - - /** - * afterCreateConfigurable function - * - * @param product $subject - * @param bool $result - * @return bool $result - */ - public function afterCreateConfigurable(product $subject, $result) - { - $extensionEnabled = $this->config->getValue('akeneo_connector/justbetter/fixconfigurableurls', scope::SCOPE_WEBSITE); - if (!$extensionEnabled) { - return $result; - } - $tmpTableName = $this->entitiesHelper->getTableName($subject->getCode()); - $this->fixDuplicateUrls($tmpTableName); - return $result; - } - - /** - * fix Duplicate Urls function - * - * @param string $tmpTableName - * @return void - */ - public function fixDuplicateUrls($tmpTableName) - { - $stores = $this->storeHelper->getStores(['lang']); - $connection = $this->entitiesHelper->getConnection(); - $identifier = " LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(`identifier`), ':', ''), ')', ''), '(', ''), ',', ''), '\/', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) "; - - foreach ($stores as $local) { - $data = []; - $channelCode = $local[0]['channel_code'] ?? false; - $local = "url_key-" . $local[0]['lang']; - $urlKey = $connection->tableColumnExists($tmpTableName, $local); - - if ($channelCode) { - if ($connection->tableColumnExists($tmpTableName, $local.'-'.$channelCode)) { - $urlKey = true; - $local = $local.'-'.$channelCode; - } - } - - if ($urlKey) { - $data[$local] = new expression("CONCAT(`" . $local . "`,'-' ," . $identifier . ")"); - - $where[] = "parent is not null"; - $where[] = "`$local` is not null"; - - $connection->update( - $tmpTableName, - $data, - $where - ); - } - } - } -}