private function UcAjaxCart::checkKitToCart in Ubercart AJAX Cart 6.2
Same name and namespace in other branches
- 7.2 uc_ajax_cart.extender.inc \UcAjaxCart::checkKitToCart()
1 call to UcAjaxCart::checkKitToCart()
File
- ./
uc_ajax_cart.php, line 70
Class
Code
private function checkKitToCart($node, $data) {
if (!module_exists('uc_attribute')) {
return true;
}
$isValid = true;
foreach ($data['products'] as $productData) {
$product = node_load($productData['nid']);
uc_product_load($product);
if ($this
->hasRequiredAttributes($product)) {
foreach ($product->attributes as $attribute) {
if ($attribute->required == "1" && (!isset($productData['attributes'][$attribute->aid]) || empty($productData['attributes'][$attribute->aid]))) {
drupal_set_message(t('You must choose an option for !attribute in !product', array(
'!attribute' => '<em>' . $attribute->name . '</em>',
'!product' => '<strong>' . $product->title . '<strong>',
)), 'error');
$isValid = false;
}
}
}
}
return $isValid;
}