Magento email template: $_item -> getDescription returns null -


project

to modify magento's email templates include long descriptions

magento version

1.6.2.0

file being edited

app/design/frontend/default/<template name>/template/email/order/items/order/default.phtml 

code of interest in file line numbers:

31 <strong style="font-size:11px;"><?php echo $this->htmlescape($_item->getname()) ?></strong> 46 <?php echo $this->escapehtml($_item->getdescription()) ?> 

problem

$_item -> getname() works, $_item -> getdescription() returns null

debug

zend dump $_item (showing "name" defined; "description" null):

array(79) { ["item_id"] => string(3) "584" ["order_id"] => string(3) "398" ["parent_item_id"] => null ["quote_item_id"] => string(4) "1951" ["store_id"] => string(1) "1" ["created_at"] => string(19) "2012-06-04 14:15:39" ["updated_at"] => string(19) "2012-06-04 14:16:18" ["product_id"] => string(3) "156" ["product_type"] => string(6) "simple" ["product_options"] => string(140) "a:1:{s:15:"info_buyrequest";a:3:{s:4:"uenc";s:48:"ahr0cdovl2rldi5hchbvz2vllmnvbs9iyxnll21hyy5odg1s";s:7:"product";s:3:"156";s:3:"qty";i:1;}}" ["weight"] => string(6) "0.0100" ["is_virtual"] => string(1) "0" ["sku"] => string(9) "mc969ll/a" ["name"] => string(21) "11" macbook air 128gb" ["description"] => null ["applied_rule_ids"] => null ["additional_data"] => null ["free_shipping"] => string(1) "0" ["is_qty_decimal"] => string(1) "0" ["no_discount"] => string(1) "0" ["qty_backordered"] => null ["qty_canceled"] => string(6) "0.0000" ["qty_invoiced"] => string(6) "0.0000" ["qty_ordered"] => string(6) "1.0000" ["qty_refunded"] => string(6) "0.0000" ["qty_shipped"] => string(6) "1.0000" ["base_cost"] => null ["price"] => string(9) "1199.0000" ["base_price"] => string(9) "1199.0000" ["original_price"] => string(9) "1199.0000" ["base_original_price"] => string(9) "1199.0000" ["tax_percent"] => string(6) "7.0000" ["tax_amount"] => string(7) "83.9300" ["base_tax_amount"] => string(7) "83.9300" ["tax_invoiced"] => string(6) "0.0000" ["base_tax_invoiced"] => string(6) "0.0000" ["discount_percent"] => string(6) "0.0000" ["discount_amount"] => string(6) "0.0000" ["base_discount_amount"] => string(6) "0.0000" ["discount_invoiced"] => string(6) "0.0000" ["base_discount_invoiced"] => string(6) "0.0000" ["amount_refunded"] => string(6) "0.0000" ["base_amount_refunded"] => string(6) "0.0000" ["row_total"] => string(9) "1199.0000" ["base_row_total"] => string(9) "1199.0000" ["row_invoiced"] => string(6) "0.0000" ["base_row_invoiced"] => string(6) "0.0000" ["row_weight"] => string(6) "0.0100" ["base_tax_before_discount"] => null ["tax_before_discount"] => null ["ext_order_item_id"] => null ["locked_do_invoice"] => null ["locked_do_ship"] => null ["price_incl_tax"] => string(9) "1282.9300" ["base_price_incl_tax"] => string(9) "1282.9300" ["row_total_incl_tax"] => string(9) "1282.9300" ["base_row_total_incl_tax"] => string(9) "1282.9300" ["hidden_tax_amount"] => null ["base_hidden_tax_amount"] => null ["hidden_tax_invoiced"] => null ["base_hidden_tax_invoiced"] => null ["hidden_tax_refunded"] => null ["base_hidden_tax_refunded"] => null ["is_nominal"] => string(1) "0" ["tax_canceled"] => null ["hidden_tax_canceled"] => null ["tax_refunded"] => null ["gift_message_id"] => null ["gift_message_available"] => string(1) "0" ["base_weee_tax_applied_amount"] => string(6) "0.0000" ["base_weee_tax_applied_row_amnt"] => string(6) "0.0000" ["base_weee_tax_applied_row_amount"] => string(6) "0.0000" ["weee_tax_applied_amount"] => string(6) "0.0000" ["weee_tax_applied_row_amount"] => string(6) "0.0000" ["weee_tax_applied"] => string(6) "a:0:{}" ["weee_tax_disposition"] => string(6) "0.0000" ["weee_tax_row_disposition"] => string(6) "0.0000" ["base_weee_tax_disposition"] => string(6) "0.0000" ["base_weee_tax_row_disposition"] => string(6) "0.0000" } 

question

why description null here?

i've found changing product name after order placed doesn't change name in order, appears order object has own data on product ordered separated live catalog (which suppose makes sense: you'd want information static , unchangeable).

it makes sense wouldn't try store long and/or short descriptions item every time it's ordered, because of wasted space in database. why include description field leave blank?

is way information load catalog/product model, find product , attribute want (like here)?

you correct in everything. don't know why included description field, empty in of 250,000 orders.

you can description following method:

$_description = mage::getmodel('catalog/product')     ->load($_item->getproductid())     ->getdescription(); 

this return null case if product had been deleted.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -