-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
84 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,4 @@ | ||
# Ignore everything (useful to ignore the whole Contao installation) | ||
/* | ||
|
||
# Do not ignore ".gitignore" | ||
!.gitignore | ||
!.tx | ||
!composer.json | ||
!build.xml.dist | ||
!README.md | ||
|
||
# Isotope ignoring rules | ||
!isotope/ | ||
isotope/* | ||
!isotope/.htaccess | ||
!isotope/index.html | ||
!system/ | ||
system/* | ||
!system/modules | ||
system/modules/* | ||
!system/modules/isotope/* | ||
!system/modules/isotope_reports/* | ||
!system/modules/isotope_rules/* | ||
/system/modules/isotope/config/runonce.php | ||
|
||
# Gulp and node modules | ||
!gulpfile.js | ||
!package.json | ||
node_modules/ | ||
/vendor/ | ||
/node_modules/ | ||
/composer.lock | ||
/.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
system/modules/isotope/library/Isotope/Upgrade/To0020050150.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* Isotope eCommerce for Contao Open Source CMS | ||
* | ||
* Copyright (C) 2009-2017 terminal42 gmbh & Isotope eCommerce Workgroup | ||
* | ||
* @link https://isotopeecommerce.org | ||
* @license https://opensource.org/licenses/lgpl-3.0.html | ||
*/ | ||
|
||
/** | ||
* Isotope eCommerce for Contao Open Source CMS | ||
* | ||
* Copyright (C) 2009-2016 terminal42 gmbh & Isotope eCommerce Workgroup | ||
* | ||
* @link https://isotopeecommerce.org | ||
* @license https://opensource.org/licenses/lgpl-3.0.html | ||
*/ | ||
|
||
namespace Isotope\Upgrade; | ||
|
||
use Contao\Database; | ||
|
||
class To0020050150 extends Base | ||
{ | ||
public function run($blnInstalled) | ||
{ | ||
if (!$blnInstalled) { | ||
return; | ||
} | ||
|
||
$attributes = Database::getInstance()->execute( | ||
"SELECT field_name FROM tl_iso_attribute WHERE type='checkbox' AND (optionsSource='table' OR optionsSource='foreignKey')" | ||
)->fetchEach('field_name'); | ||
|
||
if (empty($attributes)) { | ||
return; | ||
} | ||
|
||
$fields = implode(', ', $attributes); | ||
|
||
$products = Database::getInstance()->execute("SELECT id, $fields FROM tl_iso_product")->fetchAllAssoc(); | ||
|
||
foreach ($products as $product) { | ||
$update = []; | ||
|
||
foreach ($attributes as $attribute) { | ||
if (0 !== strpos($product[$attribute], 'a:')) { | ||
continue; | ||
} | ||
|
||
$value = deserialize($product[$attribute]); | ||
|
||
if (\is_array($value)) { | ||
$update[$attribute] = implode(',', $value); | ||
} | ||
} | ||
|
||
if (empty($update)) { | ||
continue; | ||
} | ||
|
||
Database::getInstance()->prepare("UPDATE tl_iso_product %s WHERE id=?")->set($update)->execute($product['id']); | ||
} | ||
} | ||
} |