Skip to content

Instantly share code, notes, and snippets.

@sfelde
Created July 11, 2012 12:45
Show Gist options
  • Save sfelde/3090160 to your computer and use it in GitHub Desktop.
Save sfelde/3090160 to your computer and use it in GitHub Desktop.
seo oxid
public function getShopUrl(){
return $this->getConfig()->getShopUrl();
}
public function setSpeakingUrl($speakingUrl)
{
$this->_speakingUrl = $speakingUrl;
}
public function getSpeakingUrl($id=false)
{
//die( $id );
if($id){
$sSql = sprintf('select * from oxseo where OXOBJECTID = "%s"', $id);
$rows = oxDb::getDb(true)->GetAll($sSql);
#print_r($rows[0]['OXSEOURL']);
if (count($rows) > 0){
return $rows[0]['OXSEOURL'];
}
return false;
}
return $this->_speakingUrl;
}
public function existSeoEntry($objid){
$sSql = sprintf('select * from oxseo where OXOBJECTID = "%s"', $objid);
$rows = oxDb::getDb(true)->GetAll($sSql);
if (count($rows) > 0){
return true;
}
return false;
}
public function updateSeoEntry($objid){
$sSql = sprintf('update oxseo set OXSTDURL=\'%s\' where oxid="%s"', $this->getSpeakingUrl(), $objid);
oxDb::getDb()->Execute($sSql);
}
public function existSpeakingUrl(){
$sSql = ('select * from oxseo where OXSEOURL LIKE ("%'.$this->getSpeakingUrl().'%")');
$rows = oxDb::getDb(true)->GetAll($sSql);
#print_r($rows);
if(count($rows) > 0){
return true;
}
return false;
}
$iLang = oxLang::getInstance()->getEditLanguage();
$iShopId = $this->getConfig()->getShopId();
$notSpeakingUrl = sprintf('index.php?cl=srmag&m=%s',$objid);
$speakingUrl = 'test-speaking/url/';
oxSeoEncoder::getInstance()->addSeoEntry($objid,$iShopId,$iLang,$notSpeakingUrl,$speakingUrl,'STATIC');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment