Jump to content

Archived

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

Chemo

A Store Speed Optimization in Progress

Recommended Posts

Ok Did test order with cookies enabled everything went well. Disabled cookies deleted all old cookies and tried again. Worked Great. Cant wait to get the new modifications.

 

Had no problems logging off or on at all either.

 

Thanks again Chemo.


:)

Share this post


Link to post
Share on other sites

:thumbsup:

Just uploaded the v1.3 release of the Page Cache contribution.

 

If you have v1.0 - v1.2 installed upgrade directly.

 

Just upgraded and noticed that the breadcrumb trail which reads home>>Catalog>>

 

Switches backwards when logging in

ie...

account>>home>>catalog.

 

Thought it may be a mistake by me but it does the same thing on the test site too.

 

Not to big of a deal. Just wanted to let you know though.

 

Thanks a million for the hard work


:)

Share this post


Link to post
Share on other sites

Big bug fix creates small bug problem :) Isn't that par for the course?

 

The issue is that the breakcrumb trail on those pages are added BEFORE the header.php include where the others are added to the trail.

 

How do we fix it? Don't know yet...but I'm think about it.

 

Hey, at least the session_id is fixed! :)

Share this post


Link to post
Share on other sites
Big bug fix creates small bug problem :)  Isn't that par for the course?

 

The issue is that the breakcrumb trail on those pages are added BEFORE the header.php include where the others are added to the trail.

 

How do we fix it?  Don't know yet...but I'm think about it.

 

Hey, at least the session_id is fixed! :)

 

LOL :D

:'( Bugs Yuck! :blink:

But I for one like small bugs better than big bugs!


:)

Share this post


Link to post
Share on other sites
LOL :D

:'( Bugs Yuck! :blink:

But I for one like small bugs better than big bugs!

 

Ok I had an Idea to help solve this and so far its working for me.

I created a new file called breadcrumb.php and placed the code you moved to the header there, deleted the code from the header then called the breadcrumb.php file at the bottom of application_top. It seems to be working like this. I will test it a little more then send it over to you.


:)

Share this post


Link to post
Share on other sites

That will present problems since the breadcrumb trail URL's will be malformed due to the tep_href_link() code change. It will only affect those that are not logged in and have cookies disabled.

Share this post


Link to post
Share on other sites

If you've installed the version 1.3 and want to try the fix for the breadcrumb trail on non-cached pages here is the beta code:

<{POST_SNAPBACK}>

 

A fix that I'm exploring is changing the add() method in /includes/classes/breadcrumb.php to:

    function add($title, $link = '', $unshift = 0) {   
  switch ($unshift) {
   case 0:
	 $this->_trail[] = array('title' => $title, 'link' => $link);
	 break;
 case 1:
	 array_unshift($this->_trail, array('title' => $title, 'link' => $link)); 	 
	 break;
  }      
   }

 

Then, in includes/header.php change the index page breadcrumb addition to this:

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT), 1);

It works by the new switch (3rd parameter). If it is set as 1 it will add to the beginning of the breadcrumb trail. I've just added it to the dev site and am still testing it. If you install the beta code let me know how it works for you...

 

BTW, for those that have the store in a folder and NOT the root directory like the dev site: you'll have to add them in reverse order with the unshift flag set to 1.

 

As an example, this:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

Becomes this:

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT), 1);
$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER, 1);

Share this post


Link to post
Share on other sites
If you've installed the version 1.3 and want to try the fix for the breadcrumb trail on non-cached pages here is the beta code:

<{POST_SNAPBACK}>

 

A fix that I'm exploring is changing the add() method in /includes/classes/breadcrumb.php to:

 ? ?function add($title, $link = '', $unshift = 0) { ? 
? switch ($unshift) {
? ?case 0:
?	$this->_trail[] = array('title' => $title, 'link' => $link);
?	break;
?case 1:
?	array_unshift($this->_trail, array('title' => $title, 'link' => $link)); ?	
?	break;
? } ? ? ?
? ?}

 

Then, in includes/header.php change the index page breadcrumb addition to this:

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT), 1);

It works by the new switch (3rd parameter).  If it is set as 1 it will add to the beginning of the breadcrumb trail.  I've just added it to the dev site and am still testing it.  If you install the beta code let me know how it works for you...

 

BTW, for those that have the store in a folder and NOT the root directory like the dev site: you'll have to add them in reverse order with the unshift flag set to 1.

 

As an example, this:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

Becomes this:

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT), 1);
$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER, 1);

 

Thanks Again Chemo that seems to have done the trick. :thumbsup:


:)

Share this post


Link to post
Share on other sites

Outstanding...let's hear back from one more person that is is functioning properly and I'll release another version with updated install directions.

Share this post


Link to post
Share on other sites

Didnt work for me.

 

Put Catalog first

 

eg. (With it set to 1)

Catalog ? Help Desk ? Home

8 Oz Steel Hip Flask ? Catalog ? Gifts ? Home

 

eg. (With it set to 0)

Contact Us ? Home ? Catalog

48" Decorative Sword ? Home ? Catalog ? Swords ?

 

eg. (with it set to 1 and things reversed)

Catalog ? 3pc "Tiger Claw" Knife Set ? Home ? Daggers ?

Catalog ? Contact Us ? Home

 

eg. (with it set to 0 and things reversed)

Contact Us ? Catalog ? Home

Backpack/Rolling Cart (20" Tall) ? Catalog ? Home ? Luggage ?


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

Duncan Jones

Share this post


Link to post
Share on other sites
Didnt work for me.

 

Put Catalog first

 

eg. (With it set to 1)

Catalog ? Help Desk ? Home

8 Oz Steel Hip Flask ? Catalog ? Gifts ? Home

 

eg. (With it set to 0)

Contact Us ? Home ? Catalog

48" Decorative Sword ? Home ? Catalog ? Swords ?

 

eg. (with it set to 1 and things reversed)

Catalog ? 3pc "Tiger Claw" Knife Set ? Home ? Daggers ?

Catalog ? Contact Us ? Home

 

eg. (with it set to 0 and things reversed)

Contact Us ? Catalog ? Home

Backpack/Rolling Cart (20" Tall) ? Catalog ? Home ? Luggage ?

First, you have the catalog in your root directory but still have both URL's added to the breadcrumb. It's a common mistake so don't worry too much about that but here is your fix:

Change:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

To this:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER, 1);
#$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

Also, make sure you made the changes to /includes/classes/breadcrumb.php as mentioned in the beta code.

Share this post


Link to post
Share on other sites

It seems my pages arent cacheing now... Havent changed anything.

 

Index.php

Current Parse Time: 0.179 s with 63 queries

Current Parse Time: 0.180 s with 63 queries

Current Parse Time: 0.181 s with 63 queries

 

Product_Info.php

Current Parse Time: 0.153 s with 76 queries

Current Parse Time: 0.153 s with 76 queries

Current Parse Time: 0.155 s with 76 queries

 

DAMN IT!! Only thing ive done to those settings is change delete cache to true which then changed to false.


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

Duncan Jones

Share this post


Link to post
Share on other sites
First, you have the catalog in your root directory but still have both URL's added to the breadcrumb.  It's a common mistake so don't worry too much about that but here is your fix:

Change:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

To this:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER, 1);
#$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

Also, make sure you made the changes to /includes/classes/breadcrumb.php as mentioned in the beta code.

 

Made this change and now the result is -

Home ? Backpack/Rolling Cart (20" Tall) ? Luggage ?

Home ? Contact Us

Home ? Diamond Cut Knife Set (21pc) ? Knives ? Kitchen ?


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

Duncan Jones

Share this post


Link to post
Share on other sites
It seems my pages arent cacheing now... Havent changed anything.

 

Index.php

Current Parse Time: 0.179 s with 63 queries

Current Parse Time: 0.180 s with 63 queries

Current Parse Time: 0.181 s with 63 queries

 

Product_Info.php

Current Parse Time: 0.153 s with 76 queries

Current Parse Time: 0.153 s with 76 queries

Current Parse Time: 0.155 s with 76 queries

 

DAMN IT!! Only thing ive done to those settings is change delete cache to true which then changed to false.

 

Fixed it, I had to MANUALLY change the delete cache files to false (by the first page refreshed after set to true). It was set as false in settings but upon doing debug saw this. [PAGE_CACHE_DELETE_FILES] => true

 

So went in and clicked update and updated the setting to false. Works great now.


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

Duncan Jones

Share this post


Link to post
Share on other sites

Which version do you have installed? Did you follow the upgrade directions? Did you move the breadcrumb code out of application_top.ph and into header.php?

Share this post


Link to post
Share on other sites
Fixed it, I had to MANUALLY change the delete cache files to false (by the first page refreshed after set to true). It was set as false in settings but upon doing debug saw this. [PAGE_CACHE_DELETE_FILES] => true

 

So went in and clicked update and updated the setting to false. Works great now.

Upgrade to v1.3 and follow the upgrade directions. You have to move the breadcrumb code to header.php for this to work properly.

 

I checked your site with a non-cookied site and noticed that the breadcrumb is still being added in applicaiton_top.php

Share this post


Link to post
Share on other sites

I did upgrade to V1.3!

 

In application top -

 

// include the breadcrumb class and start the breadcrumb trail
 require(DIR_WS_CLASSES . 'breadcrumb.php');
 $breadcrumb = new breadcrumb;
/*
 $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
// $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

In header.php

<?php
$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER, 1);
#$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));
// add category names or the manufacturer name to the breadcrumb trail

 

Only time this wouldnt be true is on the secure pages which im yet to change.


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

Duncan Jones

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Chemo,

 

I am attempting to impliment the tax class and need to know how I can make it work with the tax emempt mod. Here is the tax code in place in general.php for tax exempt.

 

////
// Returns the tax rate for a zone / class
// TABLES: tax_rates, zones_to_geo_zones

// BEGIN - Tax Exempt and Organization Discounts
// old:function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
 function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1, $tax_exempt = -1) {
// END - Tax Exempt and Organization Discounts

   global $customer_zone_id, $customer_country_id;
// BEGIN - Tax Exempt and Organization Discounts
   if ($tax_exempt == 1) { return 0; }
// END - Tax Exempt and Organization Discounts

   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;
// BEGIN - Tax Exempt and Organization Discounts
 function tep_get_tax_description($class_id, $country_id, $zone_id, $tax_exempt) {
   if ($tax_exempt == 1) { return TEXT_TAX_EXEMPT; }
// END - Tax Exempt and Organization Discounts

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

////
// Add tax to a products price
 function tep_add_tax($price, $tax) {
   global $currencies;

   if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {
     return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_calculate_tax($price, $tax);
   } else {
     return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
   }
 }

// Calculates Tax rounding the result
 function tep_calculate_tax($price, $tax) {
   global $currencies;

   return tep_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
 }

 

Any ideas of what I need to do to make it work with the tax.php?


:)

Share this post


Link to post
Share on other sites

Try this code:

////
// 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, $tax_exempt = -1) {
   global $customer_zone_id, $customer_country_id, $osC_Tax;
// BEGIN - Tax Exempt and Organization Discounts
if ($tax_exempt == 1) { return 0; }
// END - Tax Exempt and Organization Discounts
else { return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id); }	
 }

////
// Return the tax description for a zone / class
// TABLES: tax_rates;
function tep_get_tax_description($class_id, $country_id, $zone_id, $tax_exempt) {
global $osC_Tax;
if ($tax_exempt == 1) { return TEXT_TAX_EXEMPT; }
else { return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id); }
 }

////
// Add tax to a products price
 function tep_add_tax($price, $tax) {
   global $currencies;

   if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {
     return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_calculate_tax($price, $tax);
   } else {
     return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
   }
 }

// Calculates Tax rounding the result
 function tep_calculate_tax($price, $tax) {
   global $currencies;

   return tep_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
 }

The only methods that would change are tep_get_tax_rate() and tep_get_tax_description()

Share this post


Link to post
Share on other sites

As a side note, since I'm so big on debugging, do you have the Queries and Parse time contribution installed? If so, you can change the contents of includes/performance.php to read as follows:

if (DISPLAY_PAGE_PARSE_TIME == 'true') {
$debug['TAX_RATES'] = $osC_Tax->tax_rates;
$time_start = explode(' ', PAGE_PARSE_START_TIME);
$time_end = explode(' ', microtime());
$parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
echo '<div align="center"><span class="smallText">Current Parse Time: <b>' . $parse_time . ' s</b> with <b>'.sizeof($debug['QUERIES']).' queries</b></span></div>';
if ($_REQUEST['output'] == '0') $_SESSION['output'] = '0';
if ($_REQUEST['output'] == '1' || $_SESSION['output'] == '1')
{
 $_SESSION['output'] = '1';
 echo '<pre>';
 print_r($debug);
 echo '</pre>';
} # END if request
}
unset($debug);

This will add the tax rates used on that page as part of the debug array. If it were me I'd want to know if the contribution actually worked :)

Share this post


Link to post
Share on other sites
As a side note, since I'm so big on debugging, do you have the Queries and Parse time contribution installed?  If so, you can change the contents of includes/performance.php to read as follows:

if (DISPLAY_PAGE_PARSE_TIME == 'true') {
$debug['TAX_RATES'] = $osC_Tax->tax_rates;
$time_start = explode(' ', PAGE_PARSE_START_TIME);
$time_end = explode(' ', microtime());
$parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
echo '<div align="center"><span class="smallText">Current Parse Time: <b>' . $parse_time . ' s</b> with <b>'.sizeof($debug['QUERIES']).' queries</b></span></div>';
if ($_REQUEST['output'] == '0') $_SESSION['output'] = '0';
if ($_REQUEST['output'] == '1' || $_SESSION['output'] == '1')
{
?$_SESSION['output'] = '1';
?echo '<pre>';
?print_r($debug);
?echo '</pre>';
} # END if request
}
unset($debug);

This will add the tax rates used on that page as part of the debug array.  If it were me I'd want to know if the contribution actually worked :)

 

 

Thanks Again Chemo. and Yes it does work. I haven't had any problems with it so far anyway but I am still in the building and learning stage.

 

BTW pm me with some rates if interested in a custom modification for my site.


:)

Share this post


Link to post
Share on other sites

×