Find and reference standard attribute types in Akeneo code

All standard attribute types available in Akeneo are listed in “\Akeneo\Pim\Structure\Component\AttributeTypes” (File: src/Akeneo/Pim/Structure/Component/AttributeTypes.php).

In you own code you could (and should) reference these types instead of using strings.  For example lets say you want to delete attributes by an array of attribute codes but you want to skip identifier attributes from deletion.

Create a bcrypt hash on commandline

Its easy to create a bcrypt hash  on commandline with this command:

Just replace the Placeholder USER and PASSWORD with the corresponding values. The Result should be something like that:

The part before “:” is the username. The rest is the bcrypt password hash. The -C parameter specifies the computing time for the […]

Resize product images in Magento2

To resize product images in Magento2,  you just have to add a etc/view.xml into your own theme (f.e. app/design/frontend/Sheldon/Happytheme/etc/view.xml) ans add something like that:

As you can see, you can adapt the image dimensions for each image type available. That works also for self installed image types. The values for width and height are […]

Get a filename only list of files in a folder

To get a list of all files in a folder without path, you can use the following snippet:

Example result:

Prefix files: If you want to prefix files, you can use the same command too:

Example result:


Base64 encode on shell

Sometimes you need to encode a string  with a base64 encoding. For example when trying to send a HTTP request with a Basic Authentication header like that:

As you can see the Basic Auth username and password are included in the request as a base64 encoded string. On the Linux shell this string can […]