When using the following configuration:
Product feed (preview) throws an exception:
ChannableError.ERROR: Generate: Warning: Undefined array key 1 in /var/www/html/vendor/magmodules/magento2-channable/Service/Product/PriceData.php on line 200 [] []
The code in Service/Product/PriceData.php depends on the 'Render In Currency' option(s)
(specifically, the [1] )
if ($extraRenderedPriceFields = preg_grep('/^rendered_price__/', array_keys($attributes))) {
foreach ($extraRenderedPriceFields as $label) {
$field = $attributes[$label];
$renderCurrency = $field['actions'][0] ? explode('_', $field['actions'][0])[1] : null;
if ($renderCurrency !== $config['currency']) {
$newConfig = $config;
$newConfig['currency'] = $renderCurrency;
$newConfig['exchange_rate'] = $config['exchange_rate_' . $renderCurrency] ?? 1;
Adding a nullsafe fallback prevents the error being thrown, and shows the min/max price in the feed without currency (as is configured):
--- a/vendor/magmodules/magento2-channable/Service/Product/PriceData.php
+++ b/vendor/magmodules/magento2-channable/Service/Product/PriceData.php
@@ -197,7 +197,7 @@
if ($extraRenderedPriceFields = preg_grep('/^rendered_price__/', array_keys($attributes))) {
foreach ($extraRenderedPriceFields as $label) {
$field = $attributes[$label];
- $renderCurrency = $field['actions'][0] ? explode('_', $field['actions'][0])[1] : null;
+ $renderCurrency = $field['actions'][0] ? explode('_', $field['actions'][0])[1] ?? false : null;
if ($renderCurrency !== $config['currency']) {
$newConfig = $config;
$newConfig['currency'] = $renderCurrency;
If it's a bug, the above patch (or an equivalent fix) should be applied
If the field is ment to only work with the render in currency action, the user should be given some sort of validation feedback
When using the following configuration:
Product feed (preview) throws an exception:
The code in Service/Product/PriceData.php depends on the 'Render In Currency' option(s)
(specifically, the
[1])Adding a nullsafe fallback prevents the error being thrown, and shows the min/max price in the feed without currency (as is configured):
If it's a bug, the above patch (or an equivalent fix) should be applied
If the field is ment to only work with the render in currency action, the user should be given some sort of validation feedback