Jump to content

cinolas

Members
  • Content count

    185
  • Joined

  • Last visited

  • Days Won

    2

cinolas last won the day on January 7 2017

cinolas had the most liked content!

Profile Information

  • Real Name
    Nicolas

Recent Profile Visitors

6,590 profile views
  1. cinolas

    QTPro BS

    So I found what the problem was, or how to fix it anyway. I'll post it here in case it's of any use to anyone. In shopping_cart.php around line 56 there's the line: while (list($option, $value) = each($products[$i]['attributes'])) { This is where my problem was. It wasn't doing the WHILE statement for some reason, even though that very same syntax is used around line 116 and that second instance of it works fine. So the solution to my problem was to replace the first WHILE (around line 56) with a FOREACH statement. I don't know why this works when the WHILE doesn't, but it does for me: foreach ($products[$i]['attributes'] as $option => $value) { And now my attributes display again. SOLVED! Thanks for the help!
  2. That solved it! Not sure why it didn't want to do the that WHILE, but the FOREACH works like a charm. THANK YOU! so much. seriously.
  3. I also tried enabling the logging of SQL queries (though it's probably not an SQL query problem at this point) but it doesn't seem to work. My settings are like: Store Page Parse Time true Log Destination /rollergirl.ca/html/skateshop/err_logs/page_parse_time.log Log Date Format %d/%m/%Y %H:%M:%S Display The Page Parse Time true Store Database Queries true I created the /rollergirl.ca/html/skateshop/err_logs/page_parse_time.log folder and file chmodded both to 777, but nothing gets written in to the file...
  4. What does this line do: reset($products[$i]['attributes']); It's just above the second while, but not above the first one. Could it explain why the first while is being skipped but not the second one? Cheers!
  5. The relevant part of my shopping_cart.php looks like this now with the echos in place. It shows "inside for", "inside if" then "inside SECOND while", but NOT "inside FIRST while" or "Victory!". $any_out_of_stock = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (2 == $customer_id) { echo "inside for<br>"; } // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { if (2 == $customer_id) { echo "inside if<br>"; } while (list($option, $value) = each($products[$i]['attributes'])) { if (2 == $customer_id) { echo "inside FIRST while<br>"; } echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, popt.products_options_track_stock, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; $products[$i][$option]['track_stock'] = $attributes_values['products_options_track_stock']; if (2 == $customer_id) { print_r(array($products[$i][$option], $i, $option, $attribute_values, $languages_id)); var_dump ($attributes_values); var_dump ($attributes); echo "Victory!"; } } } } ?> <table class="table table-striped table-condensed"> <tbody> <?php $products_name = NULL; for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_name .= '<tr>'; $products_name .= ' <td valign="top" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . ' <td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><strong>' . $products[$i]['name'] . '</strong></a>'; if (STOCK_CHECK == 'true') { //$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); //++++ QT Pro: Begin Changed code if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity'], $products[$i]['attributes']); }else{ $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); } //++++ QT Pro: End Changed Code if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { if (2 == $customer_id) { echo "inside SECOND while<br>"; } $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } }
  6. Thanks @ecartz. I added the print_r line just under the track_stock line and it printed nothing. Nothing to be seen in the source: <div class="contentContainer"> <div class="contentText"> PRINT_R RESULTS SHOULD BE HERE <table class="table table-striped table-condensed"> <tbody> <tr> <td valign="top" align="center"><a href="https://www.rollergirl.ca/skateshop/product_info.php?products_id=2183{98}2348"><img src="images/IMPROLLER1_holographic_300.jpg" alt="Impala - Holographic" title="Impala - Holographic" width="115" height="115" class="img-responsive" /></a></td> <td valign="top"><a href="https://www.rollergirl.ca/skateshop/product_info.php?products_id=2183{98}2348"><strong>Impala - Holographic</strong></a><br /><small><i> - </i></small><br><input type="text" name="cart_quantity[]" value="1" style="width: 45px;" class="form-control" /><input type="hidden" name="products_id[]" value="2183{98}2348" /> <button type="submit" class="btn btn-info btn-xs">update</button> <a id="btn2" href="https://www.rollergirl.ca/skateshop/shopping_cart.php?products_id=2183{98}2348&amp;action=remove_product" class="btn btn-danger btn-xs"> <span class="glyphicon glyphicon-trash"></span> </a></td><td align="right" valign="top"><strong>$125<span class="cent">.00 CAD</span></strong></td></tr> </tbody> </table> I tried adding an echo "hello world" to see if I would get that in the source, and that didn't show up either! Hmmmm I moved the echo outside the while (list($option, $value) = each($products[$i]['attributes'])) { and it finally showed up, so the contents of that while is not happening. Strangely that very same while statement is used a few line under to cycle through the attributes to actually show the contents on screen: if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } And that while statement seems to be happening since I see the dash on the page where the attribute should be. I actually added a bunch of echos to run a trace of sorts. It goes into the FOR statement, then into the IF statement, but it does NOT go into the first WHILE. It does however go into the second WHILE. I copied the syntax over, it's the very same syntax and condition. I truly don't understand how that can be. Any clues again, is gold. Thanks!
  7. @hungryfrank I did remove that until I can get the data to display. Same results. Good thinking though. Cheers!
  8. Thanks @ecartz that's a good clue. Neither of those 2 file has been modified in my installation, other than for QTPro. I tested the sql query for the attribute values at the end of the cart function of includes/classes/order.php (which was modified for QTPro) the same way as I did the one in shopping_cart.php (replaced variables with specific ids from know product) and it returns the text values as expected. The includes includes/classes/shopping_cart.php files doesn't deal with the text values that I can see, only setting the IDs, and that part works well. I can make the shopping cart page dump the attribute IDs array and the IDs are all there and fine, it's just the text it's not pulling. There's this bit of SQL on /shopping_cart.php that seems to be cycling through the IDs in the cart array to request the related values in the product options table: $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, popt.products_options_track_stock, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; $products[$i][$option]['track_stock'] = $attributes_values['products_options_track_stock']; } } } Since the data IS in the DBs, and since the SQL query has been tested to be correct, it seems the problem should be in the above code. Either in the way it tries to find the related records in products_options and products_options_values, or in the way it then puts the text data in the array to be displayed. But this code is standard and valid and I can see nothing wrong with it. Any idea how I can test or trace this bit of code, to see where between building the query, fetching the array, and putting it in the variables the text disappears? Cheers!
  9. cinolas

    QTPro BS

    Gotchya! So just modifications to shopping_cart.php, application_top.php and template_top.php? Anything else I should clean up that could affect this? Again, thank you so much for all the help. We would all be lost without people willing to help like you do.
  10. cinolas

    Feedback for raiwa

    I have not worked with @raiwa directly, however he has provided me unparalleled support for various areas of osCommerce through the years. He has always been helpful, courteous, professional, concise and patient, even though some of my requests were clearly beyond what would be considered "regular technical support". His generosity, and ability to see clearly through the various slightly-confused bug-reports from non-coder users, never cease to amaze me. A high quality human!
  11. cinolas

    QTPro BS

    That would be a nightmare @raiwa, my installation is highly customized. I understand that the problem is in my customizations, and not in your code. As such, your help is beyond supporting your contribution. My problem is seemingly simple though: The attribute data is in the database, I just need to make it display on the page. I placed a few var dumps on my page to see some traces, and when I add this line just after the stock check in shopping_cart.php: echo '<pre>'; print_r($products[$i]['attributes']); echo '</pre>'; I get a nice array of all the attribute IDs for that product, but no text. When I place that echo inside the attribute While loop: if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { echo '<pre>'; print_r($products[$i][$option]); echo '</pre>'; $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } I get empty arrays for each attribute. No text, nothing. I took the SQL query that gets constructed just above for the attribute text and ran it directly on my database to see if it would pull the text: <?php $any_out_of_stock = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, popt.products_options_track_stock, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; $products[$i][$option]['track_stock'] = $attributes_values['products_options_track_stock']; } } } ?> Replaced the variables with specific IDs from my actual test item that's in my cart and not showing any attribute text: select `popt`.`products_options_name` AS `products_options_name`,`popt`.`products_options_track_stock` AS `products_options_track_stock`,`poval`.`products_options_values_name` AS `products_options_values_name`,`pa`.`options_values_price` AS `options_values_price`,`pa`.`price_prefix` AS `price_prefix` from ((`products_options` `popt` join `products_options_values` `poval`) join `products_attributes` `pa`) where `pa`.`products_id` = '1941' and `pa`.`options_id` = '27' and `pa`.`options_id` = `popt`.`products_options_id` and `pa`.`options_values_id` = '1442' and `pa`.`options_values_id` = `poval`.`products_options_values_id` and `popt`.`language_id` = '1' and `poval`.`language_id` = '1' And it pulled the text values just fine. I tried hardcoding the language ID in my shopping_cart.php and it gave me the same results. So it's not a language problem. SO (and I do understand that this is no longer support for this contribution, but simply php help) IF the query is good, AND the data is in the DB, THEN the problem must be somewhere in these lines: $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; $products[$i][$option]['track_stock'] = $attributes_values['products_options_track_stock']; Those lines look fine... I would love to add an echo for $products[$i][$option]['products_option_name'] to see if it's blank, but my echo doesn't work there... Again, I know that this is beyond the call of duty... still, any clues is still greatly appreciated, any debugging tips is gold thanks!
  12. cinolas

    QTPro BS

    Thanks @raiwa! I'm a bit hesitant to mess with my QTPro installation since everything else is working fine. I looked at version 6.0 for EDGE and noticed in application_top.php that those modifications: $attributes=array(); if (isset($_POST['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$_POST['attrcomb']))) { $attrlist=explode(',',$_POST['attrcomb']); foreach ($attrlist as $attr) { list($oid, $oval)=explode('-',$attr); if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval) $attributes[$oid]=$oval; } } if (isset($_POST['id']) && is_array($_POST['id'])) { foreach ($_POST['id'] as $key=>$val) { if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val) $attributes=$attributes + $_POST['id']; } } $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $attributes))+1, $attributes); use the $_POST variable, where in my application_top.php the variable used is $HTTP_POST_VARS. Is this a difference between Gold and Edge? Just the same, I copied the code from your 6.0 application_top.php over and just changed $_POST for $HTTP_POST_VARS and it gave me the very same result: all the dashes are there, but no product attribute values. If I wanted to re-install QTPro using your latest 6.0 files linked above, should I change $_POST for $HTTP_POST_VARS? Or should I use a different version that uses $HTTP_POST_VARS instead to match my application_top? Cheers!
  13. cinolas

    QTPro BS

    Hi @raiwa, thanks for this version of QTPro and all the support you provide! I'm using osC 2.3.4 BS Gold with QTPro and everything is working well except for one thing: the product option / attribute values do not show up on the shopping cart page. It shows the correct number of dashes under the product name, where the option values should be, one dash per attribute, but the lines are empty (it only shows the dash "-"). The attribute values do show up properly on checkout_confirm.php so it must be a display problem of some sort. I tried using the latest modified shopping_cart.php file from your github: https://github.com/raiwa/qtpro-5.0-BS/blob/master/Modified files for 2.3.4 BS/shopping_cart.php And it gave me the same results: no values, just the dashes. The data is in the database, I'm using your original code... This is very bizarre and no doubt a problem with my specific setup. How should I go about debugging that?? I'm not even sure where to start You can take a look here, it's a live site: https://www.rollergirl.ca/skateshop Add this product to your cart, select the two options: https://www.rollergirl.ca/skateshop/derby-laces-p-1956.html See how the option values are not showing up? Any clues would be greatly appreciated! Cheers!
  14. Thanks @kgtee, that was worth a try, but interestingly it gives the exact same result: It draws the right number of dashes, but the values are missing. So strange.
×