Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

Hillbilly's Achievements


Newbie (1/14)



  1. I have setup Google Enhanced Analytics on my website to track each stage of the checkout process. I.E. 1) Step 1 - View Cart 2) Step 2 - Add Billing Details (Checkout page in book) 3) Step 3 - Review order, add payment details This triggers when a user loads each page. However the Google analytics is showing more users are reaching Step 3 than are reaching the Step 2 (an impossible event). So I am wondering, as per the book: "The shopping part of the site purposefully does not use sessions (in order to give longevity to the customer’s cart and wish list), but the checkout process will." - Does starting a new session at Step 2 cause this issue? Has anyone else had an issue with this? Or am I barking up the wrong tree?
  2. Perfect! I should have tried that first and saved myself alot of effort! I was testing on both IE and Chrome and both were giving the same issues - now cleared. (Site was already live when the issues showed up) Thank you for your input. Now my mind is at ease.
  3. Hi Larry, You can view yourself - the site is live: www.ltprtz.co.uk If you select the (for eg) "On Road Lights" and then choose one of the drop down menu links: All the menu links EXCEPT the last menu link will link correctly: Ie: The resultant page will open and the link will display: /browse/on-road/headlights However - the last menu item in this drop down - in our case "Round Driving Lights", when clicked, will show: /browse/on-road/driving-round-lights?type=on-road&category=driving-round-lights This is the same across all the product menu items. I'm stumped.
  4. Hi David - sorry for the late response: Code is as follows //fetch data $r = mysqli_query($dbc, "SELECT * FROM categories WHERE master_category = 'on-road' ORDER by id;"); // create variable $on_road_products_basic_menu = ''; //create links while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC ) ) { if ( $r ) { $on_road_products_basic_menu .= '<li> <a href="/browse/'.$row['master_category'].'/'.$row['category'].'/"> '.$row['display_name'].'</a> </li>'; } }
  5. ok - now I see that it is just the last link in each of my drop down menu lists that show the variables in the URL bar when clicked? The links look EXACTLY the same to the other links in the drop down menu (dynamically created). Any ideas anyone? Im going around in circles here... Here is the html of a drop down menu - the highlighted link shows the variables once clicked? (its always the last link that does this) <ul class="menu photo-dropdown submenu is-dropdown-submenu first-sub vertical js-dropdown-active" data-submenu="" role="menu" style=""> <li class="cell is-submenu-item is-dropdown-submenu-item" role="menuitem"> <a href="/browse/off-road/worklights/"> <img src="/products/menu_work_light.jpg" alt="Work Lights"> <br>Work Lights</a> </li> <li class="cell is-submenu-item is-dropdown-submenu-item" role="menuitem"> <a href="/browse/off-road/lightbars/"> <img src="/products/menu_lightbars.jpg" alt="Lightbars"> <br>Lightbars</a> </li> </ul>
  6. Hi, My htaccess has a this ReWriteRule which works perfectly: RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/?$ browse.php?type=$1&category=$2 However sometimes I see the variables included in the URL bar. Eg: https://www.mysite.com/browse/on-road/lights?type=on-road&category=lights Other links are fine: https://www.mysite.com/browse/on-road/worklights I cant tell why only a few select links show the variables. Any help would be appreciated. Here is my full htaccess file - some bits added for SEO: <if "%{HTTPS} == 'on'"> Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" </if> ErrorDocument 404 /404.php <IfModule mod_rewrite.c> Options -MultiViews ## Base Redirects ## # Turn on Rewrite Engine RewriteEngine On # Redirect to secure HTTPS before changing host RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteCond %{https} off RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L] # Remove trailing slash from non-filepath urls RewriteCond %{REQUEST_URI} /(.+)/$ RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ https://www.mysite.com/%1 [R=301,L] # Include trailing slash on directory RewriteCond %{REQUEST_URI} !(.+)/$ RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+)$ https://www.mysite.com/$1/ [R=301,L] # Force HTTPS and WWW RewriteCond %{HTTP_HOST} !^www\.(.*)$ [OR,NC] RewriteCond %{https} off RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L] # For product categories: RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/?$ browse.php?type=$1&category=$2 # For specific product: RewriteRule ^products/([A-Za-z\+\-]+)/([0-9a-zA-Z-]+)/?$ products.php?category=$1&SEOpagename=$2 </IfModule
  7. Thanks Larry, One last question regarding the above. I just have one small issue in that some of the columns names in Winch Specifications table and the Hoist Specifications table are the same. Is there any way to add a prefix to the column names of the entire table? Eg: SELECT psw.* AS psw_*, psh.* AS psh_* ... (rather than listing every singles column with AS)
  8. OK - I managed to return the products and the specifications in a big table as follows: IN product_ids VARCHAR (300) // the product ids and sku's sent concatenated in an array eg: "1-WIN01","123-HOIS98","206-WIN651" // I concatenated the sku and ids as if I used the id on its own then the WHERE clause failed as it would find "1" in "123" BEGIN set @query = concat("SELECT c.category, pr.*, psh.*, psw.* FROM products AS pr INNER JOIN categories AS c ON c.id = pr.category_id LEFT JOIN product_specs_hoists AS psh ON psh.id = pr.specs_id LEFT JOIN product_specs_winches AS psw ON psw.id = pr.specs_id WHERE CONCAT(pr.id,pr.sku) IN (" , product_ids ,") AND pr.enabled=1"); PREPARE stmt FROM @query; EXECUTE stmt ; END So now I can simply use the category result on the php page to decide which specifications to display. If ($row['category']== "winches" { // echo Winches Specifications; } else { //echo hoist specifications } Am I re-inventing the wheel here - is there an easier way to do this?
  9. Thanks for responding Larry, Basically I would like to return a list of products with their technical specifications. The database has a list of products, each product belongs to a category and each category has a separate table for it's technical specifications. For example: Product (Winch 1) - Category (Winches) - Specifications (Winches Technical Specs) Product (Hoist 1) - Category (Hoists) - Specifications (Hoists Technical Specs) Product (Winch 2) - Category (Winches) - Specifications (Winches Technical Specs) etc I have a situation where I need to call products from both winches and hoists categories at the same time but I am unsure of how to write the Stored Procedure so it knows which Technical Specs table join to for each product? P.S. The products table is linked to the categories table with an index (category_id) and to its specifications by an index (specs_id). So in this example "Winch 1" and "Hoist 1" could have the same Specs_id column value but these would be referring to different tables. I hope that makes sense?
  10. Hi, (Thanks for the great book ) I am trying to write a a stored procedure that will perhaps loop through an array of product ids and then JOIN tables in the database depending on what category the product is in (their may be multiple products in different categories). I am not sure if this possible - am I barking up the wrong tree? Very simplified - this obviously doesn't work but perhaps you can get an idea of what I'm trying to achieve) IN: product_ids_array VARCHAR (300) //Array of ids sent with the call BEGIN // start loop here somehow ? Would I have to split ID array first? DECLARE master_category SMALLINT SELECT master_cat_id INTO master_category FROM products WHERE id IN (products_ids_array); IF master_category = 1 THEN SELECT p*, sp* FROM products AS p INNER JOIN specs_table_1 as sp ON sp.id = pr.specs_id WHERE pr.id IN (products_ids_array); ELSE SELECT p*, sp* FROM products AS p INNER JOIN specs_table_2 as sp ON sp.id = pr.specs_id WHERE pr.id IN (products_ids_array); ENDIF; end loop here ?? END Any help would be much appreciated.
  11. I am sure this is a stupid question but I'm tearing my hair out. I am trying to email data that I have cleaned (from a multi-line text box) with escape_data. The problem is the data is sent with \r\n instead of actual line breaks. Eg: message in email will read "Hello\r\nThis is the 1st parapgraph\r\n\r\nThis is another" I have tried to remedy this below but it does not work: if ($_POST['Information'] != '') { $Information = escape_data($_POST['Information'], $dbc); $Informationformatted = str_replace(array("\r\n", "\r", "\n"), "<br />", $Information); } else { $contact_errors['Information'] = 'Please enter your message'; } //message in email $body = $Informationformatted; $headers = 'MIME-Version: 1.0'. "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n"; $headers .= 'From:'.$Email; mail ('email@email.com', 'Message', $body, $headers); I am still getting the same output: "Hello\r\nThis is the 1st parapgraph\r\n\r\nThis is another" I have also tried $Informationformatted = nl2br($Information); This did not work either. (Or would be something to do with the headers?)
  • Create New...