Jump to content
vampirehunter

Index.php and product listing absolutely awful coding, impossible to modify

Recommended Posts

Can someone help as to why the index.php and product listing pages are so awfully coded?

 

trying to edit the layout of the tables into divs is proving almost impossible.

 

im trying to move the sorting function also into a drop down box and cannot for the life of me workout how these 2 pages are doing it.

 

they seem to be connected stupidly.

 

i'm this close to giving up. I really thought i was getting somewhere, but now changing the layout is proving impossible due to the way these have been coded.

 

i now know exactly how people feel when they say oscommerce's coding is from the caveman ages.

 

im about this close to giving up again with oscommerce, and after banging my head against the wall for 12 hours today, ive just about had enough.

 

i cannot hack into the core code anymore just to add simple things like "sorting products via dropdown box".

 

and changing the table layout into a div layout.

 

man, this is torture, really bad torture.

 

i feel sorry for anyone having to edit this code.

Share this post


Link to post
Share on other sites

it is all in the columns array, but find that search by dropdown contribution and see how that is done, it should make things much clearer


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

or you just forget about the columns and hardcode the fields you want to use for display and just put your div element together as you please

 

perhaps the 'smart columns' contribution is something you might like ?


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

@Mention

I can relate to your frustration, but once you get the hang of it, you'll find the very thing you are struggling with is exactly the reason OSCommerce, esp 2.2RCA is so nimble and flexible.

 

Interweaving the php and html like OSC does cuts out lots of files and depth of structure that would normally be written into a program to make it more user friendly.

 

But making a program user friendly complicates things if you prefer to just work directly with the code, instead of an admin interface.

 

I suggest first getting a real grasp on:

1) How includes/application_top.php controls stuff in index and product_info

2) Spend a few days understanding how the box classes work. (includes/classes/boxes)

 

OSCommerce is really efficiently written.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

@Mention

I can relate to your frustration, but once you get the hang of it, you'll find the very thing you are struggling with is exactly the reason OSCommerce, esp 2.2RCA is so nimble and flexible.

 

Interweaving the php and html like OSC does cuts out lots of files and depth of structure that would normally be written into a program to make it more user friendly.

 

But making a program user friendly complicates things if you prefer to just work directly with the code, instead of an admin interface.

 

I suggest first getting a real grasp on:

1) How includes/application_top.php controls stuff in index and product_info

2) Spend a few days understanding how the box classes work. (includes/classes/boxes)

 

OSCommerce is really efficiently written.

 

hi

thanks

 

yes, im prepared to edit code, but for some reason this productlisting.php and index.php is driving me nuts

 

i had a look at this contribution here:http://www.oscommerce.com/community/contributions,4312

 

but it seems to be making an sql entry into the database to create a sorting array when creating a dropdown?

 

is there a way to simply copy the standard sorting thats available on the price, and product, quantity columns and move them into a dropdown box?

Edited by vampirehunter

Share this post


Link to post
Share on other sites

ok thanks

 

so if want to extract the functionality of the column sort, but put it into a div, which section of the index.php code do i need to look at?

 

im getting confused at the way the query is put together.

 

for example this here when i hover over the product name column header, this is the path for sorting descending.

 

http://localhost/mywebsite/index.php?cPath=23&page=1&sort=2d

 

But i can't seem to work out how this query is put together from that index.php file.

 

i basically want to put that query and all other sorting queries into a dropdown box so i can put that dropdown box into a div container alongside my pagination results.

Share this post


Link to post
Share on other sites

This happen using the function tep_create_sort_heading()

 

ok thanks

 

what would you say is the easiest way to change the product listing look so that its in div tags rather than a table?

 

from what i can see, it seems the php has been coded specially for tables in this instance.

 

im trying to figure out how i can change this so that i get div containers of the each products content.

Share this post


Link to post
Share on other sites

@Mention

I can relate to your frustration, but once you get the hang of it, you'll find the very thing you are struggling with is exactly the reason OSCommerce, esp 2.2RCA is so nimble and flexible.

 

Interweaving the php and html like OSC does cuts out lots of files and depth of structure that would normally be written into a program to make it more user friendly.

 

But making a program user friendly complicates things if you prefer to just work directly with the code, instead of an admin interface.

 

I suggest first getting a real grasp on:

1) How includes/application_top.php controls stuff in index and product_info

2) Spend a few days understanding how the box classes work. (includes/classes/boxes)

 

OSCommerce is really efficiently written.

 

hi i found your osc to css.

 

i was wondering if you can advise

 

ive already installed 2.3.3 and modifed it quite a bit. obviously that was before i realised you had already made a full css version of 2.2rca.

 

well i was wondering how i should go about changing the productlisting page for my 2.3.3?

 

should i download your osc to css file and just use that to modify my file?

 

i absolutely hate the terrible table format in product listing and index.php.

 

i looked at your demo site, and thats got exactly what i need.

 

ie divs for the products, and the sorting options in dropdown boxes.

 

or do you have an example available for modifying 2.3.3 product listing and index.php to tableless?

Share this post


Link to post
Share on other sites

Why are you trying to force tabular data into a div based layout?

 

i don't get what you mean?

 

im trying to make the product listing page so that each product is in its own div tag

 

and i thought i could have the sorting options in some dropdown boxes or even text links in some divs alongside the pagination. And links to view 20, 40 and All products.

 

i want to have product listing completely free of tables.

 

I found this page here: http://www.css-oscommerce.com/css-product-listings/#comment-1122

 

but looked at my 2.3.3 product listing.php code and it seems its quite different to the default 2.2rca. So now thats another issue to overcome.

 

I'm surprised the product listing into css hasn't made it into any of the 2.3 versions. You would think it would be a no brainer, as it makes styling the products so much easier.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

Hi Burt, just to doublecheck.

 

is the output for the product listings done entirely from productlisting.php? or do i have to look into classes/boxes.php?

 

because this method here is for the 2.2rca http://www.css-oscommerce.com/css-product-listings/#comment-1122

 

and that involved adding a new class into the classes/boxes folder.

 

But from what i can see, in 2.3.3 the product listing output seems to be all done from one single file , productlisting.php

 

Is that right?

 

thanks

Share this post


Link to post
Share on other sites

[/font][/color]

 

Tabular data should be displayed in tables. Using div's for things "just because you want to" is wrong.

There is a time and place for div's and a time and place for tables.

 

Well, i haven't touched the shopping carts table, thats left as it is and a few other places.

 

the only thing im trying to change is the product listings into divs.

 

Practically all modern online shops have the same div based layouts for products, so i don't understand why i shouldn't have it on mine?

 

Also, how is product listing data defined as "tabular data"?

 

I'm trying to make my shop look as professional and far away from the default look as possible, and that means modifying the product listing page amongst other things.

 

Trying to place things inside a table is just incredibly difficult, especially in oscommerce. With a div tag, its so much easier to place, margin,padding etc.

 

Im looking right now at 10 different clothing shops, and not one single one is using a table for its product listings.

 

 

Added to that, why the hell does oscommerce by default have rows instead of columns for product listings?

i could understand if it was 2003, but we are in 2012, and surely that could have been changed to default in 2.3.3

 

I'm looking at Amazon, and even they have switched to divs for product listings.

 

I'm not against tables at all, but from what i've observed and seen, putting each product into its own div seems reasonable and will allow me to style it much easier and also will be semantic in terms of layout.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

[/font][/color]

 

Tabular data should be displayed in tables. Using div's for things "just because you want to" is wrong.

There is a time and place for div's and a time and place for tables.

 

So are you saying that all those big online shops are wrong in what they are doing with their layouts?

 

Do i really have to stick to a 2003 design and be stuck with an outdated design? I sure hope not.

 

I want to make a nice looking shop, and I know css, so im sure its possible. The only problem is the spaghetti code in oscommerce, the way the table layout for product listing is formed, its almost impossible to follow easily.

 

Code should be easy to follow, but from my experience, the product listing and index.php codes are torturous to follow.

 

There seems to be no structure to them.

 

If i can finish my shop, I will gladly share it with everyone as a contribution, so people won't have to suffer like i have had to.

 

I'm sure someone out there will appreciate the design i've come up with.

 

What i find quite funny is that under "Live Shops" there are many shops in there that are not even running on Oscommerce anymore, even though they are listed under there.

 

It seems people have given up, as the code is truly staggeringly a pain to modify.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

File includes/modules/product_listing.php is the only file responsible for the product listing html

 

Where exactly are your issues with that file?

Where exactly is the "spaghetti code" in that file?

For what reason do you want a div layout? I mean, what do you want to achieve visually on the screen? Is it a listing in "grid" mode?

Did you check the addons? There are at least 2 addons that create a grid listing.

 

I know really many osCommerce stores that use a variety of listing styles including alot of fancy stuff like a listing switch table/grid etc etc, so it doesn't sound like people giving up on this.

 

Maybe instead of blaming the code and osCommerce you could invest more time trying to understand it?

 

Anyway, could you share what you did so far?

Share this post


Link to post
Share on other sites

@@vampirehunter reading some of your other posts all you seem to do is to belittle oscommerce and moan. Why are you using something you do not like? Its not because its free is it. If you want new modern code use a new modern coded application, but i do not think you will still find one you like.

 

The addons area is always the first place to look. If there is something there that will do nearly what you want you can use that as a basis for your mods. The chances are if you want oscommerce to do something, someone has wanted it before you, and there is already a solution. Mosr addons for 2.2 will work with thew latest 2.3 version with only a few mods to the code, and if the addon is any good someone will have already uploaded a new verion. Once you have completed your mod, upload it also, then you can help others in the comunity, and maybe even those that gave you help.

 

Moaning about something is not the way to get help.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Phoenix version here

It's easy to say to yes every question.

Share this post


Link to post
Share on other sites

Most big shops use unordered lists or divs instead of tables for product listings. Yes, you would list tabular data or 'chart' data in tables, but product listings are not tables or 'charts'.

 

The way you can get the product listings in 2.3 to look like I have the product listings in 'OSC to CSS' is to change three files. includes/modules/product_listings.php, includes/classes/boxes.php and the css file.

(If you are using 2.3 stick with it, you can change the product listings there to look like my demo, or even better)

 

Compare the file includes/modules/product_listing.php. The main thing I did there was change 'new productlistingbox' to 'new plistingbox'.

Since I changed it to 'pllistingbox' I now have to create a new class in includes/classes/boxes.php called plistingbox.

 

The classes in includes/classes/boxes.php control how the product listing is displayed. Compare includes/classes/boxes.php in 2.3 and in 'OSC to CSS'. You will see that I duplicated the classes, and renamed the duplicated classes. Then I went into the duplicated classes and changed the table tags to div tags. (Renaming is an involved process as you have to carefully go through almost every line and change stuff).

 

If you did two things you would have this product listing issue down pat.

1) Duplicate the classes in your 2.3 includes/classes/boxes.php

2) Change your duplicated classes to unordered list tags or div tags instead of table tags.

 

 

It took me weeks to walk through the box classes and change them, maybe I am slow, but expect it to be a tedious task.

If you do get the product listing converted to ul tags it would be awesome, and you should post your solution back on the forum.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

@@vampirehunter

 

Code should be easy to follow, but from my experience, the product listing and index.php codes are torturous to follow.

 

There seems to be no structure to them.

 

There is a serious learning curve involved here, but once you get over the hump, and decipher that spaghetti code and references to files tucked away here and there, you'll start to appreciate the efficiency of OSCommerce. Check out amazon for books on oscommerce.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

@@multimixer @@vampirehunter

Version 2.3 does not use the boxes class at all, it's all a plain loop within file product_listing.php, anything can be changed in there, divs, uls, whatever

 

Then changing it to div or ul should be easier in 2.3 than in 2.2rc2a.

Edited by npn2531

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

Then changing it to div or ul should be easier in 2.3 than in 2.2rc2a.

 

Yes, that's true, it's all in one file completely visible where the tables, trs and tds start and end that can be replaced with anything, it's up to the styling target

Share this post


Link to post
Share on other sites

you may think I moan, but do you know how many hours ive spent looking at the code and trying to understand it? ive spent the last 24 hours trying to do certain things, but the code is hard to follow.

 

in regards to the 2.3 product listing.

 

thanks for confirming that. thats the reason i was asking to check as 2.2rca was being modified via a new class. 2.3 doesn't have it.

 

But the problem im having is that in 2.3 productlisting.php

 

im struggling to work out how the Sorting of columns is being done. for example, clicking on the product name, or price to sort asc or descending.

 

im trying to find out how to extract the bit that creates the url on the fly so i can have them elsewhere on the page instead of them being click only through column name.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

There are many "clichés" going around, like that divs are good while tables are bad

 

There is a lot that you can do with tables that you could never do with divs in a reasonable way and opposite. It all depends on the data

 

Above article linked by @@burt is very good

Share this post


Link to post
Share on other sites

@@vampirehunter

 

[/font][/color]

 

@@npn2531

 

 

 

Any set of information that has multiple data points is better presented in a table - in this scenario a table uses less code than a lot of nested divs, is more semantic and more accessible.

 

Suggest you both read this: http://www.noupe.com/how-tos/better-ui-design-proper-use-of-tables.html as it says everything in a much more succinct way and far more politely than I ever could.

 

ok thanks, I get your point

 

but why are all these new ecommerce shops using divs for their product listings? especially all these big websites, and even other shopping cart systems.

 

they all seem to be using divs for product listings than tables for the product listings.

 

Why do they do that then?

 

They put each product in its own Div tag. So one row of 4 products will have 4 div tags.

 

I'm confused now.

 

Should I not modify the product listing.php page then?

 

If thats what you mean, then the only i will need is to move the sorting functions into fixed text links.

 

Can anyone point me to the way to extract the sorting functions for each column and to put them into fixed text hyperlinks.

 

I don't even want the dropdown box anymore. FIxed text links to sort products seems better.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

@@vampirehunter

 

You will find it easier to style the product listings if they are coverted to div or ul. For one thing you can control the number of columns simply by setting the width of each product listing in the stylesheet. Tables are better for listing data where you are relating the x-axis to the y-axis (ie a chart with a set heading along either or both the x and y axis), but product listings are simple lists you are stacking up like bricks or legos.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×