X-Cart CDN Integration

This X-Cart CDN integration tutorial shows how to complete a CDN integration with KeyCDN.

For this X-Cart CDN Integration tutorial we’re using the default skin called “ideal_comfort”. If you are using another skin you will need to modify the code shown below to match the name of your skin.

This tutorial works with X-Cart 4.4.x (fixed path to skin).

  1. Create a pull zone before you start with the X-Cart CDN integration.
  2. Go to the root directory of X-Cart and create a backup of the core X-Cart file “smarty.php”.
  3. Open the core X-Cart file “smarty.php”. Search for the following lines:
    $smarty->assign('ImagesDir', $xcart_web_dir . $smarty_skin_dir . '/images'); 
    $smarty->assign('SkinDir', $xcart_web_dir . $smarty_skin_dir);
  4. Two lines need to be replaced with your CDN URL (e.g. http://yourzone-ab12.kxcdn.com):
    // KeyCDN Integration
     if ($_SERVER['HTTPS'] != 'on') 
        {$smarty->assign("SkinDir","http://yourzone-ab12.kxcdn.com/skin/ideal_comfort";     
         $smarty->assign("ImagesDir","http://yourzone-ab12.kxcdn.com/s/skin/ideal_comfort/images"); } 
    else { 
         $smarty->assign("SkinDir",$xcart_web_dir."/skin/ideal_comfort"); 
         $smarty->assign("ImagesDir",$xcart_web_dir."/skin/ideal_comfort/images"); 
         }
  5. Save the changes.
  6. Check in the HTML to see if the URL has been rewritten properly.

Leave A Comment?