From a0e3aa208252ff07a6a2bae50301cc05201e60ed Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 12 May 2021 15:12:30 +0000 Subject: [PATCH] wip #4447 @2 --- inc/ws/Metier/class.ws.book.parametres.php | 1 + .../html5/master/class.ws.html5.compiler.php | 30 ++++++++++++ .../html5/master/class.ws.html5.links.php | 46 +++++++++---------- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index b8fddce67..5ad6d65b0 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -681,6 +681,7 @@ class wsBookParametres extends wsParametres 'Mopec' => 'Mopec', 'Puma' => 'Puma', 'MIF' => 'MIF', + 'Flexipan' => 'Flexipan', 'Zoom + lien produit (déprécié, utiliser la fonctionnalité "Zoom produits")' => 'ZoomProductLink', 'Wishlist Jouéclub' => 'JoueclubWishlist', 'GrandVision' => 'GrandVision', 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 bc5a1ad02..c491ee1fc 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -518,6 +518,34 @@ class wsHTML5Compiler return false; } + public function writeFlexipanCart() + { + $this->lessVariables['import-cart-styles'] = 'flexipan'; + + $this->addJsLib('cookie', 'js/libs/jquery/jquery.cookie.js'); + $this->addJsLib('flexipan', 'js/libs/fluidbook/cart/fluidbook.cart.flexipan.js'); + $this->addJsLib('html2pdf', 'js/libs/html2pdf/html2pdf.min.js'); + + $cdir = $this->wdir . '/commerce/'; + + + $file = $cdir . $this->book->parametres->basketReferences; + $this->config->basketReferences = wsUtil::excelToArrayKeyVars($file); + + wsLinks::getLinksAndRulersFromFile($this->book_id, $links, $rulers); + + foreach ($links as $link) { + if ($link['type'] == '12') { + + } + } + + $this->config->product_zoom_references = []; + foreach ($this->config->basketReferences as $ref => $data) + $this->config->product_zoom_references[$ref] = [$ref]; + } + } + public function writeMIFCart() { $this->lessVariables['import-cart-styles'] = 'mif'; @@ -618,6 +646,8 @@ class wsHTML5Compiler if ($this->config->basket) { $this->addJsLib('cart', 'js/libs/fluidbook/fluidbook.cart.js'); switch ($this->config->basketManager) { + case 'Flexipan'; + return $this->writeFlexipanCart(); case 'Puma': return $this->writePumaCart(); case 'MIF': diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 953e62ef0..3304ff036 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -131,7 +131,7 @@ class wsHTML5Link return new actionLink($id, $init, $compiler); case 12: - if ($compiler->book->parametres->basketManager === 'Puma' || $compiler->book->parametres->basketManager === 'MIF') { + if ($compiler->book->parametres->basketManager === 'Puma' || $compiler->book->parametres->basketManager === 'MIF' || $compiler->book->parametres->basketManager === 'Flexipan') { return new zoomProductLink($id, $init, $compiler); } if ($compiler->book->parametres->product_zoom_references !== '') { @@ -1812,28 +1812,28 @@ class htmlMultimediaLink extends wsHTML5Link return $this->_content; } - public function getLottieContent($c, $width, $height) - { - $this->_config = ['width' => $this->width * $this->getCssScale(), 'height' => $this->height * $this->getCssScale()]; - $parsedLottie = self::_parseLottieContent($c); - - $lottieID = $this->compiler->addLottie($parsedLottie['animation'], $parsedLottie['params'], $parsedLottie['hash']); - return '
'; - } - - public static function _parseLottieContent($c) - { - $hash = hash('sha256', $c); - $start = mb_strpos($c, 'var animationData = {') + 20; - $end = mb_strpos($c, '};', $start) + 1; - $ad = mb_substr($c, $start, $end - $start); - $animationData = json_decode($ad); - preg_match('/var params = (\{.*\});/sU', $c, $matches); - $matches[1] = str_replace('container: document.getElementById(\'lottie\'),', '', $matches[1]); - $matches[1] = str_replace('animationData: animationData', '', $matches[1]); - $params = CJSON::decode($matches[1]); - return ['animation' => $animationData, 'params' => $params, 'hash' => $hash]; - } +// public function getLottieContent($c, $width, $height) +// { +// $this->_config = ['width' => $this->width * $this->getCssScale(), 'height' => $this->height * $this->getCssScale()]; +// $parsedLottie = self::_parseLottieContent($c); +// +// $lottieID = $this->compiler->addLottie($parsedLottie['animation'], $parsedLottie['params'], $parsedLottie['hash']); +// return '
'; +// } +// +// public static function _parseLottieContent($c) +// { +// $hash = hash('sha256', $c); +// $start = mb_strpos($c, 'var animationData = {') + 20; +// $end = mb_strpos($c, '};', $start) + 1; +// $ad = mb_substr($c, $start, $end - $start); +// $animationData = json_decode($ad); +// preg_match('/var params = (\{.*\});/sU', $c, $matches); +// $matches[1] = str_replace('container: document.getElementById(\'lottie\'),', '', $matches[1]); +// $matches[1] = str_replace('animationData: animationData', '', $matches[1]); +// $params = CJSON::decode($matches[1]); +// return ['animation' => $animationData, 'params' => $params, 'hash' => $hash]; +// } public function getHTMLContainerClass() { -- 2.39.5