Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dropdown, MySQL and Calculator help :)

Featured Replies

Hi guys (and girls),

 

I have a bit of a problem, and would massively appreciate any help or guidance you can provide :)

 

I'm in the process of developing a website which is for a small buisness building and selling custom computers. They also sell a range of pre-designed systems which need to be customisable on the site.

 

Each system has an order button, and a customise button. The order button takes the customer to a confirmation page where they are shown the full specification of the system, and they can choose to order it, or customise it. The customise buttons on both pages will take them to the same page to customise the system.

 

Each system will have a customise page, which has dropdown boxes for each individual component they may wish to change.

The plan is for each dropdown to have its' option value as a component id number.

 

Each component will be in a MySQL database table. The table will have 3 fields - Product ID, Description and Price.

 

What I would like is for the bottom of the customise page to have a running total, which will be the price for the database minus the basic price, so just the difference in prices.

 

Is this possible? as the dropdowns won't be drawn from the database, however my thoughts where that the cost function could lookup in the database for each product code selected.

 

Now I come to the confirm order page. I would like to be able to display all of the original options for the computer unless any have been modified in the customise page, in which case the new item description will have to be taken from the database, and replace the old item description.

 

There will be a seperate order page for each system, and when the order button is submitted, an e-mail will be sent to the sales team who will create an invoice, check the latest prices etc and work out a shipping cost.

 

Does the above sound reasonable and possible? If anyone is able to provide any hints, tips, or code to hekp acheive this, it would be very welcome.

 

I hope I have explained this clearly, but any questions, please, do ask :)

 

Harry

Sounds possible, but a lot of work and therefore you could charge quite a lot for something like this.

An alternative is to try to find an existing e-commerce solution which can do it for you, though may take some customisation to do exactly what you want.

 

Magento allows configurable products, see an example

 

As you can see, you can see the preconfigured system which you can add to cart straight way, or if you click the product then you can customise it, with real-time price updates.

 

The only thing I'm not sure if Magento can do or not, is your checkout process for each system individually.

 

Magento is free to use, and therefore will save you a lot of time and cost of developing your own. You'd just have to create a theme (or buy a ready-made one) and then customise it to meet your needs.

 

Other shopping cart scripts exist too, so it would be worth doing your research first.

Here's a list of shopping carts, it's still being updated but has quite a few mentioned that you could check out.

My first response for the dropdown menus would be to use some sort of Ajax call when an option is clicked to get the price from the database and update the total. So something like this where "updateTotal(id);" is a javascript function utilising the Ajax interface:

 

<select name="blah">
 <option value="39393" onClick="updateTotal('39393');">Geforce 9200 Graphics Card</option>
 <option value="12121" onClick="updateTotal('12121');">Geforce 9300 Graphics Card</option>
</select>

I'm afraid I can't help you with the Ajax as I don't have much experience with it myself but I know many developers here do and they might be able to help you out a bit more. It might also help to use some sort of Javascript framework such as jQuery to simplify the development process.

 

For the confirm order page, you can have the users chosen hardware stored in a PHP session which the confirm page can draw data from in order to display on the page. Plenty of information can be found on this sort of things if you search google for "PHP Forms", "Multi-Page PHP Forms" or something similar.

 

I'm probably dropping links a bit too much here but I have found CodeIgniter to be a fantastic framework for building applications such as this. It's built in form, session and security features make it a breeze to work with plus the documentation is perfect.

 

Dan

 

EDIT: Mr Brightside's option might be better if you're not considering the "DIY" approach :)

  • Author

Cheers chaps :) If possible I'm going to try and create it myself, although I may well end up using a pre-buitl cart as above. At least by doing it DIY it will help me improve my skills (i'm a Computer Science student by day) so it can't hurt :)

 

Once again, your responses are very greatfully recieved :)

 

Ps. I see your an ATC man also Dan, nice one :good:

 

*edit - having looked more closely at magneto, I'll be installing it on a test area I have to see if I can do what I want, and see if I can create a theme for it :)

 

The way the item is ordered is not massively important, all I need to be able to do is check the prices as I buy each part as a PC is ordered, so it may be that it goes down in cost, or indeed up :)

It's always better to code your own, if you have the time at least give it a go, experience is always good :D

 

Building what Dan said, you don't need the AJAX call to get the prices if you already have the prices displayed on the page. You can have a callback each time the drop-down value is changed, which updates the total price based on the price of the newly selected product.

 

Storing the products in the session is the best way to go. You can use an array for each system so it's easy to loop through and display the system on other pages such as the Shopping Cart.

 

I've not tried CodeIgniter myself, I'm more familiar with Zend Framework. For any reasonable sized application a PHP framework is always good to use, so try out CodeIgniter and see what you think. It'll save you from trying to do the mundane things, and let you actually get on with coding the application itself.

 

As a Computer Science student, no doubt you'll be familiar with OOP, which you can use in PHP. Most Frameworks use the MVC (Model-View-Controller) architecture, in which your models will essentially be your class files. This'll make your application really flexible and easy to maintain and modify in future.

  • Author

Sounds good, will get a move on after my last exam :)

 

My thoughts are to have the price difference displayed in the dropdownm although I don't know how to draw it from here..

My thoughts are to have the price difference displayed in the dropdownm although I don't know how to draw it from here..

I'm not sure what you mean by the price difference but you may be able to do it with something like this where "updateTotal(price)" is the javascript function that takes the price variable and updates the "total" value with it:

 

<select name="hardware">
 <option value="3939" onClick="updateTotal('150')">Geforce 9200 Graphics Card - £150</option>
</select>

It hadn't dawned on me that you will have already selected the product information to display on the page so as MrBrightside said, Ajax wont be needed.

 

I see your an ATC man also Dan, nice one

1476 (Rayleigh) Squadron all the way :D

  • Author

Sorry, what I emant was the price I would charge for the new component, which would be the price of it minus the price of the existing component. Eg standard graphics card is £100, new one is £175, the price displayed would be +£75

 

I'll probably be adding each dropdown list manually, if that makes any difference?

  • Author

I'm going to sound really daft, but I'm not too good with this web design lark (doing the site as a favour). What code can I use to display the total on the customise page? Then do I pass this to the confirmation page? :)

 

Cheers

You can use a javascript variable to display the total. You can then use javascript functions to update that variable and update the page with the new value.

 

I didn't know that you are a complete beginner though. To achieve what you have described in post #1 requires quite a bit or work for the beginner. You will have to learn HTML, CSS, PHP and some jQuery would also be helpful for the updating of the page etc.

 

There are hundreds of posts on the forum detailing where to start. You should probably start with the W3 Schools PHP and Javascript tutorials.

 

After learning the basics, we'll always be here to help ^_^

  • Author

I have a fair idea of CSS and HTML, just not much experience of PHP and Javascript, although have doen Java, so have some basics :)

I have a fair idea of CSS and HTML, just not much experience of PHP and Javascript, although have doen Java, so have some basics :)

 

There's still quite a significant difference between PHP and Java - the concepts are the same, but they both do very different things.

You would be better off working through some simpler tutorials before attempting something like this.

  • Author

Ok, cheers chaps :) Will have a gander through tutorials, then have a pop at this :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.