From: vincent@cubedesigners.com Date: Wed, 23 Nov 2022 08:38:20 +0000 (+0000) Subject: wait #5598 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4b00aa6d47ae1247ddc81da6cc85860af06a41f9;p=cubeextranet.git wait #5598 @1 --- diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 0bb3e6aa3..99fc6f112 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -765,22 +765,32 @@ class wsHTML5Compiler if (file_exists($this->wdir . 'commerce/aliases.txt')) { $lines = explode("\n", file_get_contents($this->wdir . 'commerce/aliases.txt')); foreach ($lines as $line) { - $base = false; - $refs = explode('/', $line); + $bases = []; + $refs = explode('/', trim($line)); foreach ($this->config->basketReferences as $ref => $d) { if (strpos($ref, $refs[0]) === 0) { - $base = $ref; - break; + $bases[] = $ref; } } - if (!$base) { + if (!count($bases)) { continue; } + for ($i = 1; $i < count($refs); $i++) { foreach ($this->config->basketReferences as $ref => $d) { - if (strpos($ref, $refs[$i]) === 0) { - $aliases[$ref] = $base; - break; + if (strpos($ref, $refs[$i]) !== 0) { + continue; + } + $foundColor = false; + foreach ($bases as $base) { + if (substr($ref, -2) === substr($base, -2)) { + $aliases[$ref] = $base; + $foundColor = true; + break; + } + } + if (!$foundColor) { + $aliases[$ref] = $bases[0]; } } }