Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

djmonkey1

Pioneers
  • Posts

    2,114
  • Joined

  • Last visited

Posts posted by djmonkey1

  1. Hello,

     

    I like the new update and how it gets the shipping prices! Nice work.

     

    One comment, not an issue, but if I was to write in the comments box that I have credited a customer £20 for example, once it is updated it adds a funny capital  infront of the pound sign, which it never used to

     

    Thanks

     

    Dave

     

    This is the UTF-8 bug. See my previous post for more on this topic.

  2. Hello,

     

    in switzerland i need accentued characters in words ex: écouter and when i wright a new status or comment, the word is écouter ...

    only when in the admin box of Order Editor "Allow the use of AJAX to update order information? " is TRUE

    else if AJAX is on "FALSE" all is OK?

     

    Have you an idea?

     

    Thank you

     

    (Before we begin I would like to add that if you are having encoding issues like this one you can avoid them altogether without any further ado by setting 'Allow the use of AJAX to update order information?' to "false" at Admin->Configuration->Order Editor. However, if you do this, you won't be able to enjoy all the neato benefits of using the AJAX features. So, if AJAX is the thing for you, please continue reading.)

     

    As VaM and yedle have shown us, this is not a problem with the JavaScript function encodeURIComponent; rather it is an issue of conflict between whatever CHARSET you are using and the fact that XMLHttpRequest encodes data sent to the server in UTF-8 (UTF-8 is a nearly universal multilingual character encoding that is rapidly becoming the standard method of encoding characters throughout the world of email and the internet. osCommerce 3.0, for example, is encoded in UTF-8). So if you have a charset of, say, ISO 8859-1, but then use AJAX to submit a word like "écouter" to the server, it ends up being displayed as "écouter". The reason is that the AJAX encodes the "é" in UTF-8, but ISO 8859-1 interprets that encoded value as "é".

     

    The first thing we have to do is make sure that Order Editor is using the corrrect user-defined CHARSET. This is done, as VaM has suggested, by finding in edit_orders_ajax.php v5.0, v5.0.1, or v5.0.2 (this is a bug that will be fixed as of the soon to be released v5.0.3) the code

      // output a response header
    			   header('Content-type: text/html; charset=ISO-8859-1');
    
    			   require('includes/application_top.php');

    and changing it to:

      require('includes/application_top.php');
    
    			   // output a response header
    			   header('Content-type: text/html; charset=' . CHARSET . '');

     

    This, however, will not solve all your AJAX encoding problems, because your CHARSET is probably not UTF-8. You can find your CHARSET settings for the admin and catalog sides, independently, at includes/languages/*.php where * is whatever language(s) you have defined on your site; the reason for this is that each different language could have its own CHARSET. The code you're looking for will look something like this:

    // charset for web pages and emails
       define('CHARSET', 'iso-8859-1');

    To change it to UTF-8 you would replace that with

    // charset for web pages and emails
       define('CHARSET', 'UTF-8');

    You can probably change all of your CHARSETs to UTF-8 and get away with it. In fact, in the long run, you'll probably be better off if you do. UTF-8 works with a huge number of languages; the odds that UTF-8 doesn't support your language are pretty slim, and if it doesn't and you deal with website design you probably already know.

     

    The problem with switching, especially if you have an established website, is that all of the characters you've typed into your product descriptions, currency symbols, etc, are encoded in whatever CHARSET you had before, and might appear differently when rendered in UTF-8. For instance if you use GBP as one of your currencies you probably have this as the currency symbol: £. If you entered that in your database using iso-8859-1 then switched to UTF-8, the pound symbol will then show up as a question mark (?) and you will have to re-enter it into the database in order for it to appear properly. On my english language sandbox site this is the only problem that I ran into when changing over to UTF-8, however the number of symbols and characters that this kind of problem can occur with goes up exponentially with various languages; for an example see the screenshots posted by yedle. Probably, if your website is already established and written using the Cyrillic alphabet, you don't want this sort of thing happening on every page of your website, unless you're looking for something to do.

     

    Another possibility is using or writing a function that will convert the data from UTF-8 back to your CHARSET. The problem here is that it requires custom coding for each different encoding. The PHP module/function iconv should be able to handle this but doesn't support all encodings and is not yet widely available (it is included by default with PHP 5.0).

     

    So, yes, this can be fixed, but not necessarily easily.

  3. Hi DJ,

     

    The local value of register_globals is on.

     

    Cheers,

    Max

     

    Try this- open admin/edit_orders_ajax.php, scroll all the way to the bottom, and find this code:

    	<?php } //end if ($action == 'new_order_email')  {  ?>

     

    Change it to this:

    	<?php } //end if ($action == 'new_order_email')  {  
    echo 'Hello world!'; ?>

     

    Then try an edit and see what you get.

  4. Server settings for register_globals is off, however there is an entry in /.htaccess as follows:

     

    #<IfModule mod_php4.c>
      php_value session.use_trans_sid 0
      php_value register_globals 1
    #</IfModule>

     

    osC works correctly without the use of the register_globals patch - my assumption is that this setting in .htaccess overrides the server setting. I just checked the .htaccess in the /admin folder and all of this had been commented out. So I replaced it with the text above, but still get no joy.

     

    Cheers,

    Max

     

    Go to Admin->Tools->Server info and find there what the Local Value of register_globals is.

  5. SUPER NOW is editing OK.

     

    My last problem with code on pages.

     

    Because I have page in another language (czech) have trouble with write to database. In other part of shop is editing OK. When I use code Windows-1250

     

    i change in editorder.php this

     

    */

    // charset for web pages and emails

    define('CHARSET', 'windows-1250');

     

    here is sample BEFORE EDIT: - here is OK

     

    here is picture when EDITing : - here is OK

     

    after send comments or select shipping : - here is bad code for my language.

     

    I test today ORDER EDIT and other function is very good. I make only language modul for CZECH.

     

    Thank you for pointing out these problems. As VaM has suggested, change in /admin/edit_order_ajax.php

      // output a response header
      header('Content-type: text/html; charset=ISO-8859-1');
    
      require('includes/application_top.php');

    to:

      require('includes/application_top.php');
    
      // output a response header
      header('Content-type: text/html; charset='.CHARSET.'');

     

    After that, I have the same question for you: what happens if you change your Charset to UTF-8?

  6. Ajax Order Editor is excellent!

    But i have one problem with charset (other than iso-8859-1, for example, problem with russian language charset windows-1251).

     

    All content in ajax order editor in UTF-8.

    For example, i change Shipping method and after reloading input filed with shipping method was filled with new shipping information BUT in UTF-8 encoding, not in windows-1251.

     

    How to use CHARSET constant defined in osCommerce ?!

     

    I change in /admin/edit_order_ajax.php

      // output a response header
      header('Content-type: text/html; charset=ISO-8859-1');
    
      require('includes/application_top.php');

    to:

      require('includes/application_top.php');
    
      // output a response header
      header('Content-type: text/html; charset='.CHARSET.'');

     

    And problem resolved, but not for all ajax order editor.

     

    Comments still added in UTF-8 encoding and sending to customer in UTF-8.

    I wan't to see all information in CHARSET constant (for russian - CHARSET constant = windows-1251)

     

    P.S. Sorry for my english, i hope you understand me.

     

    This is excellent information, thank you for pointing out these problems. Unfortunately, as you have experienced, XMLHttpRequest sends all data in UTF-8 format. That's not something we can change, it's just the way it works.

     

    Here's what I'm wondering, however: what happens if you change your charset to UTF-8?

  7. Hi DJ,

     

    Here's what happened:

     

    When I clicked the "edit" button to go to the edit_orders.php:

     

    When attempting to change the quantity of an item:

     

    When attempting to delete an item:

     

    The error relating to 'cursor' also appears in my default installation of osC.

     

    I hope this is helpful - on the face of it, there seems to be some problem with CSS, but I don't know if it is related to this particular problem. Thanks for all your help :)

     

    Max

     

    Those errors are normal. But, something is not happening. You're not getting a responseText, in fact nothing is happening on the server side.

     

    What PHP version are you running?

  8. Hi!

    Firstly, thanks for this wonderful contribution.

    I have just installed osCommerce and this is the very first contribution I have tried to install.

    Since I didn't have any other editions, I basically uploaded the required folders/files into their respective and overwrite the existing.

    When I test to edit the order, I receive the same error as jimmydagoogler.

    Any guide or suggestion would be deeply appreciated~ :blush:

     

    As it turns out, tep_hide_session_id() is used in admin/orders.php at lines 334 and 337 of the stock file (must be new for RC1 or I just missed it before).

     

    If you just installed osC you must be using RC1; if you're not using RC1 you should upgrade before you make any other changes.

     

    The function tep_hide_session_id() is defined on the admin side at admin/includes/functions/html_output.php at about line 294:

    ////
    // Hide form elements
      function tep_hide_session_id() {
     $string = '';
    
     if (defined('SID') && tep_not_null(SID)) {
       $string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
     }
    
     return $string;
      }
    
    ////

     

    Based on what i've seen so far it appears the conflict you and jimmy have described occurs when dropping the files included with the contribution into a brand new osC install that is pre-RC1.

  9. Hi DJ,

     

    This happens with IE6 (Windows XP SP2) and with Firefox 2.0.0.6. No errors are apparent, Javascript or otherwise. I'll re-try the install again today and will let you know how I go. I'll also do an install on a clean copy of osC, just to make sure there's no other contributions messing with it.

     

    Cheers,

    Max

     

    That should not be necessary. Open an order using Order Editor in Firefox, then go to Tools->Error Console. Hit "Clear". Then try to edit an order by changing products prices, quantities, etc. Once the total components disappear check the error console window and see if any new errors have appeared.

  10. I am setting up a new cart, currently on a localhost. I have installed the most current versions of Order Editor and Manual Order Maker. We will be taking orders over the phone. When creating a new order, order editor allows me to select credit card as payment method but does not allow entry of information. How do I add and store this information? Is there an add-on that will send a new order through for credit card processing?

     

    Go to Admin->Configuration->Order Editor->"Select your credit card payment method"->select your credit card payment method->In Order Editor, when you select your credit card payment method, the fields for storing cc info appear. Order Editor is not a payment module, however. Actually processing the credit card payment is up to you.

  11. Hi folks,

     

    I'm having troubles with the shipping and tax in the order totals.

     

    I need some assistance please... I thought I could fix this after reading the code but I'm not good enough.

     

    I am getting this as I modify anything to do with the shipping.

    On first view of an order, all totals are correct... as soon as I edit anything about shipping it does this calculation wrong.

     

    Sub-Total: $100.00 (Correct)

    Shipping: $10.00 (Correct)

    Tax: $10.00 (Correct)

    Total: $110.91 (Wrong by $0.91)

     

    The "Total:" line is adding a second helping of tax (10%) on the shipping fee which already has the tax included!!

     

    :)

     

    I know this is one I can beat... but only with help from you guys!!

     

    Find in admin/edit_orders.php and admin/edit_orders_ajax.php (one occurrence in each file):

    		if (DISPLAY_PRICE_WITH_TAX == 'true') {//extract the base shipping cost or the ot_shipping module will add tax to it again
    		$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
    		$tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    		$order->info['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100))); 
    		}

    and change it to

    		if (DISPLAY_PRICE_WITH_TAX == 'true') {//extract the base shipping cost or the ot_shipping module will add tax to it again
    		$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
    		$tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    		$order->info['total'] -= ( $order->info['shipping_cost'] - ($order->info['shipping_cost'] / (1 + ($tax /100))) );
    		$order->info['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100)));
    		}

     

    Thank you for pointing this out.

  12. I have original edit_orders_add_product.php (5.0.2) and don´t change it. Please can you specifi part of this file who make stock downgrade?

    In admin i have AJAX use TRUE.

     

     

    Thanks

     

    In admin/edit_orders_add_product.php find

    		//add on for downloads
    		 if (DOWNLOAD_ENABLED == 'true' && isset($filename[$option_id])) {
    
    		 $Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET
    				 orders_id = '" . tep_db_prepare_input($oID) . "',
    				 orders_products_id = '" . tep_db_prepare_input($new_product_id) . "',
    				 orders_products_filename = '" . tep_db_prepare_input($filename[$option_id]) . "',
    				 download_maxdays = '" . tep_db_prepare_input($maxdays[$option_id]) . "',
    				 download_count = '" . tep_db_prepare_input($maxcount[$option_id]) . "'";
    
    					 tep_db_query($Query);
    
    			} //end if (DOWNLOAD_ENABLED == 'true') {
    		 //end downloads 
    		   }
    		 }

    BELOW that code add this:

    		// Update inventory Quantity
    			 // This is only done if store is set up to use stock
    			 if (STOCK_LIMITED == 'true'){
    			 tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET
    			 products_quantity = products_quantity - " . $_POST['add_product_quantity'] . " 
    			 WHERE products_id = '" . $_POST['add_product_products_id'] . "'");
    			 }
    			 // Update products_ordered info
    			 tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET
    			 products_ordered = products_ordered + " . $_POST['add_product_quantity'] . "
    			 WHERE products_id = '" . $_POST['add_product_products_id'] . "'");

     

    Next in admin/edit_orders_ajax.php find

      //2.  Update the orders_products table for qty, tax, name, or model
     if ($action == 'update_product_field') {

    BELOW that code add:

    		if ($_GET['field'] == 'products_quantity') {
    			 // Update Inventory Quantity
    			 $order_query = tep_db_query("
    			 SELECT products_id, products_quantity 
    			 FROM " . TABLE_ORDERS_PRODUCTS . " 
    			 WHERE orders_id = '" . $_GET['oID'] . "'
    			 AND orders_products_id = '" . $_GET['pid'] . "'");
    			 $orders_product_info = tep_db_fetch_array($order_query);
    
    			 //  stock check 
    
    			 if ($_GET['new_value'] != $orders_product_info['products_quantity']){
    			 $quantity_difference = ($_GET['new_value'] - $orders_product_info['products_quantity']);
    				 if (STOCK_LIMITED == 'true'){
    					 tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET 
    					 products_quantity = products_quantity - " . $quantity_difference . ",
    					 products_ordered = products_ordered + " . $quantity_difference . " 
    					 WHERE products_id = '" . $orders_product_info['products_id'] . "'");
    					 } else {
    					 tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET
    					 products_ordered = products_ordered + " . $quantity_difference . "
    					 WHERE products_id = '" . $orders_product_info['products_id'] . "'");
    				 } //end if (STOCK_LIMITED == 'true'){
    			 } //end if ($_GET['new_value'] != $orders_product_info['products_quantity']){
    		 }//end if ($_GET['field'] = 'products_quantity'

  13. Just one more thing. I switched the AJAX stuff off, just to see if that's the problem. Now when I go into the order editor, there's instruction to click "update" to save all changes. Except there is no "update" (button or plain old link) to click. ARGGHH! Have I missed something? Have I done something dumb (entirely possible)?

     

    Max

     

    Make sure you have uploaded all the files and performed all the changes as listed in the installation instructions. Also it could be a problem with the CSS.

  14. Hi DJ,

     

    If I refresh the page, I get the original order editing screen, complete the with the item(s) I just removed. In other words, it's as if I'd done nothing at all. This also happens when modifying quantities. I really like the idea of this contribution, and can't wait to start using it. Thankyou for all your help with it :)

     

    Max

     

    View the HTML source of edit_orders.php when viewing an order and find the javascript function updateOrdersField. It should look something like this:

    function updateOrdersField(field, value) {
    
    	createRequest();
    
    	var url = "edit_orders_ajax.php?action=update_order_field&oID=2&field=" + field + "&new_value=" + value;
    
    	xmlHttp.open("GET", url, true);
    
    	xmlHttp.onreadystatechange=
    			function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'orders')}};
    
    	xmlHttp.send(null);
    
    
    } //end function updatOrdersField

     

    Post what you find in your file.

  15. I just want to thank you djmonkey1 for your work and your support. I wish more would follow your lead. I have finished my testing with the latest release and integrating it with manual order maker and so far so good. I am have one small annoyance but I don't know if it is related to this contribution yet or not but I have officially taken this off the white board as completed.

     

    -Thanks again.

     

    No problemo.

  16. Hello,

     

    I like the new update and how it gets the shipping prices! Nice work.

     

    One comment, not an issue, but if I was to write in the comments box that I have credited a customer £20 for example, once it is updated it adds a funny capital  infront of the pound sign, which it never used to

     

    Thanks

     

    Dave

     

    This looks like it might be another limitation of encodeURIComponent. It's not the greatest workaround but you could write GBP instead, or turn off the AJAX functions altogether.

  17. Hi,

     

    i have little problem. After instalation if I add new product to order stay stock quantity some as before change, but if i delete product from order stock, quantity is changed ok.

     

    other function is ok.

     

    Can you know where is problem.

     

    Thank

     

    David

     

    There is a lack of stock check code in edit_orders_add_product.php, an oversight on my part. I should be able to get a fix for this by the end of the day. The AJAX code may also lack stock checking code for updating products quantities, I'll look into that too.

  18. This is really helpful. If I just detect that I have a non NULL VAT number stored for the customer then I can zero the tax. I'll have a look at this today.

    In the event that you have Display Prices with Tax set to 'true' make sure your modifications are made to/inside the code

    		if (DISPLAY_PRICE_WITH_TAX == 'true') {//extract the base shipping cost or the ot_shipping module will add tax to it again
    	   $module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
    	   $tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    	   $order->info['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100))); 
    	   }

    or you'll get weird results.

  19. Hello all,

     

    A huge thanks to djmonkey1 for a great contribution!!

    I have installed and am using Order Editor v5.0.2 and only have 1 issue to combat.

     

    This is what is in the 'Order Totals:' section for my shipping on orders when I first open the Order Editor.

    AusPOST Parcel Post (Delivery to Post Code: <b>3196</b><br>1 day(s) Estimated Delivery Time*<br>1 box @ 5.45kg(s)):

     

    It looks ugly and is causing problems being sent back and forth to the database... I want to just have

    AusPOST Parcel Post

     

    Being a newbie to PHP I'm not sure how I tell the order editor to look at the string and only write out up to the first instance of (

     

    I think something like this should do it for me but not sure where (and what variable) to use it on???

    $ot_shipping = substr($ot_shipping,0,strpos($ot_shipping, '(')-1)

     

    Any assistance is much appreciated

    Tim

     

    That string is what is being stored in the database during the checkout procedure. You need to edit the shipping module itself to not display that information.

  20. okay i was able to exclude the products from the page but i cannot find where it looks for the categorys. the only refference i doulc find was here

     

      $category_array = array(array('id' => '', 'text' => TEXT_SELECT_CATEGORY),
    					   array('id' => '0', 'text' => TEXT_ALL_CATEGORIES));

     

     

    so where can i find the query that $category_array is calling? i searched in the files the Oeditor calls but did not find it.

     

    It use the function tep_get_category_tree to generate the list of all categories:

    <td class="dataTableContent" valign="top"><?php echo tep_draw_pull_down_menu('add_product_categories_id', tep_get_category_tree('0', '', '0', $category_array), $add_product_categories_id,'style="width:300px;" onchange="this.form.submit();"'); ?></td>

     

    Luckily enough, the third parameter of tep_get_category_tree is $exclude. So if you change the third parameter to the category_id of the category you want to avoid the function will do the rest of the work for you.

  21. I believe it 2.84

    im trying to delete an item order and relpace it for a different one..

     

    Thanks

     

    And this just started happening today? Something tells me this isn't a problem with Order Editor. Have you modified something recently? Upgraded to a newer version of PHP and/or MySQL? Changed webhosts even?

  22. Yes, i made sure twice, and checked the file after I uploaded.

     

    Any other suggestions? I could PM you with my ftp info?

     

    This is pretty much the last component that I need working, and its a godsend of a component...i just need to have it working with the individual shipping function.

     

    1. Undo the change you made to admin/order_editor/functions.php.

     

    2. Open admin/order_editor/shipping.php and find the following line of code:

        //start indvship
       function get_shiptotal() {
         global $cart, $order;
         $this->shiptotal = '';
         $products = $cart->get_products();
         for ($i=0, $n=sizeof($products); $i<$n; $i++) {
           if (tep_not_null($products[$i]['products_ship_price'])) {
             $products_ship_price = $products[$i]['products_ship_price'];
             $products_ship_price_two = $products[$i]['products_ship_price_two'];
             $products_ship_zip = $products[$i]['products_ship_zip'];
             $qty = $products[$i]['quantity'];
             if(tep_not_null($products_ship_price) ||tep_not_null($products_ship_price_two)){
               $this->shiptotal += ($products_ship_price);
               if ($qty > 1) {
                 if (tep_not_null($products_ship_price_two)) {
                   $this->shiptotal += ($products_ship_price_two * ($qty-1));
                 } else {
                   $this->shiptotal += ($products_ship_price * ($qty-1));
                 }
               }//
             }
           }
         }// CHECK TO SEE IF SHIPPING TO HOME COUNTRY, IF NOT INCREASE SHIPPING COSTS BY AMOUNT SET IN ADMIN
         if (($order->delivery['country']['id']) != INDIVIDUAL_SHIP_HOME_COUNTRY) {
           if(INDIVIDUAL_SHIP_INCREASE > '0' || $this->shiptotal > '0') {
             $this->shiptotal *= INDIVIDUAL_SHIP_INCREASE;
           } else {
             $this->shiptotal += INDIVIDUAL_SHIP_INCREASE *  $this->get_indvcount();
           }
           return $this->shiptotal;
         }
       }
    
       function get_indvcount() {
         global $cart;
         $this->indvcount = '';
         $products = $cart->get_products();
         for ($i=0, $n=sizeof($products); $i<$n; $i++) {
           if (tep_not_null($products[$i]['products_ship_price'])) {
             $products_ship_price = $products[$i]['products_ship_price'];//}
             $products_ship_price_two = $products[$i]['products_ship_price_two'];
             if(is_numeric($products_ship_price)){
               $this->indvcount += '1';
             }
           }
         }
         return $this->indvcount;
       }
    
       // end indvship

    4. Upload the newly changed files and test it out.

×
×
  • Create New...