Two little lines...

Dec 29, 2005 14:55

So, one of our clients' online catalogs, when you clicked for the next page, said it was now on page two, but still showed you the products that were on page one. No matter what page you went to, you were seeing page one's products.

It took me a lot of time searching through osCommerce code to find the fix. osCommerce is open-source, free to use software for doing e-commerce stuff. In order to be used and changed by anyone/everyone, the code is nearly incomprehensible to read. It drove me nuts and gave me headaches. You want to know what the problem was?

if (offset < 0) offset = 0;
offset = 0;

Just those two lines, burried in thousands of lines over dozens of files that I had to trace backwards.
Those two lines say that no matter what, set the product offset to zero.
So that no matter what page you're on, view the first product.
It should be that the offset is equal to however many products you have per page times whatever page you're on.
It now works, and looks instead like this:

if (offset < 0)
{
offset = 0;
}

That's it. It works.
But my sanity is gone :(
Hurry up, weekend...
Previous post Next post
Up