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

How to add custom links to my account navigation menu in magento

How to add custom links to my account navigation menu in magento


Step1. add xml file in modules/etc/Mymodule_Customerpage.xml

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

Step 2: Define your module config file for all actions  like below : app\code\community\Mymodule\Customerpage\etc\config.xml

<config>
 <modules>
 <Mymodule_Customerpage>
 <version>1.0.0</version>
 </Mymodule_Customerpage>
 </modules>
    <frontend>
        <layout>
            <updates>
                <mymodule_customerpage module="Mymodule_Customerpage">
                    <file>mymodule_customerpage.xml</file>
                </mymodule_customerpage>
            </updates>
        </layout>  
        <routers>
            <mymodule_customerpage>
                <use>standard</use>
                <args>
                    <module>Mymodule_Customerpage</module>
                    <frontName>mymodule_customerpage</frontName>
                </args>
            </mymodule_customerpage>
        </routers>      
    </frontend>

    <global>
        <helpers>
            <mymodule_customerpage>
                <class>Mymodule_Customerpage_Helper</class>
            </mymodule_customerpage>
        </helpers>      
    </global>

</config>

Step 3: Creating the Controller Action Method http://store.example.com/mymodule_customerpage/index/index/ app\code\community\Mymodule\Customerpage\controllers\IndexController.php


class Mymodule_Customerpage_IndexController extends Mage_Core_Controller_Front_Action {
    public function preDispatch()
    {
        parent::preDispatch();
        $action = $this->getRequest()->getActionName();
        $loginUrl = Mage::helper('customer')->getLoginUrl();

        if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
            $this->setFlag('', self::FLAG_NO_DISPATCH, true);
        }
    }    
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}


Step 4 :   Creating the helper   app\code\community\Mymodule\Customerpage\Helper\Data.php


<?php
class Mymodule_Customerpage_Helper_Data extends Mage_Core_Helper_Abstract
{
}

Step 4 : Creating our Page Content   a) app\design\frontend\base\default\layout\mymodule_customerpage.xml


<layout>
    <customer_account>
        <reference name="customer_account_navigation">
            <action method="addLink">
                <name>my_module_section</name>
                <path>mymodule_customerpage/index/index</path>
                <label>My Module Link</label>
            </action>
        </reference>
    </customer_account>

    <mymodule_customerpage_index_index>
        <update handle="customer_account" />
        <reference name="my.account.wrapper">
            <block type="core/template" name="mymodule_customerpage_content" template="mymodule_customerpage.phtml"/>          
        </reference>
    </mymodule_customerpage_index_index>

</layout>

b) app\design\frontend\base\default\template\mymodule_customerpage.phtml

    <div class="dashboard">
        <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
        <div class="box-account box-info">
            <div class="box-head">
                <h2><?php echo $this->__('My Module Link') ?></h2>
            </div>
        </div>
    </div>

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