function amazon_test_form_validate in Amazon Product Advertisement API 7.2
Same name and namespace in other branches
- 7 amazon.admin.inc \amazon_test_form_validate()
File
- ./
amazon.admin.inc, line 175 - Amazon Admin pages.
Code
function amazon_test_form_validate($form, &$form_state) {
// Normalize input and look up
$asin = amazon_convert_to_asin($form_state['values']['asin']);
$items = amazon_item_lookup_from_web(array(
$asin,
), $form_state['values']['locale']);
if (!empty($items) && is_array($items)) {
$form_state['amazon_item'] = array_pop($items);
}
else {
form_set_error('asin', t("%input is no valid ASIN or EAN. Please check the !link for messages.", array(
'%input' => $form_state['values']['asin'],
'!link' => l(t("error log"), 'admin/reports/dblog'),
)));
}
}