X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Third Party Add-Ons for X-Cart 4 (https://forum.x-cart.com/forumdisplay.php?f=45)
-   -   MAX cdn (https://forum.x-cart.com/showthread.php?t=64443)

zone1creative 07-31-2012 10:25 AM

MAX cdn
 
Hi,

I have just configured a site with MAXcdn.com. They provide a guide but it is not designed for xcart 4.4.x.

The guide can be found at http://www.maxcdn.com/features/integrations/x-cart/

Would be worth xcart contacting MAXcdn to give them a more accurate guide.

I will provide my integration for xcart 4.4.x when I get a chance.

Also when I get results of how good this tool is for site performance

ambal 07-31-2012 10:40 PM

Re: MAX cdn
 
> I will provide my integration for xcart 4.4.x when I get a chance.

Thank you for sharing this information in advance.
You are welcome to post it here or submit directly at
http://help.x-cart.com/index.php?title=X-Cart:Performance_tips#Use_Content_Delivery_Network s_like_MaxCDN

philrisk 09-19-2012 07:10 AM

Re: MAX cdn
 
Code:

Open smarty.php:

**************************************************************************************
$smarty->assign('ImagesDir',        $xcart_web_dir . $smarty_skin_dir . '/images');
$smarty->assign('SkinDir',          $xcart_web_dir . $smarty_skin_dir);
**************************************************************************************
Replace with this:

**************************************************************************************
/ WCM - MaxCDN Implementation
if ($_SERVER['HTTPS'] != 'on')
{
$smarty->assign('ImagesDir',        "http://CdnUrl.example.com" . $smarty_skin_dir . '/images');
$smarty->assign('SkinDir',          "http://CdnUrl.example.com" . $smarty_skin_dir);
}
else
{
$smarty->assign('ImagesDir',        $xcart_web_dir . $smarty_skin_dir . '/images');
$smarty->assign('SkinDir',          $xcart_web_dir . $smarty_skin_dir);
}
**************************************************************************************


This only calls the common_files images though. Looking for better integration.

zone1creative 09-19-2012 07:53 AM

Re: MAX cdn
 
There were a few files I had to change including smarty plugin functions. The above only covers a few images. The main images such as thumbnails expanded, and category and manufacturer images are not covered here

totaltec 09-19-2012 07:54 AM

Re: MAX cdn
 
I don't have Max CDN but to include the $AltSkinDir and $AltImagesDir it seems that you would need to find:
PHP Code:

if (@file_exists($alt_skin_dir XC_DS 'css' XC_DS 'altskin.css')) {
        
$smarty->assign('AltImagesDir'$alt_skin_info['web_path'] . '/images');
        
$smarty->assign('AltSkinDir',   $alt_skin_info['web_path']);
    } 

and replace with:
PHP Code:

// WCM - MaxCDN Implementation
if (@file_exists($alt_skin_dir XC_DS 'css' XC_DS 'altskin.css')) {
  if (
$_SERVER['HTTPS'] != 'on')
  {
    
$smarty->assign('AltImagesDir'"http://CdnUrl.example.com" $alt_skin_info['web_path'] . '/images');
    
$smarty->assign('AltSkinDir',   "http://CdnUrl.example.com" $alt_skin_info['web_path']);
    
  }
  else
  {
    
$smarty->assign('AltImagesDir'$alt_skin_info['web_path'] . '/images');
    
$smarty->assign('AltSkinDir',   $alt_skin_info['web_path']);
  }


Again, just shooting in the dark. Look correct?

philrisk 09-19-2012 11:26 PM

Re: MAX cdn
 
Quote:

Originally Posted by totaltec
I don't have Max CDN but to include the $AltSkinDir and $AltImagesDir it seems that you would need to find:
PHP Code:

if (@file_exists($alt_skin_dir XC_DS 'css' XC_DS 'altskin.css')) {
        
$smarty->assign('AltImagesDir'$alt_skin_info['web_path'] . '/images');
        
$smarty->assign('AltSkinDir',   $alt_skin_info['web_path']);
    } 

and replace with:
PHP Code:

// WCM - MaxCDN Implementation
if (@file_exists($alt_skin_dir XC_DS 'css' XC_DS 'altskin.css')) {
  if (
$_SERVER['HTTPS'] != 'on')
  {
    
$smarty->assign('AltImagesDir'"http://CdnUrl.example.com" $alt_skin_info['web_path'] . '/images');
    
$smarty->assign('AltSkinDir',   "http://CdnUrl.example.com" $alt_skin_info['web_path']);
    
  }
  else
  {
    
$smarty->assign('AltImagesDir'$alt_skin_info['web_path'] . '/images');
    
$smarty->assign('AltSkinDir',   $alt_skin_info['web_path']);
  }


Again, just shooting in the dark. Look correct?


I tried similar to this and the urls looked correct but the images were missing as not populated on maxcdn.

philrisk 09-19-2012 11:27 PM

Re: MAX cdn
 
Quote:

Originally Posted by zone1creative
There were a few files I had to change including smarty plugin functions. The above only covers a few images. The main images such as thumbnails expanded, and category and manufacturer images are not covered here


Can you give us a clue on the files you changed?

philrisk 09-21-2012 01:16 AM

Re: MAX cdn
 
I worked out out how to use the default images folder plus the alt images folder on maxcdn.

In smarty.php

PHP Code:

if ($_SERVER['HTTPS'] != 'on')
{
$smarty->assign('ImagesDir',    "http://collectables.collectablesreta.netdna-cdn.com" $smarty_skin_dir '/images');
$smarty->assign('SkinDir',        "http://collectables.collectablesreta.netdna-cdn.com" $smarty_skin_dir);
$smarty->assign("AltImagesDir",    "http://collectables.collectablesreta.netdna-cdn.com/skin/ideal_comfort/images");
$smarty->assign("AltSkinDir",    "http://collectables.collectablesreta.netdna-cdn.com/skin/ideal_comfort");
}
else
{
$smarty->assign('ImagesDir',        $xcart_web_dir $smarty_skin_dir '/images');
$smarty->assign('SkinDir',          $xcart_web_dir $smarty_skin_dir);



philrisk 09-21-2012 01:17 AM

Re: MAX cdn
 
Just have to work out how to do product images as this didn't work.

PHP Code:

// WCM - CDN Images
        
if (($type == 'T' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on')
        {
        
$image_path str_replace('/path/to/images//','http://collectables.collectablesreta.netdna-cdn.com/',$image_path);
        return 
str_replace('$http_location','',$image_path);
        }
        
// / WCM - CDN Images 


PhilJ 09-21-2012 01:24 AM

Re: MAX cdn
 
Skip to...

http://forum.x-cart.com/showpost.php?p=352228&postcount=57


All times are GMT -8. The time now is 12:34 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.