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

Get the view of configurable product with option by product id


<?php 
//Get the view of configurable product with option by product id
 $_helper = $this->helper('catalog/output');
   $productId = 1112;
    $_product = Mage::getModel('catalog/product')->load($productId);  //

   $_coreHelper = $this->helper('core');
                         $regularprice = $_coreHelper->currency(number_format($_product->getPrice(),2),true,false);
                         $specialprice = $_coreHelper->currency(number_format($_product->getSpecialPrice(),2),true,false);   
                         $test=$_product->getSpecialPrice();
      
      
?>
        <div class="quickViewSec" id="sectionOne">
 
     <form action="<?php echo Mage::helper('checkout/cart')->getAddUrl($_product); ?>" method="post" id="product_addtocart_form" >
       <?php echo $this->getBlockHtml('formkey') ?>
<div class="no-display">
     <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
<input id="related-products-field" type="hidden" value="" name="related_product">
</div>
 
          <a href="javascript:void(0)" class="close">CLOSE</a><div class="clearfix"></div>
             <div class="quickViewSecLeft"><img src="<?php echo Mage::helper('catalog/image')->init($_product, 'image')->resize(350,350); ?>"></div>
                <div class="quickViewSecRight">
                    <p><?php echo $_product->getName(); ?></p>
                    <p><div class="price-box">
              <div class="special-price">
                <div class="price"><?php echo $regularprice; ?></div>
              </div>
            </div></p>
                   <p><?php echo nl2br($_product->getShortDescription()) ?> </p>
      
       <?php
            if ($_product->getData('type_id') == "configurable")
            {
                $config = $_product->getTypeInstance(true);
                foreach($config->getConfigurableAttributesAsArray($_product) as $attributes)
                {
                    ?>
    
     <div id="product-options-wrapper" class="product-options">
   
    <ul>
            <li><span class="optionsLabel"> <label class="required"><em>*</em>Size:</span>
        <ul class="optionsGroupul last">
          <div>
    <?php  foreach($attributes["values"] as $values) { ?>
   <label onclick="fun1('<?php echo $values["value_index"]; ?>')"><?php echo $values["label"]; ?></label>
    <?php  } ?>
    </div>
        </ul>
        <div style="clear:both;"><!-- product clear --></div>
       </li>
        </ul>
   
    </div>





      
          
        
            <div class="input-box" style="display:none;">
    <label class="required"><em>*</em><?php echo $attributes["label"]; ?></label>
             <select  class="required-entry testtpp super-attribute-select" name="super_attribute[<?php echo $attributes['attribute_id'] ?>]" id="attribute<?php echo $attributes['attribute_id'] ?>">
     <option value="">-- Please Select --</option>
                <?php
                                    foreach($attributes["values"] as $values)
                                    {
          //print_r($values);
$testcc= $values["value_index"];
                                        echo "<option value='$testcc'  price='0'>".$testcc."</option>";
                                    }
                                    ?>
              </select>
            </div>
       
        <?php
                }
            }?>
 
  
  
  
  <input id="qty" class="input-text qty" type="hidden" title="Qty" value="1" maxlength="12" name="qty" pattern="\d*">
  <script>
function fun1(theText){
 //alert(theText)
jQuery(".testtpp option:contains(" + theText + ")").attr('selected', 'selected');
}
  </script>
                    <p>
                       <div class="add-to-cart-buttons">
            <button onclick="productAddToCartForm.submit(this)" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>
                    </div>
</p>
 </div>
</form>
       <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>       
        </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...