Code Monkey home page Code Monkey logo

akeneo-table-attribute-bundle's Introduction

Flagbit Table Attribute for Akeneo PIM

Adds the new attribute type Table for Akeneo products.

Key FeaturesInstallationCompatibilityDevelopmentContributing

Key Features

Provides a table as attribute type where you can define a set of columns of different types and validation rules.

Column Types

  • Text
  • Number (Integer or Decimal)
  • Simple select
  • Simple select from URL

Import/Export

The extension supports the standard Akeneo product import/export, so you don't need to create any special import/export profile for table information.

All product information related to attributes of type table will be imported/exported as JSON.

Installation

Simply install the package with the following command:

composer require flagbit/table-attribute-bundle

Enable the bundle

Enable the bundle in the kernel:

<?php
// config/bundles.php

return [
    // ...
    Flagbit\Bundle\TableAttributeBundle\FlagbitTableAttributeBundle::class => ['all' => true],
];

Configuration

Add mapping_overrides in a new config/packages/table.yml file or an existing one:

akeneo_storage_utils:
    mapping_overrides:
        -
            original: Akeneo\Pim\Structure\Component\Model\AttributeOption
            override: Flagbit\Bundle\TableAttributeBundle\Entity\AttributeOption

Import the routing

Now that you have activated and configured the bundle, you need to import the routing files.

# config/routes/flagbit_table_attribute.yml
flagbit_table_attribute:
    resource: "@FlagbitTableAttributeBundle/Resources/config/routing.yml"

Clear the cache:

php bin/console --env=prod cache:clear

Update the database schema:

php bin/console --env=prod doctrine:schema:update --force

Build and install the new front-end dependencies (new icon, etc.)

make cache assets css javascript-prod javascript-extensions

In case you're using Doctrine migrations, you have to create a new migration class

php bin/console --env=prod doctrine:migration:diff

and migrate the schema updates:

php bin/console --env=prod doctrine:migrations:migrate

Compatibility

This extension supports the latest Akeneo PIM CE/EE stable versions:

  • 6.0
  • 5.0
  • 4.0
  • 3.2 (LTS)
  • 3.0 (LTS)
  • 2.3 (LTS)

Development

Running Test-Suits

The TableAttributeBundle is covered with tests and every change and addition has also to be covered with unit or/and integration tests. It uses two testing suits: PHPSpec and PHPUnit.

To run the tests you have to change to this project's root directory and run the following commands in your console:

vendor/bin/phpunit
vendor/bin/phpspec run

Coding style

TableAttributeBundle uses the PSR-2 coding style and can be checked with Codesniffer.

vendor/bin/phpcs --standard=PSR2 --extensions=php ./src

Contributing

Contributions are always welcome! Please have a look at the contribution guidelines first.

License

The TableAttributeBundle is licensed under the MIT License - see the LICENSE file for details.

Supported with ❤ by Flagbit GmbH & Co. KG

akeneo-table-attribute-bundle's People

Contributors

amansilla avatar amitflagbit avatar angelvazquezarroyo avatar elias-knodel avatar flagbird avatar hackwell avatar hpjc avatar lealilien avatar ronanguilloux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

akeneo-table-attribute-bundle's Issues

Composer hangs forver during install.

Hey Guys.

We are finding on both Staging and Prod, that the installation of the flagbit module hangs when updating dependencies (Including require-dev)

not really much i can provide from logs at this point, as the server is unreachable, and i dont want to risk data loss. It has been working for the past 15 minutes now at 80% CPU ultilization.

https://prnt.sc/qpj0b4

Will post some more logfiles when i get access to the server again.

Update 40 minutes post installing the repository.

Had to force server to stop, and re-launch.

Status : Server is not reachable, and looks like i need to recover from backup.

Allow pagination for simple select from URL

For large list of options it would be nice to allow pagination für the simple select search results.

To achieve this a page parameter needs to be added to the URL.

The Select2JsonResponse should also return information about the current pagination.

The initial request on page load to get the labels of the current selected options for a product should add the selected value to the URL or the product field may not be able to resolve labels for options on the second page or later.

Akeneo patch 4.0.90 gives a validation error.

update the product using api. attached is the payload.
{
"code": 422,
"message": "Validation failed.",
"errors": [
{
"property": "values",
"message": "This field is missing.",
"attribute": "recommended_application_timing",
"locale": "en_US",
"scope": null
}
The recommended_application_timing is the table attribute field, it is not a product variant,
there is no constraint added for it. Still this error occurs.
I tried to add values for this field in payload still the error remains the same.
Also when we tried to remove category from the products there was still the same error.
Attaching the screenshot for that as well.
we don't have any customization on this.
If you highlight the changes so that we can change the flagbit code accordingly.
payload for product patch.txt
Screenshot from 2021-02-24 19-56-38

Table Attribute Support

Hello,
We have some additional requirements for table attribute which you are supporting.
Can you provide me contact to whom I can contact for additional requirements?
Regards,
Geeta

Akeneo 5.0

Since the last merge, on akeneo. 5.0 CE :

Product works fine, each attribute (each type) give me a fatal error :

request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Compile Error: require(): Failed opening required '/data/www/pim/var/cache/prod/doctrine/orm/Proxies/__CG__AkeneoPimStructureComponentModelAttributeOption.php' (include_path='.:/usr/share/php')" at /data/www/pim/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php line 206 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Compile Error: require(): Failed opening required '/data/www/pim/var/cache/prod/doctrine/orm/Proxies/__CG__AkeneoPimStructureComponentModelAttributeOption.php' (include_path='.:/usr/share/php') at /data/www/pim/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:206)"}

Cannot save attribute option

PIM Community Edition 2.3.51
Table Attribute Bundle: v2.1.4

Adding a new column at the flagbit table attribute fails:

-> POST /configuration/attribute-option/19
-> {"code":"example_code","optionValues":{"de_DE":{"locale":"de_DE","value":"example_translation","id":null}},"constraints":{},"type_config":{},"type":"text"}

<- 400 Bad Request 
<- {"constraints":"This value is not valid.","type_config":"This value is not valid."}

Can't perform a React state update on an unmounted component

After folowing the installation steps on Akeneo 4.0.73, adding an attribute with the table type.
And adding this new attribute to a product group and family

The attributes tab while enriching a product is completely empty. with no other messages in the console other than:

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    in AnnouncementList (created by Panel)

If i were to remove this attribute or select a product which does not have this attribute this message does not appear and all of the attributes load as normal.

I have tried this using the 4.0.1 and dev-master (75d97db) and in both cases this error/warning appears.

Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function setValue() on null" atvendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php line 169

Hi

If I try to get "Columns" tab content in a attribute (Table type) edit page I get the nex bug.

request.INFO: Matched route "pim_enrich_attributeoption_index". {"route":"pim_enrich_attributeoption_index","route_parameters":{"_controller":"pim_enrich.controller.attribute_option:indexAction","_format":"json","attributeId":"78","_route":"pim_enrich_attributeoption_index"},"request_uri":"http://akeneo-logotech.com/configuration/attribute-option/78","method":"GET"} []
[2019-01-29 16:49:54] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function setValue() on null" at /mnt/data/www/akineo/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php line 169 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function setValue() on null at /mnt/data/www/akineo/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php:169)"} []

Suggestions

Dear Akeneo Table Attribute Team,

I have a few suggestions for your bundle I would like if you could think about them.

1.) Currently it is possible to leave the attribute creation without clicking on the confirmation button on the table columns. It would be nice if the site would ask something like: "Are you sure you want to exit?" or similar.

2.) When an validation error occured the field which contains the error is not highlighted. This can lead to a lot of confusion because it is not clear where the error happend.

3.) A validation rule which basically means "is greater as" or "is lower as". This rule should compare two fields of the same row against each other.

4.) A validation rule which only allows positive number (so above and equals 0).

Thanks for your hard work,
Jordan Kniest

Error when selecting AttributeOption within Rules configuration (Akeneo 5.0.43)

When editing Rules, it was noticed that a "Semantic Error" occurred when querying AttributeOption.

image

and here are the log entries for the failed query of AttributeOptions

[2021-08-05 14:46:31] request.INFO: Matched route "pim_ui_ajaxentity_list". {"route":"pim_ui_ajaxentity_list","route_parameters":{"_route":"pim_ui_ajaxentity_list","_controller":"pim_ui.controller.ajax_option:listAction"},"request_uri":"http://localhost/list.json?class=Akeneo%5CPim%5CStructure%5CComponent%5CModel%5CAttributeOption&collectionId=357&dataLocale=de_AT&options%5Btype%5D=code&options%5Blocale%5D=de_AT&options%5Bpage%5D=1&options%5Blimit%5D=20&search=","method":"GET"} []
[2021-08-05 14:46:31] request.CRITICAL: Uncaught PHP Exception Doctrine\ORM\Query\QueryException: "[Semantical Error] line 0, col 137 near 'v WITH v.locale=:locale': Error: Class Akeneo\Pim\Structure\Component\Model\AttributeOption has no association named optionValues" at /srv/pim/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php line 74 {"exception":"[object] (Doctrine\ORM\Query\QueryException(code: 0): [Semantical Error] line 0, col 137 near 'v WITH v.locale=:locale': Error: Class Akeneo\Pim\Structure\Component\Model\AttributeOption has no association named optionValues at /srv/pim/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:74, Doctrine\ORM\Query\QueryException(code: 0): SELECT o.id, o.code, v.value AS label, a.properties FROM Akeneo\Pim\Structure\Component\Model\AttributeOption o LEFT JOIN o.optionValues v WITH v.locale=:locale LEFT JOIN o.attribute a WHERE o.attribute=:attribute ORDER BY o.sortOrder, o.code ASC at /srv/pim/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:43)"} []

Using created reference simple select attribute as column option.

This is a request for enhancement/feature.

I know the module is offered for free, and I highly appreciate that. We are very for being able to use the module for solving a compliance issue in the industry we operate in.

It would be nice if you could add the functionality, to use an already created Akeneo attribute as a column option. You already offer Simple Select, but in cases where the values of the simple select option can vary from locale to locale, it would be beneficial to add each option in its locale.

example: https://prnt.sc/r4q6iw

This is from one of the competitor's modules, which offers the ability to add in an existing attribute. In the existing attribute, we would define all sorts of nutritional ingredients with a defined label in each locale present in our Akeneo.

https://prnt.sc/r4qaj3

By implementing this, we would have a database of ingredients in sports nutrition, and simply add the ingredient + metric + value in the table attribute. In the end, we are then having a database that can be used for both showing EU compliance labels + Generating EU compliance labels by a print cloud -> as all ingredients in foods and supplements need to be declared in the local language where the product is sold.

Issue with flagbit bundle

Hi,
I installed akeneo-table-attribute-bundle in our akeneo application. I completed all steps described in installation steps. But when I creating an table attribute , and click on column tab some errors occured.
Error is:
akeneo-table-attribute-bundle
Attribute type flagbit_catalog_table must be configured to display attribute Specifications as grid column

How can I fix this?

Update Akeneo 7x

Hi there!

just curious to know if this extension is still under development and if there will be an update for akeneo 7.x?

Happy to hear from you

Best,

Full support of disabled option

First of all thanks for your awesome add-on! What I want to add here is a request for enhancement/feature.

In the project I'm currently working on, we would like to integrate your plugin to work with our bundle. In the bundle we use disable option for all of the fields in the form. When we tried to create a table attribute field we noticed that your library doesn't support fully this option.

What I need is to prepare full support for disabling field in Akeneo. Especially to disable all of the inputs, remove Add a row button and delete buttons in all rows.

Cover Akeneo TableAttributeBundle with tests

Currently there are still tests missing for this bundle for the PHP and Javascript part.

  • Check if the code is testable and create tests
  • Look into the need of integration tests with Akeneo, so there can be checks for BC
  • Make tests run with all supported Akeneo versions
    • For easier implementation always test with the latest patch version. This can be improved later

Update install guide for Akeneo 2.3

Using Akeneo 2.3 and requiring the extension as described in Readme file with composer require flagbit/table-attribute-bundle produces an uninstallable set of packages, see error:

composer require flagbit/table-attribute-bundle"
Using version ^3.0 for flagbit/table-attribute-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - flagbit/table-attribute-bundle v3.0.1 requires akeneo/pim-community-dev ^3.0.0 -> satisfiable by akeneo/pim-community-dev[3.0.x-dev, 3.1.x-dev, 3.2.x-dev, v3.0.0, v3.0.1, v3.0.10, v3.0.11, v3.0.12, v3.0.13, v3.0.14, v3.0.15, v3.0.16, v3.0.17, v3.0.18, v3.0.19, v3.0.2, v3.0.20, v3.0.21, v3.0.22, v3.0.23, v3.0.24, v3.0.25, v3.0.26, v3.0.27, v3.0.28, v3.0.29, v3.0.3, v3.0.30, v3.0.31, v3.0.32, v3.0.33, v3.0.34, v3.0.35, v3.0.36, v3.0.37, v3.0.38, v3.0.39, v3.0.4, v3.0.40, v3.0.41, v3.0.42, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.1, v3.1.10, v3.1.11, v3.1.12, v3.1.13, v3.1.14, v3.1.15, v3.1.16, v3.1.17, v3.1.18, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-BETA2, v3.2.0-BETA3, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8] but these conflict with your requirements or minimum-stability.
    - flagbit/table-attribute-bundle v3.0.0 requires akeneo/pim-community-dev ^3.0.0 -> satisfiable by akeneo/pim-community-dev[3.0.x-dev, 3.1.x-dev, 3.2.x-dev, v3.0.0, v3.0.1, v3.0.10, v3.0.11, v3.0.12, v3.0.13, v3.0.14, v3.0.15, v3.0.16, v3.0.17, v3.0.18, v3.0.19, v3.0.2, v3.0.20, v3.0.21, v3.0.22, v3.0.23, v3.0.24, v3.0.25, v3.0.26, v3.0.27, v3.0.28, v3.0.29, v3.0.3, v3.0.30, v3.0.31, v3.0.32, v3.0.33, v3.0.34, v3.0.35, v3.0.36, v3.0.37, v3.0.38, v3.0.39, v3.0.4, v3.0.40, v3.0.41, v3.0.42, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.1, v3.1.10, v3.1.11, v3.1.12, v3.1.13, v3.1.14, v3.1.15, v3.1.16, v3.1.17, v3.1.18, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-BETA2, v3.2.0-BETA3, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8] but these conflict with your requirements or minimum-stability.
    - Installation request for flagbit/table-attribute-bundle ^3.0 -> satisfiable by flagbit/table-attribute-bundle[v3.0.0, v3.0.1].


Installation failed, reverting ./composer.json to its original content.

For installing the extension in Akeneo 2.3 the following command should be used instead: composer require flagbit/table-attribute-bundle:^2.1@stable.

Please fix the install documentation with this information.

Documentation Missing

There is no documentation online based on what I can find on how to use
"SimpleSelect by URL". Neither is there on YouTube.

I have tried all rest calls that the pim uses for a "regular" attribute,
and a number of others without success.

What url should I point to, to get it working with an existing SimpleSelect attribute?

Fix Akeneo 5 installation guide

Running the steps described in the installation guide on README results in a broken Akeneo installation since the file js/extensions.json is missing. After executing make javascript-extensions the issue is solved so I guess this step should be added to the current Akeneo 5.0 installation guide.

Problem after creating a new table attribute

Hello,

First of all let me say thank you for taking the time to release and maintain this bundle.

Secondly, I'd like to outline the problem I'm having...

I recently installed a fresh version of Akeneo (3.2.12 CE) and then on top of this installation I installed the akeneo-table-attribute-bundle - visually everything looked good.

I then created by first table attribute and clicked save to see the "columns" option display... this also looked good.

The issues came when I started to add column values - upon clicking save I see a red alert icon which has a tooltop saying "500". and in the logs I have the following error:

[2019-10-10 15:42:55] request.INFO: Matched route "pim_enrich_attributeoption_create". {"route":"pim_enrich_attributeoption_create","route_parameters":{"_controller":"pim_enrich.controller.attribute_option:createAction","_format":"json","attributeId":"11","_route":"pim_enrich_attributeoption_create"},"request_uri":"https://pim.example.com/configuration/attribute-option/11","method":"POST"} [] [2019-10-10 15:42:55] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function setValue() on null" at /var/www/pim.example.com/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php line 167 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function setValue() on null at /var/www/pim.example.com/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php:167)"} []

Any help or pointers would be appreciated.

Many Thanks,

Support for akeneo 6

Hello,
Are you planning to support akeneo 6. I know that akeneo is supporting table attribute but it has restrictions and also table attribute data is not getting imported in new table attribute for akeneo from flagbit. By any chance you are supporting the migration or any kind of support for akeneo 6, kindly let me know.
Regards,
Geeta

Error on Creation of Attribute Option or Table Attributes

Hi,

I installed the bundle on my Akeneo PIM CE version 4.

Now, when I try to open the Attribute -> Option page I get this error:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\UndefinedMethodError: "Attempted to call an undefined method named "isTableAttribute" of class "Akeneo\Pim\Structure\Component\Model\AttributeOption"." at /apps/bomax-pim/pim-community-standard/src/Flagbit/Bundle/TableAttributeBundle/Normalizer/AttributeOptionNormalizer.php line 26 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Attempted to call an undefined method named "isTableAttribute" of class "Akeneo\Pim\Structure\Component\Model\AttributeOption". at /apps/bomax-pim/pim-community-standard/src/Flagbit/Bundle/TableAttributeBundle/Normalizer/AttributeOptionNormalizer.php:26)"}

When I try to add an option to a Table Attribute I get this:

request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: "An exception occurred while executing 'SELECT t1.id AS id_2, t1.code AS code_3, t1.sort_order AS sort_order_4, t1.type AS type_5, t1.type_config AS type_config_6, t1.constraints AS constraints_7, t1.attribute_id AS attribute_id_8 FROM pim_catalog_attribute_option t1 WHERE t0.code = ? AND t0.attribute_id = ?' with params ["test", 97]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.code' in 'where clause'" at /apps/bomax-pim/pim-community-standard/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 60 {"exception":"[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing 'SELECT t1.id AS id_2, t1.code AS code_3, t1.sort_order AS sort_order_4, t1.type AS type_5, t1.type_config AS type_config_6, t1.constraints AS constraints_7, t1.attribute_id AS attribute_id_8 FROM pim_catalog_attribute_option t1 WHERE t0.code = ? AND t0.attribute_id = ?' with params ["test", 97]:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.code' in 'where clause' at /apps/bomax-pim/pim-community-standard/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:60, Doctrine\DBAL\Driver\PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.code' in 'where clause' at /apps/bomax-pim/pim-community-standard/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.code' in 'where clause' at /apps/bomax-pim/pim-community-standard/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)"}

Is is a know issue for the Bundle?

Thank you
Andrea

Question: Using search API for searching table values

Is there a way I can use the default search API to query table values? It is rather tedious to fetch all products and then filter for required parameters within the table, unless I am missing something obvious.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.