Jump to content

norbie

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

norbie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I've running an online shop and would like the /cart/ folder to use SSL only, and all other areas of the site to be non-SSL. This is currently working using the following code: root .htaccess: Options +FollowSymLinks RewriteEngine On RewriteCond %{SERVER_PORT} 443 RewriteCond %{REQUEST_URI} !images RewriteCond %{REQUEST_URI} !includes RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L] /cart/.htaccess Options +FollowSymLinks RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domain.com/cart/$1 [R,L] This all works fine. You can see I have excluded the images and includes folder from this rule - this is because when viewing the cart which includes images, there are SSL errors due to the modrewrite trying to show non-SSL images on an SSL page. The only issue I have currently is I have some files eg. /delivery.php in the root of the site that I have linked to in the cart page using the facebox plugin. The issue is that when I click on these links, they do not load properly (I imagine this is because the facebox plugin is being called from an SSL window). Can anyone see a way around this? Perhaps I need to improve the .htaccess code I've already used? Many thanks.
  2. I hope this explains it better, this is what I have at the moment: When a user selects a different colour from the drop down box, a new set of radio buttons must be loaded to represent the stock available in that colour. e.g. for the colour yellow, the "m" radio button is disabled as this product is out of stock in the colour + size. I thought the best way to do this would be to have the radio buttons within a div, and on page load create say 2 divs that are hidden, 1 for yellow, 1 for blue and when the user selects the relevant colour, un-hide the relevant one.
  3. Any suggestions? Please say if you need a better explanation. Many thanks.
  4. Hi guys, I have a coding problem here that I can't quite figure out. For a clothing website I need to display information for each product related to colours and sizes available. I'm using a mysql database to store information on what sizes and colours are available. The structure for this is as follows: `prodcolours` table `colour_id` `colour_name` e.g. Brown `prodsizes` table `colour_id` `size` e.g. M `instock` (boolean) Might not be the easiest way to describe it, but every product has many colours. Each colour has a record stored in the database for S, M, L sizes and has a boolean field to determine whether or not it is in stock. On the product page, there is a drop down box for the user to select a colour. When the user selects a colour I need to show relevant radio buttons for the sizes available in that colour. Sizes that are not available show as greyed out (disabled="disabled"). This works absolutely fine when hardcoding the options for just 1 colour. The issue lies when the user selects a colour, I want the radio buttons to change to reflect the sizes available for the selected colours. The best way I thought of doing this is on page load, create a hidden div for each possible colour and fill them with the right radio buttons code. When the select drop down for colour is changed, make the correct div visible. e.g. colour1 is selected so make the colour1 div visible which contains the right size stock information. Does this make sense? I am very grateful for your help and suggestions.
  5. Hi PFMaBiSmAd, Thanks for your reply. That code snippet is just an example, the data would be stored across multiple tables. The form would be capturing a user's personal details such as name, address, contact details etc which would all go in a "customer" table, with some more data such as their job role and company type (drop down box in form used as a lookup from other tables) then stored in the "customer" table as an ID/integer so that it is normalised. You mentioned putting the field names into an array, can you provide a short example of how this would work? I presume I create an array with the field names, this loops through to process the POST data, but how does this create the mysql query string? Many thanks.
  6. Hi guys, I'm about to produce quite a large booking form that needs to insert data into a mysql database when it has been submitted. It's pretty simple stuff, but there will be around 40-50 fields to enter into the database and I want to check that the code I would normally use is the most efficient way of doing it. I would normally use code like this: <? $field1 = strip_tags($_POST[field1]; $field2 = strip_tags($_POST[field2]; $field3 = strip_tags($_POST[field3]; $field4 = strip_tags($_POST[field4]; $field5 = strip_tags($_POST[field5]; mysql_query("INSERT INTO `table` (`id` ,`field1` ,`field2` ,`field3` ,`field4` ,`field5`) VALUES ('' , '" . $field1 . "', '" . $field2. "', '" . $field3 . "', '" . $field4 . "', '" . $field5 . "')"); ?> field1, field2 etc are all just random names I have chosen for this example. This code works but when producing for say 50 fields, all with different names it can be very tedious to program. I was wondering if there is a more efficient way that perhaps grabs all POST data and puts it all in the database, rather than having to specify each field name and where it goes... Thanks for your time.
  7. All sorted, used arsort to reverse it. Thanks for everyone's help.
  8. That's perfect, just what I was looking for. Thanks! Using the usort() function I can sort the array, but it sorts the wrong way down. i.e. item 21 = 1 item 18 = 5 item 1 = 9 How can I get it to sort the quantity values on the right the other way round?
  9. FYI, it's the quantity that was bought on that order. For instance, order 1 could contain: item2 quantity3 item5 quantity5 I'll have a look through your suggestions now. Cheers.
  10. Hi, I am setting up an e-commerce website where orders are stored in a mysql database after processing. A table called `itemorder` contains a record for each item that has been bought, the quantity purchased, and the order that it belongs to. I'd like to create a list of popular items based on this table. I've tried putting the itemids into an array but can't work out how to do the maths in php to count up how many of each value there are. The quantity field would make things even harder. Any suggestions how I can do this? Many thanks. [attachment deleted by admin]
  11. All sorted now! I looked up which categories the product belonged to, then added the values to an array. Then when creating the list of checkboxes, I used in_array to see if the checkbox value was in the array. If it was then I added the 'checked' attribute. I now have a related problem. When editing an item, it needs to display the correct selected value for a drop down box. These items are DVDs and the drop down box is for the region the dvd belongs to. At the moment I am using this code, but it's very messy looking and I wondered if there was a nicer way of doing it! switch($regionid) { case "0"; $selected0 = "selected=\"selected\""; break; case "1"; $selected1 = "selected=\"selected\""; break; case "2"; $selected2 = "selected=\"selected\""; break; case "3"; $selected3 = "selected=\"selected\""; break; case "4"; $selected4 = "selected=\"selected\""; break; case "5"; $selected5 = "selected=\"selected\""; break; case "6"; $selected6 = "selected=\"selected\""; break; }; <select name=\"regionid\"> <option value=\"0\" " . $selected0 . ">0 - Region Free (Plays everywhere)</option> <option value=\"1\" " . $selected1 . ">1 - United States of America, Canada</option> <option value=\"2\" " . $selected2 . ">2 - Europe, including France, Greece, Turkey, Egypt, Arabia, Japan and South Africa</option> <option value=\"3\" " . $selected3 . ">3 - Korea, Thailand, Vietnam, Borneo and Indonesia</option> <option value=\"4\" " . $selected4 . ">4 - Australia and New Zealand, Mexico, the Caribbean, and South America</option> <option value=\"5\" " . $selected5 . ">5 - India, Africa, Russia and former USSR countries</option> <option value=\"6\" " . $selected6 . ">6 - Peoples Republic of China</option> </select> Thanks for all your help so far.
  12. Excellent! That all works now. I need to setup a page now so the administrator can edit an item. So it will be something like foreach record in the title for that item id, check the relevant checkbox on the list of categories. Could be a bit more challenging..
  13. Hi Adam, That's exactly what I've done - it says in my first post. I'm jsut figuring out a way to have the GUI enable that. Maybe checkboxes will be best. So he can tick the categories it belongs to?
  14. Hi, I'm not sure if I've posted this in the right section, so apologies if I haven't! I have setup an e-commerce website using PHP/MySQL that has an administrator CMS backend. The administrator adds a new product to the system and puts in the name, description etc. He also chooses what category the item belongs to, but it is possible that the item belongs to 2 categories. The database structure is like so: Category - id, name Item - id, name, description CatItem - itemid, catid The 'CatItem' table is used to record which items belong to which category. This is because each item could belong to multiple categories. Upon manually entering data into the database, this works fine. However I am a bit confused for the CMS adding an item. I can create a drop down list to choose a category for the item to belong to, but I need to create a button to "add another category?" which then creates another drop down box like before. This needs to provide the function to add at least say 3 drop down boxes. I can't figure out how to do this so any help is much appreciated! Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.