Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Page cache by Chemo


100asa

Recommended Posts

  • Replies 91
  • Created
  • Last Reply

Top Posters In This Topic

The config cache update file setting was written specifically for this contribution: http://www.oscommerce.com/community/contributions,1862

 

Further, that is the only contribution I make sure ALL my code is compatible with. Page cache was written specifically to not only be compatible but seamlessly integrated with it.

 

So, if you have the configuration cache installed this is the absolute filesystem path the admin/includes/configuration_cache.php file.

Link to comment
Share on other sites

Thank you, Chamo, for all your contribution.

One question: I'm try to install MS3 Tax Class for osCommerce-ms2, but I've some difficult to replace code into general.php.

REPLACE tep_get_tax_rate() it with this code:

function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {

global $customer_zone_id, $customer_country_id, $osC_Tax;

return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);

}

but what part of original code I've to replace?

Please, tell me from ... to ...

Thank you.

Edited by 100asa

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Find this:

  function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
   global $customer_zone_id, $customer_country_id;

   if ( ($country_id == -1) && ($zone_id == -1) ) {
     if (!tep_session_is_registered('customer_id')) {
       $country_id = STORE_COUNTRY;
       $zone_id = STORE_ZONE;
     } else {
       $country_id = $customer_country_id;
       $zone_id = $customer_zone_id;
     }
   }

   $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority");
   if (tep_db_num_rows($tax_query)) {
     $tax_multiplier = 1.0;
     while ($tax = tep_db_fetch_array($tax_query)) {
       $tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);
     }
     return ($tax_multiplier - 1.0) * 100;
   } else {
     return 0;
   }
 }

and replace with this:

  function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
   global $customer_zone_id, $customer_country_id, $osC_Tax;
return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);
 }

 

Find this:

  function tep_get_tax_description($class_id, $country_id, $zone_id) {
   $tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority");
   if (tep_db_num_rows($tax_query)) {
     $tax_description = '';
     while ($tax = tep_db_fetch_array($tax_query)) {
       $tax_description .= $tax['tax_description'] . ' + ';
     }
     $tax_description = substr($tax_description, 0, -3);

     return $tax_description;
   } else {
     return TEXT_UNKNOWN_TAX_RATE;
   }
 }

and replace with this:

  function tep_get_tax_description($class_id, $country_id, $zone_id) {
global $osC_Tax;
return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id);
 }

Link to comment
Share on other sites

Is it normal that I've just edit in admin section one of my products and at the same time the product info page show (in guest page) the product infomation (price, text, last update date etc.) just updated?

How can I do to control that the page cache script is still working?

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Why in some page (as product new, specials, login, reviews, etc) I see in the header first section and after Home page? (Login ? Top, New Products ? Top, Specials ? Top, and cart page)

Thank you

please browse into my website to see this

Edited by 100asa

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Is it normal that I've just edit in admin section one of my products and at the same time the product info page show (in guest page) the product infomation (price, text, last update date etc.)  just updated?

How can I do to control that the page cache script is still working?

No...your settings are not correct. Check your debug output and notice your settings at the bottom. Correct them.

 

Why in some page (as product new, specials, login, reviews, etc) I see in the header first section and after Home page? (Login ? Top, New Products ? Top, Specials ? Top, and cart page)

Thank you

please browse into my website to see this

Read or search the support thread for the discussion and answer.

Edited by Chemo
Link to comment
Share on other sites


This is my output debug:

Array
(
   [PAGE_CACHE] => Array
       (
           [admin_config_settings] => Array
               (
                   [ENABLE_PAGE_CACHE] => true
                   [PAGE_CACHE_LIFETIME] => 30
                   [PAGE_CACHE_DEBUG_MODE] => false
                   [PAGE_CACHE_DISABLE_PARAMETERS] => false
                   [PAGE_CACHE_DELETE_FILES] => true
                   [PAGE_CACHE_UPDATE_CONFIG_FILES] => /web/htdocs/www.100asa.it/home/securecentoasa/includes/configuration_cache.php
               )

           [cache_dir] => /web/htdocs/www.100asa.it/home//cache/
           [PAGE_CACHE_UPDATE_CONFIG_FILE_EXISTS] => true
           [deleting_file] => Array
               (
                   [0] => /web/htdocs/www.100asa.it/home//cache/_product_info.php_products_id=355__.cache
               )

           [delete_cache_files] => cache files deleted - top level
           [cache_filename] => _index.php
           [cache_param] => debug=1
           [cache_language] => _italian
           [cache_currency] => _EUR
           [cache_file] => /web/htdocs/www.100asa.it/home//cache/_index.php_debug=1_italian_EUR.cache
           [cache_lifetime] => 1800 seconds
           [debug_output] => true
           [is_guest] => 1
           [compress_buffer] => compressing buffer
           [customer_cart] => 1
           [customer_sid] => id=6661244f092b76fa48c6cb462f620596
           [is_guest_check] => customer_id not set - cache_this_page()
           [no_file_or_expired] => file does not exist or is expired
           [ob_started] => ob started @ 1102338541
           [is_guess_check_end] => customer_id not set - end_page_cache()
           [output_ob] => output_ob = true
           [ob_compressed] => output buffer flushed and compressed
           [output_2_screen] => successfully output to screen
           [unset_screen_buffer] => screen buffer unset
           [output] => compressed ob sent to screen
           [file_write] => buffer writtent to file
           [unset_write_buffer] => write buffer unset
           [write_file] => compressed ob written to file
           [unset_cache_compress] => cache compress unset
       )

   [COOKIE_INFO] => Array
       (
           [cookie_test] => please_accept_for_session
       )

   [SESSION_INFO] => Array
       (
           [SESSION_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
           [SESSION_IP_ADDRESS] => 80.182.118.228
           [cart] => shoppingcart Object
               (
                   [contents] => Array
                       (
                       )

                   [total] => 0
                   [weight] => 0
                   [content_type] => 
               )

           [language] => italian
           [languages_id] => 4
           [currency] => EUR
           [navigation] => navigationhistory Object
               (
                   [path] => Array
                       (
                           [0] => Array
                               (
                                   

 => index.php
                                   [mode] => NONSSL
                                   [get] => Array
                                       (
                                           [debug] => 1
                                       )

                                   [post] => Array
                                       (
                                       )

                               )

                       )

                   [snapshot] => Array
                       (
                       )

               )

       )

)
1

 

Page cache is correct and working?

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

[PAGE_CACHE_DELETE_FILES] => true

This should be false. If the setting is true on every page load it will delete the cache files (thereby having to parse the page again). Most likely the setting below is incorrect.

[PAGE_CACHE_UPDATE_CONFIG_FILES] => /web/htdocs/www.100asa.it/home/securecentoasa/includes/configuration_cache.php

Notice that this contribution is usually installed in the admin directory. Maybe try adding ...securecenoasa/admin/includes...

[cache_dir] => /web/htdocs/www.100asa.it/home//cache/

Notice the two slashes (home//cache). Correct that...

[cache_file] => /web/htdocs/www.100asa.it/home//cache/_index.php_debug=1_italian_EUR.cache

Once again...notice the two slashes.

Link to comment
Share on other sites

[PAGE_CACHE_DELETE_FILES] => true

How can I resolve this problem? Into your contribution delete cache file is false.

My admin directory is called "securecentoasa"

How can I resolve the two slashes?

[cache_dir] => /web/htdocs/www.100asa.it/home//cache/
(into configure.php?) Edited by 100asa

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Chemo, this problem:

Why in some page (as product new, specials, login, reviews, etc) I see in the header first section and after Home page? (Login ? Top, New Products ? Top, Specials ? Top, and cart page)

Thank you

please browse into my website to see this

is because your contribution page cache 1.3 delete this code from application_top

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));
// add category names or the manufacturer name to the breadcrumb trail
if (isset($cPath_array)) {
for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
$categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
if (tep_db_num_rows($categories_query) > 0) {
$categories = tep_db_fetch_array($categories_query);
$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
} else {
break;
}
}
} elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
$manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
if (tep_db_num_rows($manufacturers_query)) {
$manufacturers = tep_db_fetch_array($manufacturers_query);
$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
}
}
// add the products model to the breadcrumb trail
if (isset($HTTP_GET_VARS['products_id'])) {
$model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
if (tep_db_num_rows($model_query)) {
$model = tep_db_fetch_array($model_query);
$breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
}
}

and paste it into header.

Perhaps is it the problem?

Thank you

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Bobby - - I've noticed this a few times, when I refresh a page immediately after deleting the cache files (via the admin). I'm guessing it's happening *while* the page cache files are being deleted.

 

In any case, here's what I see:

 

Warning: unlink(/home/my_username/public_html//cache/_product_info.php_products_id=5059__.cache): No such file or directory in /home/username/public_html/includes/classes/page_cache.php on line 301

 

If I wait a few seconds, and then refresh, all is good.

 

-jared

Link to comment
Share on other sites

  • 1 month later...

Orders getting posted under wrong customer.

 

I have a site that is supporting about 16.6 million hits & 2.4 million page views per month, so at times the server was getting a little taxed. Anyhow, we installed Page_Cache 1.3 in dec of 2004. Everything was working great. On Jan 15 of 2005, we upgraded to 1.4, and everything seemed OK, but we have found 3 orders got placed under the wrong customer. The shipping address & billing address are the correct customer, but the customer is a different customer. We have not made *ANY* other changes to the system since the upgrade other than adding an additional processor & another gig of ram.

Has anybody else noticed the problem?

Anybody know of any thing to try?

 

We are really under the gun, because the site takes several 100 orders per day, so we cannot let this go on.

 

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Hi

 

I've added a lot of contributions lately, and now when i enable page cache in Admin, it works for a while, then i can't change pages. The address bar changes but the page stays the same. The only way to get it to work again is to clear the cache file,or disable the feature. Has anybody got any ideas why it might do this, or if anybody has had this problem and how they resolved it.

 

TIA

 

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Link to comment
Share on other sites

  • 2 months later...
I've just installed this contribution:

http://www.oscommerce.com/community/contributions,2561/

 

First question:

what's CHMOD for cache folder?

config cache update file: what's the setting?

 

Thank you

 

 

I have installed page cache contribution ver. 1.5. Once I enable page cache in admin, I am unable to move between categories and products. I am able to go to shopping cart, shipping, contact us, etc. pages, but I am unable to view products or categories without deleting (clearing) the cache file. In other words if I have an empty or deleted cache file, then I am able to click on a category and then go to the list of products, but I cannot then go back to the categories page. Since both of these pages are accessed via index.php, it is as though cache cannot differentiate the pages. I'm not sure if this makes sense, but that is what seems to be happening.

 

I've tried it with and without the GC patch (although I don't see that this would have any effect) and there is no change in the behavior.

 

 

Any ideas about what I can do about this?

 

Thanks.

Link to comment
Share on other sites

  • 2 months later...

Hi Chemo and others

 

unfortunatly i get this error

 

Fatal error: Cannot instantiate non-existent class: infoboxheading in /home/XXXX/public_html/shop/includes/boxes/shopping_cart.php on line 20

 

 

i have AutoTheme installed, and im expecting it to conflict with each other.

 

 

have anyone got a solution to this ?

Link to comment
Share on other sites

  • 3 months later...
Hi Chemo and others

 

unfortunatly i get this error

 

Fatal error: Cannot instantiate non-existent class: infoboxheading in /home/XXXX/public_html/shop/includes/boxes/shopping_cart.php on line 20

i have AutoTheme installed, and im expecting it to conflict with each other.

have anyone got a solution to this ?

Hello,

 

I use a "Page Cache v1.5". I get a "<osCsid>" in my product path: http://store.com/osCommerce/product_info.p...&<osCsid>. I think I found what causes <oscid> to appear in the path, that a tep_href_link function in includes/functions/html_output.php:

}

 

if (!tep_session_is_registered('customer_id') && ENABLE_PAGE_CACHE == 'true' && class_exists('page_cache')) {

$link .= $separator . '<osCsid>';

} elseif (isset($_sid)) {

$link .= $separator . $_sid;

}

 

return $link;

}

 

////

// The HTML image wrapper function

If I replace that code with an original one, I don't see an <osCsid> on my pages any more. I don't know how this change affects what contib does. Does anybody else having the same problem as I do? What a solution to it?

 

Thanks for any help,

Irina.

Link to comment
Share on other sites

  • 7 months later...

Hello,

 

I'm designing an OSC based website and using the Page Cache v1.5 contribution (as well as Ultimate SEO URLs v2.1d and Queries Debug v1.6) and have a problem that I can not find a solution to on the forum and would greatly appreciate your help.

 

I'm using a custom template with the Cart Item Count in the header, but when I add an item to the shopping cart, the index page (as well as others) does not update the quantity correctly. I'm not sure if this issue is contribution configuration, cache or session related.

 

If contribution related, I imagine that I might need to add or modify the code in the includes/header.php, includes/application_top.php and/or the includes/classes/seo.class.php files to correct the problem, but not being a coder, I do not know exactly how to do accomplish this and would love to know if anyone has a solution to this problem.

 

The site can be viewed here.

 

Thank you in advance for your help.

 

Dreamlab

Link to comment
Share on other sites

Hello,

 

I'm designing an OSC based website and using the Page Cache v1.5 contribution (as well as Ultimate SEO URLs v2.1d and Queries Debug v1.6) and have a problem that I can not find a solution to on the forum and would greatly appreciate your help.

 

I'm using a custom template with the Cart Item Count in the header, but when I add an item to the shopping cart, the index page (as well as others) does not update the quantity correctly. I'm not sure if this issue is contribution configuration, cache or session related.

 

If contribution related, I imagine that I might need to add or modify the code in the includes/header.php, includes/application_top.php and/or the includes/classes/seo.class.php files to correct the problem, but not being a coder, I do not know exactly how to do accomplish this and would love to know if anyone has a solution to this problem.

 

The site can be viewed here.

 

Thank you in advance for your help.

 

Dreamlab

 

well, the reason for that is rather simple.

when a page is cached, everyone who requests that page after it was cached will receive the very same page content. That is what caching is all about, no more database calls or computations, the page is basically fixed and send out as is.

Ofcourse there are ways around that. The most obvious example is in the contribution itself, the cart box.

Instead of putting the cart box in the page that is cached, page cache puts a placeholder like <%CART%> in its place. Then when the page is requested from the cache, the page cache class first replaces that placeholder in the file with the actual cart box html specific for that customer/session and then sends it out. The same is done for the session id's in the links on the page.

 

so if you wish to keep caching pages but also have session specific data on them, use placeholders.

Treasurer MFC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...