Jump to content
Dr. Rolex

jQuery/Ajax Fast checkout/Login/Create account/Shopping Cart/Bootstrap MATC 2.3.3

Recommended Posts

@@Dr. Rolex

And you can confirm that the php I loaded is the same as your production. I did a compare in Notepad++ and it shows no differences. Wondering if what you are using is different from the addons.oscommerce repository.

 

Also, could it be a different setting? Like I've said before.

[color=#000000][font='Lucida Grande', 'Lucida Sans', Verdana, Arial, sans-serif][size=2]javascript_validation(); ?>[/size][/font][/color]

sits at the top of the browser as if a php tag is missing. Did you use short tags? I don't believe I have that enabled.

 

YES, damn I forgot to mention that. That was the whole point of my original reply, ha ha.

 

Actually it was the original authors of this Add-On who used <? instead of <?php so try to search the entire file for <? and replace them with <?php

 

The error you're getting "javascript_validation(); ?>" is quite typical to short tags errors and I think I had the same issue once.

Also, don't forget to go through ./ajax/javascript/form_check.js.php as well..

 

I found a lot of them in your file, however I think that you don't need to change these "<?=TEXT_INFORMATION?>"

Edited by Dr. Rolex

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Errors are fixed after changing the lines I listed above. It was the <? short tags that caused the error. Now it runs without any issues.

Share this post


Link to post
Share on other sites

Errors are fixed after changing the lines I listed above. It was the <? short tags that caused the error. Now it runs without any issues.

 

Great, you solved it by yourself then. :=)

 

However, I'm still not able to change the quantities of the products nor delete them. I'm also having problems to click the "Update" button the second time. This is probably Javascript problems.

Share this post


Link to post
Share on other sites

Not sure what's happening now. There are no errors, but I enabled a debugger.

I cannot add quantity, remove item, or continue with the login (both real account and guest).

It works in the normal checkout. Any ideas?

Share this post


Link to post
Share on other sites

Not sure what's happening now. There are no errors, but I enabled a debugger.

I cannot add quantity, remove item, or continue with the login (both real account and guest).

It works in the normal checkout. Any ideas?

 

It has been too long since I last worked on this Add-On. But it might be so that you have to include the file jquery-oscart.js from the jQuery/Ajax Shopping Cart 2.3.3 Add-On.

 

I have attached the specific file with this post.

 

I use a function to load Scripts or CSS which I placed in ./includes/functions/html_output and it looks like this:

////
// The HTML href link with Static Content
function tep_static_link($script, $type, $cookieless = '', $version = null) {

if ($type == 'script')
return '<script type="text/javascript" src="' . (($cookieless == true) ? HTTP_COOKIELESS_DOMAIN : '') . $script . (is_numeric($version) ? '?' . $version : '') . '"></script>';

if ($type == 'link')
return '<link rel="stylesheet" type="text/css" href="' . (($cookieless == true) ? HTTP_COOKIELESS_DOMAIN : '') . $script . '" />';

return "No link found";
}

 

And then in ./includes/template_top.php you can add this code after you have included jQuery and jQuery-UI, modify the location of jquery-oscart.js to where you put it on your server:

echo tep_static_link('js/jquery-oscart.js', 'script', false, '1127');

Edited by Dr. Rolex

Share this post


Link to post
Share on other sites

To assist others with their endeavors. This seems to be a working ajaxManagerTest.class.php ajaxManagerTest.class.php

I was trying to install both Shopping Cart and Fast Checkout...

which leads me to a new problem

 

@@Dr. Rolex

Does the Guest Checkout work with the jQuery Shopping Cart? I have completed all of this code to find out that the guest feature does not seem to be enabled.

Comparing the ajaxManager.js, it seems the new one supplies with AJAX Fast Checkout is not compatible with jQuery Shopping Cart, and the ajaxManager.js supplied with jQuery Shopping Cart works, but does not work with guest checkout.

There are some buttons and such missing as well.

You can see an example here. http://mtrosemedia.org/store_staging/ajax_checkout.php

 

"Fast Checkout" button is missing.

Also, the categories page is all screwy... Assuming this has something to do with the CSS.

Clicking the "-" when there is only one product left shows a quick error.

 

 

I think I have successfully joined jQuery Shopping Cart, AJAX Fast Checkout, KISSit Image Thumbnailer, and QTPro; but there are some oddities still after the installation of your two add-ons. Any help is appreciated. The whole purpose of trying your add-on is because it is the latest add-on with Guest Checkout, so I assumed it would be the most compatible with osc 2.3.3.4

 

Everything seems smooth, it's just those couple of things, which I think may be easy fixes for you, since you know your way around the code already.

 

I can post all the final files I came up with if anyone needs them.

Edited by newburns

Share this post


Link to post
Share on other sites

After merging this addon with my site I cannot make it work. ajax_checkout.php returns always empty content. I tried to enable error logging in application_top.php and fixed all notices/errors there. Any idea why nothing is loaded? What I discovered is that actually ajax_checkout.php creates another block of "body" tag (because template_top and template_bottom define original body tag) what is not ok. But even after I fixed this, it doesn't work :(. Any idea what can I try? Tomorrow I will try to debug javascript, but would appreciate any hints.

Edited by HuffYk

Share this post


Link to post
Share on other sites

Javascript returns these errors: might be some of them reason for not showing anything? I'm using localhost but have tried also my productive server and same result :(

 

 

 

 

TypeError: $(...) is null

 

url = $(location).attr('href').split("/");

ajaxMa...js?1308 (line 15)

 

 

 

 

TypeError: $(...) is null

 

...-e"}}).addClass("ui-priority-secondary").parent().removeClass("tdbLink");</scrip...

3

ajax_checkout.php (line 38)

 

 

 

 

TypeError: $(...) is null

 

$("#headerShortcuts").buttonset();

ajax_checkout.php (line 41)

 

 

 

 

TypeError: $(...).attr is not a function

 

url = $(location).attr('href').split("/");

ajaxMa...js?1308 (line 15)

 

 

 

 

TypeError: $(...) is null

 

$('.productListTable tr:nth-child(even)').addClass('alt');

ajax_checkout.php (line 418)

 

 

 

 

TypeError: objBody is null

 

...objBody.width() + 'px; height: ' + objBody.height() + 'px; display: block;"><tab...

requester.js?1308 (line 139)

Share this post


Link to post
Share on other sites

I fixed it at last. Problem was in template_top file this line:

<script type="text/javascript" src="js/prototype.js"></script>

 

after this all buttons stopped working including this addon

Share this post


Link to post
Share on other sites

I have this addon running with ajax shopping cart. I have two problems to fix:

 

1. in shopping_cart.php is not updated shopping cart box Total, when I change count of some product. It is working fine in ajax_checkout.php.

2. I have to set some dependencies between payment types and shipping types. Is it already configurable somewhere or do I have to code it?

 

thanks

Share this post


Link to post
Share on other sites

Well, I just want to let you know that I'm integrating my own working version's (the ones from my production server) of a combined jQuery/Ajax Shopping Cart and jQuery/Ajax Fast checkout to a clean 2.3.3.4 osCommerce install.

When it works I'll upload the full package. From there, it will probably be easier for you to work it into your own shop.

 

There might be bug's that I will fail to recognize or simply ignore. If you find them, Post them here and also Post your solution (if you found one or many) so everyone doesn't need to sit endless hours for a 1 minute fix. :thumbsup:

 

It's not completed yet, but since currently there's a blizzard outside and accordingly to the much trusted weather forecast it will be gone tomorrow, I expect the blizzard to maintain it's position and strength until Monday.

So I'll probably spend my weekend working inside with this project as long as the trees decide not to fall over too many power lines and upload the files as soon as it's ready...

Share this post


Link to post
Share on other sites

I made an (enough) working combo for you to try out and use the code to figure out your current problems.

 

However, the code is not without bugs, i.e. products with attributes will not be added/removed correctly. But they do this in the newest update of jQuery Shopping cart.

SO, well.. If you need them look in the instructions and code for jQuery/Ajax Shopping Cart 2.3.3.

 

BUG: A small fix needs to be done for the Ajax fast checkout to function with tep_recreate_sessions set to ON.

BUG: More of visual failures i.e. the total sum in the bm_shopping_cart.php will not "spin/count" to the new order total.

 

More BUGS to find if you decide to use the complete code, it would probably be better if you "borrowed" the code you need and replace/insert to the already installed Add-Ons.

 

Test Shop: http://ajax.jholmster.com

Complete code: http://ajax.jholmster.com/osCommerce-2.3.3.4-Ajax%20Fast%20checkout-AND-jQuery%20Shopping%20cart-COMBINED.tar.gz

 

Good luck! :coffee:

Share this post


Link to post
Share on other sites

I tried to compare code, merge changes but still getting no updates to shopping card box :(. I tried to use exactly same /shopping_cart.php and \includes\modules\boxes\bm_shopping_cart.php and no change. I think I will have to debug ajax to find root cause.

 

btw. another question to "jQuery-UI Autocomplete". Any idea why list of search results generated by ajax is not shown in search box? I can see request is send and also result generated, but result is not shown anywhere

Edited by HuffYk

Share this post


Link to post
Share on other sites

Hello HuffYk,

 

I tried to compare code, merge changes but still getting no updates to shopping card box :(. I tried to use exactly same /shopping_cart.php and \includes\modules\boxes\bm_shopping_cart.php and no change. I think I will have to debug ajax to find root cause.

Is it possible for you to PM me the web address or are you running it on a local server?

 

As you say, this is most probably a javascript error. Download & Install Google Chrome for your OS. Start Google Chrome and then click View => Developer => Javascript console.

In this console you will see all Javascript errors as they occur when you browse the troubled areas. You can also expand them and find at which line in which file the error occurred.

 

You also check your Apacha/PHP error log. If you´re on a Linux server one common place to look would be /var/log/

 

If you´re on some kind shared hosting and you can't find the log file, then you could also do this to display the errors & notices as html when you browse. However, DO NOT do this on a Live/Production Server.

In both ./includes/application_top.php

and ./admin/includes/application_top.php

 

Find this piece of code :

// set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE);

And Replace it (temporarily) with this code:

// set the level of error reporting
// error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL);
ini_set('display_errors', '1');

 

Have you checked so ext/modules/shopping_cart/jquery-oscart.js has been loaded OK?

 

btw. another question to "jQuery-UI Autocomplete". Any idea why list of search results generated by ajax is not shown in search box? I can see request is send and also result generated, but result is not shown anywhere

Check for Javascript errors on this one too, for some reason it probably can't find one or more of the required data fields. Have you upgraded to MySQLi or do you still use MySQL?

 

Best Regards,

Rolex - Doctor

Share this post


Link to post
Share on other sites

ok shopping card issue solved. I had to include also accounting.min.js. Without it updating of cart box is not working. This file is not included anywhere, I found it in zipped shop you sent. I was not able to make workable your shopping_cart.php. I had to bring back this code:

 

if ( (int)$_GET['ajax'] )

{

echo '<span id="boxcart-total-new" style="display: none;">' . $currencies->format($cart->show_total()) . '</span>';

}

 

and remove this ID from file down bellow. So actually shopping cart from original ZIP is working fine at last so accounting file was missing:). btw. jquery-oscart.js from you zipped shop is showing error in jquery.min.js (I use 2.0.3 and tried also 2.0.2) so I had to roll back to file from original zip. Anyhow at last it is working.

 

Now I'm going to analyze why autocomplete is not working

Share this post


Link to post
Share on other sites

So the reason why autocomplete is not working is because of including require('includes/application_top.php') :(. I don't understand why results are not shown. When I change code to use only mysql functions, autocomplete starts working. Any idea what might cause autocomplete not working with application_top ? (I tried also original application_top from 2.3.3.4)

Share this post


Link to post
Share on other sites

This is the code of autocomplete which is working for me fine. So something what application_top was including caused the problem before.

 

<?php
// load server configuration parameters
if (file_exists('includes/local/configure.php')) { // for developers
 include('includes/local/configure.php');
} else {
 include('includes/configure.php');
}
// define our general functions used application-wide
require(DIR_WS_FUNCTIONS . 'general.php');
require(DIR_WS_FUNCTIONS . 'html_output.php');
// include the list of project database tables
require(DIR_WS_INCLUDES . 'database_tables.php');
// include the database functions
require(DIR_WS_FUNCTIONS . 'database.php');
// include the list of project filenames
require(DIR_WS_INCLUDES . 'filenames.php');

tep_db_connect() or die('Unable to connect to database server!');

$return_arr = array();

$keyword = tep_db_prepare_input($_GET['term']);
$fetch = tep_db_query("select pd.products_id, pd.products_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS . " p on pd.products_id = p.products_id WHERE p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and pd.products_name LIKE '%" . tep_db_input($keyword) . "%'  LIMIT 0,10");

while ($row = tep_db_fetch_array($fetch))
{
 $row_array['id'] = tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$row['products_id']);
 $row_array['value'] = $row['products_name'];
 array_push($return_arr, $row_array);
}

echo json_encode($return_arr);
flush();
?>

Share this post


Link to post
Share on other sites

btw. that code should work by default with mysqli, but also with old mysql. Database.php file from oscommerce is doing fallback to old functions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×