Thursday, October 2, 2008

Change the last modification date on products in osCommerce

I've recently made a ton of changes to my existing site which include more information on the product info pages. I'd like to have these pages reindexed. I decided to change the last modification date on my sitemap for all the products. To do this I ran the following sql statement via phpadmin.

UPDATE `products` SET products_last_modified=now()

Friday, June 27, 2008

Admin Paging Contribution

I don't think a large site could do without the Admin Paging contribution, however, it is quite annoying that the pagination doesn't work properly when selecting , copying, or moving an item from the product list, you'll always return to page 1 then have to click through the pages to find your product again.

I've tried every code change I could find on the forums and settled on this one. The product I am interested in will remain at the #1 position when selected from a search, copying or moving, not perfect, but definitely good enough.

Here's the post http://forums.oscommerce.com/index.php?s=&showtopic=230262&view=findpost&p=1065755

Thursday, June 19, 2008

Adding Date and Order Number to Packing Slip

Here's a post on just how to add the order number and order date to the packing slip:

osCommerce order number and date on packing slip modifications

Monday, April 28, 2008

Sort osCommerce attributes by price

As you are aware, osCommerce will sort the product attributes (options) according to the sequence they are entered. This may cause some confusion if you add another attribute with a lower price out of sequence.

To show attributes with the lowest price first its a quick fix.

In /product_info.php replace the following:

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

with:

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.products_attributes_id");

This change will sort the attributes by price, if you have two items with the same price, those will be sorted by price first, then by the order entered.


Sunday, April 20, 2008

Add Category Name To Product Info Pages

There is a very simple way to add the category name to the product info pages in osCommerce. Here's how:

In functions/general.php add the following code:


//// Return categories name
// TABLES: categories_description
function tep_get_categories_name($who_am_i) {
global $languages_id;

$the_categories_name_query= tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id= '" . $who_am_i . "' and language_id= '" . $languages_id . "'");

$the_categories_name = tep_db_fetch_array($the_categories_name_query);

return $the_categories_name['categories_name'];

}

////


Now you should be able to drop the category name into your product_info.php wherever you'd like using the following:

<?php echo tep_get_categories_name($current_category_id);?>



Of course the simplest way to implement the code is to add it just after the products name, like this:

<td class="pageHeading" valign="top"><?php echo $products_name; ?> - <?php echo tep_get_categories_name($current_category_id);?></td>

Which displays this on your product info page:

Product Name - Category Name

Saturday, April 19, 2008

Easy Fixed Width & Center osCommerce Store

Standard osCommerce installs a fluid site, which means your site width will adjust to fill the visitors entire screen. While a fluid site is convenient in this aspect, its an inconvenience when trying to create custom headers and footers as well as customizing the look of your store.

When determining the width of your site, consider your page layout, graphics, header and footer and so on. You may also consider the majority of users screen resolution.

According to W3 Schools Browser Display Statistics 54% of Internet users have a screen resolution setting of 1024x768. I've found that a 960 pixel width site is a good fit for 1024x768 resolution screens. Of course, anyone with a screen resolution less than 1024x768 will see a horizontal scroll bar and any items in the left of the screen may not be visible without scrolling for those visitors.

If you'd like to have a fixed width osCommerce store here's the simple instructions (from the Fixed Width Site with CSS mod) :


1. A minor modification is required to your stylesheet.css file.

Replace the following code:
---------------------------

BODY {
background: #ffffff;
color: #000000;
margin: 0px;
}

with:
-----

BODY {
text-align: center;
background: #ffffff;
color: #000000;
margin: 0px;
}

.fixcenter {
width: 758px;
border: solid; border-width: 1px;
background: #ffffff;
color: #000000;
margin: auto;
margin-top: 20px;
text-align: left;
}

2. On-page changes:

In /catalog/includes/header.php
-------------------------------
immediately below this piece of code

if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
?>

add

<div class="fixcenter">

In catalog/includes/footer.php
------------------------------

Immediately below the closing php tag

?>

add this

</div>



Remember to change to suite your site!


Now, if you would like to try something different and create a site which is both fluid and fixed width you may want to try a Jello width. I personally have not tried this with osCommerce, but I see no reason why it wouldn't work.

Thursday, April 17, 2008

Installing osCommerce & Where to Find Answers

I have not used the new osCommerce RC store installs, I only use the previous 2.2 MS2 version at this point. Since most modules have been created to work with 2.2 MS2 I see no reason to update to the new version. This is purely my preference and not a recommendation. You can download the 2.2 MS2 version here.

There is a quite informative pdf file which is included in your download of the oscommerce install. I suggest reading this pdf file in full. You can download the most recent version of oscommerce here.

In the install instructions you'll find tips on how to customize your store. Once you are comfortable with making small changes then start adding modules or "add-ons" to your store. These are changes to the code and database which will add additional functions to your store. Add-ons are available here.

The osCommerce forums have a wealth of information on installing and tweaking your store. I've also found the osC Answers forum to be very helpful. Please, remember, try searching the forums exhaustively prior to asking a question. Chances are someone has had the same issue.

Here is a great tip for an easier search of the forums. Go to Google.com and enter the following into a search: site:forums.oscommerce.com keywords . ~Replace keywords with your search terms. Since the forums search engine leaves little to be desired, this is the best method I've found.

Again, get comfortable with the layout, code, functions and database before you jump into an add-on. Install your store, play with it, delete it, reinstall it and so on until you understand it.

You chose osCommerce because it was free and customizable, however you still need to invest your own time into creating a successful store. Don't rush it. Take your time and learn it. If you feel that the code is over your head, by all means pay someone to do it.

If you decided to pay someone to create your store for you, I highly recommend requesting a coder here. There are some great osC gurus helping out with the osC Answers forum and they are very good at what they do. Any of them would gladly offer a quote to do your install and customization for you. Note: I am not one of those gurus. I have too little time to build for others, my own sites keep me busy enough.