Skip to main content

Get Google Calendar Event List in WordPress

<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 Another Customer Registration form in Magento

Add Another Customer Registration form in Magento


1.\app\code\community\Esitee\Club\controllers\IndexController.php

<?php
class Esitee_Club_IndexController extends Mage_Core_Controller_Front_Action {
    public function indexAction(){
        $this->loadLayout()->renderLayout();
    }
   
    public function submitAction() {
        // Check the email is exists or not
        $post = $this->getRequest()->getPost();
        $user = Mage::getModel("customer/customer")
                ->setWebsiteId(Mage::app()->getWebsite()->getId())
                ->loadByEmail($post["email"]);
        if($user->getId() > 0) {
            Mage::getSingleton('core/session')->addError("The User Exists");
            $this->_redirect("*/*/");
            return;
        }
        // Save the User
        $user->setData($post);
        $user->save();
        // Save address as the default address
        $address = Mage::getModel('customer/address');      
        $address->setData($post["address"]);
        $address->setCustomerId($user->getId());
        $address->setCountryId(Mage::helper('core')->getDefaultCountry());
        $address->setIsDefaultBilling(1);
        $address->setIsDefaultShipping(1);
        $address->save();
        Mage::getSingleton('core/session')->addSuccess("Thank you for your register");
        $this->_redirect("*/*/");
    }
}


2.\app\code\community\Esitee\Club\etc\config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Esitee_Club>
            <version>1.0</version>
        </Esitee_Club>
    </modules>
    <frontend>
        <routers>
            <club>
                <use>standard</use>
                <args>
                    <module>Esitee_Club</module>
                    <frontName>club</frontName>
                </args>
            </club>
        </routers>
        <layout>
            <updates>
                <club>
                    <file>club.xml</file>
                </club>
            </updates>
        </layout>
    </frontend>
</config>

3.app\design\frontend\default\default\template\club\register.phtml

All The extra field add through extension of customer attributes extension
http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15903/
http://www.kirtiwebsolutions.com/customer-attributes-magento-extension.html


<div class="account-create">
    <div class="page-title">Tri Nature Loyalty Club Registration</div>  
    <form id="form-validate" method="post" action="<?php echo $this->getUrl("*/index/submit") ?>">
        <div class="fieldset">
            <h2 class="legend">Personal Information</h2>
            <ul class="form-list">
                <li>
                    <label class="required"><em>*</em>First name</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" maxlength="255" title="First Name" value="" name="firstname" id="firstname">
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>Last name</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" maxlength="255" title="Last Name" value="" name="lastname" id="lastname">
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>Email Address</label>
                    <div class="input-box">
                        <input type="text" class="input-text validate-email required-entry" title="Email Address" value="" id="email_address" name="email">
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>Street Address</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" title="Street Address" value="" id="street_address" name="address[street][0]">                      
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>Suburb</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" title="Suburb" value="" id="suburb" name="address[suburb]">                      
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>State</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" title="State" value="" id="region" name="address[region]">                      
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>Postcode</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" title="Postcode" value="" id="postcode" name="address[postcode]">                      
                    </div>
                </li>
                <li>
                    <label class="required"><em>*</em>Phone 1</label>
                    <div class="input-box">
                        <input type="text" class="input-text required-entry" title="Phone 1" value="" id="telephone" name="address[telephone]">                      
                    </div>
                </li>
                <li>
                    <label>Phone 2</label>
                    <div class="input-box">
                        <input type="text" class="input-text" title="Phone 2" value="" id="telephone2" name="address[telephone2]">                      
                    </div>
                </li>
                <li>
                    <label>How did you hear about TriNature?</label>
                    <div class="input-box">
                        <select id="hear_type" name="hear_type">
                            <?php
                            $collection = Mage::getResourceModel("customer/attribute_collection")
                                    ->setEntityTypeFilter(Mage::getModel('eav/entity')->setType("customer")->getTypeId())
                                    ->addVisibleFilter()
                                    ->addFilter('attribute_code', "hear_type");
                            $attribute = $collection->getFirstItem();
                            if ($attribute) {
                                foreach ($attribute->getSource()->getAllOptions() as $instance) {
                                    echo '<option value="' . $instance['value'] . '" >' . $instance['label'] . '</option>';
                                }
                            }
                            ?>
                        </select>
                    </div>
                </li>
            </ul>
        </div>
        <div class="fieldset">
            <h2 class="legend">If distributor</h2>
            <ul class="form-list">
                <li>
                    <label>Distributors Name</label>
                    <div class="input-box">
                        <input type="text" class="input-text" value="" id="distributor_name" name="distributor_name">
                    </div>
                </li>
                <li>
                    <label for="distributor_number">Distributor Number</label>
                    <div class="input-box">
                        <input type="text" class="input-text" value="" id="distributor_number" name="distributor_number">
                    </div>
                </li>
            </ul>
        </div>
        <div class="buttons-set">
            <p class="required">* Required Fields</p>
            <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
        </div>
    </form>
</div>

<script type="text/javascript">
    var dataForm = new VarienForm('form-validate', true);
</script>

4.\app\design\frontend\default\default\layout\club.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
    </default>
    <club_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block name="customer_form_register" type="core/template" template="club/register.phtml" />
        </reference>
    </club_index_index>
</layout>

5.app\etc\modules\Esitee_Club.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Esitee_Club>
            <active>true</active>
            <codePool>community</codePool>
        </Esitee_Club>
    </modules>
</config>

Comments

Popular posts from this blog

Create Signature pad with save on database in php

Create Signature pad with save on database in php 1.create a folder images index.php ============   <!DOCTYPE >     <head>     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />     <title>Signature Pad</title>     <script type="text/javascript" src="jquery-1.8.0.min.js"></script>     <script type="text/javascript"> $(document).ready(function () {     /** Set Canvas Size **/     var canvasWidth = 400;     var canvasHeight = 100;     /** IE SUPPORT **/     var canvasDiv = document.getElementById('signaturePad');     canvas = document.createElement('canvas');     canvas.setAttribute('width', canvasWidth);     canvas.setAttribute('height', canvasHeight);     canvas.setAttribute('id', 'canvas');     canvasDiv.appendChild(canvas);    ...

Get Google Calendar Event List in WordPress

<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, ...

WooCommerce Mini cart With Ajax

WooCommerce Mini cart //MINI CART SECTION   <div class="productdiv rightcart">                                                         <?php if ( ! WC()->cart->is_empty() ) : ?>     <ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">         <?php             do_action( 'woocommerce_before_mini_cart_contents' );             foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {                 $_product     = apply_filters( 'woocommerce_cart_item_pro...