<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function get_calender_events() { $params = array(); /*Get current date*/ $current_date = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key = "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...
Add new field customer registration form in magento.
Step 1: Create file app/etc/modules/Samrat_Customer.xml
Add this code
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Samrat_Customer>
<codePool>local</codePool>
<active>true</active>
</Samrat_Customer>
</modules>
</config>
Step 2: Create files and folder app/code/local/Samrat/Customer/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Samrat_Customer>
<version>1.7.0.0</version>
</Samrat_Customer>
</modules>
<global>
<fieldsets>
<customer_account>
<occupation><create>1</create><update>1</update></occupation>
<jobtitle><create>1</create><update>1</update></jobtitle>
</customer_account>
</fieldsets>
<models>
<Samrat_Customer>
<class>Samrat_Customer_Model</class>
</Samrat_Customer>
</models>
<helpers>
<Samrat_Customer>
<class>Samrat_Customer_Helper</class>
</Samrat_Customer>
</helpers>
<resources>
<customerattribute_setup>
<setup>
<module>Samrat_Customer</module>
<class>Samrat_Customer_Model_Entity_Setup</class>
</setup>
</customerattribute_setup>
</resources>
</global>
</config>
Step 3: Create files and folder app/code/local/Samrat/Customer/Model/Entity/Setup.php
<?php
class Samrat_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup
{
public function getDefaultEntities(){
return array(
'occupation'=>array(
'type'=> 'static',
'label'=> 'Occupation',
'visiable' => true,
'required' => true,
'sort_order' => 80,
),
'jobtitle'=>array(
'type'=> 'static',
'label'=> 'Jobtitle',
'visiable' => true,
'required' => true,
'sort_order' => 80,
)
);
}
}
?>
Step 4: Create files and folder app/code/local/Samrat/Customer/sql/customerattribute_setup/mysql4-install-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute('customer', 'occupation', array(
'label' => 'Occupation',
'visible' => 1,
'required' => 0,
'position' => 1,
'sort_order' => 80,
));
$installer->addAttribute('customer', 'jobtitle', array(
'label' => 'Jobtitle',
'visible' => 1,
'required' => 0,
'position' => 1,
'sort_order' => 80,
));
$installer->endSetup();
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'occupation');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'jobtitle');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
?>
Step 5: Create files and folder app\design\frontend\default\default\template\customer\form\register.phtml
<li>
<label for="email_address" class="required"><em>*</em><?php echo $this->__('Occupation') ?></label>
<div class="input-box">
<input type="text" name="occupation" id="occupation" value="<?php echo $this->escapeHtml($this->getFormData()->getOccupation()) ?>" title="<?php echo $this->__('Occupation') ?>" class="input-text required-entry" />
</div>
</li>
<li>
<label for="email_address" class="required"><em>*</em><?php echo $this->__('Jobtitle') ?></label>
<div class="input-box">
<input type="text" name="jobtitle" id="jobtitle" value="<?php echo $this->escapeHtml($this->getFormData()->getJobtitle()) ?>" title="<?php echo $this->__('Jobtitle') ?>" class="input-text required-entry" />
</div>
</li>
/**********************************///
Magento Add ‘Customer Group’ to Registration Form.
Step -1
customer/form/register.phtml Add
<div>
<label for=”group_id”><?php echo $this->__(‘Group’) ?><span class=”required”>*</span></label><br/>
<select name=”group_id” id=”group_id” title=”<?php echo $this->__(‘Group’) ?>” class=”validate-group required-entry input-text” />
<?php $groups = Mage::helper(‘customer’)->getGroups()->toOptionArray(); ?>
<?php foreach($groups as $group){ ?>
<option value=”<?php print $group['value'] ?>”><?php print $group['label'] ?></option>
<?php } ?>
</select>
</div>
Step-2
Mage\Customer\controllers\AccountController.php
line no 358 add
replace $customer->getGroupId();
with
if($this->getRequest()->getPost('group_id'))
{
$customer->setGroupId($this->getRequest()->getPost('group_id'));
} else {
$customer->getGroupId();
}
Step-3
Mage\Customer\etc\config.xml
Add customer_account node
<group_id><create>1</create><update>1</update></group_id>
Comments
Post a Comment