Skip to main content

Posts

Showing posts from August, 2015

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&quo

Call Observer when product save in magento.

\app\etc\modules\Samrat_Parida.xml <?xml version="1.0"?> <config>     <modules>         <Samrat_Parida>             <active>true</active>             <codePool>local</codePool>                    </Samrat_Parida>     </modules> </config> \app\code\local\Samrat\Parida\etc\config.xml <?xml version="1.0"?> <config>     <modules>         <Samrat_Parida>             <version>0.1.0</version>         </Samrat_Parida>     </modules>     <global>                  <models>             <saporder>                 <class>Samrat_Parida_Model</class>                            </saporder>                                           </models>         <resources>                 <saporder_setup>                     <setup>                         <module>Samrat_Parida</module>                       

CSV file Import and Export in php

<?php if (isset($_POST['submit'])) { if (is_uploaded_file($_FILES['filename']['tmp_name'])) { echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h1>"; } $handle = fopen($_FILES['filename']['tmp_name'], "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if($data[6]!="Email Address" and $data[6]!=""){ $sql="select * from test where email_address='$data[6]'"; $pageposts = $wpdb->get_row($sql); if($pageposts->email_address){ $import="update test set home_address='$data[4]',city_state_zip_code='$data[5]',email_address='$data[6]' where email_address='$data[6]'"; } else { $import="INSERT INTO `test` (`last_name`,  `home_address`, `city_state_zip_code`, `email_address`) VALUES ('$data[1]','$data[2]', '$data[

5 Useful Tricks For Your Magento local.xml

5 Useful Tricks For Your Magento local.xml <?xml version="1.0" encoding="UTF-8"?> <!-- /**  * local.xml  *  * Local layout modifications for our local theme  *  * @category    design  * @package     my_theme_default  * @copyright   Copyright (c) 2015 samart.  */ --> <layout version="0.1.0"> ... </layout> 1. Adding and removing scripts and stylesheets One of the things I find doing quite often is adding and removing JavaScript and CSS includes. For example, some third party extensions install their own CSS with, maybe a few lines of styling. I prefer to move this into the main stylesheet and just not include the original. Similarly, sometimes I don’t want some JavaScript included on all or some pages. Also, if I develop some of my own JS, I need to include it. Clearly, for functionality you develop via a custom module, you may have already created a module specific layout XML file that will handle your custom includes, but if it’

Create new page layout in magento

1.\app\code\local\Samrat\Cmspage\etc\config.xml <?xml version="1.0"?> <config>  <global>   <page>    <layouts>     <custom_static_page_one>      <label>Custom static page 1</label>      <template>page/custom-static-page-1.phtml</template>     </custom_static_page_one>    </layouts>   </page>  </global> </config> 2.\app\etc\modules\Samrat_Cmspage.xml <?xml version="1.0"?> <config>  <modules>   <Samrat_Cmspage>    <codePool>local</codePool>    <active>true</active>   </Samrat_Cmspage>  </modules> </config>