Jump to content

ledave

Members
  • Content count

    69
  • Joined

  • Last visited

3 Followers

About ledave

  • Birthday 04/16/1976

Profile Information

  • Real Name
    David Parloir
  • Gender
    Male
  • Location
    127.0.0.1
  • Website
  1. ledave

    Ajax Order Editor

    hi everybody, sorry for not responding you, but I haven't received any notification email :( Anyway, I'm currently finishing a 2.0 version of this contrib, those tax problems and other bugs will bo solved. Besides, there is no need anymore to refresh the browser to see the changes, real AJAX this time ;) Before uploading it at osc's contribution I want to make more test. So if anyone is interested in testing it, please mail me at david[dot]parloir[arobase]gmail[dot]com and I'll send you a zip. See you soon
  2. ledave

    Ajax Order Editor

    well sabiam, those lines doens't seem to interfer with our problem: the first one is about the billing address and the other is about the price of the ordered product. Have you check what I asked you before?
  3. ledave

    Ajax Order Editor

    hi sabian, well I'm confused... I don't understand why it's working for some stuff and not for others :huh: let's start with the "add a product" action, it may be easier. ¿Have you check if the product is in the db, in the orders_products table, but with a wrong oID? Also, as my files are heavy modified, could you paste here the part of the orders_ajax.php that add the product in the db? (i think it's if ($action == 'set_attributes') { and also what is like the function setAttr(tabl){ in the includes/ajax.js see you. ps: as the forum doesn't warn me when there is an answer, if I don't answer you in 2 days don't hesitate to send me a pm :)
  4. ledave

    Ajax Order Editor

    wex:sorry, I can't look into that. Here you will find my orders_ajax (in txt mode so you can see it), the one I use in my shop: I have no problem of 2-3% as your comenting. Maybe it can help you: compare it with yours and see the diferences (if you don't have it yet, use winmerge for that). There is some stuff relative to my shop that wont serve you. DON'T REPLACE YOUR FILE BY MINE, that would cause a lot of problems. In this file the specials prices are managed too. Hope it can help you, and don't hesitate to get back to me here if you need help understanding some part of the code... or for telling me that it fixed this issue :rolleyes: bkpie: sure, there is always a way ;) Get inspiration of the model. Hope that help. As for wex, don't hesitate to ask me here about some points of coding problem you could meet. cheers have a good code, and day
  5. ledave

    Ajax Order Editor

    hi wex, how do you manage the taxes? I mean, do ou display with or without tax? Do you have several taxes set? It seems that the code add a tax to the price... Should it?
  6. ledave

    Ajax Order Editor

    PHP5 COMPATIBILITY I've just upgrade to php5 and have had a compatibility problem. The solution is changing the admin/includes/advanced_search.php by: <?php require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS); $heading[] = array('text' => ''); $info_box_contents = array(); $info_box_contents[] = array('text' => tep_draw_input_field('keywords', '', 'id="keywords" onKeyUp="loadXMLDoc(this.value);" autocomplete="off" style="width: 100%"')); $info_box_contents[] = array('text' => '<div style="display: block; margin-left: 0%; width:100%; float: left; border:solid 1px; background-color:#CCCCCC;" id="quicksearch">' . PRODUCTS_SEARCH_RESULTS . '</div>'); $box = new box; echo $box->infoBox($heading, $info_box_contents); ?> Hope it can help someone.
  7. ledave

    Ajax Order Editor

    okay, it seems that your catalog/includes/advanced_search.php is wrong, it should be like this: <?php require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS); $info_box_contents = array(); $info_box_contents[] = array('text' => tep_draw_input_field('keywords', '', 'id="keywords" onKeyUp="loadXMLDoc(this.value);" autocomplete="off" style="width: 100%"')); $info_box_contents[] = array('text' => '<div style="display: block; margin-left: 0%; width:100%; float: left; border:solid 1px; background-color:#CCCCCC;" id="quicksearch">' . PRODUCTS_SEARCH_RESULTS . '</div>'); $box = new box; echo $box->infoBox('', $info_box_contents); ?> yours is missing the id="keywords" tell me how it's working now
  8. ledave

    Ajax Order Editor

    hi rajonbh, glad you like it :thumbsup: Do you have the admin acces contrib installed? You have to autorized the orders_ajax.php file. I guess that's why it's not working. If that doesn't work we'll look into it. cheers
  9. ledave

    Ajax Order Editor

    craxx, in order to keep the french forum in french, I answer you here. The code you spoke about is just to have indicated when you add a product if it has stock or no, integrating QTpro. Here it is: in admin/includes/ajax.js, add those 2 fonctions: function check_stock() { var atributo = ''; for (var i=0; i<document.attributes.elements.length; i++) { if (document.attributes.elements[i].name.indexOf('atrid_') == 0) { atributo += ((atributo == '') ? '' : ',') + document.attributes.elements[i].name.substring(6)+'-'+document.attributes.elements[i].value; } } var url = "orders_ajax.php?action=check_stock&prID=" + document.attributes.products_id.value + "&atr=" + atributo; createRequest(); xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = StateChangeStock; xmlHttp.send(null); } function StateChangeStock() { if(xmlHttp.readyState == 4) { document.getElementById("checkStock").innerHTML = xmlHttp.responseText; } } Then in admin/orders_ajax.php, line 171, after if ($products_attributes['total'] > 0) { add $check_stock = ''; Line 183, replace $attributes .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td class="main">' . tep_draw_pull_down_menu('atrid_' . $products_options_name['products_options_id'], $products_options_array, $selected_attribute) . '</td></tr>'; with $attributes .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td class="main">' . tep_draw_pull_down_menu('atrid_' . $products_options_name['products_options_id'], $products_options_array, $selected_attribute, 'onchange=check_stock()') . '</td></tr>'; $check_stock .= (($check_stock == '') ? '' : ',') . $products_options_name['products_options_id'] . '-' . $products_options_array[0]['id']; and line 185, just before $attributes .= '<tr><td colspan="2">' . tep_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '</td></tr></table></form>'; add $check_stock_query = tep_db_query("select products_stock_id from " . PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['prID'] . "' and products_stock_attributes = '" . $check_stock . "' and products_stock_quantity > '0'"); $attributes .= '<tr><td colspan="2" id="checkStock">' . ((!tep_db_num_rows($check_stock_query)) ? 'This option is not available.' : ' ') . '</td></tr>'; And finally, just before the las ?>, add elseif ($action == 'check_stock') { $check_stock_query = tep_db_query("select products_stock_id from " . PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['prID'] . "' and products_stock_attributes = '" . $HTTP_GET_VARS['atr'] . "' and products_stock_quantity > '0'"); echo ((!tep_db_num_rows($check_stock_query)) ? 'This option is not available.' : ' '); } That's it. But I repeat, I'm not planning to update stocks in this contrib, it would be very heavy. The easiest way to do it, I think, is to update when you send the order. cheers
  10. ledave

    Ajax Order Editor

    :blush: thanks, glad you like and use it :thumbsup:
  11. ledave

    Ajax Order Editor

    hi mck, for having decimals as your products_quantity, you should just change the type of data of this column in the database (products table). However, in your case it would be better to add th weight field and make it editable: I can't help you with this, but if you look at the code you could do it. hi sukarya, this should work: $street = (($ajax != '') ? '<a href="java script: updateOrderField(\'' . $order_id . '\', \'orders\', \'' . $ajax . 'street_address\', \'' . addslashes(tep_output_string_protected($address['street_address'])) . '\');" class="ajaxLink">' : '') . tep_output_string_protected($address['street_address']) . (($ajax != '') ? '</a>' : '');
  12. ledave

    Ajax Order Editor

    hi craxx, I'm sorry to say that no, it isn't includes QTpro. I do have it installed in my shop, but I update the stock when I change the order's status to send, so I only do the update once, in the moment the products really leave the store. Freeman, I'm preparing a 2.0 version of that contrib: besides the fact that 2.0 is cool right now :lol: , I've thought a way to do it in a more eficient way. I'll keep you updated. cu
  13. ledave

    Ajax Order Editor

    hi freeman, yep, that's right, one small bug. I tought I had corrected but it seems not... Here what I have in the brackets of } elseif ($action == 'set_attributes') { $orders_id = $HTTP_GET_VARS['oID']; $attributes = array(); $products_id = 0; $products_quantity = 0; foreach($HTTP_POST_VARS as $key => $value) { if ($key == 'products_id') { $products_id = $value; } elseif ($key == 'products_quantity') { $products_quantity = $value; } elseif (stristr($key, 'trid_')) { $attributes[] = array(substr($key, 6), $value); } } //select customer's group $b2b_query = tep_db_query("select c.customers_group_id from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_id = '" . $orders_id . "' and o.customers_id = c.customers_id"); $b2b = tep_db_fetch_array($b2b_query); //check for special price $special_price_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $products_id . "' and status = '1' and customers_group_id = '" . $b2b['customers_group_id'] . "'"); if (tep_db_num_rows($special_price_query)) { $special_price = tep_db_fetch_array($special_price_query); $product_price = $special_price['specials_new_products_price']; } else { if ($b2b['customers_group_id'] != 0) { $product_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id = '" . $b2b['customers_group_id'] . "'"); $product_price_ = tep_db_fetch_array($product_price_query); $product_price = $product_price_['customers_group_price']; } else { $product_price_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'"); $product_price_ = tep_db_fetch_array($product_price_query); $product_price = $product_price_['products_price']; } } $product_info_query = tep_db_query("select p.products_model, pd.products_name, p.products_tax_class_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_id = '" . $products_id . "' and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); if (DISPLAY_PRICE_WITH_TAX == 'true') { $tax_query = tep_db_query("select tax_rate, tax_description from " . TABLE_TAX_RATES . " where tax_rates_id = '" . $product_info['products_tax_class_id'] . "'"); $tax_ = tep_db_fetch_array($tax_query); $tax = $tax_['tax_rate']; $tax_desc = $tax_['tax_description']; } else { $tax = 0; } //OJO, hay que insertar primero el product para saber el orders_products_id... $attribute_price_sum = 0; $attribute_update = false; if (sizeof($attributes) > 0) { $attribute_update = true; for ($j=0; $j<sizeof($attributes); $j++) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $attributes[$j][0] . "' and options_values_id = '" . $attributes[$j][1] . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { $attribute_price_sum += (float)$attribute_price['options_values_price']; } else { $attribute_price_sum -= (float)$attribute_price['options_values_price']; } $attribute_name_query = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $attributes[$j][0] . "' and language_id = '" . (int)$languages_id . "'"); $attribute_name = tep_db_fetch_array($attribute_name_query); $options_name_query = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $attributes[$j][1] . "' and language_id = '" . (int)$languages_id . "'"); $options_name = tep_db_fetch_array($options_name_query); tep_db_query("insert into " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " (orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix) values ('" . $orders_id . "', '0', '" . tep_db_input((string)$attribute_name['products_options_name']) . "', '" . tep_db_input((string)$options_name['products_options_values_name']) . "', '" . tep_db_input((float)$attribute_price['options_values_price']) . "', '" . tep_db_input((string)$attribute_price['price_prefix']) . "')"); } } $final_price = (float)$product_price + (float)$attribute_price_sum; tep_db_query("insert into " . TABLE_ORDERS_PRODUCTS . " (orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity) values ('" . $orders_id . "', '" . $products_id . "', '" . $product_info['products_model'] . "', '" . $product_info['products_name'] . "', '" . $product_price . "', '" . $final_price . "', '" . $tax . "', '" . $products_quantity . "')"); $orders_products_id = tep_db_insert_id(); if ($attribute_update == true){ tep_db_query("update " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set orders_products_id = '" . $orders_products_id . "' where orders_products_id = '0'"); } as you can see, besides the specials price, it checks the customer's group (SPPC contrib). If you don't have it installed in youir store, you should erase this: //select customer's group $b2b_query = tep_db_query("select c.customers_group_id from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_id = '" . $orders_id . "' and o.customers_id = c.customers_id"); $b2b = tep_db_fetch_array($b2b_query); and this if ($b2b['customers_group_id'] != 0) { $product_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id = '" . $b2b['customers_group_id'] . "'"); $product_price_ = tep_db_fetch_array($product_price_query); $product_price = $product_price_['customers_group_price']; } else { (and don't forget the last closing bracket. cheers
  14. ledave

    Ajax Order Editor

    hi Nika, well I don't understand, that's weird. ¿have you changed anything in the orders_ajax.php file? When you installed it, ¿everything went smooth or do you had problems?
  15. ledave

    Ajax Order Editor

    hi Rob, this line is correct. Maybe the line before or after. Anyway, the best way to install a contrib is merge the files with a compare and merge program (I use winmerge, free and free): with this tool you can see the difference between 2 files and avoid those parse errors. good luck
×