osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

code reduction/simplification ideas

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 12-02-2003, 08:44 PM
kodersoftware's Avatar
New Member
 
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kodersoftware
Default code reduction/simplification ideas

i would like to start a topic about streamlining the code. i feel as though there may be better ways to get the same visual effect on the page with less HTML in the background.

what spawned this idea is that sometimes I get pages that only get up to the column_right.php and then the code stops there, so it's just a partial page and there is no footer.

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
  #2  
Old 12-02-2003, 08:55 PM
kodersoftware's Avatar
New Member
 
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kodersoftware
Default fully qualified domain name redundancy

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;
to
Code:
$link = DIR_WS_HTTP_CATALOG;
The only problem with doing just this is that there are some situations in which the entire url should be sent, like in emails, so you have to check any php code or strings that will send the url to non-relative locations. There may be other things that this is going to screw up, but I'm just finding them as I go along at this point.

Thoughts
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 12-02-2003, 09:04 PM
kodersoftware's Avatar
New Member
 
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kodersoftware
Default simplify links when listing products

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 = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
			  $lc_text = $listing['products_name'] . '</a> ';
            }
            break;
and
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 = ' <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> ';
			  $lc_text = ' <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;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 12-02-2003, 09:27 PM
kodersoftware's Avatar
New Member
 
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kodersoftware
Default

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>
just be
Code:
<td height="10"> </td>
?

anyone... anyone?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5  
Old 12-11-2003, 12:48 PM
kodersoftware's Avatar
New Member
 
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kodersoftware
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #6  
Old 12-16-2003, 12:17 AM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 11,080
Thanks: 81
Thanked 348 Times in 327 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Default

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 That is a nice one. Thanks for sharing.
__________________
Michael Sasek
osCMax Developer


  • osCMax Templates - Hundreds of premium quality templates designed for osCMax 2. Loyalty discounts up to 30% off!
    Each purchase supports the osCMax project with much needed funds!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. Default multi server configuration for exceptional performance!

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 09:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax