Jump to content



Latest News: (loading..)

* * * * * 6 votes

A Store Speed Optimization in Progress


  • Please log in to reply
904 replies to this topic

#901   14steve14

14steve14

    STORE OWNER NOT CODER

  • Members
  • 3,075 posts
  • Real Name:Steve
  • Gender:Male
  • Location:Dorset UK

Posted 30 June 2012 - 04:12 PM

Reduce your images files sizes. They are way too large for the size of the images. You have two choices, add a auto thumbnailer, or create a smaller version of each image used. When creating products first upload the small image, then add the large image.

That should improve the load times drastically.

Then you could remane every image and remove the spaces, and this will help with your SEO. Only a suggestion.
REMEMBER BACKUP, BACKUP AND BACKUP
I am not a coder, so dont bother sending PMs asking for help as you wont get any.  

OSC has a steep learning curve, but in general the program does work.  If it doesnt work, the chances are it is something you have done.

#902   trier

trier
  • Members
  • 33 posts
  • Real Name:Jimbo
  • Gender:Male

Posted 20 July 2012 - 07:22 AM

Hi,

A somewhat trivial question regarding items #875 through #878(ish) of this topic, the items relate to the one of the many very useful suggestions from ACIDVERTIGO - is the changed piece of code needed at all?

The tep_create_random_value function seems to generate alpha/numeric characters depending on whether an alpha/numeric field is requested:


function tep_create_random_value($length, $type = 'mixed') {
if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false;

$rand_value = '';
while (strlen($rand_value) < $length) {
if ($type == 'digits') {
$char = tep_rand(0,9);
} else {
$char = chr(tep_rand(0,255));
}
[color=#0000CD]if ($type == 'mixed') {[/color]
[color=#0000CD]if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;[/color]
[color=#0000CD]} elseif ($type == 'chars') {[/color]
[color=#0000CD]if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;[/color]
[color=#0000CD]} elseif ($type == 'digits') {[/color]
[color=#0000CD]if (preg_match('/^[0-9]$/i', $char)) $rand_value .= $char;[/color]
[color=#0000CD]}[/color]
}

return $rand_value;
}


The piece of code being changed (highlighted) seems to test the generated character for alpha/numeric – is it necessary? Could the generated character be appended to the generated field without being tested?

The question is more out of interest to satisfy my untrained curiosity/knowledge, I may be missing the point. It is not of dramatic relevance, the only purpose of the function is to generate a random cart_id or a forgotten password.


#903   acidvertigo

acidvertigo
  • Members
  • 167 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 20 July 2012 - 07:13 PM

In Oscommerce 2.3.2 this function is heavily changed. And seems to be faster than with the previous with preg_match

Edited by acidvertigo, 20 July 2012 - 07:13 PM.


#904   mr_absinthe

mr_absinthe
  • Members
  • 423 posts
  • Real Name:Alex
  • Location:London, UK

Posted 25 July 2012 - 06:46 PM

Two most memory hungry and slowest queries are related to reviews and testimonials boxes. Would anyone know if it is possible to optimize them somehow?

reviews
<!-- reviews //-->
		  <tr>
			<td>
<?php
  $info_box_contents = array();
  $info_box_contents[] = array('text' => BOX_HEADING_REVIEWS);
  new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_REVIEWS));
  $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and r.approved = '1'";
  if (isset($HTTP_GET_VARS['products_id'])) {
	$random_select .= " and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'";
  }
  $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
  $random_product = tep_random_select($random_select);
  $info_box_contents = array();
  if ($random_product) {
// display random review box
	$review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$random_product['reviews_id'] . "' and languages_id = '" . (int)$languages_id . "'");
	$review = tep_db_fetch_array($review_query);
	$review = tep_break_string(tep_output_string_protected($review['reviews_text']), 15, '-<br>');
	$info_box_contents[] = array('text' => '<div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><br><div align="center">' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>');
  } elseif (isset($HTTP_GET_VARS['products_id'])) {
// display 'write a review' box
	$info_box_contents[] = array('text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . BOX_REVIEWS_WRITE_REVIEW .'</a></td></tr></table>');
  } else {
// display 'no reviews' box
	$info_box_contents[] = array('text' => BOX_REVIEWS_NO_REVIEWS);
  }
  new infoBox($info_box_contents);
?>
			</td>
		  </tr>
<!-- reviews_eof //-->

testimonials
<!-- customer testimonials //-->
<?php
  if ($random_testimonial = tep_random_select("select * FROM " . TABLE_CUSTOMER_TESTIMONIALS . " WHERE status = 1 ORDER BY rand() LIMIT 1")) {
?>
		  <tr>
			<td>
<?php
	$info_box_contents = array();
	$info_box_contents[] = array('align' => 'left',
								 'text'  => BOX_HEADING_CUSTOMER_TESTIMONIALS
								);
	new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, '', 'NONSSL'));
	$testimonial = substr($random_testimonial['testimonials_html_text'], 0, 140);
	$info_box_contents = array();
	$info_box_contents[] = array('align' => 'left',
								 'text'  => '<a href="' . FILENAME_CUSTOMER_TESTIMONIALS .'?testimonial_id=' . $random_testimonial['testimonials_id'] . '">' . $testimonial . '...<br /><br />Read more...</a><b>'.$random_testimonial[''].'</b>'
								 );
	new infoBox($info_box_contents);
?>
			</td>
		  </tr>
<?php
  }
?>
<!-- customer testimonials_eof //-->

Absinthe Original Liquor Store

#905   rabon33

rabon33
  • Members
  • 74 posts
  • Real Name:jason ravone

Posted 06 May 2013 - 07:24 PM

do you want to check the real issues.... http://gtmetrix.com