![]() |
Re: MAX cdn
Sorry to keep posting -- hoping someone jumps in on this...
I was not able to get the detailed images (colorbox) working. I tried editing these files, using the smarty 'replace' command as used elsewhere: /common_files/modules/Detailed_Product_Images/product_images.tpl /common_files/modules/Detailed_Product_Images/colorbox_image.tpl /common_files/modules/Detailed_Product_Images/popup_image.tpl and replaced {$i.image_url|amp} with Code:
{$i.image_url|amp|replace:'www.domain.com':'cdn.domain.com'} Maybe this needs a php solution after all? |
Re: MAX cdn
OK -- another roadblock:
Images that are hard coded into the product description... Since you can't use {$AltImagesDir} in the product description, I use a dedicated directory for all images that need to be hardcoded for the product description: /product-images/ So I need to figure out how to get all of these images from the product description to the CDN I guess it's gonna have to be the good old, <img src="http://cdn.domain.com/product-images/image.jpg" />, right? Fortunately, I only have 20 product pages - and only 8 needed edits. Took 5 minutes. And these pages now load faster. Just like that. 3 steps forward, 2 steps back. |
Re: MAX cdn
Quote:
Like in this thread: http://forum.x-cart.com/showthread.php?t=21027&highlight=eval |
Re: MAX cdn
Quote:
Thanks, Mike -- but I am not using variables here... just a path to an image directory. And there is no need to make a var out of this since I hard coded the path initially. Thanks for the suggestion though... The more I edit templates integrating the CDN, the more I realize this is a much needed part of the core code that should be a checkbox and a one line text input. Once you see the metrics comparing stock xcart vs. xcart with CDN, your jaw will drop. You can spend days (weeks) optimizing php code and templates, or you can spend minutes turning on the CDN. It's that big a deal. In my case more than 50% reduction in page load time! :-) |
Re: MAX cdn
What is the best practice for MaxCDN settings:
SEO robots.txt -- disabled? But is that logical? I want my images indexed. But if the URL for the image is a cache file, that's not good... Set Default Cache Time: 7 days? Longer? Product images are static and rarely change. Homepage banner images can change daily, or not. Is there a best practice for this? What does Google see when it finds cached images? Thinking out loud. Thanks, J |
Re: MAX cdn
Still trying to solve this -- anyone have any ideas?
Quote:
|
Re: MAX cdn
What about getting the product images to show up using the CDN in the root images folder T and P?
|
Re: MAX cdn
Quote:
For the T thumbs, I followed the suggestion from post #31 Then added the https code as follows: I used this code for the Thumbs (trapping for https): Code:
FILE: |
Re: MAX cdn
Quote:
I have that set, but its not showing. For Thumbnails, category images, or detailed. Anything else im missing? |
Re: MAX cdn
Quote:
Did you set the CNAME record in cPanel? Are you using cdn.domain.com as an alias for "company.company.netdna-cdn.com" ? If you have it set correctly, if you view your page source, almost immediately, what was: Code:
<img src="http://www.domain.com/images/T/xctmp0O7ydz.jpg" Code:
<img src="http://cdn.domain.com/images/T/xctmp0O7ydz.jpg" Are you seeing anything sent to the cdn? |
Re: MAX cdn
Hey,
Yes I am using a CName record for this. I fixed it using include/func/func.files.php Quote:
however, on_sale.php is not showing the correct images since for some reason it is not using FS. http://domain.com/image.php?type=T&id=18816 |
Re: MAX cdn
Quote:
It was 2am when I configured this -- so I am not sure why I chose to use the template edits vs. the php -- but the php is clearly the better solution. I removed the https edit from the thumb template and all is perfect. W (variant) D (detailed) P (product) T (thumbs - which for my store is also used as main image) All good now. The only thing left for my integration is the cached js and css. DId you see post #37? ANy ideas how to solve this? Thanks to all for sharing. |
Re: MAX cdn
in regards to #37, maybe a skin issue? I am using a custom skin and am not having issues right now with https
Quote:
try that? |
Re: MAX cdn
this is what the end of my file looks like, i am to tired to edit all out so this is what i am using and is working, thanks for coming up with a solution for the images, i spend hours trying to get that (i am not really much of a programmer, basic little hacks is about all i can do
Code:
// WCM - MaxCDN Implementation |
Re: MAX cdn
Also adding it to the images almost seems to drop the load time in about half from high 2's to mid 1's
|
Re: MAX cdn
Thanks Dave!
I had a syntax issue... I thought I could if/else within the function -- but by your example, there is an if, then the else -- and the $result = ('js' == $type) is repeated on the else. I'm not a php coder either, but always learning. THANKS! for the contribution to this thread. I will try to assemble a master list of edits for 4.5.4 and see if anything is missing. Thanks! Jeremy |
Re: MAX cdn
Here is my list of MaxCDN edits for my 4.5.4 store.
I have the X-Cart Banner mod, and these images MUST live in the file system for MaxCDN. This is a collection of edits as contributed by many others here -- but here is what I am using, all in one post... Hope this helps someone the way other posts here have helped me. Setting Up MaxCDN -- make a CNAME record in cPanel to simplify the URL and make it looks like: cdn.domain.com (as opposed to companyname.companyname.netdna-cdn.com) http://cp3support.netdna.com/tutorials/create-cname/ 1. file: /smarty.php FIND: PHP Code:
REPLACE WITH: PHP Code:
note: a) change "cdn.domain.com" to your cdn.domain.com b) change /skin/books_and_magazines/ to your skin -- if you use "3-columns" - the path would be /skin/3-columns/ etc... ================================== 2. For css and js code file: /include/templater/plugins/function.load_defer_code.php FIND: PHP Code:
REPLACE WITH: PHP Code:
================================== 3. FOR CATEGORY IMAGES file: /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'])); Code:
return str_replace("www.domain.com","cdn.domain.com",func_convert_amp(func_get_image_url($category['categoryid'], 'C', $category['image_path']))); ================================== 4. FOR IMAGES (W, D, P, T images in file system) file: /include/func/func.files.php FIND: Code:
$current_location = $current_location; REPLACE WITH: PHP Code:
5. FOR X-CART BANNER SYSTEM (A images in file system) FILE: /skin/common_files/modules/Banner_System/banner_rotator.tpl FIND: Code:
src="{$content.image_path|amp}" REPLACE WITH: Code:
src="{$content.image_path|amp|replace:'www.domain.com':'cdn.domain.com'}" ADDED on Jan 18 6. FOR T images -- I think this is needed too file: /common_files/product_thumbnail.tpl FIND: Code:
{$tmbn_url|amp} Code:
{* MaxCDN edit - comment out next line *} ADDED on Feb 21 7. FOR IMAGES (W, D, P, T images in file system) I noticed that some variant images were not getting to the CDN. SO I tried using the code suggested by Phil in post #58 - this seems to work, and is probably a brute force solution. Don't know if I can remove #4? file: /include/func/func.files.php FIND: PHP Code:
REPLACE WITH: PHP Code:
This seems to be doing the trick... |
Re: MAX cdn
Great guide and confirmed working :)
One thing though, for step 4... Quote:
^ Did not exist for me, so I replaced... Code:
// image_path is an locally placed image With... Code:
// image_path is an locally placed image (This is for v4.5.4 Gold) |
Re: MAX cdn
Quote:
Phil, What edit did you make to init.php? I have 4.5.4 gold plus -- I don't think there is a difference in this file?? In your opinion, is it better to do the images (step 4) in init.php (as opposed to /include/func/func.files.php ) ? What is the benefit? One final step that I failed to discuss: make CERTAIN that you enable robots.txt in the MaxCDN control panel. You do not want duplicate content at the search engines. I believe the crawlers will still find your original images on your site, even if they are all cached to the cdn. Right? Is that how everyone is doing this? PS -- my page load time is now just over 1.3 seconds (was 4.5 secs+) To further reduce page load time: 1. CloudSearch needs to use a CDN. I have asked them to do this; 2. Socialize module may be convenient, but it's a resource pig. Too many images, too many http calls. I will work on localizing these resources and getting them to the cdn. 3. Advanced Customer Reviews uses P images on the sidebar, when it only needs a 65px x 65px thumb. I'm working on making this better; 4. I'm sure there are plenty of opportunities to optimize even more, but once we get these elements to the cdn, it's diminishing returns for the effort. A 1 second page load is a zillion times better than 4.5 seconds. hard to take much more off of it. |
Re: MAX cdn
Sorry, init.php was not the correct file to edit, see my modifed post above :)
|
Re: MAX cdn
I added #6 template edit because T images were not sending to the CDN
Anything else that I should add to this? |
Re: MAX cdn
Quote:
In my case, I also had to take out some IF statements relating to {$current_location}, in order to correctly display the flag icons for the XMultiCurrency module... Quote:
|
Re: MAX cdn
|
Re: MAX cdn
I have set up 3 pull zones. One for each of smarty.php, function.load_defer_code.php and func.files.php. Makes a big difference to page load speed. Balances the load across servers then and reduces wait time.
|
Re: MAX cdn
Quote:
DO you tell each pull zone to restrict its caching to just those files? Want to know more on how you configured this. $24/year for 2 more pull zones seems like a bargain if the speed increase is substantial. Please share? Thanks, J |
Re: MAX cdn
I have created 3 identical pull zones so you get 3 cdn urls. I used one URL for each of the different lots of content being pulled in. One for the Alt Images, one for the T and P images and one for the css/js plus background images. Seems to work great so far. I haven't done any more restricting that that.
It doesn't cost anything for pull zones. I have the basic 1TB bandwidth from my start-up account and can create as many pull zones as I like. In 6 months I have only used 116Gb bandwidth even though about 5GB is getting downloaded per day. |
Re: MAX cdn
If you want to look at my site it is here http://collectables.co.uk
|
Re: MAX cdn
Quote:
Are you sure about that? I just tried to add a pull zone and it wanted to charge me $12/year (per zone). I am only subscribed to the "starter" plan. Could you be subscribed to the "business" plan that includes 25 zones? |
Re: MAX cdn
I have the 1Tb pre paid bandwidth. I cant see anything else to tell me the type of account.
|
Re: MAX cdn
Looking at the plans I am definitely not on the business plan lol.
|
Re: MAX cdn
Quote:
On the pull zones page, https://cp.maxcdn.com/zones/pull I can "buy additional zones" -- but not add any (without subscription) How did you enable 3 unique pull zones? |
Re: MAX cdn
Quote:
I have a button on that page that says "Create Pull Zone" top right. It doesn't charge me to do so. |
Re: MAX cdn
|
Re: MAX cdn
This is what I have.
http://collectables.co.uk/images/max.jpg |
Re: MAX cdn
Are you subscribed to the "Current Package: Starter Recurring" plan? ($39.95)
https://cp.maxcdn.com/account Hmm... I just sent a support request to maxcdn. |
Re: MAX cdn
Quote:
I have a $39.95 account according to my first invoice. I did get that first 1TB free with a promotion they were running. That runs till August 2013 when I have to buy more bandwidth for ё39.95(1TB). The starter plan does say you only get one pull zone included. I know they mess up their advertising campaigns. Maybe that promo put people on the business platform for the starter price. I'm not complaining lol. |
Re: MAX cdn
Lucky.
So is it really faster with 3 zones? I am satisfied with my speed... Will additional zones speed things up? http://www.carpeperdiem.us/xcartforum/maxcdn-results1.png |
Re: MAX cdn
It sped up my site having 3 zones. 2 even helps. Using Pingdom you could see the wait time decrease with multiple zones.
http://tools.pingdom.com/fpt/#!/h6RkfWa4H/http://collectables.co.uk/ What tool did you use to get those results? |
Re: MAX cdn
Quote:
http://www.webpagetest.org/ |
Re: MAX cdn
Quote:
|
All times are GMT -8. The time now is 04:27 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.