Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

jQuery/Ajax Advanced Order Handler for osCommerce 2.3.3


Recommended Posts

 

Hi Dr. Rolex,

 

We fixed the issue with missing function.

 

Now we are getting the page on screen.

 

While we are adding new record, we are getting the following error message.

 

An error occured while communicating to the server.
 
Please help me.

 

 

 

then another issue I have (and for the life of me cannot find where to edit this) is

 

I have the pruchase order payment module installed.  If I use the edit "Edit Orders" link - I have an error with the Purchase Order payment module - the small drop down

 

 

I knew these kind of problems would happen to a lot of people, that is problem with additional modules or at least it looks like problem due to modules.

 

The only solution that I could up with was to try and set as many variables that modules might use as possible.

 

@@NCPLUS

If you get that message you probably have a fatal error in your PHP log, check that and reply what it says.

 

One thing that might fix problems with loading some modules is to do the following modification to ajax_update.php, note that I haven't tried it myself.

 

Replace this in ajax_update.php

    $cart = new shoppingCart();

With this:

    include_once DIR_WS_CLASSES . 'order.php';
    $order = new order();
    $cart  = new shoppingCart();

If you can't find it, it's located right under this line.

  public function create_new_order( $GET, $POST ) {

@@mommaroodles

 

 

1.)  In order_handler/general_functions.php - I had to comment out the tep_count_modules function - previously declared in admin/includes/functions/general.php

 

I don't think this function exists originally in oscommerce, so you'll probably added this yourself because of another module. Perhaps it was still there from the older order handler?

 

 

I have the pruchase order payment module installed.  If I use the edit "Edit Orders" link - I have an error with the Purchase Order payment module - the small drop down

 

Is this the module: http://addons.oscommerce.com/info/5710?

 

I'll take a look at it when I have some time.

 

 

 

 

I have fixed support for NON-mysqlnd servers, so now the order handler rev3 should work for those people as well. I'll upload this update later today (probably)..

Link to comment
Share on other sites

 

is there not perhaps something on this line 111 of edit_orders.php ?

<td class="main"><span><?php echo tep_cfg_pull_down_payment($order -> info['payment_method'], 'id="payment_method_pull_down" class="multiselect btn btn-xs btn-info" data-table="orders" data-field="payment_method"', $custom); ?></span></td>

 

OK, now I understand what you mean. It wasn't a module problem after all. :P

 

To fix this, make the following changes to ./admin/includes/modules/order_handler/js/01_03_order_handler_rev3_module.js

 

Find this code:

    updatePaymentMethod = function( settings ) {
        var jqxhr =
            $.ajax({
                type: 'GET',
                url: encodeURI( settings.url_title ),
                async: true,
                dataType: 'json'
            });

        this.json_message( jqxhr, settings );
    },

Replace With:

    updatePaymentMethod = function( e, settings ) {
        var jqxhr =
            $.ajax({
                type: 'GET',
                url: encodeURI( settings.url_title ),
                async: true,
                dataType: 'json'
            });

        jqxhr.done(function( payload ) {
            if ( false === edit_order ) {
                var order_id = $( e.target ).closest( "tr.jtable-child-row" ).prev().attr( "data-record-key" );
                $( "#payment_method_" + order_id )[0].innerHTML = settings.newValue;
            }
        });

        this.json_message( jqxhr, settings );
    },

Find this code:

                            return ( oHandler.updatePaymentMethod( settings ) );

Replace With:

                            return ( oHandler.updatePaymentMethod( event, settings ) );

Find this code:

                return ( oHandler.updatePaymentMethod( settings ) );

Replace With:

                return ( oHandler.updatePaymentMethod( event, settings ) );

Remember that whenever you make changes to the javascript or CSS files, you need to change the four flags in get_table.php to false for Javascript and/or one flag for CSS, otherwise it will load the minimized files.

 

Javascript: Two occasions of this line (replace true to false), line 162 & 214

    tep_preload_scripts( $store_country_iso_2[0]['countries_iso_code_2'], true );

Javascript: Two occasions of this line (replace to false), line 163, 338

    tep_afterload_scripts( true );

CSS: One occasions of this line (replace to false), line 99

    tep_load_css( true );

You can keep using the uncompressed files if you want to, the page might, initially (on page reload), load a bit slower but otherwise I don't think it will be noticeable.

There are many JS & CSS compressors which can be used to make a new minimized file if you don't want to use all files separated and uncompressed.

  • I prefer the YUI Compressor, which is written in Java and works on most Operating Systems.
  • If you use Sublime Text, then you can install a minifier package via package control which will take care of all your unminify/minify needs directly in the editor. I'm sure most better editors have this feature. There's a

    lot of really great packages for this editor, so I can really recommend it if you haven't tried it before. They have a free trial (without time limitation) for the editor, packages are free.
  • Google also have a supposedly good minifier.
  • If you use Chrome you can install the PageSpeed Insights Extension which will auto generate minified files for you.
  • And finally, there are many online JS & CSS compressors, here's one that can handle both JS & CSS. Sometimes they doesn't work, though..

 

Before you compress it, you need to concatenate the files.

Files starting with 01_* needs to be in the same file.

Files starting with 02_* needs to be in the same file.

 

Here's how I concatenate files in a Unix Terminal:

cat 01_*.js > 01_order_handler_rev3.min.js \
cat 02_*.js > 02_order_handler_rev3.min.js

Also, remember to remove the original minified files so you don't accidentally concatenate them as well.

Edited by Dr. Rolex
Link to comment
Share on other sites

Please refer my error_log statements once.

 

Please help me how can I get this worked.

 

 

Edit: Oops, answering an old post. I let this post be anyway, perhaps it could help someone...

 

To check where your error log is located, go to Tools => Server Info in your Admin Panel.

 

Then search for "error_log", there you will see where the log is located on your VPS.

 

Open it in a text editor right after you have received the error message in the order handler and look at the bottom of the file for messages.

 

If it's a linux VPS, you can run this command in your terminal to follow the file and look for the latest messages

tail -f /path/to/php_errors.log

Also check for Javascript errors in Chrome console.

Edited by Dr. Rolex
Link to comment
Share on other sites

I knew these kind of problems would happen to a lot of people, that is problem with additional modules or at least it looks like problem due to modules.

 

The only solution that I could up with was to try and set as many variables that modules might use as possible.

 

@@NCPLUS

If you get that message you probably have a fatal error in your PHP log, check that and reply what it says.

 

One thing that might fix problems with loading some modules is to do the following modification to ajax_update.php, note that I haven't tried it myself.

 

Replace this in ajax_update.php

    $cart = new shoppingCart();

With this:

    include_once DIR_WS_CLASSES . 'order.php';
    $order = new order();
    $cart  = new shoppingCart();

If you can't find it, it's located right under this line.

  public function create_new_order( $GET, $POST ) {

@@mommaroodles

 

 

I don't think this function exists originally in oscommerce, so you'll probably added this yourself because of another module. Perhaps it was still there from the older order handler?

 

 

Is this the module: http://addons.oscommerce.com/info/5710?

 

I'll take a look at it when I have some time.

 

 

 

 

I have fixed support for NON-mysqlnd servers, so now the order handler rev3 should work for those people as well. I'll upload this update later today (probably)..

 

Hi Dr. Rolex,

 

Thanks for your support.

 
I have updated ajax_update.php with the following.
    include_once DIR_WS_CLASSES . 'order.php';
    $order = new order();
Still I am getting the error message "An error occured while communicating to the server.".
 
The following are error messages from error_log file.
 
[29-Jul-2014 23:32:48 America/Chicago] PHP Warning:  Missing argument 1 for order::order(), called in /home/xxxxxxx/public_html/admin/includes/modules/order_handler/ajax_update.php on line 1400 and defined in /home/xxxxxxx/public_html/admin/includes/classes/order.php on line 16
[29-Jul-2014 23:32:48 America/Chicago] PHP Fatal error:  Cannot redeclare class order in /home/xxxxxxx/public_html/includes/classes/order.php on line 13
 
Please help me.
Link to comment
Share on other sites

 

Hi Dr. Rolex,

 

Thanks for your support.

 
I have updated ajax_update.php with the following.
    include_once DIR_WS_CLASSES . 'order.php';
    $order = new order();
Still I am getting the error message "An error occured while communicating to the server.".
 
The following are error messages from error_log file.
 
[29-Jul-2014 23:32:48 America/Chicago] PHP Warning:  Missing argument 1 for order::order(), called in /home/xxxxxxx/public_html/admin/includes/modules/order_handler/ajax_update.php on line 1400 and defined in /home/xxxxxxx/public_html/admin/includes/classes/order.php on line 16
[29-Jul-2014 23:32:48 America/Chicago] PHP Fatal error:  Cannot redeclare class order in /home/xxxxxxx/public_html/includes/classes/order.php on line 13
 
Please help me.

 

 

Forget about that modification, I don't know what I was thinking. Change it back from

    include_once DIR_WS_CLASSES . 'order.php';
    $order = new order();
    $cart = new shoppingCart();

To:

     $cart = new shoppingCart();

Which shipping and payment modules are you selecting when you add a new record?

Look in your PHP log again, there should be a fatal error. Change back the code above and then check the PHP log again after you have tried to add a new record.

Link to comment
Share on other sites

OK, now I understand what you mean. It wasn't a module problem after all. :P

 

To fix this, make the following changes to ./admin/includes/modules/order_handler/js/01_03_order_handler_rev3_module.js

 

Find this code:

    updatePaymentMethod = function( settings ) {
        var jqxhr =
            $.ajax({
                type: 'GET',
                url: encodeURI( settings.url_title ),
                async: true,
                dataType: 'json'
            });

        this.json_message( jqxhr, settings );
    },

Replace With:

    updatePaymentMethod = function( e, settings ) {
        var jqxhr =
            $.ajax({
                type: 'GET',
                url: encodeURI( settings.url_title ),
                async: true,
                dataType: 'json'
            });

        jqxhr.done(function( payload ) {
            if ( false === edit_order ) {
                var order_id = $( e.target ).closest( "tr.jtable-child-row" ).prev().attr( "data-record-key" );
                $( "#payment_method_" + order_id )[0].innerHTML = settings.newValue;
            }
        });

        this.json_message( jqxhr, settings );
    },

Find this code:

                            return ( oHandler.updatePaymentMethod( settings ) );

Replace With:

                            return ( oHandler.updatePaymentMethod( event, settings ) );

Find this code:

                return ( oHandler.updatePaymentMethod( settings ) );

Replace With:

                return ( oHandler.updatePaymentMethod( event, settings ) );

Remember that whenever you make changes to the javascript or CSS files, you need to change the four flags in get_table.php to false for Javascript and/or one flag for CSS, otherwise it will load the minimized files.

 

Javascript: Two occasions of this line (replace true to false), line 162 & 214

    tep_preload_scripts( $store_country_iso_2[0]['countries_iso_code_2'], true );

Javascript: Two occasions of this line (replace to false), line 163, 338

    tep_afterload_scripts( true );

CSS: One occasions of this line (replace to false), line 99

    tep_load_css( true );

You can keep using the uncompressed files if you want to, the page might, initially (on page reload), load a bit slower but otherwise I don't think it will be noticeable.

There are many JS & CSS compressors which can be used to make a new minimized file if you don't want to use all files separated and uncompressed.

  • I prefer the YUI Compressor, which is written in Java and works on most Operating Systems.
  • If you use Sublime Text, then you can install a minifier package via package control which will take care of all your unminify/minify needs directly in the editor. I'm sure most better editors have this feature. There's a

    lot of really great packages for this editor, so I can really recommend it if you haven't tried it before. They have a free trial (without time limitation) for the editor, packages are free.
  • Google also have a supposedly good minifier.
  • If you use Chrome you can install the PageSpeed Insights Extension which will auto generate minified files for you.
  • And finally, there are many online JS & CSS compressors, here's one that can handle both JS & CSS. Sometimes they doesn't work, though..

 

Before you compress it, you need to concatenate the files.

Files starting with 01_* needs to be in the same file.

Files starting with 02_* needs to be in the same file.

 

Here's how I concatenate files in a Unix Terminal:

cat 01_*.js > 01_order_handler_rev3.min.js \
cat 02_*.js > 02_order_handler_rev3.min.js

Also, remember to remove the original minified files so you don't accidentally concatenate them as well.

 

 

Thank You Dr rolex - I applied the changes and so far it's all good - it also fixed the issue I was experiencing when I clicked the "expand order" link  :)

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

Hm, this was weird. Do you get any errors in your php log?

 

The fix you provided for the js file, must have fixed this issue too, because the order is expanding now.

 

Just one last quick question?  I've obviously upgraded from the Rev2 - (btw the tep_count_modules function was in the general.php file from Rev2) - which of the files from Rev 2 can are not being used and can be deleted.?

 

I'm assuming the create_order.php and create_order_process.php but can the following files be deleted too?

 

  1. oc_batch_delete_confirm.php
  2. oc_batch_delete.php
  3. order_handler.php
  4. order_poller.php
  5. orders_ajax.php

 

Once again, thank you for your support and for making this wonderful addon.

 

Melanie

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

@@Dr. Rolex I'm just wondering if I am missing something here regarding the operation of the Calculate Orders Totals - I select 2 or 3 items, click on Calculate Orders Total and then nothing appears,  Without anything selected I get a popup saying the totals are 0

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

The fix you provided for the js file, must have fixed this issue too, because the order is expanding now.

 

Just one last quick question?  I've obviously upgraded from the Rev2 - (btw the tep_count_modules function was in the general.php file from Rev2) - which of the files from Rev 2 can are not being used and can be deleted.?

 

I'm assuming the create_order.php and create_order_process.php but can the following files be deleted too?

 

  1. oc_batch_delete_confirm.php
  2. oc_batch_delete.php
  3. order_handler.php
  4. order_poller.php
  5. orders_ajax.php

 

Once again, thank you for your support and for making this wonderful addon.

 

Melanie

 

I think that almost all of the files from Rev2 can be safely removed, or perhaps, I'm guessing that this is the case. So don't blame me if I got it wrong. ;)

I made the Add-On in a way that it should work side by side with Rev2 if someone liked that one better.

 

Here are the files which I can find (after a quick look at them) that you should not delete.

 

  • admin/images/icons/delete.png
  • admin/includes/languages/english/order_handler.php
  • ext/flot/*
  • images/borders/*
  • ext/jquery/ui/jquery-ui-1.10.4.custom.min.js (I'm not sure of this one, probably best to keep it)
  • ext/jquery/ui/redmond/jquery-ui-1.10.4.css (Not sure about this one either)
  • ext/jquery/jquery-2.1.0.min.js (Not sure about this one either)

The rest of the files under Step #2 - Copy new files with the exception of the ones in the list above can be deleted (again, I think they can be deleted). So, assuming I'm right, you can delete these files:

 

    •    admin/ajax_handler.php

    •    admin/create_order.php

    •    admin/create_order_process.php

    •    admin/css/avgrund.css

    •    admin/css/bootstrap-3.1.1.min.css

    •    admin/css/bootstrap-multiselect-3.1.1.css

    •    admin/css/bootstrap-theme.3.1.1.min.css

    •    admin/css/fonts/fontawesome-webfont.eot

    •    admin/css/fonts/fontawesome-webfont.svg

    •    admin/css/fonts/fontawesome-webfont.woff

    •    admin/css/fonts/glyphicons-halflings-regular.eot

    •    admin/css/fonts/glyphicons-halflings-regular.svg

    •    admin/css/fonts/glyphicons-halflings-regular.woff

    •    admin/css/images/buttons.psd

    •    admin/css/images/close.png

    •    admin/css/images/close_hover.png

    •    admin/css/images/icons/chat.png

    •    admin/css/images/icons/clock.png

    •    admin/css/images/icons/error.png

    •    admin/css/images/icons/form.png

    •    admin/css/images/icons/help.png

    •    admin/css/images/icons/info.png

    •    admin/css/images/icons/information21.png

    •    admin/css/images/icons/lock.png

    •    admin/css/images/icons/tick.png

    •    admin/css/images/icons/warning.png

    •    admin/css/images/maximize.png

    •    admin/css/images/maximize_hover.png

    •    admin/css/images/minimize.png

    •    admin/css/images/minimize_hover.png

    •    admin/css/images/select2.png

    •    admin/css/images/select2x2.png

    •    admin/css/line/line.png

    •    admin/css/line/[email protected]

    •    admin/css/line/red.css

    •    admin/css/select2.css

    •    admin/css/tikslusdialog.css

    •    admin/images/gritter-light.png

    •    admin/images/gritter-long.png

    •    admin/images/gritter.png

    •    admin/images/ie-spacer.gif

    •    admin/includes/advanced_search.php

    •    admin/includes/classes/order_prepared.php

    •    admin/includes/form_check.js.php

    •    admin/includes/languages/english/create_order.php

    •    admin/includes/languages/english/create_order_process.php

    •    admin/includes/modules/create_order_details.php

    •    admin/js/bootstrap-3.1.1.min.js

    •    admin/js/bootstrap-multiselect-3.1.1.js

    •    admin/js/history.js

    •    admin/js/icheck.js

    •    admin/js/jquery.avgrund.js

    •    admin/js/jquery.gritter.js

    •    admin/js/order_handler.js

    •    admin/js/select2.js

    •    admin/js/switchery.js

    •    admin/js/tikslusdialog.js

    •    admin/oc_batch_delete.php

    •    admin/oc_batch_delete_confirm.php

    •    admin/order_handler.php

    •    admin/order_poller.php

    •    admin/orders_ajax.php

    •    admin/print_batch_invoice.php

    •    admin/print_batch_process_2.php

    •    admin/stream.php

 

 

 

 

Once again, thank you for your support and for making this wonderful addon.

 

No, problem. Glad I could help! :thumbsup:

Link to comment
Share on other sites

Forget about that modification, I don't know what I was thinking. Change it back from

    include_once DIR_WS_CLASSES . 'order.php';
    $order = new order();
    $cart = new shoppingCart();

To:

     $cart = new shoppingCart();

Which shipping and payment modules are you selecting when you add a new record?

Look in your PHP log again, there should be a fatal error. Change back the code above and then check the PHP log again after you have tried to add a new record.

 

Hi Dr. Rolex,

 

Thanks for your suggestions.

 

We are adding two extra fields in order totals. It will be fine if we make orders from front end.

 

But from this plugin, while adding new records, it can not add those two extra fields by default.

 

And it can not store customers data into customers table.

 

Please help me where I can add the code to get these changes.

Link to comment
Share on other sites

Hi Dr. Rolex,

 

Thanks for your suggestions.

 

We are adding two extra fields in order totals. It will be fine if we make orders from front end.

 

But from this plugin, while adding new records, it can not add those two extra fields by default.

 

And it can not store customers data into customers table.

 

Please help me where I can add the code to get these changes.

 

Hello Michael,

 

No, you're correct. I haven't added any feature to add customers to the database.

 

Take a look at the order creator in Rev2, if I remember correctly it was possible to do it in the order creator. You could simply add the code from that Add-On to this one in e.g. the create_new_order function.

 

 

We are adding two extra fields in order totals. It will be fine if we make orders from front end.

 

But from this plugin, while adding new records, it can not add those two extra fields by default.

 

In order to help you I must know which module you're using that creates the two extra order fields.

Shipping/Payment & Order Totals modules all work differently, if it e.g. requires to know what weight your order has, then it will not work since you haven't added the products when you create the order.

Link to comment
Share on other sites

@@Dr. Rolex I'm just wondering if I am missing something here regarding the operation of the Calculate Orders Totals - I select 2 or 3 items, click on Calculate Orders Total and then nothing appears,  Without anything selected I get a popup saying the totals are 0

 

It's probably the regex that doesn't work or problem with Firefox and .innerText. I changed the one I'm using from the one in the Add-On.

 

Try if this work, find the code below in ./admin/includes/modules/order_handler/js/01_03_order_handler_rev3_module.js

            toolbar: {
                items: [ {
                    text: 'Configuration',
                    iconCSS: 'fa-cogs',
                    cssClass: 'configurationModal',
                }, {
                    text: 'Calculate Orders Totals',
                    iconCSS: 'fa-dollar',
                    click: function() {
                        var orders_total = 0,
                        selectedRows = $( "#orderTable" ).jtable( "selectedRows" ),
                        numRows = selectedRows.length;

                        for ( var i = 0; i < numRows; i++ ) {
                            orders_total += parseFloat( selectedRows.find( "td.order_total" )[ i ].innerText
                                .replace( /(,|\.)(?=[^.]*(,|\.))/, "" )
                                .replace( /\D/g, "." )
                                .replace( /\.(?=[^.]*\.)/, "" ));
                        }
                        $.fn.tdialog( {
                            type: "info",
                            content: "Combined Order Totals for selected rows are " + orders_total + ".",
                            title: "Calculate Orders Totals",
                            icon: "info",
                            showOverlay: oHandler.configuration.settings.showOverlay,
                            effect: 'css3',
                            css3EffectIn: '',
                            css3EffectOut: 'bounce',
                        } );
                    }
                },
                {
                    text: 'Statistics',
                    iconCSS: 'fa-bar-chart-o',
                    cssClass: 'statistics',
                } ]
            },

Replace With:

            toolbar: {
                items: [ {
                    text: 'Configuration',
                    iconCSS: 'fa-cogs',
                    cssClass: 'configurationModal',
                }, {
                    text: 'Calculate Orders Totals',
                    iconCSS: 'fa-dollar',
                    click: function() {
                        var orders_total = 0,
                        selectedRows = $( "#orderTable" ).jtable( "selectedRows" ),
                        numRows = selectedRows.length;

                        for ( var i = 0; i < numRows; i++ ) {
                            orders_total += parseFloat( selectedRows.find( "td.order_total" ).eq( i ).text()
                                .replace( /[^0-9\,\.]+/g, "" )
                                .replace( /(,|\.)(?=[^.]*(,|\.))/, "" )
                                .replace( /\D/g, "." )
                                .replace( /\.(?=[^.]*\.)/, "" ));
                        }
                        $.fn.tdialog( {
                            type: "info",
                            content: "Combined Order Totals for selected rows are " + orders_total + ".",
                            title: "Calculate Orders Totals",
                            icon: "info",
                            showOverlay: oHandler.configuration.settings.showOverlay,
                            effect: 'css3',
                            css3EffectIn: '',
                            css3EffectOut: 'bounce',
                        } );
                    }
                },
                {
                    text: 'Statistics',
                    iconCSS: 'fa-bar-chart-o',
                    cssClass: 'statistics',
                } ]
            },

If that works, then you probably also need to change this to get the Statistics working, change this

 

            var s                    = this,
            orders_total             = 0,
            // chartData                = [],
            selectedRows             = $( "#orderTable" ).jtable( "selectedRows" ),
            numRows                  = selectedRows.length,
            order_handler_statistics = $( "#order_handler_statistics");

            chartData                = [];

            for ( var i = 0; i < numRows; i++ ) {
                // Create UNIX Timestamp from Date
                var n = numRows - i - 1;
                var newDate = new Date( selectedRows.find( "td.date_purchased" )[ n ].innerText ).getTime();
                newDate = new Date(newDate);

                newDate = newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-" + newDate.getDate() + " " + newDate.getHours() + ":00:00";
                //var newDate = new Date( selectedRows.find( "td.date_purchased" )[ n ].innerText );

                chartData.push({
                    date: new Date(newDate),//newDate.getFullYear() + "-" + newDate.getMonth() + "-" + newDate.getDate() + " " + newDate.getHours(),
                    products_purchased: parseInt( selectedRows.find( "td.products_purchased" )[ n ].innerText, 10 ),
                    order_total: parseFloat( selectedRows.find( "td.order_total" )[ n ].innerText
                        .replace( /(,|\.)(?=[^.]*(,|\.))/, "" )
                        .replace( /\D/g, "." )
                        .replace( /\.(?=[^.]*\.)/, "" ) ),
                });
            }

            chartData = groupByDate( chartData );

With This:

            var s                    = this,
            orders_total             = 0,
            // chartData                = [],
            selectedRows             = $( "#orderTable" ).jtable( "selectedRows" ),
            numRows                  = selectedRows.length,
            order_handler_statistics = $( "#order_handler_statistics");

            chartData                = [];

            for ( var i = 0; i < numRows; i++ ) {
                // Create UNIX Timestamp from Date
                var n = numRows - i - 1;
                // var newDate = new Date( selectedRows.find( "td.date_purchased" )[ n ].innerHTML.replace( /\s/, "T" ) ).getTime();
                // newDate = new Date(newDate);

                // newDate = newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-" + newDate.getDate() + " " + newDate.getHours() + ":00:00";

                var newDate = Date.parse( selectedRows.find( "td.date_purchased" )[ n ].innerHTML.replace( /\s/, "T" ) );
                newDate = new Date(newDate);
                newDate = newDate.getFullYear() + "-" + ('0' + (newDate.getMonth() + 1)).slice(-2) + "-" + ('0' + newDate.getDate()).slice(-2) + " " + ('0' + newDate.getHours()).slice(-2) + ":00:00";

                chartData.push({
                    date: new Date(newDate.replace( /\s/, "T" )),
                    products_purchased: parseInt( selectedRows.find( "td.products_purchased" )[ n ].innerHTML, 10 ),
                    order_total: parseFloat( selectedRows.find( "td.order_total" ).eq( i ).text()
                                .replace( /[^0-9\,\.]+/g, "" )
                                .replace( /(,|\.)(?=[^.]*(,|\.))/, "" )
                                .replace( /\D/g, "." )
                                .replace( /\.(?=[^.]*\.)/, "" ) ),
                });
            }

            chartData = groupByDate( chartData );

 

Link to comment
Share on other sites

Hello Michael,

 

No, you're correct. I haven't added any feature to add customers to the database.

 

Take a look at the order creator in Rev2, if I remember correctly it was possible to do it in the order creator. You could simply add the code from that Add-On to this one in e.g. the create_new_order function.

 

 

In order to help you I must know which module you're using that creates the two extra order fields.

Shipping/Payment & Order Totals modules all work differently, if it e.g. requires to know what weight your order has, then it will not work since you haven't added the products when you create the order.

 

Hi Dr. Rolex,

 

If we select shipping_method, it can not store selected shipping method into order totals. It is storing the first shipping_method like "Ground Shipping" in order totals.

 

I tried to fix it by uncomment the statements(shipping related) in ajax_update. It is getting the shipping_method value. But can not store the correct shipping_method value in Order totals.

 

Please help me how can we resolve the shipping_method issue.

 

I want to keep the United States in States select box. And I want to display Billing address and shipping address instead of delivery address. Is it possible to do it?

Edited by NCPLUS
Link to comment
Share on other sites

Hi Dr. Rolex,

 

If we select shipping_method, it can not store selected shipping method into order totals. It is storing the first shipping_method like "Ground Shipping" in order totals.

 

I tried to fix it by uncomment the statements(shipping related) in ajax_update. It is getting the shipping_method value. But can not store the correct shipping_method value in Order totals.

 

Please help me how can we resolve the shipping_method issue.

 

I want to keep the United States in States select box. And I want to display Billing address and shipping address instead of delivery address. Is it possible to do it?

 

Try this, find this code in ajax_update.php

    $quotes           = $shipping_modules->quote();
    $sort_order       = $GLOBALS[ $POST['shipping_module'] ]->sort_order;

    $shipping_tax     = tep_get_tax_rate( $shipping_module->tax_class, $country[0]['countries_id'] );
    $shipping_tax     = tep_calculate_tax( $quotes[0]['methods'][0]['cost'], $shipping_tax );
    $tax_description  = tep_get_tax_description( $shipping_module->tax_class, $country[0]['countries_id'] );

    $shipping =
      array(
      'id'          => $quotes[0]['id'],
      'title'       => $quotes[0]['module'] . ' (' . $quotes[0]['methods'][0]['title'] . ')',
      'cost'        => $quotes[0]['methods'][0]['cost'], # + $shipping_tax,
      #'tax'         => $shipping_tax,
      'sort_order'  => $sort_order
    );


    $order->info['tax_groups']      = array( $tax_description => 0 );//$shipping['tax'] );
    $order->info['shipping_cost']   = $shipping['cost'];
    #$order->info['tax']             += $shipping['tax'];
    $order->info['payment_method']  = $payment_modules->selected_module;
    $order->info['shipping_method'] = $shipping['title'];
    $order->info['total']           += $shipping['cost'];

    # "fix shipping"
    $shipping_total =
      array(
      'code'       => 'ot_shipping',
      'title'      => $shipping['title'] . ":",
      'text'       => $currencies->format( $shipping['cost'], true, $currency, $currency_value ),
      'value'      => $shipping['cost'],
      'sort_order' => $sort_order,
    );

    require DIR_WS_CLASSES . 'order_total.php';
    $order_total_modules = new order_total;

    $shipping_total['sort_order'] = $GLOBALS['ot_shipping']->sort_order;
    $GLOBALS['ot_shipping']->output[] = $shipping_total;
    $GLOBALS['shipping']['id'] = $quotes[0]['id'] . '_' . $quotes[0]['methods'][0]['id'];

Replace With:

    $quotes           = $shipping_modules->quote();
    $shipping_tax     = tep_get_tax_rate( $shipping_module->tax_class, $country[0]['countries_id'] );
    $shipping_tax     = tep_calculate_tax( $GLOBALS[ $POST['shipping_module'] ]->quotes['methods'][0]['cost'], $shipping_tax );
    $tax_description  = tep_get_tax_description( $shipping_module->tax_class, $country[0]['countries_id'] );

    $shipping =
      array(
      'id'          => $GLOBALS[ $POST['shipping_module'] ]->quotes['id'],
      'title'       => $GLOBALS[ $POST['shipping_module'] ]->quotes['module'] . ' (' . $GLOBALS[ $POST['shipping_module'] ]->quotes['methods'][0]['title'] . ')',
      'cost'        => $GLOBALS[ $POST['shipping_module'] ]->quotes['methods'][0]['cost'],// + $shipping_tax,
      'tax'         => $shipping_tax,
      'sort_order'  => $GLOBALS[ $POST['shipping_module'] ]->sort_order,
    );

    
    $order->info['tax_groups']      = array( $tax_description => 0 );//$shipping['tax'] );
    $order->info['shipping_cost']   = $shipping['cost'];
    //$order->info['tax']             += $shipping['tax'];
    $order->info['payment_method']  = $payment_modules->selected_module;
    $order->info['shipping_method'] = $shipping['title'];
    $order->info['total']           += $shipping['cost'];

    # "fix shipping"
    $shipping_total =
      array(
      'code'       => 'ot_shipping',
      'title'      => $shipping['title'] . ":",
      'text'       => $currencies->format( $shipping['cost'], true, $currency, $currency_value ),
      'value'      => $shipping['cost'],
      'sort_order' => $shipping['sort_order'],
    );

    require DIR_WS_CLASSES . 'order_total.php';
    $order_total_modules = new order_total;

    $shipping_total['sort_order']     = $GLOBALS['ot_shipping']->sort_order;
    $GLOBALS['ot_shipping']->output[] = $shipping_total;
    $GLOBALS['shipping']['id']        = $GLOBALS[ $POST['shipping_module'] ]->quotes['id'] . '_' . $GLOBALS[ $POST['shipping_module'] ]->quotes['methods'][0]['id'];

 

I want to keep the United States in States select box. And I want to display Billing address and shipping address instead of delivery address. Is it possible to do it?

 

Do you mean customers address? Shipping address is the same as delivery address, right?

I'm not sure that I understand what you mean but have you tried right clicking the heading and then deselect whatever address you don't want there?

Link to comment
Share on other sites

  • 2 weeks later...

I'm missing something here folks.

 

Download and unzipped and I have a XZ file - is this some different type of compression again?

 

Don't know what to do with it...

Link to comment
Share on other sites

I'm missing something here folks.

 

Download and unzipped and I have a XZ file - is this some different type of compression again?

 

Don't know what to do with it...

 

Hello Russell,

 

Since there is a 3 MB file limit on the Add-On packages that can be uploaded I had to use a different archiver with a better compression ratio.

To decompress it you can download 7-Zip, it's open source and free for commercial use.

 

http://www.7-zip.org/

Link to comment
Share on other sites

Hello Russell,

 

Since there is a 3 MB file limit on the Add-On packages that can be uploaded I had to use a different archiver with a better compression ratio.

To decompress it you can download 7-Zip, it's open source and free for commercial use.

 

http://www.7-zip.org/

Thanks for that - had to go round the houses a bit - for some reason it kept coming up with another XZ file (don't know if it's as reliable on windows 64) but eventually managed to copy the proper files to a different folder.. - Cheers!

Link to comment
Share on other sites

Having some fun with this MySQL Native driver business.

 

I uploaded the order_handler_check.php and the messages on there were:

 

It looks like you're using an old version of PHP. This may or may not be a problem. Check your configuration, it doesn't look like MySQL Native driver is loaded. :=( This is not a 100% reliable test. To be sure if you have MySQL Native Driver Support, check your server configuration or ask your host provider.

 

My host live chat said:

 

"it looks like the MySQL Native driver might be a separate php extension. MySQL Native driver isn't installed by default with PHP5.2 whereas it is with PHP5.4 but I tested your site with php 5.4 and it looks like it just breaks with it. Yeah looks like the OSCOMMERCE is incompatible with php 5.4. so you'd need to install the MySQL Native driver, but before you try that I'd recommend submitting a ticket to have our upper level techs see if the MySQL Native driver is installed at the system root for the php."

 

 

 

I have submitted the ticket..

 

Then I read in the readme file: "Requires MySQL Native Driver (Optional with this Version)"

 

If it's optional should I wait for support to get back to me or will it all run fine without MySQL Native driver and should I carry on with the install?

 

PHEW!

Russ

Link to comment
Share on other sites

Having some fun with this MySQL Native driver business.

 

I uploaded the order_handler_check.php and the messages on there were:

 

My host live chat said:

 

 

 

I have submitted the ticket..

 

Then I read in the readme file: "Requires MySQL Native Driver (Optional with this Version)"

 

If it's optional should I wait for support to get back to me or will it all run fine without MySQL Native driver and should I carry on with the install?

 

PHEW!

Russ

 

If you downloaded the latest package, the one called "Advanced Order Handler Rev3 - Compatible Without mysqlnd", then you can go ahead and try. It will work without the MySQL Native Driver functions.

 

Ha ha, osCommerce is compatible with PHP 5.4, I have no idea where those shared hosting support people get all the stuff they come up with from. :P

PHP is unfortunately not backwards compatible, which makes it a bit of a mess. But if your site doesn't work with PHP 5.4 it's because of some modification you've done to it, perhaps a very old contribution?

 

If you just want it to work, then try to install the Add-On first and if everything runs fine then skip the PHP upgrade if your not comfortable with getting your hands dirty finding incompatible PHP functions. ;)

Link to comment
Share on other sites

If you just want it to work, then try to install the Add-On first and if everything runs fine then skip the PHP upgrade if your not comfortable with getting your hands dirty finding incompatible PHP functions. ;)

 

Yep it was the latest version of Order Handler I downloaded -  I'll go through the install and see if it works ok - They haven't answered the ticket yet but I just checked in CPanel and it's now showing PHP version 5.4.24 - Yesterday it was definitely PHP Version: 5.2.17.

 

Funny thing is though that /admin/order_handler_check.php is still showing PHP Version: 5.2.17 so I don't basically know what the hell is going on.

 

If it is 5.4.24 then my site is working ok so you were right of course about OSCommerce and PHP4.

 

ANYWAY - I'll post back here my results - it may help someone else hopefully :-)post-330229-0-86169300-1408011294_thumb.jpg

Edited by uncoolthreads
Link to comment
Share on other sites

ok I did the install - seemed pretty straightforward enough..

 

Now when I go to orders I can see "Order Handler R3" menu but when I click it there's nothing on the page but a title. Is there something really wrong or do I have to enable something?

 

As regards the PHP question - I'm with Hostmonster and their support got back to me saying "The Native MySQL driver doesn't come with PHP 5.2 nor is it supported by the same PHP Version. You would need to be running PHP 5.4 to be able to make use of it. Your PHP Version can be changed by going to php config in Cpanel"

 

I went there and it says on the page:

PHP 5.4+ Incompatible Applications Installed

OSCOMMERCE 2.3.4 /home2/helpandi/public_html/xxxxx.co.uk

 

I can change this if I wish but am a bit scared of doing in case everything breaks!

 

I'll include a pic of what I'm seeing in the admin: post-330229-0-59967000-1408033430_thumb.jpg

 

Thanks for any help - I'm not a programmer and all I wanted was a shop to process orders and be able to print invoices etc etc..

Link to comment
Share on other sites

ok I did the install - seemed pretty straightforward enough..

 

Now when I go to orders I can see "Order Handler R3" menu but when I click it there's nothing on the page but a title. Is there something really wrong or do I have to enable something?

 

As regards the PHP question - I'm with Hostmonster and their support got back to me saying "The Native MySQL driver doesn't come with PHP 5.2 nor is it supported by the same PHP Version. You would need to be running PHP 5.4 to be able to make use of it. Your PHP Version can be changed by going to php config in Cpanel"

 

I went there and it says on the page:

PHP 5.4+ Incompatible Applications Installed

OSCOMMERCE 2.3.4 /home2/helpandi/public_html/xxxxx.co.uk

 

I can change this if I wish but am a bit scared of doing in case everything breaks!

 

I'll include a pic of what I'm seeing in the admin: attachicon.gifrev3.jpg

 

Thanks for any help - I'm not a programmer and all I wanted was a shop to process orders and be able to print invoices etc etc..

 

The easiest way to check which version of PHP you're using and which extensions that are configured is to go to Tools => Server Info in your oscommerce admin.

 

If you can switch back to your current (old) version of PHP, then I don't think you need to worry. Simply switch to PHP 5.4, test your shop thoroughly and if it doesn't work then switch back to the version you're using now.

But you never know, things usually go wrong when you least expect them to. ;)

 

Ask your host provider if there will be any problem to switch back the PHP version if something goes wrong.

Also, it's usually best practice to do this at night or sometime when you have few customers visiting your shop.

 

 

Now when I go to orders I can see "Order Handler R3" menu but when I click it there's nothing on the page but a title. Is there something really wrong or do I have to enable something?

 

Check your PHP error log after you have tried to load the order handler page. You probably have a fatal error there or something. Reply with the last lines of the log after you have tried visiting get_table.php.

 

It could be anything, but my guess is that since your using PHP 5.2, there might be more functions that are incompatible. I think that the Add-On will work with PHP 5.3 and above but I'm not sure about older versions. But the error log should have the answer to that.

 

If you don't know where the error log is located then take a look at the Server Info page and search the page for the error_log directive on that page.

Link to comment
Share on other sites

I checked into some things.

 

First yes the PHP version is definitely 5.217.

 

Now I have a problem in that I have another domain on that account that is stuck on Joomla! 1.526 because there are custom components I had built that would all have to changed if I were to upgrade Joomla! and that is simply too expensive to get coded. I know from the Joomla! forums that that website would definitely not work with PHP 5.4. - It's a working site that earns money.

 

I am with HostMonster and there is no option to change the PHP to 5.3 - only 5.2 or 5.4

 

Anyway I went to the PHP error logs (on the same page but underneath the main error logs) and they are sorted by directory. There are no php error logs at all for the directory where this OSCommerce install is, absolutely none... I did a Ctrl+F on the page and that directory isn't there. I tried to access the /admin/get_table.php a couple of times, went back to the php_error page and still nothing at all...

 

I'm at a loss as to what to do now.. This is still a test site so no business is being lost as yet but unless I can batch print invoices then it will be useless for my purposes. The site is for Groupon offers and the ability to be able to run off lots of invoices in one batch is crucial..

 

Is there another way to get around this?

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...