You are here

protected function FeedsCommerceProductProcessor::entityValidate in Commerce Feeds 7

Validate the commerce_product entity.

File

plugins/FeedsCommerceProductProcessor.inc, line 209
Class definition of FeedsCommerceProductProcessor.

Class

FeedsCommerceProductProcessor
Creates products from feed items.

Code

protected function entityValidate($product, FeedsSource $source = NULL) {
  if (empty($product->sku)) {
    throw new FeedsValidationException(t('Required product SKU is missing.'));
  }
  else {
    if (!commerce_product_validate_sku($product->sku)) {
      throw new FeedsValidationException(t('Product SKU ("@sku") is invalid.', array(
        '@sku' => $product->sku,
      )));
    }
  }
}