Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Everything posted by Jane39

  1. It's fine Hartley as I messed things up. I will keep looking around for the answer and let you know if I found one. I just have one more question. In the php code mentioned above, is it possible to define the array "$color_palettes[$ii]" before the <td> tag (without changing the html output)? So that way I can use it in the src attributes of the .main class instead of within .toggles class only. Thanks
  2. I pressed F12 (Ctrl+Shift+J) while I'm on the link page and found this. event.returnValue is deprecated. Please use the standard event.preventDefault() instead. panel-1 category.php?category=Dresses:75 Is it the way of viewing the console in browser? This line (panel-1....) comes from another function that I'm using on a navigation bar. I'm placing it within the <body> tag and it's working. As I mentioned, hover function on ProductImage is working but on colors isn't working even I'm putting them in the same place (within th
  3. I had copied and pasted exactly what you gave me into my code but I still didn't see errors in the browser. I think I don't know how to view the console but I will google it now. I'm using Chrome as my browser.
  4. I copied your example as above and replaced the current one in my javascript file but still see no errors in the browser. I think my problem is probably from php code. From select statement I posted in category.php section, you would see I created two columns related to colors; one is called "color_palette" and the other is "color_palettes" which is group concat by all "color_palette" of each product id. Within .main class, each variable "$color_palette" I'm using in the src attributes is from column "color_palette". And within .toggles class, each array "$color_palettes[$ii]" in src
  5. This is generated HTML Hartley. I spaced them for an easier view. <table><tr> <td><div class="image"> <a href="product.php?id=2&colorpalette=JJ2BGXX"><img class="main" data-alt-src="images/1431.JJ2BGXX.BR.jpg" src="images/1431.JJ2BGXX.FR.jpg" width="300" height="327" /></a><br /> <div class="toggles"> <a href="product.php?id=2&colorpalette=JJ169XX"><img data-src="images/1431.JJ169XX.FR.jpg" src="images/1431.JJ169XX.CP.jpg" /></a> <a href="product.php?id=2&colorpalette=JJ2BGX
  6. There's no errors shown up in the browser. I put javaScript in a separate file and link it at the <head> part of html. Hover function on ProductImage is working, but the other is not Hartley.
  7. Hartley, I will store the alternate image for each color later. I did have a column for images, but also when I tried to combine variables $style & $color to create names and links for images and it worked. So I thought I would go with it as that way i don't have to create another table for images. The alternate images and colors still work when I switched the code a little bit but somehow hover function on colors are not working. Here are my javascript. //Hover function on ProductImage var sourceSwap = function () { var $this = $(this); var newSource = $this.data('alt-s
  8. Hi, My product page (output) in HTML is something like this: ProductImage1 ProductImage2 ProductImage3 ProductImage4 Color1 Color2 Color3 Color4 Color2 Color5 Color6 What I'm trying to do is when I hover my mouse over any color above, an original (main) image of ProductImage will switch to another image (to match the hovered color). And that original image will be back when the mouse leaves. Example: http://jsfiddle.net/4dK2x/27/ I also added another hover function on ProductImage
  9. I finally managed to get all products and their available colors displayed on the page Hartley. It took me a lot of days before I figured it out, and now I feel super happy because I can move to the next step. Thanks
  10. Awesome Hartley. I made the php files work finally. It's my fault when I didn't create stored procedures as guidance in Larry's book at first. You're always helpful Hartley. Thank you.
  11. I totally agreed with you about the DB design Hartley and I think I did the same thing. Here are how my tables look like. tblProducts tblSizes tblColors tblImages tblSpecific_Products id id id id id product_name size color image product_id (FK) style_code
  12. Hi Hartley, Regarding step 1 as you mentioned, I tried but still couldn't get all available colors to display on the product page. How do I have those colors in colors table to display on the product page? Do I have to create another attribute table for colors and products tables? Right now I have products table, colors table, sizes table, images table and specific_products table (product_id FK, color_id FK, size_id FK, image_id FK). What I've done now is I had all items displayed on the page. Each item has a default (front-view) image and a hidden (back-view) image. So when user
  13. I'm running PHP files of example 2 from my computer and I got those following errors across pages. An error occurred in script 'D:\XAMPP\htdocs\ex2\html\views\home.html' on line 14: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array An error occurred in script 'D:\XAMPP\htdocs\ex2\html\shop.php' on line 32: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array An error occurred in script 'D:\XAMPP\htdocs\ex2\html\sales.php' on line 20: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array An error occ
  14. I'll follow your recommendation and let you know after trying it Hartley.
  15. Hi HartleySan, Thank you for your clarification, I have a better understanding of how it's like now. Regarding your question, I want users to select a color first (if color options are > 1), then they will click on a dropdown list to select a size available for that color. While unavailable sizes are seen by users, they aren't clickable. As for product images, I will create one separate table for them as you suggested. Here are my php codes for fetching records from database and echoing them to the page. $sql = mysqli_query($con, "SELECT sp.id, p.product_name,p.
  16. Hi everyone, I'm building my own shopping website. I haven't figured out how to populate two dropdown lists with available sizes and colors of a product_id from database. Here is the result I've got from querying database. id product_name style size color price image sku stock 1 Neck Top 104 S White $30.00 104.jpg 104-1 5 2 Neck Top 104 S Black $30.00 104.jpg 104-2 5 3 Neck Top 104 M Red $30.00 104.j
  • Create New...