Skip to main content

Posts

Showing posts from July, 2014

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,

Create Category attribute in magento

app\code\community\Samrat\SamratAttribute\etc\config.xml <?xml version="1.0"?> <config>     <modules>         <Samrat_SamratAttribute>             <version>0.0.1</version>         </Samrat_SamratAttribute>     </modules>     <global>         <resources>             <add_samrat_attribute>                 <setup>                     <module>Samrat_SamratAttribute</module>                     <class>Mage_Catalog_Model_Resource_Setup</class>                 </setup>                 <connection>                     <use>core_setup</use>                 </connection>             </add_samrat_attribute>             <add_samrat_attribute_write>                 <connection>                     <use>core_write</use>                 </connection>             </add_samrat_attribute_write>        

Add custom image/textarea attribute to category

Just copy paste the below code in header.phtml and run yourmagento once, your attribute will be created and you can see in backend under manage category. After you are done remove this code again. <?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute('catalog_category', 'sliderimage', array(     'group'         => 'General',     'input'         => 'image',     'type'          => 'varchar',     'label'         => 'Slider Image',     'backend'       => 'catalog/category_attribute_backend_image',     'visible'       => 1,     'required'        => 0,     'user_defined' => 1,     'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, )); ?> <?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute('catalog_c

User check 30 days

Corn job https://www.setcronjob.com/manage/cron <?php ################################################################# //isFrontEndMember(); ################################################################# $SECTION_NAME='User'; $SECTION_TABLE=TBL_USER_NAME; $SECTION_FIELD_PREFIX=TBL_USER_PREFIX; $SECTION_VIEW_PAGE=FRT_USER_CHECK_FILE; $SECTION_MANAGE_PAGE=FRT_USER_CHECK_FILE; $sql=getSelectListQuery($SECTION_TABLE,$SECTION_FIELD_PREFIX); //$date = date ( 'Y-m-d H:i:s'); $date = getSiteTimezone();     $newdate = strtotime ( '-30 days' , strtotime ( $date ) ) ;     $newdate = date ( 'Y-m-d H:i:s' , $newdate );     //echo $newdate; $newdate2 = strtotime ( '-364 day' , strtotime ( $date ) ) ; $newdate2 = date ( 'Y-m-j H:i:s' , $newdate );     $sql.=" AND ".TBL_USER_PREFIX.TBL_USER_LEVEL_PREFIX."id=3"; $result_query=$dbc->select($sql); $total_row=count($result_quer