8

I used this tutorial: Add new field in magento(1.9) customer registration to add new custom field in magento.

But I want to show custom field in billing and shipping address. How to do this?

2 Answers 2

2

Ok. Lets Go to your "billing.phtml" file Which is Located at

frontend\rwd\default\template\persistent/checkout/onepage/billing.phtml

And Paste Following Code If You want to Checkbox Field.

<div class="field">
    <input id="p_method_cashondelivery" value="cashondelivery" type="checkbox" name="cod" title="Cash On Delivery" onclick="<?php echo "checked!!!!";?>" class="checkbox" autocomplete="off">
    <label for="p_method_cashondelivery">Cash On Delivery </label>
</div>

Same Way You Can Add Custom Field In Shipping Address File.

frontend\rwd\default\template\checkout/onepage/shipping.phtml
1
2

Please place this code too at end line of your installer code after the " $attribute->save();" function call.

$installer->run("
    ALTER TABLE {$this->getTable('sales_flat_quote_address')} ADD COLUMN `license_number` VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL AFTER `fax`;
    ALTER TABLE {$this->getTable('sales_flat_order_address')} ADD COLUMN `license_number` VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL AFTER `fax`;
");
$installer->endSetup();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.