Originally Posted by
Famine_1
I am trying to email the attributes when a product is bought.
PHP Code:
// Attributes
$product['attributes']['option'] .
"\n" .
$product['attributes']['value'] .
But this does not show the attributes in the email, and yes I have double-checked I have added an attribute to the product.
There's actually another loop that is missing unfortunately:
Code:
foreach ($order->products as $product) {
// Option: $product['attributes'][$attr_index]['option']
// Option Value: $product['attributes'][$attr_index]['value']
// Option ID: $product['attributes'][$attr_index]['option_id']
// Value ID: $product['attributes'][$attr_index]['value_id']
// Price: $product['attributes'][$attr_index]['price']
// Is Free: $product['attributes'][$attr_index]['product_attribute_is_free']
}
So:
Code:
foreach ($order->products as $product) {
if (!empty($product['attributes'])) {
foreach ($product['attributes'] as $attribute) {
// Option: $attribute['option']
// Option Value: $attribute['value']
// Option ID: $attribute['option_id']
// Value ID: $attribute['value_id']
// Price: $attribute['price']
// Is Free: $attribute['product_attribute_is_free']
}
}
}
Bookmarks