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,

Magento get review view.phtml

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/**
 * Product view template
 *
 * @see Mage_Catalog_Block_Product_View
 * @see Mage_Review_Block_Product_View
 */
?>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="product-view">
    <div class="product-essential">
        <div class="catagory-name">
            <?php
            $_category_detail = Mage::registry('current_category');
            echo $_category_detail->getName();
            ?>
        </div>
        <?php

        function curPageURL() {
            $pageURL = 'http';
            if ($_SERVER["HTTPS"] == "on") {
                $pageURL .= "s";
            }
            $pageURL .= "://";
            if ($_SERVER["SERVER_PORT"] != "80") {
                $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
            } else {
                $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
            }
            return $pageURL;
        }

        $url = curPageURL();
        $array = explode('/', $url);
        $key = array_search('category', $array);

        $storeId = Mage::app()->getStore()->getId();
        $summaryData = Mage::getModel('review/review_summary')->setStoreId($storeId)->load($_product->getId());
        $prod = Mage::getSingleton('catalog/product')->load($_product->getId());
        $productId = $prod->getId();
        $reviews = Mage::getModel('review/review')
                ->getResourceCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addEntityFilter('product', $productId)
                ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                ->setDateOrder()
                ->addRateVotes();


        $current_url = $this->helper('core/url')->getCurrentUrl();
        $review_url = Mage::getUrl('review/product/list', array('id' => $this->getProduct()->getId(), 'category' => $this->getProduct()->getCategoryId()));
        ?>

        <div class="pro-rating">
            <div class="ratings">
                <div class="rating-box"><div class="rating" style="width:<?php echo $summaryData['rating_summary']; ?>%"></div></div>
                <span class="amount"><a href="<?php echo $review_url ?>">4,1 sterren van <?php echo count($reviews); ?> stemen</a></span>
            </div>

            <button class="button" onclick="window.location = '<?php echo $review_url ?>'">
                <span>
                    <span>Stem nu</span>
                </span>
            </button>
        </div>


        <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if ($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
            <?php echo $this->getBlockHtml('formkey') ?>
            <div class="no-display">
                <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
                <input type="hidden" name="related_product" id="related-products-field" value="" />
            </div>

            <div class="product-shop">

                <div class="product-name">
                    <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
                </div>
                <div class="company-detail">

                    <div class="detail-left">

                        <?php echo $_helper->productAttribute($_product, nl2br($_product->getCompanyaddress()), 'companyaddress') ?>                        
                    </div>
                    <div class="detail-right">
                        <ul>
                            <li class="tel"> <?php echo $_product->getCompanyphone() ?></li>
                            <li class="mobile"> <?php echo $_product->getCompanymobile() ?></li>
                            <li class="fax"> <?php echo $_product->getCompanyfax() ?></li>
                        </ul>
                        <ul>
                            <li class="email"> <?php echo $_product->getCompanyemail() ?></li>
                            <li class="website"> <?php echo $_product->getCompanyurl() ?></li>
                        </ul>
                    </div>
                </div>

                <?php if ($_product->isSaleable() && $this->hasOptions()): ?>
                    <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
                <?php endif; ?>
                <?php if (!$this->hasOptions()): ?>
                    <div class="add-to-box">
                        <div class="add-to-cart">
                            <button class="btn-cart button"><span><span>offerte aanvragen</span></span></button>
                        </div>  
                    </div>  
                <?php endif; ?>
            </div>
        </form>
        <div class="product-img-box">
            <?php echo $this->getChildHtml('media') ?>
        </div>
        <div class="cls"></div>

    </div>

    <script type="text/javascript" src="<?php echo $this->getSkinUrl('slider/jquery.js') ?>"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('slider/skin1.css') ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('slider/skin.css') ?>">

    <script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('#more-views-images').jcarousel({
            visible: 5,
            vertical: false,
            //auto: 1,
            scroll: 1,
            //wrap: 'circular',
            wrap: 'null',
            animation: "slow",
            buttonNextHTML: '<div title="Next"></div>',
            buttonPrevHTML: '<div title="Previous"></div>',
            buttonNextEvent: 'click',
            buttonPrevEvent: 'click',
            buttonNextCallback: null,
            buttonPrevCallback: null,
        });
    });
    </script>

    <div class="catagory-name">
        <?php
        $_category_detail = Mage::registry('current_category');
        echo "PRODUCTEN " . $_category_detail->getName();
        ?>
    </div>
    <div class="cls"></div>
    <div class="more-views-images" id="more-views-images" >
        <div class=" jcarousel-skin-tango">
            <div style="position: relative; display: block;" class="jcarousel-container jcarousel-container-horizontal">
                <div style="position: relative;" class="jcarousel-clip jcarousel-clip-horizontal">
                    <ul>
                        <?php $_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages(); ?>
                        <?php if ($_images) { ?>

                            <?php
                            $i = 0;
                            foreach ($_images as $_image) {
                                $i++;
                                ?>
                                <li>
                                    <img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(155, 155); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()); ?>" title="<?php $this->htmlEscape($_image->getLabel()); ?>" /><?php } ?>
                            </li>
                        <?php } ?>
                    </ul>
                </div></div></div>
    </div>
    <div class="product-collateral">
        <div class="product-decription">
            <h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
            <div class="decription-left">
                <p><?php echo $_helper->productAttribute($_product, nl2br($_product->getDescription()), 'description') ?></p>
            </div>

            <button class="button requist-quote" onclick="myFunction()"><span><span>offerte aanvragen</span></span></button>

        </div>


        <script>
    function myFunction()
    {
        document.getElementById("product_addtocart_form").submit();
    }
        </script>

        <?php if ($key == "") { ?>
            <div class="review-main">
                <ul>
                    <?php
                    if (count($reviews) > 0) {
                        $a = 1;
                        foreach ($reviews->getItems() as $review) {
                            foreach ($review->getRatingVotes() as $vote) {
                                $vote = $vote->getPercent();
                            }
                            if ($a <= 2) {
                                $a++;
                                ?>

                                <li>
                                    <div class="review-star">
                                        <div class="ratings">
                                            <div class="rating-box">
                                                    <!--<a href="<?php echo $review->getReviewUrl(); ?>"><div class="rating" style=" width:<?php echo $vote; ?>%;"></div></a>-->
                                                <div class="rating" style=" width:<?php echo $vote; ?>%;"></div>
                                            </div>
                                        </div>
                                        <span class="customer-name"><?php echo $review->getNickname(); ?></span>
                                        <!--<span class="customer-place">plaats hier</span>-->
                                    </div>
                                    <div class="review-text">
                                        <p><?php echo $review->getDetail(); ?></p>
                                    </div>
                                </li>
                                <?php
                            }
                        }
                    }
                    ?>
                </ul>
            </div>
        <?php } ?>


        <?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html): ?>
            <div class="box-collateral <?php echo "box-{$alias}" ?>">
                <?php if ($title = $this->getChildData($alias, 'title')): ?>
                    <h2><?php //echo $this->escapeHtml($title);  ?></h2>
                <?php endif; ?>
                <?php //echo $html;  ?>
            </div>
        <?php endforeach; ?>
        <?php //echo $this->getChildHtml('upsell_products')  ?>
        <?php echo $this->getChildHtml('product_additional_data') ?>



        <div class="social-share">
            <label>Social Shares</label>
            <div class="icons"><!-- AddThis Button BEGIN -->
                <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
                    <a class="addthis_button_preferred_1"></a>
                    <a class="addthis_button_preferred_2"></a>
                    <a class="addthis_button_preferred_3"></a>
                    <a class="addthis_button_preferred_4"></a>
                    <a class="addthis_button_compact"></a>
                    <a class="addthis_counter addthis_bubble_style"></a>
                </div>
                <script type="text/javascript">var addthis_config = {"data_track_addressbar": true};</script>
                <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-527332b65cf0b661"></script>
                <!-- AddThis Button END --></div>
        </div>

    </div>
</div>

<script type="text/javascript">
//<![CDATA[
    var productAddToCartForm = new VarienForm('product_addtocart_form');
    productAddToCartForm.submit = function(button, url) {
        if (this.validator.validate()) {
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
                form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }
    }.bind(productAddToCartForm);

    productAddToCartForm.submitLight = function(button, url) {
        if (this.validator) {
            var nv = Validation.methods;
            delete Validation.methods['required-entry'];
            delete Validation.methods['validate-one-required'];
            delete Validation.methods['validate-one-required-by-name'];
            // Remove custom datetime validators
            for (var methodName in Validation.methods) {
                if (methodName.match(/^validate-datetime-.*/i)) {
                    delete Validation.methods[methodName];
                }
            }

            if (this.validator.validate()) {
                if (url) {
                    this.form.action = url;
                }
                this.form.submit();
            }
            Object.extend(Validation.methods, nv);
        }
    }.bind(productAddToCartForm);
//]]>
</script>

Comments

Popular posts from this blog

Create post with all post type

<?php /* add_action( 'wp_enqueue_scripts', 'mpcth_child_enqueue_scripts', 1000 ); function mpcth_child_enqueue_scripts() { wp_enqueue_style( 'mpc-styles-child', get_stylesheet_directory_uri() . '/style_custom.css' ); } */ function registration_form( $username, $fname, $lname, $email, $password, $confirm_password, $account_type, $distict_city, $school_name ,$school_address, $school_type, $grade_level, $invcode ) { ?>     <style>       /* Always set the map height explicitly to define the size of the div        * element that contains the map. */     #map {     height: 260px; }     </style>   <script> function initMap() {     var map = new google.maps.Map(document.getElementById('map'), {       center: {lat: -33.8688, lng: 151.2195},       zoom: 13     });     var input = document.getElementById('searchInput');    // map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);    

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);     if (typeof G_vmlCanvasManager != 'undefined') {        

Smarty Pagination with php mysql

Smarty Pagination with php mysql ------------------------------------------------------------- --------------------------------------------------------------  <?php  Pagination using PHP,Smarty And MySql $sql="SELECT * FROM `fieldname1` WHERE is_active='Y' ORDER BY fieldmame2"; $rs=mysql_query($sql); $num=mysql_num_rows($rs); $i=0; /*while ($row = mysql_fetch_array($rs)) { $arr1[$j] = $row; $j++; }*/ //////////////////////////////////////////// if (!(isset($pagenum))) { $pagenum = 1; } //Here we count the number of results //Edit $data to be your query $rows = $num; //This is the number of results displayed per page $page_rows = 2; //This tells us the page number of our last page $last = ceil($rows/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //This sets the range to display in our query $max = 'LIMIT ' .($pagen