Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding fields to products - need feedback


mouflon

Recommended Posts

I'm partway through a contribution to add custom user fields to the products table, and need a bit of feedback before going any further.

 

Any thoughts on how many fields to include? What I have now is adding 6 new generic fields to the products table. I looked at the possibility of a seperate table for the extra fields, kinda like attributes, or product_description so that I wouldn't be stuck with a fixed number. It would probably involve touching fewer core files, but I couldn't see an easy way to administrate those properly or perform searches on them easily.

 

I'm also looking to customize the field descriptions and enable or disable the fields either through the admin panel or by checking the categories.php language file. Probably the latter for ver.1.

 

Any thoughts would be appreciated, especially if you think I'm heading off in the wrong direction here.

Unexpect the Expected

Link to comment
Share on other sites

That's a great idea. I just added an extra product field to my site, and it wasn't very fun. Also I don't have the ability to enable or disable the fields, which is definately important.

 

After I added the field, I realized that I should have not just added a plain field, but one more like the manufacturers. I don't know if this would help others out too, but I run a performance car parts store and users tend to either search by manufacturer or by application. So it would be nice to maybe add a generic manufacturer-like field. I don't know how difficult this would be, but it would really come in handy. Especially on the product listing page, if my customers could click on say "Big Block Chevy" and view all products for that application.

 

Another thought: It would be nice if the extra fields could be part of the advanced search.

 

As far as how many extra fields to add. I'd say add 10...the more the better :)

Mary

Link to comment
Share on other sites

Based on a post and some code for product_info.php by MaxiDVD in another thread, I'm going to add 50 fields.

 

It will probably be released in several stages, with added administrative and search functions in each stage. First, though, I'll just make the necessary changes to the core code and the database.

 

What I see it being eventually:

enable/disable fields in admin

name fields in admin (multi language)

enable/disable fields in product listing if enabled in the admin function

add fields to general search

enable/disable fields in advanced search

choose order to display in product_info

 

Any other suggestions?

Unexpect the Expected

Link to comment
Share on other sites

I have been struggling with adding fields for a few weeks now- really excited about your idea for this contribution.

 

Along with adding fields to OScommerce- and figuring out how to get them to display properly in both the shop and admin- I have had trouble adding fields to EZ poplulate. Is this something that you have experience with?

 

Look forward to the first release! I will help you test it out for sure.

Link to comment
Share on other sites

Jeff,

How about creating a table just for the fields; something like the following:

 

TABLE: products_specifications

product_specs_id int NOT NULL autoincrement

products_id int NOT NULL

language_id int NOT NULL

spec_header varchar(50) NULL

spec_line varchar(255) NULL

sort_order int NOT NULL DEFAULT = 0

 

This would allow you to display virtually any number of additional data concerning the product if you use a WHILE/WEND loop or similar and a query statement similar to:

SELECT * FROM products_specifications WHERE products_id = $product_id AND language_id = $language ORDER BY sort_order, spec_header

 

The Admin part shouldn't be too difficult as all you need to do is have a button to add, delete, and update a specline in the product maintenance page. (probably would be a good idea to tack it on under each language TEXTAREA field on the form.)

 

Just a thought on how you could do what I think you were after in a more useful manner. Oh, if you use the same values in the spec_header field, it could be displayed once with a subloop that would just list the appropriate entries without repeating the header value.

 

I'm attaching the core of the code written in vbscript that accomplishes this task :arrow:

 

RScatalog_spec.open SQL2, ConnectStr, adopenstatic

CatHdr = ""

If RScatalog_spec.EOF Then

   Response.Write "<font face=verdana,arial,helvetica size=1>No product specifications currently exist for this item.</font><br>"

End If

Do While Not RScatalog_spec.EOF

   If CatHdr <> RScatalog_spec("specheader") Then

       Response.Write "</td></tr>" & vbcrlf

       If instr(RScatalog_spec("specheader"),"Caution!") Then

           Response.Write "<tr bgcolor=#9ACD32><td align=left align=top>" & vbcrlf

           strSpecDisplay = "<img src='/media/images/icons/caution.gif' border=0 height=20 width=20 hspace=4 vspace=2 align=left>"

       Else

           Response.Write "<tr bgcolor=#ffffff><td align=left valign=top>" & vbcrlf

           strSpecDisplay = "<font face=verdana,arial,helvetica size=1><B>" & RScatalog_spec("specheader") & "</B></font><br>"

       End If

       CatHdr = RScatalog_spec("specheader")

       Response.Write strSpecDisplay

   Else

       ' do nothing

   End If

   <font face=verdana,arial,helvetica size=1><%=RScatalog_spec("specline")%></font><br>

   RScatalog_spec.MoveNext

Loop

RScatalog_spec.close

Set RScatalog_spec=nothing

 

==== Ends up looking something like this ==================

Game Contains

8 pages of Rules, 4 of notes and commentary

1 hardbacked map

140 3/4 inch square counters/markers

170 5/8 inch square counters

4 victory point charts with combat charts on reverse

4 nation force arrival charts

1 master nation force arrival chart

 

Number of Players

3 to 4

 

Recommended Ages

12 and up

 

Time to play

6 hours

============================================

 

I'm not really knowledgeable enough with PHP yet to make the conversion, but I hope this helps :)

 

Regards,

Obewanz

The GraphicZoo

check profile for web address

Link to comment
Share on other sites

Thanks, Obewanz - I've been off on another project, and just getting back to this. I've been pondering a seperate table solution, and certainly at first glance, what you are saying makes sense.

 

I'll have a look this weekend, and let you know what I come up with.

 

Jeff

Unexpect the Expected

Link to comment
Share on other sites

  • 1 month later...

I'm just curious. I am looking at creating a solution for this issue. But has there already been progress on this contribution?

Link to comment
Share on other sites

Mark,

I haven't had time to work on this as of yet, not sure if anyone else has picked up the torch, but if complete this, I would certainly want to use it. If you haven't or can't, let me know as my php skills are getting much better and I might just be able to make this if I put a little time into it... :lol:

 

Regards,

Obewanz

The GraphicZoo

check profile for web address

Link to comment
Share on other sites

This is exactly what I need for my OSC :) This should indeed be a part of the next OSC release. Unf. I'm not a PHP nerd so all I can do in this case is some simple copy/paste :?

 

Hope someone have the knowlegde and time to fix such a tiny little mod ;-)

 

Regards, Jes

Link to comment
Share on other sites

I've been trying to do the same things as you guys, except in the products_description table.

 

Seems that it's a difficult thing to do, at least for someone with my excessively limited php code ability :D

 

However, MaxiDVD and mouflon did post a huge set of examples if you just want to add the fields to the products table. I haven't yet tried their approach but I think it would probably suit what you want.

 

http://www.oscommerce.com/forums/viewtopic.php?t=36053

 

Obewan if you're still up for the challenge I'd appreciate seeing some example code and knowing what files you had to change...

 

Thanks!

 

-al

Link to comment
Share on other sites

  • 2 weeks later...

I found this... can't remember the url but I've uploaded it here

 

http://www.bronzemoon.co.uk/productdimensions.txt

 

I've changed the .sql configuration to include text

and you can change the all or nothing display at the line 105 alteration in catalogproduct_info.php

 

I'd like to say it works but I can't get any fields to diplay exept price, module, image and description... but I've queried that elsewhere if any answers!

 

Hope this helps

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Link to comment
Share on other sites

I found this... can't remember the url but I've uploaded it here

 

http://www.bronzemoon.co.uk/productdimensions.txt

 

I've changed the .sql configuration to include text

and you can change the all or nothing display at the line 105 alteration in catalogproduct_info.php

 

I'd like to say it works but I can't get any fields to diplay exept price, module, image and description... but I've queried that elsewhere if any answers!

 

Hope this helps

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 weeks later...

Where are you Mouflon????

We need you!!!

Your contribution project is a very great idea! :idea:

 

I?m not a coder... I could only help you to test and translate it to spanish

 

Let uskonw...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...