<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, ...
Fix Category Url Filter in Magento Layered Navigation
www.yoursite.com/electronics.html?cat=12->www.yoursite.com/electronics/cameras.html
This can be fixed quite easily by overriding the getUrl() method in the Mage_Catalog_Model_Layer_Filter_Item class (Accessible at: /app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php)
This can be fixed quite easily by overriding the getUrl() method in the Mage_Catalog_Model_Layer_Filter_Item class (Accessible at: /app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php)
The code
Right, down to the fun part! Locate the function at line 57, it should look like this:public function getUrl()
{
$query = array(
$this->getFilter()->getRequestVar()=>$this->getValue(),
Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
);
return Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query));
}
Now you need to edit this code and put in a condition to check for
the presence of the category filter (“cat” request variable). With this
we first load the category object using its ID, and then retrieve the
correct category URL.
The next section below (lines 7-12) checks if the current request includes any other query string parameters, and builds a new query string accordingly.
Finally, this query string is added to the category URL and returned.
public function getUrl()
{
if($this->getFilter()->getRequestVar() == "cat"){
$category_url = Mage::getModel('catalog/category')->load($this->getValue())->getUrl();
$return = $category_url;
$request = Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));
if(strpos($request,'?') !== false ){
$query_string = substr($request,strpos($request,'?'));
}
else{
$query_string = '';
}
if(!empty($query_string)){
$return .= $query_string;
}
return $return;
}
else{
$query = array(
$this->getFilter()->getRequestVar()=>$this->getValue(),
Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
);
return Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query));
}
}
I made these changes to this file and dropped the modified version into the local code pool while preserving the path, but the changes are not being recognized. I do not want to change this in the core code pool. Can you tell me how to make my changes recognized in the local code pool for this? Thanks.
ReplyDelete