Skip to content

Commit

Permalink
Merge pull request #179 from Nosto/hotfix/2.1.2
Browse files Browse the repository at this point in the history
HotFix - 2.1.2
  • Loading branch information
supercid authored Jul 3, 2018
2 parents 193b1f5 + 58e31d9 commit eb369eb
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 99 deletions.
51 changes: 36 additions & 15 deletions Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
use Nosto\Object\Signup\Account as NostoAccount;
use phpseclib\Crypt\Random as NostoCryptRandom;
use Doctrine\ORM\TransactionRequiredException;
use Shopware\Components\Model\ModelManager;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\OptimisticLockException;
use Shopware\Models\Category\Category;
Expand All @@ -80,7 +81,7 @@
class Shopware_Plugins_Frontend_NostoTagging_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
const PLATFORM_NAME = 'shopware';
const PLUGIN_VERSION = '2.1.1';
const PLUGIN_VERSION = '2.1.2';
const MENU_PARENT_ID = 23; // Configuration
const NEW_ENTITY_MANAGER_VERSION = '5.0.0';
const NEW_ATTRIBUTE_MANAGER_VERSION = '5.2.0';
Expand Down Expand Up @@ -249,6 +250,21 @@ public function createConfiguration()
);
}

/**
* Returns an array with metadata of Nosto tables
*
* @param ModelManager $modelManager
* @return array
*/
protected function getNostoModelClassMetadata(ModelManager $modelManager)
{
return array(
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Account\Account'),
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Customer\Customer'),
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Setting\Setting')
);
}

/**
* Creates needed db tables used by the plugin models.
*
Expand All @@ -262,13 +278,7 @@ protected function createMyTables()
$this->registerCustomModels();
$modelManager = Shopware()->Models();
$schematicTool = new Doctrine\ORM\Tools\SchemaTool($modelManager);
$schematicTool->createSchema(
array(
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Account\Account'),
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Customer\Customer'),
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Setting\Setting')
)
);
$schematicTool->createSchema($this->getNostoModelClassMetadata($modelManager));
}

/**
Expand Down Expand Up @@ -567,7 +577,9 @@ private function clearShopwareCache()
*/
public function update($existingVersion)
{
$this->updateMyTables();
$this->createMyAttributes($existingVersion);
$this->createConfiguration();
$this->clearShopwareCache();

return true;
Expand Down Expand Up @@ -597,13 +609,22 @@ protected function dropMyTables()
$this->registerCustomModels();
$modelManager = Shopware()->Models();
$schematicTool = new Doctrine\ORM\Tools\SchemaTool($modelManager);
$schematicTool->dropSchema(
array(
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Account\Account'),
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Customer\Customer'),
$modelManager->getClassMetadata('\Shopware\CustomModels\Nosto\Setting\Setting')
)
);
$schematicTool->dropSchema($this->getNostoModelClassMetadata($modelManager));
}

/**
* Update existing db tables.
*
* Run on update.
*
* @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::update
*/
protected function updateMyTables()
{
$this->registerCustomModels();
$modelManager = Shopware()->Models();
$schematicTool = new Doctrine\ORM\Tools\SchemaTool($modelManager);
$schematicTool->updateSchema($this->getNostoModelClassMetadata($modelManager), true);
}

/**
Expand Down
134 changes: 52 additions & 82 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,111 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.1]
- Fix Backwards Compatibility With PHP 5.4

## [2.1.0]
- Add Restore Cart Link To Cart Tagging
- Add Inventory Level And Supplier Cost To Product API Calls
- Renders Tagging Programmatically
- AddSkuToCart Function To Template
- Add Custom Field Tagging For Product And SKU
- Add Product Streams Support

## [2.0.4]
## 2.1.2
- Fix SKU variations for single products
- Add variant configuration group options into custom attributes
- Fix issue when updating the plugin could not create database column for cart restore hash
- fix missing category tagging in category listing page

## 2.1.1
- Fix backwards compatibility with PHP 5.4

## 2.1.0
- Add restore cart link to cart tagging
- Add inventory level and supplier cost to product API calls
- Renders tagging programmatically
- AddSkuToCart function to template
- Add custom field tagging for product and SKU
- Add product streams support

## 2.0.4
- Fix marketing permission tagging

## [2.0.3]
## 2.0.3
- Fix order confirmation handling when using Shopware API or cli

## [2.0.2]
## 2.0.2
- Fix PHP backwards compatibility

## [2.0.1]
## 2.0.1
- Fix builder deleting composer autoloader

## [2.0.0]
## 2.0.0
- Bump SDK to 3.3.1
- Fix shopware platform version detection
- Handle Opt-In for Customer and Buyer
- Handle opt-in for customer and buyer

## [1.2.6]
## 1.2.6
- Add support for Shopware 5.4

## [1.2.5]
## 1.2.5
- Add support for Shopware 5.3

## [1.2.4]
## 1.2.4
- Make order status handling compatible with Shopware < 5.1

## [1.2.3]
## 1.2.3
- Fix a bug that cause php fatal error on shopware 4

## [1.2.2]
## 1.2.2
- Fix a bug to prevent two shopware sub shops connect to same nosto account

## [1.2.1]
## 1.2.1
- Fix a bug that cause php fatal error in certain sub shop setup

## [1.2.0]
## 1.2.0
- Add support for multi-store, customer groups and price groups
- Add ratings, reviews, inventory level, supplier cost, alternative images
- Fix the customer reference tag class
- Clean up the extension code, bump SDK, add Phan, PHPCS, PHPCBF, PHPMD

## [1.1.9]
## 1.1.9
- Refactor utility methods to be static
- Add visitor tagging hash
- Add "js stub" for Nosto javascript

## [1.1.8]
## 1.1.8
- Fix issue in update method
- Clear shopware cache after Nosto plug-in is installed or updated

## [1.1.7]
## 1.1.7
- Remove date_published field from product tagging
- Add page type tagging
- Add customer reference tagging
- Use direct include for Nosto javascript
- Fix add to cart javascript function
- Handle some deprecated calls that will be removed in Shopware 5.3

## [1.1.6]
## 1.1.6
- Add support for using multiple currencies across different stores

## [1.1.5]
## 1.1.5
- Add support for the new Nosto UI

## [1.1.4]
## 1.1.4
- Fix the product duplicating

## [1.1.3]
## 1.1.3
- Fix failing installation with Shopware 5.2
- Add safeguards for method calls to non-objects

## [1.1.2]
## 1.1.2
- Add extendability for line items, cart, order, customer, category and buyer
- Fix product update listener when only product details are updated
- Add support for account details
- Set user agent for API calls

## [1.1.1]
## 1.1.1
- Fix product delete bug
- Introduce packaging with phing (development only)

## [1.1.0]
## 1.1.0
- Support using recommendations in Shopping Worlds
- Add tagging to 404 pages
- Automatic price per unit tagging (tag2)
- Fix for handling empty payment provider

## [1.0.4]
## 1.0.4
- Fix the order and product export controller to respect the shop parameters
- Add support for MediaService in Shopware 5.1
- Add functionality for overriding the product data
Expand All @@ -112,42 +118,42 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix the email address use when creating a new account
- Fix a bug where the email address in account opening is omitted

## [1.0.3]
## 1.0.3
- Remove check for existing image file in the file system, as it makes it hard
to debug image url issues

## [1.0.2]
## 1.0.2
- Check that a price model is found before using it in the product model
- Fix product image url protocol to be based on the current shop settings

## [1.0.1]
## 1.0.1
* Fix fatal error in product when image has no media

## [1.0.0]
## 1.0.0
### Added
- First public release

## [0.6.0]
## 0.6.0
### Added
- Order status and payment provider to order tagging

### Fixed
- window.postMessage event origin validation to work with new sub-domains

## [0.5.0]
## 0.5.0
### Changed
- The Nosto account configuration iframe to use merchant specific sub-domains in
- The Nosto account configuration iFrame to use merchant specific sub-domains in
the urls to allow editing multiple accounts simultaneously

### Fixed
- Cart/order tagging to use correct product id and name for line items, so that
the different product variations can be recognized in emails

## [0.4.1]
## 0.4.1
### Fixed
- Product image tagging to check if image exists

## [0.4.0]
## 0.4.0
### Added
- Unique indexes to db tables
- Nosto meta tags to the frontend pages
Expand All @@ -157,51 +163,15 @@ the different product variations can be recognized in emails
- Account connection OAuth flow to open the Nosto configuration after being
redirected back from Nosto

## [0.3.0]
## 0.3.0
### Fixed
- Bug fixes for older SW 4 versions

## [0.2.0]
## 0.2.0
### Added
- "add-to-cart" feature to enable adding products to cart directly from the
recommendations

## 0.1.0
### Added
- Initial beta-release

[unreleased]: https://github.com/nosto/nosto-shopware-plugin/compare/2.1.0...develop
[2.1.0]: https://github.com/nosto/nosto-shopware-plugin/compare/2.0.4...2.1.0
[2.0.4]: https://github.com/nosto/nosto-shopware-plugin/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/nosto/nosto-shopware-plugin/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/nosto/nosto-shopware-plugin/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/nosto/nosto-shopware-plugin/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.6...2.0.0
[1.2.6]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.5...1.2.6
[1.2.5]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.4...1.2.5
[1.2.4]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.3...1.2.4
[1.2.3]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.2...1.2.3
[1.2.2]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.9...1.2.0
[1.1.9]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.8...1.1.9
[1.1.8]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.7...1.1.8
[1.1.7]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.6...1.1.7
[1.1.6]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.5...1.1.6
[1.1.5]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.4...1.1.5
[1.1.4]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.3...1.1.4
[1.1.3]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.2...1.1.3
[1.1.2]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.1...1.1.2
[1.1.1]: https://github.com/nosto/nosto-shopware-plugin/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/nosto/nosto-shopware-plugin/compare/1.0.4...1.1.0
[1.0.4]: https://github.com/nosto/nosto-shopware-plugin/compare/1.0.3...1.0.4
[1.0.3]: https://github.com/nosto/nosto-shopware-plugin/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/nosto/nosto-shopware-plugin/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/nosto/nosto-shopware-plugin/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/nosto/nosto-shopware-plugin/compare/0.6.0...1.0.0
[0.6.0]: https://github.com/nosto/nosto-shopware-plugin/compare/0.5.0...0.6.0
[0.5.0]: https://github.com/nosto/nosto-shopware-plugin/compare/0.4.1...0.5.0
[0.4.1]: https://github.com/nosto/nosto-shopware-plugin/compare/0.4.0...0.4.1
[0.4.0]: https://github.com/nosto/nosto-shopware-plugin/compare/0.3.0...0.4.0
[0.3.0]: https://github.com/nosto/nosto-shopware-plugin/compare/0.2.0...0.3.0
[0.2.0]: https://github.com/nosto/nosto-shopware-plugin/compare/0.1.0...0.2.0
20 changes: 19 additions & 1 deletion Components/Helper/CustomFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

use Shopware\Models\Article\Detail;
use Nosto\Helper\SerializationHelper;
use Shopware\Models\Article\Configurator\Option;

/**
* Class Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CustomFields
Expand Down Expand Up @@ -64,7 +65,7 @@ class Shopware_Plugins_Frontend_NostoTagging_Components_Helper_CustomFields
'articleId',
'article'
);
public static $test = 'getWidth';

/**
* Returns an array with defined properties in the settings
* panel of the variant/main product
Expand All @@ -77,10 +78,27 @@ public static function getDetailSettingsCustomFields(Detail $detail)
// Iterates through the $productCustomFields array and
// dynamically execute the methods in the Detail object.
$settingsCustomFields = array();
// Add variant configuration group options into custom attributes
try {
$configurator = $detail->getConfiguratorOptions()->getValues();
foreach ($configurator as $config) {
/** @var Option $config */
if (!$config instanceof Option
|| $config->getGroup() === null
) {
continue;
}
$settingsCustomFields[$config->getGroup()->getName()] = $config->getName();
}
} catch (\Exception $e) {
/** @noinspection PhpUndefinedMethodInspection */
Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->warning($e->getMessage());
}
foreach (self::$productCustomFields as $key => $productCustomField) {
$method = sprintf('get%s', $productCustomField);
if (method_exists($detail, $method)) {
$fullMethod = $detail->{$method}();
/** @noinspection TypeUnsafeComparisonInspection */
if (!empty($fullMethod) && $fullMethod != 0) {
$settingsCustomFields[$key] = $detail->{$method}();
}
Expand Down
Loading

0 comments on commit eb369eb

Please sign in to comment.