Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

A Store Speed Optimization in Progress


Guest

Recommended Posts

Terfexdotcom,

 

It hits me that you have some other SEO contribution installed that adds the product name to the page title and also the breadcrumb.

 

You need to move the SEO breadcrumb addition to below the rest of them in header.php

 

Thanks, your a life saver, a great mod and thanks for making your instructions so easy to follow, they webpage you put with each mod makes it VERY easy to install.

- Duncan

---------------------------------

Duncan Jones

Link to comment
Share on other sites

  • Replies 905
  • Created
  • Last Reply

Any idea of what I need to set to get the Cache option working on a locally-installed Windows machine?

 

I followed the instructions, created the cache folder, updated IIS to mark it writeable, restarted IIS and got:

 

Warning: fopen(/cache/_osc_slc_index.php__english_USD.cache): failed to open stream: No such file or directory in c:\inetpub\wwwroot\osc_slc\includes\classes\page_cache.php on line 245

 

Thanks!

 

Larry

Link to comment
Share on other sites

I found this note on the zend.com site:

 

On the Windows platform, be careful to escape any backslashes used in the path to the file, or use forward slashes.

 

<?php
$handle = fopen("c:\\data\\info.txt", "r");
?>  

 

I ran a simple test, and it worked for me.

 

I'm still very much a newbie. What would I need to change in your scripts to ensure the slashes are escaped?

 

Thanks!

 

Larry

Link to comment
Share on other sites

Ah, dumb me. More research pointed out that changing the slashes won't do it.

 

Changing the permissions will do it.

 

For those who are Windows-challenged, there is a very simple explanation at this site:

 

http://www.iis-resources.com/modules/newbb...d=2213&forum=18

 

Somehow, all of the early configuration errors that I experienced I now understand.

 

Needless to say, I no longer have to "chmod" I can change security properties.

 

I may actually get to writing this up as a separate "Tip" in a week or two.

 

Larry

Link to comment
Share on other sites

So far, this works wonderfully for me. Of course, it's 2:30, I have 4 customers browsing, and what do I know? :)

 

Tomorrow will tell whether I've botched things or not. Seemed to all go ok on my test server . . .

 

-jared

Link to comment
Share on other sites

hey , i am trying to install MS3 Tax Class for ms2 contribution and got stuck on step 3 Edit includes/functions/general.php

i dont have this code in my general.php file

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);
}

 

 

MY FILE includes/functions/general.php

////
// Returns the tax rate for a zone / class
// TABLES: tax_rates, zones_to_geo_zones
 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;
   }
 }

////
// Return the tax description for a zone / class
// TABLES: tax_rates;
 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;
   }
 }

////

 

 

Thankx

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 it wih 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);
}

Link to comment
Share on other sites

The instructions say replace the function. Basically, delete (or my preferred method: comment out) the entire original function and replace it with the supplied code.

Link to comment
Share on other sites

The instructions say replace the function.? Basically, delete (or my preferred method: comment out) the entire original function and replace it with the supplied code.

 

I had the same problem as sin. thx for the fix chemo

 

appreciate all your hard work ;)

 

I was having some troubles with the tax fix, i'll post on that later

 

another question I had, since I use STS template, I've removed the footer completely from my template. Would oscommerce still reference it? I'm not sure if I need to use the banner/footer fix you have supplied

Link to comment
Share on other sites

I haven't tested it with any of the template systems...although it should be noted that most of the reported problems thus far are those with BTS/STS installed.

Link to comment
Share on other sites

just taking the item/ category count off for me helped TONS. I have about 60k products and I thank you for the insight

I'm working with a site now that has only a few products but nearly 20,000 orders and he is seeing his dedicated server MySQL load spike at times. Frequently he would see useage hit 90%+ for up to 30 seconds at a time. He was thinking it was related to something in the checkout process...until I installed a data logger.

 

Every time it took more than "X" seconds to execute a query I logged:

 

1. Date / Time

2. IP of customer

3. Query execution time

4. Actual query

 

Turns out it was the also_purchased.php module :) Now, it should have been cached right along with the category and manufacturers box but we also found out his cache was not working. Damn CRE loaded packages...a nightmare to debug.

 

At any rate, it stops those large table scans and keeps the frequency to a minimum.

 

The same result for his large number of orders will present exactly the same for someone with a large number of products and relatively few orders.

 

In addition, I noticed that the default code for the cache is reliant on SID. For customers without cookies turned on they bypass the cache and still execute the query. Now, the workaround is to create a little but of custom code :) I'll post it directly -> also_purchased.php module cache with or without cookies

Link to comment
Share on other sites

Chemo,

 

sorry for asking this late in the game (have been out of town, and just getting back into the groove again)

 

Which modules are the ones the give the most problems?

for starters could you show me what/where the Join command should go in the new_products.php file?

 

Thank you,

RW

Link to comment
Share on other sites

Chemo - Am very interested in all of your work here along with the things posted by everyone else. Nice work people :D The site I am streamlining has 25000 products in the database so as you can guess it takes a while to load...Need this

 

I am not goign to install the caching module as my site uses alot of randomly generated things and I want the page to be refreshed each time.

 

I have taken out the category count which has helped with the loading time and I have also remove d the banners and hit counter. I am getting the hang of joins but I not quite sure which areas of the site I could incorporate some joins. Could you give me a quick list of suggested places where you feel it would help please? - I will start with the new products module. Then once I am done, I will post what I have done here for the people who are struggling with the actual join code.

 

One other thing, the posted fix for query that supposedly cut out some queries where it gets the products name multiple times (new_products) did not seem to work. It just removed the name from the product display. Where should it get the variable from??

 

thanks again

 

Gareth

always here to offer some useless advice....

Link to comment
Share on other sites

...

One other thing, the posted fix for query that supposedly cut out some queries where it gets the products name multiple times (new_products) did not seem to work. It just removed the name from the product display.  Where should it get the variable from??

 

thanks again

 

Gareth

In includes/modules/new_products.php find this code:

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

...change it to this code:

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join products_description pd on p.products_id = pd.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join products_description pd on p.products_id = pd.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 

Next, find this line and comment it out like htis:

#$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

Link to comment
Share on other sites

The join method is general and can be used for a number of contributions. I would suggest installing the query debug tool and go page by page finding bugs and eliminating them.

Link to comment
Share on other sites

I have got the debug installed :D

my queries are coming down :D

I have only installed one contribution - the switch payment module.

I am working from the original code apart from that and where I have modded it myself not using contribs :D

But I use joins myself so my queries should be fine.

 

It is the default changes to code that I would like to make the most of. I am trying to develop a 'default' starting block for me to use for OSC sites which is optimised and has time consuming things like language changes already made.

 

So if you know of any areas in the default code where I can make use of the joins then let me know :D

 

thanks again

always here to offer some useless advice....

Link to comment
Share on other sites

Got a question, i have been using oscommerce and this Page Cache contribution and everything is working except the bug with the top>> catalog issue. I have to get that fixed but i have 2 questions. Why does my site take so long for it to load. It says it loads very fast but thats without pics and what not. Oscommerce loads everything all at once and then displays it. How can i fix that? Also i have emailed someone, i think you chemo, but i need code to make a caching compatible with coolmenu.

 

Thanks

Danny

Link to comment
Share on other sites

And also what should i have checked or unchecked in the sissions config?

 

Thanks

Danny

 

This is what i have now:

Session Directory /cache ??

Force Cookie Use False

Check SSL Session ID False

Check User Agent False

Check IP Address False

Prevent Spider Sessions True

Recreate Session False

Link to comment
Share on other sites

Got a question, i have been using oscommerce and this Page Cache contribution and everything is working except the bug with the top>> catalog issue. I have to get that fixed but i have 2 questions. Why does my site take so long for it to load. It says it loads very fast but thats without pics and what not. Oscommerce loads everything all at once and then displays it. How can i fix that? Also i have emailed someone, i think you chemo, but i need code to make a caching compatible with coolmenu.

 

Thanks

Danny

The reason that the site takes so long to load is your DHTML menu. Just about every DHTML menu system I've seen used for osC has slowed it down tremendously. Do you want fancy or performance?

 

I would recommend dropping the DHTML menu and make another that is purely text link based and cache it...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...