Skip to content

Instantly share code, notes, and snippets.

@antoniocosentino
Created February 1, 2018 11:19
Show Gist options
  • Save antoniocosentino/273aaf7f1fe0db255541265e153dafdc to your computer and use it in GitHub Desktop.
Save antoniocosentino/273aaf7f1fe0db255541265e153dafdc to your computer and use it in GitHub Desktop.
shopware5/engine/Shopware/Plugins/Local/Frontend/StylaSEO/Controllers/Frontend/Magazin.php if CURL request to SEO API is creating issues replace postDispatch() with this
public function postDispatch(){
$type = $this->_feed_params['type'];
$js_include = StylaUtils::getJsEmbedCode($this->_username, $this->_snippet_url);
$ret = null;
$path = StylaUtils::getCurrentPath($this->_base_dir);
//disabling call to SEO API
//$ret = StylaUtils::getRemoteContent($this->_username, $path, $this->_url_query_params, $this->_source_url);
$custom_page = $this->View()->getAssign('sCustomPage');
if($ret){
$custom_page['head_content'] = $ret['head_content'];
$custom_page['page_title'] = $ret['page_title'];
$custom_page['meta_description'] = $ret['meta_description'];
$custom_page['query_params'] = $ret['query_params'];
$stylaDiv = '<div id="stylaMagazine" data-magazinename="'.$this->_username.'" data-rootpath="'.$this->_base_dir.'"></div>';
$this->View()->assign('sContent', $ret['noscript_content']."\r\n".$js_include."\r\n".$stylaDiv);
$status_code = $ret['status_code'];
}
//since we disabled SEO API call, providing just the basic content
else {
$stylaDiv = '<div id="stylaMagazine" data-magazinename="'.$this->_username.'" data-rootpath="'.$this->_base_dir.'"></div>';
$this->View()->assign('sContent', $js_include."\r\n".$stylaDiv);
$status_code = 200;
}
$this->View()->assign('sCustomPage', $custom_page);
$this->View()->assign('feed_type', $type);
$this->Response()->setHttpResponseCode($status_code);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment