-1

Iam Using magrnto 1.7.2 I need to add a paypal email adress to customer registration form and need to validate it with paypal Will anybody help me to achevie it?

5
  • Have you tried to Google? There are lots of articles on this subject.
    – user487772
    Mar 25, 2014 at 8:40
  • @Tim the tutorial is not working with 1.7.0.2
    – SAMUEL
    Mar 25, 2014 at 10:32
  • @MohammadFaisal i tried this tutorial but results Fatal error: Call to a member function select() on a non-object in E:\xampp\htdocs\customer\app\code\core\Mage\Core\Model\Resource\Setup.php on line 734.. can you please help me
    – SAMUEL
    Mar 25, 2014 at 10:34
  • @SamuelJMathew: have you been able to find the solution? Apr 4, 2014 at 11:17

1 Answer 1

3

the code in installer script to add column

<?php

$installer = $this;
$installer->startSetup();
$cust_setup = Mage::getModel('customer/entity_setup', 'core_setup');
$cust_setup->addAttribute('customer', 'customer_code', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'Customer Code',
    'global' => 1,
    'visible' => 1,
    'required' => 1,
    'user_defined' => 1,
    'default' => '',
    'visible_on_front' => 1,
    'forms' => array(
        'customer_account_edit', 'customer_account_create', 'checkout_register', 'adminhtml_customer'
    )
));
Mage::getSingleton('eav/config')
        ->getAttribute('customer', 'customer_code')
        ->setData('used_in_forms', array('customer_account_create', 'customer_account_edit', 'adminhtml_customer', 'checkout_register'))
        ->save();
$tableQuote = $this->getTable('sales/quote');

$installer->run(
        "ALTER TABLE $tableQuote ADD `customer_customer_code` varchar(255) NOT NULL"
);
$installer->endSetup();

This is all you need to have to add column in magento database. For frontend display you may need to change the templates using layout xml of your module.

The code may look like:

<customer_account_create>
    <reference name="customer_form_register">
        <action method="setTemplate">
            <template>sublogin/persistent/customer/form/register.phtml</template>
        </action>
    </reference>
</customer_account_create>

<customer_account_login>
    <reference name="customer_form_login">
        <action method="setTemplate">
            <template>sublogin/persistent/customer/form/login.phtml</template>
        </action>
    </reference>
</customer_account_login>

where in your template just add the input field for your column.

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.