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

Images cached by browser

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-11-2004, 11:46 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default Images cached by browser

How can I make the images be cached by the users browser so they don't have to download every time a user goes back to a page? Is this a setting in config.php?

I only want the images to download if the image is new.
Reply With Quote
  #2  
Old 03-17-2004, 12:50 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

*Bump*

Anybody?
Reply With Quote
  #3  
Old 03-17-2004, 03:54 PM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Make sure you have your x-cart set to store images in the filesystem not the database.

3.4.3 and over will use proper image URLS so the browser will cache.

If you are storing in the database it will download the files everytime.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #4  
Old 03-17-2004, 05:18 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Sorry. I did a little digging and it's only the subcategory icons that are not caching. I'm using the mod to allow images for subcategories so they get urls like
Code:
http://www.strangemonster.com/store/icon.php?categoryid=23

Looks like I need to find a way to make them read to the actual file to have them cache.
Reply With Quote
  #5  
Old 03-18-2004, 11:57 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Yup you're right about that part, they missed out the URL stuff for that area for some reason.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #6  
Old 03-28-2004, 07:12 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

What can I do to the code to make it work to allow caching?

The mod code looks like this:
Code:
{* ==================== Sub categories mod start *} {section name=cat_num loop=$subcategories} { if %cat_num.first% } {if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}../icon.php?categoryid={$cat}{/if}[/img] {/if} <table width="75%" border="0" align="center" cellpadding="5" cellspacing="0"> {/if} { if %cat_num.index% is div by 3} <tr> {/if} <td align="center" valign="top"> <a href="home.php?cat={ $subcategories[cat_num].categoryid }"> [img]../icon.php?categoryid={$subcategories[cat_num].categoryid}[/img] <font class="ItemsList">{ $subcategories[cat_num].category|escape }</font> {if $config.Appearance.count_products eq "Y"} ? ?{if $subcategories[cat_num].product_count} ? ?({ $subcategories[cat_num].product_count } Products) ? ?{elseif $subcategories[cat_num].subcategory_count} ({ $subcategories[cat_num].subcategory_count } Subcategories)</a> ? ?{/if} {/if} </td> { if %cat_num.last% } </tr> </table> {/if} {/section} {* ==================== Sub categories mod end *}

So they are calling the subcat icons with this line:
[img]../icon.php categoryid={$subcategories[cat_num].categoryid}[/img]


And I want the browser to cache the image so I guess I need the code to be written to the page as a true url to the image.


How can I do that?
Do have to make a new tpl file for the sub cat icons that functions like the product_thumbnail.tpl file? Is that what generates the true urls for the thumbnails? How would I implement that?
Reply With Quote
  #7  
Old 04-01-2004, 08:51 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

*Bump* anybody?
Reply With Quote
  #8  
Old 04-02-2004, 05:45 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

Well.... You will need to make a new .tpl file based on the product_thumbnail.tpl file. Probably call it cat_icon.tpl....

You will also need to add a function to the func.php file to read the file path from the 'icons' table, and call this function from within the categories.php file and add the results to the $subcategory array.

After you do this, you can call the icon in a similar way that you do with the thumbnails.. ie. {include file="cat_icon.tpl" categoryid=$subcategories[cat_num].categoryid icon_url=$subcategories.icon_url}
Reply With Quote
  #9  
Old 04-02-2004, 11:43 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Quote:
Originally Posted by TelaFirma
Well.... You will need to make a new .tpl file based on the product_thumbnail.tpl file. Probably call it cat_icon.tpl....

You will also need to add a function to the func.php file to read the file path from the 'icons' table, and call this function from within the categories.php file and add the results to the $subcategory array.

After you do this, you can call the icon in a similar way that you do with the thumbnails.. ie. {include file="cat_icon.tpl" categoryid=$subcategories[cat_num].categoryid icon_url=$subcategories.icon_url}

Thanks!! That totally points me in the right direction
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 08:31 AM.

   

 
X-Cart forums © 2001-2020