Hi,
I have an attribute set for product which is text input(cable length).
I put the following code but it gives an error
$item->price = $item->price;
$cable_length = $item->data["attributes"][1];
if (intval($cable_length)){
$item->price = $item->price*intval($cable_length);
#drupal_set_message("must be a number ($cable_length)","status");
}else{
drupal_set_message(" must be a number ($cable_length)","error");
}any help with this is much appreciated
Comments
Comment #1
jw100 commentedHi msemenov,
I know it's been some time, but we are trying to achieve the same thing and wondered if you ever solved this?
Our problem is the syntax for getting the attribute...
$custom_length = $item->data["attributes"][2];...doesn't work.
Do you know the correct syntax for retrieving the attribute value..
ANY help is greatly appreciated!
EDIT: Fixed
Apologies - operator error! The code above does indeed work.