This is a discussion on code reduction/simplification ideas within the osCMax v1.7 Discussion forums, part of the osCMax v1.7 Forums category; i would like to start a topic about streamlining the code. i feel as though there may be better ways ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| ||||
| ||||
| so i started carefully digging and trying to reduce code and simplify. my next posts detail some of my findings and what i did. NOTE: backup your files before you do ANYTHING! All additional ideas and help is appreciated! |
| Sponsored Links | ||
| ||
| |
|
#2
| ||||
| ||||
| the first thing i notice when i view source is my fully qualified domain name, http://www.moon-dreams.com mentionned over and over and over again. It can be especially terrible on the pages that list a bunch of products, as there is one link assigned to the picture, and then it is repeated again for the product name, and then again for the buy now button, albeit modified a bit. I went into /catalog/includes/functions/html_output.php and altered the tep_href_link function, changing Code: $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; Code: $link = DIR_WS_HTTP_CATALOG; Thoughts |
|
#3
| ||||
| ||||
| in all code that lists products in a category or group (not the product detail page), if you keep the default setup for displaying product info, you could also alter the code so that only one link is used between the product image and the product name. where you will alter the code will depend on your installation, but for me i went into /catalog/includes/modules/product_listing_col.php and modified the following 2 sections (the code that was there has a # sign before it and my code below the commented line) Code: case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
#$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
$lc_text = $listing['products_name'] . '</a>';
} else {
#$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>&nbsp;';
$lc_text = $listing['products_name'] . '</a>&nbsp;';
}
break;
Code: case 'PRODUCT_LIST_IMAGE':
$lc_align = 'center';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
#$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
} else {
#$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>&nbsp;';
$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
}
break;
|
|
#4
| ||||
| ||||
| another one: is ther any reason at all to use those transparent gifs inside the table cells? couldn't this: Code: <td><img src="/catalog/images/transprent.gif" alt="" width="1" height="10"></td> Code: <td height="10">&nbsp;</td> anyone... anyone? |
|
#5
| ||||
| ||||
| another idea that would GREATLY reduce the amaount of data to transfer to the client: div's instead of tables for all the inner tables. YES, I know, sometimes tables are just easier. In some cases, I'll use tables for layout. what do ya think? right now, catalog/index.php returns a file that is 41,923 bytes - thats JUST the text. it's a complex page, but i'd like to see that get reduced to about 25,000 bytes max. my site is getting decent volume, so every kb makes a difference and will save me money. |
|
#6
| ||||
| ||||
| kodersoftware, this is a template/design issue mostly. Since BTS is used, it should be fairly easy for you to rebuild the code to your liking. The product listing code that you came up with is quite elegant
__________________ Michael Sasek osCMax Developer
|
| Sponsored Links | ||
| ||
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Gift voucher balance not being subtracted. Any ideas? | malcol27 | osCMax v1.7 Discussion | 2 | 03-22-2006 07:31 AM |
| Change Create Order Text "Réduction" and "Li | kelly34 | osCMax v2 Customization/Mods | 3 | 08-03-2005 11:55 AM |
| Secure admin backend.. Help and/or ideas pleassee | edgecrush3r | osCMax v1.7 Installation | 3 | 07-31-2004 01:52 AM |
| Any ideas? PAYPAL IPN Not posting! Searched boards. | bleu | osCMax v1.7 Discussion | 5 | 06-29-2004 07:05 PM |