From 02e9660c42fd7b5eaf27a517ef38d7539bd64a27 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 22 Nov 2022 17:17:29 +0000 Subject: [PATCH] wip #5598 @1 --- .../html5/master/class.ws.html5.compiler.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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 b10fa73e2..0bb3e6aa3 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -760,6 +760,38 @@ class wsHTML5Compiler } $this->config->product_zoom_references[$ref] = $r; } + + $aliases = []; + 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); + foreach ($this->config->basketReferences as $ref => $d) { + if (strpos($ref, $refs[0]) === 0) { + $base = $ref; + break; + } + } + if (!$base) { + 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; + } + } + } + } + } + + foreach ($aliases as $alias => $base) { + $this->config->basketReferences[$alias]['zoom_image'] = $this->config->basketReferences[$base]['zoom_image']; + $this->config->basketReferences[$alias]['zoom_url'] = $this->config->basketReferences[$base]['zoom_url']; + $this->config->basketReferences[$alias]['zoom_image_ratio'] = $this->config->basketReferences[$base]['zoom_image_ratio']; + } } public function writePumaCart() -- 2.39.5