Hidden Custom option Magento
I'm looking for the file name containing the implementation of the "Proceed to Checkout" button.
I have found that the sales_flat_quote_item
table is being populated when the button is clicked. I have added a field called fld_data
and now I need to insert the field data, currently held in a session, when the "Proceed to Checkout" button is clicked, in the same insert statement.
Sorry for the misunderstanding actual开发者_StackOverflowly i want to add a custom option textfield which is hidden from the user and process it till the order submitted and that value is accessable at the admin side along with the order.
Hi Khaleel if I read your name correctly... you should get the template at
/app/design/frontend/base/default/template/checkout/onepage
and the layout for the template at:
/app/design/frontend/base/default/layout/checkout.xml
and the block at:
/app/code/core/Mage/Checkout/Block/Onepage/Link.php
Make sure you overwrite none of these core files but have a local version.
Overwriting or copying core files to the local folder isn't necessary here (if the additional data is related to the product)
Just create a custom module and in the mysql setup file, add a custom column to the required tables to hold your attribute value:
$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'), 'your_attribute', "decimal(12,4) DEFAULT NULL AFTER `price`");
$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'your_attribute', "decimal(12,4) DEFAULT NULL AFTER `price`");
$installer->getConnection()->addColumn($installer->getTable('sales/invoice_item'), 'your_attribute', "decimal(12,4) DEFAULT NULL AFTER `price`");
$installer->getConnection()->addColumn($installer->getTable('sales/shipment_item'), 'your_attribute', "decimal(12,4) DEFAULT NULL AFTER `price`");
$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'), 'your_attribute', "decimal(12,4) DEFAULT NULL AFTER `price`");
Then, in your custom modules config.xml file, inside the global tag, place the following
<fieldsets>
<sales_convert_quote_item>
<your_attribute><to_order_item>*</to_order_item></your_attribute>
</sales_convert_quote_item>
<sales_convert_order_item>
<your_attribute>
<to_invoice_item>*</to_invoice_item>
<to_shipment_item>*</to_shipment_item>
<to_cm_item>*</to_cm_item>
</your_attribute>
</sales_convert_order_item>
</fieldsets>
<sales>
<quote>
<item>
<product_attributes>
<your_attribute/>
</product_attributes>
</item>
</quote>
</sales>
this should do the trick without modifying core code.
精彩评论