}
+ public function writePumaSECart()
+ {
+
+ $this->lessVariables['import-cart-styles'] = 'puma-se';
+ $this->addJsLib('puma-se', 'js/libs/fluidbook/cart/fluidbook.cart.puma-se.js');
+
+ $this->_commonPuma();
+
+ }
+
+
/**
* @throws \Exception
*/
public function writePumaCart()
{
$this->lessVariables['import-cart-styles'] = 'puma';
+ $this->addJsLib('puma', 'js/libs/fluidbook/cart/fluidbook.cart.puma.js');
+ $this->_commonPuma();
+ }
+
+ protected function _commonPuma()
+ {
$this->addJsLib('parsley', 'js/libs/parsley.min.js');
$this->addJsLib('cookie', 'js/libs/jquery/jquery.cookie.js');
- $this->addJsLib('puma', 'js/libs/fluidbook/cart/fluidbook.cart.puma.js');
$this->addJsLib('html2pdf', 'js/libs/html2pdf/html2pdf.min.js');
$this->addJsLib('exceljs', 'js/libs/exceljs.min.js');
$this->addVideoJs();
}
$this->log('Puma product zoom done');
+
+ $aliases = [];
+ if (file_exists($this->wdir . 'commerce/aliases.txt')) {
+ $lines = explode("\n", file_get_contents($this->wdir . 'commerce/aliases.txt'));
+ foreach ($lines as $line) {
+ $bases = [];
+ $refs = explode('/', trim($line));
+ foreach ($cartReferences as $ref => $d) {
+ if (str_starts_with($ref, $refs[0])) {
+ $bases[] = $ref;
+ }
+ }
+ if (!count($bases)) {
+ continue;
+ }
+
+ for ($i = 1; $i < count($refs); $i++) {
+ foreach ($cartReferences as $ref => $d) {
+ if (!str_starts_with($ref, $refs[$i])) {
+ 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];
+ }
+ }
+ }
+ }
+ }
+
+ foreach ($aliases as $alias => $base) {
+ $cartReferences[$alias]['zoom_image'] = $cartReferences[$base]['zoom_image'];
+ $cartReferences[$alias]['zoom_image_ratio'] = $cartReferences[$base]['zoom_image_ratio'];
+ }
+
+ $this->log('Puma aliases handled');
+
$this->config->setRaw('product_zoom_references', $productZoomReferences);
$this->config->setRaw('basketReferences', $cartReferences);
}
}
+
public function writeCartConfig()
{
if ($this->fluidbookSettings->cartLinkAppearance == 'overlay') {
case 'Puma':
$this->writePumaCart();
return;
+ case 'Puma-SE':
+ $this->writePumaSECart();
+ return;
case 'MIF':
$this->writeMIFCart();
return;
use Fluidbook\Tools\Links\CartLink;
-class PumaCartLink extends cartLink
+class PumaCartLink extends CartLink
{
public function getInnerContent()
{
</svg>';
}
+
public function getAdditionnalContent()
{
+ $removeTooltip = $this->to === 'auto:all_in_page' ? 'remove all page products from cart' : 'remove from cart';
+
$res = parent::getAdditionnalContent();
- $res .= ' data-tooltip-conditional="' . htmlspecialchars(json_encode(['.active' => 'remove from cart'])) . '" ';
+ $res .= ' data-tooltip-conditional="' . htmlspecialchars(json_encode(['.active' => $removeTooltip])) . '" ';
+
return $res;
}
}