I've defined a custom attribute called productcomment on sales_flat_quote_item and in sales_flat_order_item and the problem is when i want to reorder an specific order, the values are not copied.
The quote attribute is saved with the product when i click "add to cart" or with an specific button through ajax.
my config.xml:
<fieldsets>
<sales_convert_quote_item>
<productcomment>
<to_order_item>*</to_order_item>
</productcomment>
</sales_convert_quote_item>
<sales_convert_order_item>
<productcomment>
<to_quote_item>*</to_quote_item>
</productcomment>
</sales_convert_order_item>
</fieldsets>
The first part (sales_convert_quote_item) works like a charm, but the second one, don't.
Magento executes this code to process a reorder:
public function addOrderItem($orderItem, $qtyFlag=null)
{
/* @var $orderItem Mage_Sales_Model_Order_Item */
if (is_null($orderItem->getParentItem())) {
$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load($orderItem->getProductId());
if (!$product->getId()) {
return $this;
}
$info = $orderItem->getProductOptionByCode('info_buyRequest');
$info = new Varien_Object($info);
if (is_null($qtyFlag)) {
$info->setQty($orderItem->getQtyOrdered());
} else {
$info->setQty(1);
}
$this->addProduct($product, $info);
}
return $this;
}
The problem with this, is that magento uses
$product = Mage::getModel('catalog/product')
and don't care about the $orderItem which already has the data
Which do you think is the best solution to this problem?
edit: I've already tried solving it with these events:
checkout_cart_product_add_after : don't have older order data
sales_convert_order_item_to_quote_item : only fired on adminhtml