Click to See Complete Forum and Search --> : A headbanger
Ok I have just aquired a really nice online shopping system that is writen using php scripts. This program puts MIVA to shame. However, as nice as it is there are still some issues that require customization. Here is our delima:
We have created a product and it is assigned to the categories that it belongs, in this case it fits 5 categories. There is only a place to put in one long description (php, java or html code are accepted) and this description is displayed in a form that calles the field. Now the description is different for each of the 5 categories.
The idea we have is to place the html scripts for all 5 descriptions into the long description field of the product come up with a java script that will get the category variable that is currently listed... ie.
we have categorys 1,2,3,4,and 5 if the user browed to the product in category 1 then the system will return the variable that matches that category the script will then search the code and display the html that relates to that category and supress the rest of the html
this would be the default view.
Now there are links for the other 4 categories in each html script, so we want customers to be able to see these other descriptions reguarless of what category of products they are browsing. So that when a user browses to one of the other descriptions the long description field is searched; the correcsponding html is then displayed and all other code is suppressed and all this staying in the same field on the php form.
Any ideas about how to go about this. At best our java programer is a light green and needs to be pushed in the right direction.
If you would like to be commishioned to take on this project email me and we can discuss compensation.
Nevermore
02-16-2003, 05:16 AM
Im not sure waht you want. Do you want to display a different description depending on what category you are in? I think that's what you seem to want. If so, do you want to use php or javascript?
Nevermore
02-16-2003, 05:34 AM
Ive made a php that does what I (think) you want. You choose a link, and based on your choice different text is added to the page. You can link from five different pages, and the php will work out from the link you used which description you want. The script for the php is:
<?php
$desc1 = "We are in category one!";
$desc2 = "We are in category two!";
$desc3 = "We are in category three!";
$desc4 = "We are in category four!";
$desc5 = "We are in category five!";
switch($category)
{
case one:
print("$desc1");
break;
case two:
print("$desc2");
break;
case three:
print("$desc3");
break;
case four:
print("$desc4");
break;
case five:
print("$desc5");
break;
}
?>
You just insert that into the body of the document, and if you server supports php, it should work. You can change the descriptions by changeing the values of $desc1 etc. at the top.
The links you need to use are these:
<a href="product.php?category=one">Category One</a><br>
<a href="product.php?category=two">Category Two</a><br>
<a href="product.php?category=three">Category
Three</a><br>
<a href="product.php?category=four">Category Four</a><br>
<a href="product.php?category=five">Category Five</a><br>
Insert them where they are needed. You may have to change the hyperlink if the two files are in different directories. To see the script in action, visit: http://www.hostultra.com/~cijori/choose.html
the php script that was given will allow me to select a default html script to be displayed based on the category the user browsed to the product from, the second half of the problem is allowing the user to see the other category descriptions for the product without having to browse to the product from a different category.
The script that chooses the default category only needs to be interpreted once, after that the user will choose the description he or she wants to see via links in the html document. So we need to be able to have whatever content the user selects appear in the table field without opening a new browse window or navigating to a different category.
hope that clarifies it
Nevermore
02-16-2003, 03:48 PM
This may sound silly, but why not just use ONE desciption if you are going to show them all?
Each description is like an html flyer that targeted for that specific use of the product, make for more effective marketing. Liability is another reason, the html descriptions were provided by the manufacturer and we run the risk of missrepresenting the intended uses of the product if we were to rewrite it to be all inclusive. The product is a vitamin that makes specific claims that have been tested by the fda and certified to perform the claims made.
Nevermore
02-17-2003, 03:07 AM
Tell me if I have misinterpreted you, but this is what I think you mean:
You want a script that can detect what category the user is in. It will then display the description for that category (in a form?), and will display the other descriptions next to the main one.
I just have a few questions you need to answer before I can script this for you:
[list=1]
Do you want to display the main description in a form?
Do you want links to the other descriptions, or them displayed elsewhere? (on the same page)
If I use JavaScript and PHP, will you be able to modify it? (I am willing to help, but I'll put in more comments if you aren't too confident, therefore making it more understandable.)
[/list=1]
If you can get back to me about these points, I can write you a script.
correct the script needs to be able to detect the category its in by using by a get_vars statment on the DB.
Now we have a product table and one of the fields in this table is the long description field. This product is then displayed with a form with the long description field being part of that form.
Now we have 5 different descriptions of this product to place in the long description field. The different descriptions are for different categories.
So if a user gets to the product from category 1 he sees A as a product description... if he gets to it by browsing category 2 he sees B as a product description... and so on.
Now the tricky part. I want to have links to the other descriptions in each individual description.
The user will be able to choose one of these other descriptions via a link. The new description that is displayed is independant of the current category and will display in the same field of the form. No new windows or taking the cust to a different product category. The form or just that field will simply refresh with the new product description will be displayed in that field of the form.
Java script would probably work best for this problem as running a php script from a field in a php driven form and sql DB might case some problems.
Nevermore
02-17-2003, 09:24 AM
Right, I'm pretty sure I understand now. The easiest way to do this would be to use an I-Frame in one of the cells in your table, as then it could be updated without changing the rest of the page. I can do this in PHP, which I think owuld probably actually be better than Java, because this way you can be sure you have the expertise to modify it.
Nevermore
02-17-2003, 09:48 AM
I think that this is what you're after. The links open a different page in the iframe depending on which link you choose, and you can view different descriptions by using the links in the documents. Tell me if it isn't what you wanted. I have attached a zip containing the files, you can see the ource by viewing them through a text editor. (By the way, the only reason three, four and five dont work is because i was too lazy to create the pages.) View it at http://members.lycos.co.uk/cijori/links.htm
this looks like it might work, ill put it together later and give it a whirl and let ya know
Nevermore
02-17-2003, 01:39 PM
I'll be away for a couple of days, so if you have any problems you can't solve, some of the other guys will have to help you. Soz.