[SOLVED] Shopping Cart.. HOW??? PHP ??? MySQL???

Please look at these 2 pages:

http://www.element-tech.co.uk/build.php?products_id=470

http://www.alienware.com/configurator_p … KU-DEFAULT

This is what I need. I Know some PHP and MySQL.

I have been sitting in front of my computer for 2 weeks know and I still don’t have anything remotely close to this stuff.

How do these pages have a price at the end of every item and that price updates and charges when they click on other items.

ALSO…

How do I get that floating window on the right side of the screen?

Thanks for all that help.

Brian

thats all javascript (the price update and the floating window)
u may take a look at the html-source of these pages (to get an idea how to do this, not to copy code as this would be illigal)

take ur time, if ur not an expert u shouldn’t be able to write something like this in just 2 weeks

So that is a combination of PHP and javascript -OR- PHP and AJAX ?

I new to all of this stuff… I have made some websites and many dynamic websites for clients… I thought this would be something I could learn as I go…

Am I going to have to tell this client that I cant do this job after 2 weeks of work or can I learn it and make this work?

AJAX is JavaScript + XML. and php can do the XML. so AJAX is JS + PHP/XML.

if u know JavaScript u can easyly learn it (but u should know the DOM of JS as well).

it’s very easy:
Javascript has a class called XMLHttpRequest
this is used to make a HTTP request without canging the page.
it just calles a URL and gets the content bach inside a variable.
this content is XML (could be plain text as well, but XML is the best to use)
then the javascript starts doing something with that data.

in ur case that would be:
ur select (or radiobuttons) gets a onChange that calls a JS function.
this function calls a php-file (e.g. motherbourds.php) and submits a POST/GET var (e.g. selectedprocessor=234).
than this PHP file uses echo to produce xml
e.g.:

<motherboards> <item id="12">ASUS fhxdhcgf jfhf</item> <item id="17">Intel dfgh fgj ghfj</item> <item id="42">lorem ipsum</item> <item id="99">dolor sit amet</item> </motherboards>

as soon as the JavaScript recives this respond it prosessed that data and changes the select/radiobuttons (best is to delete all and insert new).
then it changes the innerHTML of the tag containing the price.

thats all

some links:
http://developer.mozilla.org/en/docs/AJ … ng_Started (this one i used to leard AJAX, it very well explaned and has a lot of examples, and cares about browser-compatiblity)
http://www.xul.fr/en-xml-ajax.html (this i never read but have seen it beeng liked from a lot of sites, so it should be good, but it’s much longer)
http://en.wikipedia.org/wiki/Ajax_(programming) (just as overview)

hope u don’t loose ur client.
Q

Some details about the project I’m working on…

Client is a custom computer company. Who sells high performance built computers to general public.
When a user clicks on a Gaming PC or Workstation PC or Home Media PC … he/she will be taking to a page where just can choose the options for their custom built computer.

Options like the processor, motherboard, memory etc. etc. They will also have the option to click on more details and and a popup window with display more details of the current option. For EXAMPLE: If theres 5 different processors to choose from they can click on a little button next to each and it will show a large image and specs and detail blah blah… But Once they choose the processor the next area right below there selection will need to grey out certain motherboards that may not accept their choosen processor.
(((I was trying to do all of this with radio buttons like:
http://www.thewatchmakerproject.com/jou … pping-cart
http://www.brainbell.com/tutors/php/php … _Cart.html
)))

I have a database set up … I get the query info and set an array for the products by there catagorys (ie: motherboard, CPU, memory, etc…) I use a while loop to List the catagorys and another while loop inside that to list the items in that catagory.

I pasted an example of the code below…

The part that I don’t understand is… How do I get the prices to change and show up like in the example companies above. So it wont show the REAL price of the item… it will just show if the price will subject from the current price or add to the current price. (I hope I described that right??). THEN if someone chooses an option the other option prices will change and reflect there differences.

NEXT - At the end of the page when the user is ready that click BUY or ADD TO CART or whatever… I’m assuming I have to set a session so that the information will pass over to the next screen and show ONLY “ONE item” (the name of the Game PC) and “ONE PRICE” (the final price) and show details about the item (The details that they have choose with no prices just the names.)…

FINALLY - (this stuff I don’t understand either) :: the user is ready and then click next. I will have a SSL for the client so the customer and use a payment gateway to process the payment (credit card) probably Authorize.Net (I heard that were very good)… I have never done this e-commerce before so I’m hoping that all my hard work will just merge with the payment gateway and I don’t have to right some crazy scripts for this to work because I would just kill myself (just jokin). Most of the PHP site I have done are CMS sites and the users/customers contact the company via phone or contact forms.

HERE IS THE CODE I PROMISED: /////

<div id="divBody">
  <div id="divBody_content">
  Body Content Below Here
  <br />
<?php if (!is_null($sel_product)) {
	echo $sel_product["name"];
	} else {
	echo "<h2>DEFAULT PAGE HEADING TEXT HERE.</h2>";
	} ?>
  <br />
  
  <form id="form1" name="form1" method="post" action="">
  <p>
<?php
	// 3. Perform database query
$query = "SELECT * FROM catagorys ORDER BY catagory ASC";
$catagorys = mysql_query($query, $db_connection);
confirm_query($catagorys);

// 4. Use database retured data
while ($catagory = mysql_fetch_array($catagorys)) {
	$catagory_name = $catagory["catagory"];
	echo "<strong>{$catagory_name}</strong> <br />";
	
	// 3. again
	$query = "SELECT * FROM products WHERE id_catagory = {$catagory["id"]}";
	$products = mysql_query($query, $db_connection);
	confirm_query($products);
	
	// 4. agian
	while ($product = mysql_fetch_array($products)) {
	echo "<label><input type="radio" name="{$catagory_name}" ";
	echo "value="{$product['id']}" /> {$product["name"]} ";
	echo "[ " . ($product['price'] - $price_start) . " ] </label>";
//	echo " <a href="">oOo</a> <br />";
	echo "<a href="#" onclick="MM_openBrWindow('product.php?product={$product['id']}','DreamMachine','scrollbars=yes,width=600,height=550')">GET DETAILS</a><br />";
	}
	
}
?>

I hope this helps… Let me know what you all think??

Thanks again for the replys.
-Brian

OOPS!!!

I copy and pasted the wrong URLs for the examples of the 2 companies I was referring too

Here they are:

http://www.element-tech.co.uk/build.php?products_id=470

and

http://www.alienware.com/configurator_p … KU-DEFAULT

Sorry about that.

Brian

to be honest: now i think u have to few knowlage and/or ambitions to get this done. u always know what u wanna do, and actualy answer ur questions by just asking them, but i can’t see that anything of that went inside ur code. as u seem to be under time persure u may realy thing about giving up. i’m sure u are able to get this done, but i don’t think u will get to the point u wanna get to within the next few weeks, maybe not this year. i would like u to get this done but if u can’t get the customer to wait till next year u realy should tell him that u are overstrained.

hopefully im wrong
Q

Well I’m going to talk to the client about taking a huge pay cut like 50% or even more, and I will explain that Its new to me and I will not be upset if they drop me and go with someone else…

I don’t even care… If I learn this stuff then it will be all worth it…

Also if the client drops me I will even point them in the right direction to someone who might know this…

But I will have to continue to finish it. I’m invested now…

Any tips for helping me finish this thing.

good to know ur not giving up.

make a HTML page (no PHP) and try to get the javascripz to work in there.
so u don’t have to deal with PHP and JS at the same time.
integrating it in PHP should be easy later.

start giving all ur tags id’s. so u cann access then with document.getElementById(‘the_id_of_the_html_tag’).

then write the JS functions, and call them with onChange=“function_name(this.id)”

hope this helps u to go on.

SOLVED

This post can be marked as solved.

[SOLVED]

Sponsor our Newsletter | Privacy Policy | Terms of Service