![]() |
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 |
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 |
Re: MAX cdn
Code:
Open smarty.php: This only calls the common_files images though. Looking for better integration. |
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
|
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:
PHP Code:
|
Re: MAX cdn
Quote:
I tried similar to this and the urls looked correct but the images were missing as not populated on maxcdn. |
Re: MAX cdn
Quote:
Can you give us a clue on the files you changed? |
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:
|
Re: MAX cdn
Just have to work out how to do product images as this didn't work.
PHP Code:
|
Re: MAX cdn
|
Re: MAX cdn
Quote:
Is that for the AltImages? |
Re: MAX cdn
Give it a bash, works for a client of mine...
|
Re: MAX cdn
Quote:
|
Re: MAX cdn
That should work for T and P images, yes.
|
Re: MAX cdn
I can verify that the code Phil has provided works, MaxCDN installed correctly is awesome. :D
|
Re: MAX cdn
Quote:
^ what he said :) |
Re: MAX cdn
Quote:
Hi PhilJ That doesn't seem to work for T and P images. Works fine for AltImages though. |
Re: MAX cdn
PHP Code:
This changes the url correctly but the images are missing and not being pulled by maxcdn. |
Re: MAX cdn
|
Re: MAX cdn
Sorry this did work just needed my image path tweaked. Well worked for thumbnails anyway not P images.
|
Re: MAX cdn
Has anyone successfully managed to get maxcdn pulling the cached css and js from the speedup tool?
|
Re: MAX cdn
anyone got any ideas for 4.5.2?
Tried the above codes, but doesnt pull up from it |
Re: MAX cdn
Quote:
Mercuryminds does the full install and setup for $30 I think, works a charm on my site. They do a full documentation for $50 in total, might be worth asking them. :D |
Re: MAX cdn
yeah i may go that route, but i am cheap and will probably spend more time to end up paying the $30
Thanks for the info |
Re: MAX cdn
Do Mercuryminds also manage to pull the cached css and js?
|
Re: MAX cdn
Quote:
Hi Mike, I have Artistictune business as my template and my version is x-cart Pro 4.4.2.Please help me how to add my skin,images and template through max cdn.After adding this codes the whole site breaks. Please provide me the modified smarty.php for my 4.4.2 Pro. Thanks. |
Re: MAX cdn
Hi
Sorry I have not been following the thread but here are the files I edit to implement maxcdn. Along with smarty.php do the following 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) replace with Code:
$result = ('js' == $type) This will cover a lot of your background images and all javascript calls. Then to make all your category images use cdn edit include/templater/plugins/function.get_category_image_url.php find Code:
return func_convert_amp(func_get_image_url($category['categoryid'], 'C', $category['image_path'])); replace with Code:
return str_replace("www.yoursiteurl.co.uk","yourcdnurl.com",func_convert_amp(func_get_image_url($category['categoryid'], 'C', $category['image_path']))); |
Re: MAX cdn
Then in the template files for the product thumbnail and expanded view
you can use the smaty replace function in the following way Code:
{$tmbn_url|amp|replace:'www.yoursiteurl.co.uk':'yourcdnurl.com'} |
Re: MAX cdn
Quote:
What template files do you put that, and where i am lost on this i am sorry for beeing such a noob |
Re: MAX cdn
|
Re: MAX cdn
Quote:
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'} |
Re: MAX cdn
Quote:
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') |
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?
|
Re: MAX cdn
|
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 |
Re: MAX cdn
Quote:
file: /common_files/product_thumbnail.tpl Code:
{* MaxCDN edit - comment out next line *} |
Re: MAX cdn
Quote:
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:
Hmm... must be my php syntax, right? Isn't this how to do an if? What am I missing? Thanks! Jeremy |
Re: MAX cdn
Quote:
I used Bootstrapper50. Thanks! This is a no-brainer. |
Re: MAX cdn
Quote:
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. |
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: I used this code for the Thumbs (trapping for https): Code:
FILE: 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... |
All times are GMT -8. The time now is 06:20 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.