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
  #91  
Old 05-12-2013, 08:27 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: MAX cdn

XC versions before 4.4.x do NOT have the ability to change skins. 4.4.x and above have multiple skins to chose from for the cart so if not default the skins is AltSkin....

Prior to 4.4.x there is only one skin in XC so thereis no AltSkin. Looking at your signature you have 4.1.11 so there is no AltSkin - you have to adjust the code and modify the lines in the file showing for your version
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #92  
Old 05-12-2013, 10:04 AM
 
DavyMac DavyMac is offline
 

eXpert
  
Join Date: Apr 2007
Location: Poole, UK
Posts: 333
 

Default Re: MAX cdn

Quote:
Originally Posted by cflsystems
Looking at your signature you have 4.1.11 so there is no AltSkin - you have to adjust the code and modify the lines in the file showing for your version

My signature shows that we are using 4.5.4 and that we upgraded from 4.1.11. It seemed important to show that we came from 4.1.11 while we were getting our site working with 4.5.4 correctly - I may remove the 4.1.11 from the signature now

I'm still unclear where the new assignments are being used though.
__________________
X-Cart GOLD Plus v4.5.4
CDSEO Pro
ewdhosting Dedicated Server
Dedicated SSL
Stone Edge OM
Reply With Quote
  #93  
Old 05-12-2013, 10:22 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: MAX cdn

Oh sorry missed that...

They replace the calls in smarty.php
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #94  
Old 05-14-2013, 03:03 AM
 
DavyMac DavyMac is offline
 

eXpert
  
Join Date: Apr 2007
Location: Poole, UK
Posts: 333
 

Default Re: MAX cdn

Thanks to all that contributed to post #57 - easy edits with powerful consequences.

Like others I was unable to do step #4 as the code was not present, but step #7 caught all images, apart from the product detailed image thumbnails. I had to make the following change:

File: /skin/common_files/modules/Detailed_Product_Images/colorbox_image.tpl

FIND:
Code:
<a href="{$i.image_url|amp}" class="lightbox"{if $config.Detailed_Product_Images.det_image_icons_limit gt 0 and $config.Detailed_Product_Images.det_image_icons_limit le $smarty.foreach.images.index} style="display:none;"{/if} rel="dpimages" title="{$i.alt|escape}"><img src="{$i.icon_url|amp}" alt="{$i.alt|escape}" title="{$i.alt|escape}" width="{$i.icon_image_x}" height="{$i.icon_image_y}" /></a> *}

REPLACE WITH:
Code:
{* MaxCDN Replace with next line <a href="{$i.image_url|amp}" class="lightbox"{if $config.Detailed_Product_Images.det_image_icons_limit gt 0 and $config.Detailed_Product_Images.det_image_icons_limit le $smarty.foreach.images.index} style="display:none;"{/if} rel="dpimages" title="{$i.alt|escape}"><img src="{$i.icon_url|amp}" alt="{$i.alt|escape}" title="{$i.alt|escape}" width="{$i.icon_image_x}" height="{$i.icon_image_y}" /></a> *} <a href="{$i.image_url|amp}" class="lightbox"{if $config.Detailed_Product_Images.det_image_icons_limit gt 0 and $config.Detailed_Product_Images.det_image_icons_limit le $smarty.foreach.images.index} style="display:none;"{/if} rel="dpimages" title="{$i.alt|escape}"><img src="{$i.icon_url|amp|replace:'www.domain.com':'cdn.domain.com'}" alt="{$i.alt|escape}" title="{$i.alt|escape}" width="{$i.icon_image_x}" height="{$i.icon_image_y}" /></a>

For such small images the change made a huge difference, saving 0.88s on my test product page.
__________________
X-Cart GOLD Plus v4.5.4
CDSEO Pro
ewdhosting Dedicated Server
Dedicated SSL
Stone Edge OM
Reply With Quote
  #95  
Old 07-22-2013, 02:55 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 DavyMac
I'm asking specifically about these two lines:
PHP Code:
$smarty->assign("AltImagesDir",    "http://cdn.domain.com/skin/books_and_magazines/images"); 
$smarty->assign("AltSkinDir",    "http://cdn.domain.com/skin/books_and_magazines"); 

AltImagesDir and AltSkinDir were not present before the edit (unlike ImagesDir and SkinDir), so if they are new where are they being used? I'm guessing they are in fact used for your chosen skin, but that would mean the assignment exists elsewhere since it did not reside in smarty.php - in which case don't we need to delete the original assignment?

If I were using an XCart template then I would simply trust your post and include the code verbatim, but I'm using thexcartstore's xtreme_gear template and I've yet to workout how to include their template resources on CDN. It's complicated more because I have a different template for mobiles - so I'm not sure what to put for AltImagesDir and AltSkinDir.

And I am now understanding your confusion...
I am also confused, now that I have two active skins.
Which skin is $AltSkinDir (xtreme or xmobile?)

I am also seeing the txs templates and modules not use the default calls that automatically send content to the cdn. So I am having to figure this out.

What is the solution for step #4 if you have two active skins?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #96  
Old 09-05-2013, 12:49 AM
 
kevinrm kevinrm is offline
 

X-Wizard
  
Join Date: Aug 2003
Posts: 1,003
 

Default Re: MAX cdn

Using Vivid Dreams as a substitute for books_and_magazines, , I have the strange problem where I can get images to show in https but not in non-secure mode http using this code:

// MaxCDN - next two lines commented out
//$smarty->assign('ImagesDir', $xcart_web_dir . $smarty_skin_dir . '/images');
//$smarty->assign('SkinDir', $xcart_web_dir . $smarty_skin_dir);
// MaxCDN add the following
if ($_SERVER['HTTPS'] != 'on')
{
$smarty->assign('ImagesDir', "http://cdn.domain.com" . $smarty_skin_dir . '/images');
$smarty->assign('SkinDir', "http://cdn.domain.com" . $smarty_skin_dir);
$smarty->assign("AltImagesDir", "http://cdn.domain.com/skin/books_and_magazines/images");
$smarty->assign("AltSkinDir", "http://cdn.domain.com/skin/books_and_magazines");
}
else
{
$smarty->assign('ImagesDir', $xcart_web_dir . $smarty_skin_dir . '/images');
$smarty->assign('SkinDir', $xcart_web_dir . $smarty_skin_dir);
}
// END MaxCDN edit

Any clue why it wouldn't show up in non-https mode? If I keep the original code, however, images show but not through MaxCDN of course.

When I try to call up an individual image in a new tab, I get a "403 Forbidden" notice...
__________________
X-Cart 5.4.1.39 Live
PHP 7.4.33
5.5.5-10.3.38-MariaDB MariaDB
Apache 2.4
CENTOS 7.8 64Bit Single Quad-Core E3-1241v3 3.4Ghz 8M 1600 w/ HT
32GB RAM 2x 512GB Samsung 850 Pro SSD RAID 1
Reply With Quote
  #97  
Old 09-05-2013, 05:02 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 kevinrm
Using Vivid Dreams as a substitute for books_and_magazines, , I have the strange problem where I can get images to show in https but not in non-secure mode http using this code:
$smarty->assign("AltImagesDir", "http://cdn.domain.com/skin/books_and_magazines/images");
$smarty->assign("AltSkinDir", "http://cdn.domain.com/skin/books_and_magazines");

Any clue why it wouldn't show up in non-https mode?

Stating the obvious?
substitute
vivid_dreams_lotus
for
books_and_magazines

?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #98  
Old 09-07-2013, 11:07 PM
 
kevinrm kevinrm is offline
 

X-Wizard
  
Join Date: Aug 2003
Posts: 1,003
 

Default Re: MAX cdn

Yes, of course I replaced those.

I'm having a very difficult time getting this to work with 4.6.0. Even the basic thumbnails are giving me a 403 Forbidden error when I try to get them to load them from MaxCDN:

cdn.domain.com/images/T/image123.png

(NOTE: I had several referrers in the MAXCDN control panel - don't put referrers in there! )
__________________
X-Cart 5.4.1.39 Live
PHP 7.4.33
5.5.5-10.3.38-MariaDB MariaDB
Apache 2.4
CENTOS 7.8 64Bit Single Quad-Core E3-1241v3 3.4Ghz 8M 1600 w/ HT
32GB RAM 2x 512GB Samsung 850 Pro SSD RAID 1
Reply With Quote
  #99  
Old 01-09-2014, 07:32 PM
 
Kman Kman is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 124
 

Default Re: MAX cdn

I am having a devil of a time getting css and js files to load from the CDN in 4.6.1.

I have patched function.load_defer_load.php appropriately (Thanks Phil!), but it looks to me that the issue (for css) is in customer/service_css.tpl and customer/service_css_modules.tpl. The path to the css files there are relative from the root of the store - not complete: xx/skin/..../zz.css rather than {$SkinDir}/..../zz.css.

The result is that the redirection to the CDN in defer_load never takes place. There is no code among all of the various patches that will pick this up - everything depends on seeing {$SkinDir} or {$AltSkinDir}.

Has anyone figured this out? I suppose I could hard code the paths to all of the various modules using the {$SkinDir} abd {$AltSkinDir} constructs, but that seems too much like brute force.

I have not looked at the .js file load, but I'm betting it is somewhat similar.

A side effect of this is that if I turn on the internal X-Cart optimization for js or css, none of these files load at all.

I'll post a complete version of the solution once we (com on, let's do this together) get it right.
__________________
4.6.1 Gold Plus, working on moving to the latest 4.x soon
reBOOT Template (the best!)


AlteredCart Checkout One, Checkout One Tools & Checkout One Payments
AlteredCart SmartSearch & Search by Filters
AlteredCart On Sale
CDSEO
xCMS
BCS Point of Sale, Pre-order / Back Order
Magnetic One's Autoresponder

Heavily modified
Reply With Quote
  #100  
Old 04-15-2014, 10:44 PM
 
kevinrm kevinrm is offline
 

X-Wizard
  
Join Date: Aug 2003
Posts: 1,003
 

Default Re: MAX cdn

I'm still having a difficult time implementing MAX-CDN & XC with regards to generated thumbnails in HTTPS mode. I want it to load from MaxCDN in non-secure http mode, and to not load from MaxCDN in https mode.

Chrome is showing a yellow lock because of this and customers are bugging me about it, I need to get this figured out.

According to MAX-CDN implementation instructions for XC…

Quote:
Utilize CDN for “W”, “D”, “P” and “T” types of images:

1) Open /include/func/func.files.php and find the following line:

global $config, $sql_tbl, $xcart_dir, $current_location;

2) ADD these new lines below (DON’T replace with but ADD below it):

if ($HTTPS)
$current_location = $current_location;
else
$current_location = 'http://netdna.domain.com';


When I try to do this insecure in HTTP, it correctly generates this kind of URL for thumbnails: http://netdna.domain.com/images/T/16580t.jpg

When I try to do this in HTTPS mode, it should revert back to https://www.domain.com/images/T/16580t.jpg

However, it doesn't, I get this error:

The page at 'https://www.domain.com/home.php' was loaded over HTTPS, but displayed insecure content from 'http://netdna.domain.com/images/T/16580t.jpg': this content should also be loaded over HTTPS.

In step 4 of post #57, the code "$current_location = $current_location; " does not exist in more recent versions of /include/func/func.files.php

I've tried both Max CDN version method as well as the method shown in post #57, same error.

Anyone got this working on a more recent version of XC?
__________________
X-Cart 5.4.1.39 Live
PHP 7.4.33
5.5.5-10.3.38-MariaDB MariaDB
Apache 2.4
CENTOS 7.8 64Bit Single Quad-Core E3-1241v3 3.4Ghz 8M 1600 w/ HT
32GB RAM 2x 512GB Samsung 850 Pro SSD RAID 1
Reply With Quote
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 07:56 PM.

   

 
X-Cart forums © 2001-2020