Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Most suitable product


parma

Recommended Posts

Posted

Hello,

 

I have been thinking about creating something where by a customer is asked many questions about their product preferences and at the end is shown a number of suitable products.

 

right now I no idea how to do this, only thing that I came up with was to use Flash, but I would prefer if there was some sort of form/php that could be used. Im not that great with php but hopefully someone has seen or knows about what kind of thing im talking about.

 

I have made a tree diagram of what questions, answers and products equal so have prepared the first part, now for the hard part lol.

 

Thanks a lot

 

Regards

 

M PArmar

Posted

you're looking for a wizard-like module. Haven't seen one with the contributions but should be easy to setup the framework for it. If you create pages with the questions in a form then you could end up doing a couple of queries with the products tables and retrieve the most adequate.

 

You could use the advanced search module as a starting point.

Posted

Thanks enigma, thought no one would respond since not many people want this feature I guess.

 

Would you be able to give me a bit more guidance please?

 

Thanks again

 

Regards

 

M Parmar

Posted

Ok the high level stuff

 

1. create 2 new pages in your shop as a test derived from the catalog\advanced_search.php

2. create another new page for the decision results you could derive it from the catalog\advanced_search_results.php

2. Remove the check_form jscript functions from it - we need it simple for the time being.

3. Modify the input elements of the form to reflect the ones you want to use for this filtering. These elements should be placed below the tep_draw_form function call and before the </form> tag (or you could modify the existing ones like ENTRY_CATEGORIES, ENTRY_MANUFACTURERS etc)

4. Add an input element like a button or an image that will submit the first page of the form.

5. Modify the link of the form to point to the next page. The advanced search has a link to its results like this one:

tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false)

So modify it to point to page-2 of the new pages.

6. Repeat the process for page-2 the only difference here is you need to use different names for the input elements as these are posted with each form so they have to be unique.

7. Modify the link of the form to point to the new page of decision results. You also need at the beginning of this page to repost all posted variables. So say at the beginning of the 2nd page you need some code like this:

// Re-Post all POST'ed variables
  reset($HTTP_POST_VARS);
  while (list($key, $value) = each($HTTP_POST_VARS)) {
	if (!is_array($HTTP_POST_VARS[$key])) {
	  echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
	}
  }

This will preserve all values from page-1 as you need them on the decision/final page.

 

8. In the decision results page your $HTTP_POST_VARS array contains all variables/values from the 2 previous pages. You can access each one of them and retrieve from the dbase the range of associated products or categories. This is the difficult part and really up to you how much complexity you will add as well as the layout.

 

9. Also add the equivalent language files for each of these 3 files with the strings.

 

10. Once you have everything up and running you could shring the 2 pages into one and instead of going to the 2nd page you go to the 1st again with an additional value in the $HTTP_POST_VARS for the page number. A case statement could differentiate the page code. This way you do not have a bunch of files in the root of your catalog.

 

Later you could setup an admin interface for your wizard module making it an advanced feature.

Posted

Thanks for your reply, its very useful.

 

I have tried making the pages like you said and have linked them successfuly

 

Is there anyway to specify which categories you want available? The link below is to my site and the first page to which the form starts.

 

For this first section I only need Latex or Non Latex. However, my drop down list shows all of the categories.

 

http://gloveclub.co.uk/advanced_search_glove.php

 

On the next screen I would then depending on their first choice like to give them an option on Powder / Powder-free under which ever they chose in the previous form (either latex or non-latex).

 

One of the options which is either "textured" or "smooth" glove is not under a category but in the description. Is there a way to have a drop down box which would have the two following values that can search the descriptions under the gloves > latex / non-latex categories?

 

Thanks again for your help.

 

Im a noob with php :( but at least some progress is being made.

 

Regards

 

M PArmar

Posted
Is there anyway to specify which categories you want available?

 

There are few ways I can think of:

1. Create an extra column in the categories or categories_description sql table like a flag. When asserted the category or product will show in this form

2. Hard-code the categories ids or categories names in the php file and then compare them before populating the drop-down list.

Although I don't like the 2nd option it will be useful for the initial deployment until you have the code running properly. Then you could enhance it to add the extra field and go with option-1.

 

 

Is there a way to have a drop down box which would have the two following values that can search the descriptions under the gloves > latex / non-latex categories?

The best approach should be dbase driven from the categories or products tables (name columns) Similar descriptions could be present on multiple products/categories so code that parses the description for keywords would be more complicated to develop. So you could create a relationship of questions vs categories/products to display.

 

So for example lets say you created an sql table of questions called wizard_questions and has the following columns:

 

wizard_question_id

wizard_question_name

wizard_question_description

 

And another table linking the wizard_questions table to the categories table called wizard_to_categores with the following columns:

 

wizard_question_id

categories_id

 

So in this example you see how a relationship can exist linking the 2 tables, so every query you make in the forms has a way of retrieving pretty much everything related to a category - wizard question. Because the categories_id is the same id that exists in the categories sql table

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...