ukbaz Posted December 9, 2020 Share Posted December 9, 2020 Hi - have started using a CDN on sites - working well apart from the home slider not pulling images from CDN. Looks like the URL is set in code below: $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/prestapassionslideshow/images/'.$slideArray['images']; - I need the code to have the slide URL set to cdn.domain name/'modules/prestapassionslideshow/images/'.$slideArray['images']; Can I hardcode this or is there a better way? Thanks Link to comment Share on other sites More sharing options...
ukbaz Posted December 9, 2020 Author Share Posted December 9, 2020 Full code to get slideshow is as follows - Can anyone suggest what I need to change here? public function getSlideshow() { $id_shop = (int)Context::getContext()->shop->id; $id_lang = (int)$this->context->language->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'prestapassionslideshow` ps'; $sql .= ' LEFT JOIN `'. _DB_PREFIX_ . 'prestapassionslideshow_lang` psl'; $sql .= ' ON ps.id_prestapassionslideshow = psl.id_prestapassionslideshow'; $sql .= ' LEFT JOIN `' . _DB_PREFIX_ . 'prestapassionslideshow_shop` pss '; $sql .= ' ON ps.id_prestapassionslideshow = pss.id_prestapassionslideshow'; $sql .= ' where pss.`id_shop` ='.$id_shop ; $sql .= ' AND psl.`id_lang` ='.$id_lang ; $sql .=' AND ps.`active` =1'; $sql .= ' ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $arraySlides = array(); foreach($slides as $key => $slideArray) { $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='image'){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/prestapassionslideshow/images/'.$slideArray['images']; if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') $v = str_replace("http://", "https://", $v); } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } return $arraySlides; } Thanks Baz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now