The quote items are kept in the db.
Since there are not columns to support your package and tint attributes the values you set to the item are not persistent.
So setting
$item->setPackage('Silver'); // these values are depends upon customers selection
$item->setTint('Green');
Makes these values available only in the current request.
When the page is realoaded, the quote items are retrieved from the db and they don't have package and tint.
You should add 2 more columns in the table sales_flat_quote_item
that will hold these values.
Clear the cache when your are done.
To be able to access these values from the order items you need to do the same for the table sales_flat_order_item
.
Add 2 columns and then tell magento that when it creates an order item from a quote item it should copy these fields also.
You can do this via the fieldsets
from config.xml
.
In one of your custom modules, inside the config.xml
add this inside the <global>
tag.
<fieldsets>
<sales_convert_quote_item><!-- when converting a quote item -->
<package> <!-- copy the package field ...-->
<to_order_item>*</to_order_item> <!-- .. to the order item -->
</package>
<tint>
<to_order_item>*</to_order_item>
</tint>
</sales_convert_quote_item>
</fieldsets>
Additional...if you want these values to be available on the invoice items, shipment items and creditmemo items, you need to add the same 2 columns in the tables sales_flat_invoice_item
, sales_flat_shipment_item
and sales_flat_creditmemo_item
.
And inside the same <fieldsets>
xml node as above add this:
<sales_convert_order_item>
<package>
<to_quote_item>*</to_quote_item>
<to_invoice_item>*</to_invoice_item>
<to_shipment_item>*</to_shipment_item>
<to_cm_item>*</to_cm_item>
</package>
<tint>
<to_quote_item>*</to_quote_item>
<to_invoice_item>*</to_invoice_item>
<to_shipment_item>*</to_shipment_item>
<to_cm_item>*</to_cm_item>
</tint>
</sales_convert_order_item>
In order to save some additional details in quote items table, you need to first create a new column in sales_flat_quote_item
table. Then only your save action will work.
Magento Sales Quotes and Sales Orders are not EAV entities. They are flat entities.
Best Answer
Create a custom php file with this code, and put in your root folder of magento.
And run the file by url.