Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

MAX cdn

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #31  
Old 12-17-2012, 09:27 AM
 
MAPerformance MAPerformance is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 145
 

Talking Re: MAX cdn

Quote:
Originally Posted by dave01978
What template files do you put that, and where i am lost on this i am sorry for beeing such a noob

The file is /skin/common_files/product_thumbnail.tpl. That's where I found the line to edit and it works perfectly!

Find this near line 9:
Code:
{$tmbn_url|amp}

And replace with this:
Code:
{$tmbn_url|amp|replace:'www.your-main-url.com':'your-cdn-url.com'}
__________________
www.maperformance.com

X-Cart Version: 4.4.3 Gold
Reply With Quote

The following user thanks MAPerformance for this useful post:
carpeperdiem (01-12-2013)
  #32  
Old 12-18-2012, 05:10 AM
 
dave01978 dave01978 is offline
 

Advanced Member
  
Join Date: Nov 2006
Posts: 95
 

Default Re: MAX cdn

Quote:
Originally Posted by MAPerformance
The file is /skin/common_files/product_thumbnail.tpl. That's where I found the line to edit and it works perfectly!

Find this near line 9:
Code:
{$tmbn_url|amp}

And replace with this:
Code:
{$tmbn_url|amp|replace:'www.your-main-url.com':'your-cdn-url.com'}

Like that it works great but when you go https:// the images are gone which i understand but i tried this
and the images come up with a path like this any ideas?
https://www.waterlesscarwashproducts.com/if%20($_SERVER%5B%27HTTPS%27%5D%20!=%20%27on%27)%7 Delse%7D

here is how i tried to work around the ssl
like i did in the rest of the code changes i made
Code:
if ($_SERVER['HTTPS'] != 'on') { {$tmbn_url|amp|replace:'www.waterlesscarwashproducts.com':'driwash.waterlesscarwashproducts.com'} } else { {$tmbn_url|amp} }
__________________
Xcart Version 4.5.2
CDSEO Pro
Remember Anonymous carts
Social Bookmarks
Cart Abandonment
catagory map
mobile mod
product map
XCMS
Auth.net DPM
Reply With Quote
  #33  
Old 12-20-2012, 09:26 AM
 
MAPerformance MAPerformance is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 145
 

Default Re: MAX cdn

I hadn't even noticed that! The only place you'd see it on my site is in the cart during checkout, and now I see thumbnails do not load due to HTTPS. Maybe someone else can chime in on this?
__________________
www.maperformance.com

X-Cart Version: 4.4.3 Gold
Reply With Quote
  #34  
Old 12-21-2012, 04:17 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: MAX cdn

I found these coupons for 50% off the MaxCDN starter package

Bootstrapper50

OR

codrops

Signup
__________________
xcartmods.co.uk
Reply With Quote

The following user thanks PhilJ for this useful post:
carpeperdiem (01-12-2013)
  #35  
Old 01-12-2013, 08:55 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: MAX cdn

Is everyone happy with MaxCDN and the integration as discussed in this thread?

Is using the smarty replace technique the best/fastest/most efficient way to get the data to the CDN?

My site is well under 1TB/year in bandwidth -- so I was thinking the basic plan is sufficient.

Is one "zone" sufficient for a North American site? The maxcdn FAQ doesn't really discuss "zones". My server is in California (Hands-on VPS) and my business is 97% US and 3% Canada -- we haven't advertised or localized for other countries yet. We are not pushing video (we use embedded youtube for all video)

Anyone using more than one zone? Why?

Gonna try this now -- any other guidance from those using MaxCDN? Thanks.
Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #36  
Old 01-12-2013, 10:29 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: MAX cdn

Quote:
Originally Posted by MAPerformance
I hadn't even noticed that! The only place you'd see it on my site is in the cart during checkout, and now I see thumbnails do not load due to HTTPS. Maybe someone else can chime in on this?

file:
/common_files/product_thumbnail.tpl

Code:
{* MaxCDN edit - comment out next line *} {* {$tmbn_url|amp} *} {if $smarty.server.HTTPS ne "on"} {$tmbn_url|amp|replace:'www.domain.com':'cdn.domain.com'} {else} {$tmbn_url|amp} {/if} {* END MaxCDN edit *}
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #37  
Old 01-12-2013, 10:52 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: MAX cdn

Quote:
Originally Posted by zone1creative
To get xcart to use css and js files from maxcdn edit
include/templater/plugins/function.load_defer_code.php

find
Code:
$result = ('js' == $type) ? '<script type="text/javascript" src="' . $cacheWebFile . '"></script>' : '<link rel="stylesheet" type="text/css" href="' . $cacheWebFile . '" />';

replace with
Code:
$result = ('js' == $type) ? '<script type="text/javascript" src="' . str_replace("www.yoursiteurl.co.uk","yourcdnurl.com",$cacheWebFile) . '"></script>' : '<link rel="stylesheet" type="text/css" href="' . str_replace("www.yoursiteurl.co.uk","yourcdnurl.com",$cacheWebFile) . '" />';

This will cover a lot of your background images and all javascript calls.

Slight problem here that hopefully someone can help solve...

This code works -- until you go https at checkout, and then it's a mess (css disappears).

I tried the following, but this cased a server error:

PHP Code:
/* MaxCDN edit - comment out next two lines
            ? '<script type="text/javascript" src="' . $cacheWebFile . '"></script>'
            : '<link rel="stylesheet" type="text/css" href="' . $cacheWebFile . '" />';
*/
// Then insert the following:
if ($_SERVER['HTTPS'] != 'on') {
            ? 
'<script type="text/javascript" src="' str_replace("www.domain.com","cdn.domain.com",$cacheWebFile) . '"></script>'
            
'<link rel="stylesheet" type="text/css" href="' str_replace("www.domain.com","cdn.domain.com",$cacheWebFile) . '" />';
}
else
{
            ? 
'<script type="text/javascript" src="' $cacheWebFile '"></script>'
            
'<link rel="stylesheet" type="text/css" href="' $cacheWebFile '" />';


Hmm... must be my php syntax, right? Isn't this how to do an if? What am I missing? Thanks!
Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #38  
Old 01-13-2013, 05:58 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: MAX cdn

Quote:
Originally Posted by PhilJ
I found these coupons for 50% off the MaxCDN starter package

Bootstrapper50

OR

codrops

Signup

I used Bootstrapper50. Thanks!
This is a no-brainer.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #39  
Old 01-13-2013, 06:12 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: MAX cdn

Quote:
Originally Posted by PhilJ

Bear in mind, this is for v4.5.2

Unfortunately, 4.5.4 is different enough that you can't copy/paste this.

I am working on assembling all edits for 4.5.4 and I'll re-post in one place. many good suggestions in this thread. Most work, some don't.

Thanks to all for contributions.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #40  
Old 01-13-2013, 07:20 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: MAX cdn

Am I doing this backwards?

Is there a net difference in speed by setting the path to the cdn images in php files vs. templates?

For example, I used this code for the Banner System Images:

Code:
FILE: /skin/common_files/modules/Banner_System/banner_rotator.tpl FIND: src="{$content.image_path|amp}" REPLACE WITH: src="{$content.image_path|amp|replace:'www.domain.com':'cdn.domain.com'}"

I used this code for the Thumbs (trapping for https):

Code:
FILE: /skin/common_files/product_thumbnail.tpl FIND: {$tmbn_url|amp} REPLACE WITH: {* MaxCDN edit - comment out next line *} {* {$tmbn_url|amp} *} {if $smarty.server.HTTPS ne "on"} {$tmbn_url|amp|replace:'www.domain.com':'cdn.domain.com'} {else} {$tmbn_url|amp} {/if} {* END MaxCDN edit *}

I will now do similar "replace" code for variant and detailed images, right?

What else am I missing (besides the js and css) ?

Does it hurt site speed and performance to set the CDN path in templates vs. php files?

This could be a very useful feature that X-Cart SHOULD have as default -- supporting a CDN with a simple 1 field form entry (cdn.domain.com) and a switch to turn it on. As opposed to editing 6 or more files.

But as long as we know the list of files to edit, no worries...
Gonna keep editing...
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote

The following user thanks carpeperdiem for this useful post:
dave01978 (01-15-2013)
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:21 PM.

   

 
X-Cart forums © 2001-2020