use Cubist\Util\Graphics\Resizer;
use Cubist\Util\Text;
use Cubist\Util\Url;
+use Fluidbook\Tools\Links\ZoomLink;
use SplFileInfo;
trait Cart
}
+ /**
+ * @throws \Exception
+ */
public function writePumaCart()
{
$this->lessVariables['import-cart-styles'] = 'puma';
$this->addJsLib('exceljs', 'js/libs/exceljs.min.js');
$this->addVideoJs();
- $this->config->basketReferences = ExcelToArray::excelToArrayKeyVars($this->wdir . 'commerce/' . $this->fluidbookSettings->basketReferences);
+ $this->log('Puma libs inited');
+
+ $cartReferences = ExcelToArray::excelToArrayKeyVars($this->wdir . 'commerce/' . $this->fluidbookSettings->basketReferences);
+ $this->log('Puma excel file parsed');
$eanFile = $this->wdir . 'commerce/ean.xlsx';
if (file_exists($eanFile)) {
- $this->config->eanReferences = ExcelToArray::excelToArrayIndexKeyVars($eanFile);
+ $eanReferences = ExcelToArray::excelToArrayIndexKeyVars($eanFile);
+ $this->log('Puma ean file parsed');
+ $this->config->setRaw('eanReferences', $eanReferences);
+ $this->log('Puma ean data set');
}
+
$this->getLinksAndRulers($links, $rulers);
foreach ($links as $link) {
- if ($link['type'] == '12' && isset($this->config->basketReferences[$link['to']])) {
- $this->config->basketReferences[$link['to']]['zoom_image'] = 'data/links/zoom_' . $link['uid'] . '.jpg';
- $this->config->basketReferences[$link['to']]['zoom_url'] = base64_encode(file_get_contents($this->dir . '/data/links/zoom_' . $link['uid'] . '.jpg'));
- $this->config->basketReferences[$link['to']]['zoom_image_ratio'] = $link['width'] / $link['height'];
+ if ($link['type'] == '12' && isset($cartReferences[$link['to']])) {
+ ;
+ $cartReferences[$link['to']]['zoom_image'] = 'data/links/zoom_' . $link['uid'] . '.jpg';
+ //$cartReferences[$link['to']]['zoom_url'] = base64_encode(file_get_contents($this->dir . '/data/links/zoom_' . $link['uid'] . '.jpg'));
+ $cartReferences[$link['to']]['zoom_image_ratio'] = $link['width'] / $link['height'];
}
}
- $this->config->product_zoom_references = [];
+ $this->log('Puma cart completed');
+
+ $productZoomReferences = [];
$files = ['360°', 'Image supplémentaire', 'Fiche technique'];
- foreach ($this->config->basketReferences as $ref => $data) {
+ foreach ($cartReferences as $ref => $data) {
$r = [];
foreach ($files as $file) {
if (!isset($data[$file])) {
}
$r[] = $fname;
}
- $this->config->product_zoom_references[$ref] = $r;
+ $productZoomReferences[$ref] = $r;
}
+ $this->log('Puma product zoom done');
+
+ $this->config->setRaw('product_zoom_references', $productZoomReferences);
+ $this->config->setRaw('basketReferences', $cartReferences);
+
+ $this->log('Puma cart written');
}
if (file_exists($referencesFile) || Url::isDistant($referencesFile)) {
$rows = ExcelToArray::excelToArrayFirstSheet($referencesFile);
-
// Expected headings are: EXCLU, LIGNE, EAN, REF, DESIGNATION, COULEUR, QTE MINI, PRIX TTC
$column_headings = array_shift($rows); // We assume the first row will be the headings, so we slice it off
$column_headings = array_map(function ($heading) { // Clean the headings a bit
if (null === $this->logtime) {
$this->logtime = $currenttime;
}
- $time = $currenttime - $this->logtime;
+ $time = max(0.0001, $currenttime - $this->logtime);
$log = $step . ' | ' . round($time, 4) . 's' . "\n";
fwrite($this->logfp, $log);
fflush($this->logfp);
$this->writeImages();
$this->log('Images written');
$this->writeCartConfig();
+ $this->log('Cart written');
$this->writeXMLArticles();
$this->log('XML Articles written');
$this->writeSlider();