Version 4 Availability Google Field Automatic In Stock/out Of Stock

Very strange. This works in 4.3.4:


$schema['export_fields']['Availability']=> array(
    'linked' => false,
    'process_get' => array('fn_exim_google_export_format_availability', '#key'),
    'export_only' => true,
    'return_result' => true
);

function fn_exim_google_export_format_availability($product_id)
{
$data = db_get_field(“SELECT amount FROM ?:products WHERE product_id = ?i”, $product_id);
return ($data > 0) ? ‘in stock’ : ‘out of stock’;
}
return $schema;

This code give us blank screen on click of the data feed :(

Please PM me temporary FTP access so that we can check the issue

Sent, thanks

Very strange. This works in 4.3.4:


$schema['export_fields']['Availability']=> array(
    'linked' => false,
    'process_get' => array('fn_exim_google_export_format_availability', '#key'),
    'export_only' => true,
    'return_result' => true
);

function fn_exim_google_export_format_availability($product_id)
{
$data = db_get_field(“SELECT amount FROM ?:products WHERE product_id = ?i”, $product_id);
return ($data > 0) ? ‘in stock’ : ‘out of stock’;
}
return $schema;

This code give us blank screen on click of the data feed :(

Sorry, there is an error. Here is the valid code:

$schema['export_fields']['Availability'] = array(
    'linked' => false,
    'process_get' => array('fn_exim_google_export_format_availability', '#key'),
    'export_only' => true,
    'return_result' => true
);

function fn_exim_google_export_format_availability($product_id)
{
$data = db_get_field(“SELECT amount FROM ?:products WHERE product_id = ?i”, $product_id);
return ($data > 0) ? ‘in stock’ : ‘out of stock’;
}
return $schema;

Fixed. The issue was caused by the existent product feature with the Availability name. We have corrected the schema and renamed new field to "Stock".

I don't use this nor Google Merchant anymore so unfortunately I am not set up to test it. However, if I can recall correctly, when installing the Google export addon, I believe the availability feature is automatically created. If so, disable or delete the availability feature and try the export again.

I don't use this nor Google Merchant anymore so unfortunately I am not set up to test it. However, if I can recall correctly, when installing the Google export addon, I believe the availability feature is automatically created. If so, disable or delete the availability feature and try the export again.

Yes, but I never thought that is saves feature name, but not feature ID. Thank you.

Fixed. The issue was caused by the existent product feature with the Availability name. We have corrected the schema and renamed new field to "Stock".

THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You are welcome!