About Club osCommerce

Showcasing osCommerce - the good, the bad and the ugly!

Archive for the ‘Code Tips’ Category

Clear Cart, then add a product automatically
Written By Gary on Apr 24 2008 · Comments (0)

Frank asks;
I'm trying to create a page that when someone visits; automatically empties the shopping cart and then adds one specific product, so the cart will only have that one item whenever the customer loads that page.
I thought this was an intelligent and interesting question - and as no-one else was helping, I decided to [...]

Finding Text that you want to change
Written By Gary on Apr 21 2008 · Comments (0)

osCommerce is set up a little differently to a "normal" website.  Put simply, this is because the "base pages" are the structure and "language pages" are pulled into the structure automatically.

index.php
product_info.php
and all the rest of the pages

are your "structure pages" - these should only be amended if you are adding contributions or changing the actual [...]

Random Products on Front Page
Written By Gary on Apr 18 2008 · Comments (0)

Almost daily, I see this question asked in the osCommerce Forum...
How can I have 9 random products showing in the the "New Products For..." box in the front page of my osCommerce site?
The answer is really, really simple - you need to change the SQL that selects the 9 products, like this;
Open up /includes/modules/new_products.php
Find:
PLAIN TEXT
PHP:

p.products_date_added [...]

Updated for '08 - Make Your osCommerce Faster
Written By Gary on Apr 17 2008 · Comments (2)

I just finished up the next osC Book update - 'How To Make Your osCommerce Faster' - in this eBook I show a number of methods that will speed up your osCommerce store.
Some of the changes are very simple, some are more advanced. This morning, I installed a brand new osCommerce RC2 and managed [...]

Reversing the order of the cart contents
Written By Gary on Apr 09 2008 · Comments (2)

In the osCommerce forum, someone posed an interesting question;
does anyone know how to reverse the order of the shopping cart dsiplay so that new products added will go onto the top of the list rather than the bottom.
Having thought about the question for a minute or two, this actually makes perfect sense and makes any [...]

Just a few products? Dump the categories…
Written By Gary on Apr 03 2008 · Comments (3)

Years back I had a client who had only a few products in his store. Rather than use the category infoBox I rewrote it to simply give a direct link to each product.
It's funny that I was looking at that store the other day (it's on the Hot 100 list), and today someone in [...]

Passing $cPath thru Advanced Search…
Written By Gary on Apr 01 2008 · Comments (0)

In the official osCommerce Forum, someone asked for the ability to pass the $cPath variable through the Advanced Search Result "link" for each product.
Basically, instead of a direct link to a product, eg: product_info.php?products_id=10, he wanted product_info.php?cPath=3_11&products_id=10
The example obviously assumes that Product 10, is inside Subcategory 11 which is inside Category 3. Got that [...]

MySQL Server DOWN - oh no!
Written By Gary on Feb 27 2008 · Comments (7)

In the official osCommerce Forum I got into bit of a conversation with a Store Owner, part of the conversation was all about what happens if your MySQL server goes down whilst the webserver is still up and running.
For those who don't know, MySQL runs on it's own little server as part of the overall [...]

What Category are you looking at?
Written By Gary on Feb 24 2008 · Comments (2)

Sometimes you are not able to tell which Category you are looking at as the template that you are using might have changed (or even removed!) the Categories infobox. I've seen a few sites which use a horizontal dropdown menu (eg Easy Menu) which looks good, but takes away the visual representation of where you [...]

HOW TO: make just 1 infobox a different style
Written By Gary on Feb 16 2008 · Comments (7)

There are lots of ways to make osCommerce look different. Here is 1 way to make 1 infoBox look different to the rest - it's easy - and is done using a CSS (Cascading Style Sheet) "trick"...
Step 1: decide which infoBox to change
In this example, I'm going to change the look of the Categories [...]