Ajax Cart

Contrib type: 
Module
Moderation: 
Awaiting moderation
Status: 
Complete and working
Latest version: 
0.8
Compatibility: 
Ubercart 1.x

Here is a unobtrusive version of an ajax cart.

* Got a new block called 'Ajax Cart'
* Use standard theme functions for cart
* Without javascript, cart keeps functionality

PRODUCTION SITES

Please post me your sites for examples.

Many thanks to

chellman@drupal.org who help to host this project on drupal.org .

Dependencies

* uc_cart Ubercart
* uc_product Ubercart
* jquery_update
* jquery_ui (optional for drag and drop)

Version 0.8

* Add support for product kits
* remove jquery ui from this project

Please remove old module content before installing this module!!

Version 0.72

* Correct drag and drop for IE ( see Bug 0.7 )

Version 0.71

* Add drag and drop functionality ( option in block ) ( Be carefully with IE Browsers )
* Add jquery ui ( http://ui.jquery.com ) for drag and drop

Version 0.7

* Add "no-cache" and "Expire yesterday" headers for ajax calls
* Add "Rebuild cart cache" option

Version 0.6

* Add jquery_update to depencies

Version 0.5

* Fix some minor issues

Version 0.4

* Small Javascript Bugfixes

Version 0.3

* Add new options




Re: Ajax Cart

Hey, nice module - works really well.

A couple of things I've noticed while testing: -

1. The disabled text always doubles up, and quadruples if I view my catalog in a product grid.
2. It would be good to update the button with some different text to show the user that they have added the product to the cart, or optionally disable the button (my client sells events on their product cart).
3. Console output is displayed on the node, e.g. Cart link product action: p40_q1_a3o8_a4o (at least I think it's this module - apologies if it's coming from somewhere else!)

Other than that, it works a treat.

Dubs

Thank you

Thanks for testing my module. I will upload a new version end of this week.

Quote:1. The disabled text

Quote:
1. The disabled text always doubles up, and quadruples if I view my catalog in a product grid.

Got it ;- ) Now it works correct

Quote:
2. It would be good to update the button with some different text to show the user that they have added the product to the cart, or optionally disable the button (my client sells events on their product cart).

Now the button is disabled. But only for the request. I think it should be disabled after adding a product to cart ?

Quote:
3. Console output is displayed on the node, e.g. Cart link product action: p40_q1_a3o8_a4o (at least I think it's this module - apologies if it's coming from somewhere else!)

I test everything, but i think this is a differnt module. Please provide me a screenshot or something i can have a look on.

ajax call exposed problem

If I am pressing the add to cart button, browser redirects me to new page where
ajax callback object is exposed.

{"form_id":"uc_product_add_to_cart_form_1","content":"
4x<\/td> aaa<\/a><\/td> $444.00<\/td><\/tr><\/tbody><\/table><\/div>
4 Items<\/td> Total:<\/strong> $444.00<\/td><\/tr>
(View cart<\/a>) (Checkout<\/a>)<\/td><\/tr><\/tbody><\/table>"}

I have all modules updated to last stable and it is fresh install.
Clean urls are not enabled.

best regards

Joel

About Bug

Please can you provide me some additional informations:

* Which Browser
* Is there an error message (javascript)

I tested it on:

* Safari 3
* IE 7
* Firefox 3

I also updated to 0.5 , cleaning up code and solve some minor issues.

problem solved

Jquery update module was left disabled.
Enabling this module solved te problem
straight away.

Tank's for the answer

Ok, i added jquery_update to module dependencies.

Re: Tank's for the answer

I don't think it's really a necessity to require the module, you just need to make sure you're using the latest version of jQuery.

Quote: I don't think it's

Quote:

I don't think it's really a necessity to require the module, you just need to make sure you're using the latest version of jQuery.

Correct, but you can have problems with collapsable fieldset and color chooser. You should really use jquery_update.

ajax call exposed problem

Hi

i have the same exposed ajax call problem.
i have tried with the latest jquery_update module - version 1.x and 2.x, and also with the latest jquery - 1.2.6.
ubercart is the latest - 1.3
drupal 5.10.

also - no js errors.

thanks,
tal

AJAX Cart Block Does Not Update On First Product Addition

When clicking on the AJAX-ified Add to cart button, the shopping cart block does not always update.

The item does get added to the cart, but this is not reflected in the AJAX shopping cart block until the page is reloaded.

This seems to only affect the first insertion of a given product. Subsequent "add to cart" clicks for the same product updates immediately.

Is this caching related?

Regards
Petrus

Re: Ajax Cart

Thank for testing. I don't know exactly if there is a problem with cache. Please post your url, so i can check this. I will also add a new option "Clear Cache" so there is now problems with cache anymore.

New version released

Version 0.7

* Add "no-cache" and "Expire yesterday" headers for ajax calls
* Add "Rebuild cart cache" option

Re: Ajax Cart

I'm just trying out your module, thx, and I don't see the 'issue of first added item' in version 0.7.

Sometimes, when I add same item more then once, like 10 / 20 times, it hangs and no button is showing anymore and Add product to... stays. This happens in IE6, didn't test it in other browsers for the moment.

Fossie

my first D6 attempt

I needed this mod for D6 application.
so I tried myself in porting it into Drupal6.4 / ubercart 6.x-2.x-dev 2008-Sep-22

it is not ready ..
but it is working with my first test product Smiling

the most brutal hack of mine is in
jquery.ajax.cart.js:

var bText = "bText";// Drupal.settings.uc_ajax_cart.text ;

var disabled = "";//Drupal.settings.uc_ajax_cart.disable ;

var bclass = 'ajax-cart-form';//Drupal.settings.uc_ajax_cart.bclass ;

Sorry for that...
I dont know how to get those Drupal.settings here.

Could somebody help?
Axel

AttachmentSize
uc_ajax_cart-6.x-0.1-dev.zip7.04 KB

correction

ok, removed these ugly things...

checked the module with drupals coder mod, left no warnings inside.

could someone check it please, to me it looks ok,
axel

PS: just saw, there were some files missing in my 0.1. now they are inside the zip ...

AttachmentSize
uc_ajax_cart-6.x-0.2-dev.zip10.93 KB

Re: Ajax Cart

Thanks for a great job on this contrib.

Are you planning to make a drag & drop functionality?
I mean something like this one: http://www.panic.com/goods/, I know a lot of people would like this option Smiling.

If you were thinking about implementing such featueres, please PM me, maybe i could help.

There is also one nice solution: http://www.martinprzybyla.com/how-to-build-a-drag-and-drop-shopping-cart....
I've found this one after checking many other examples and AFAIK it's the best one from the Drupal's point of view (it's fast and uses JQuery, so you don't need to wrap JS to use Prototype, etc.).

Re: Ajax Cart

There is a problem with not-logged users - the products are not added to cart after clicking the button.

Another bug (both on 5.x version) - Thickbox login does not show up. I think both issued may be related to usage of JQuery in your module and in Thickbox login.

Quote:There is a problem

Quote:
There is a problem with not-logged users - the products are not added to cart after clicking the button.

Please check your access rules. I tested it with the last versions and there was no problems.

Quote:
Another bug (both on 5.x version) - Thickbox login does not show up. I think both issued may be related to usage of JQuery in your module and in Thickbox login.

I tested it with

* Thickbox 5.x-2.0
* Ubercart 1.3
* jQuery Update 5.x-2.0 (!)

No Problems.

Quote: Please check your

Quote:

Please check your access rules. I tested it with the last versions and there was no problems.

I don't have a clue why but I can't see any checkoboxes near uj_ajax_cart in rules table.

But what I fixed today is I put the module folder into ubercart/contrib (previously I just uploaded it to sites/all/modules).
After that, the uploading image ('Adding to cart') shows only when I'm logged, on FF. On IE & Chrome it works but shows button with 'Add to cart...Add to cart...' (exactly) when adding product to cart through Ajax.

jQuery Update 5.x-2.0
Ubercart 1.4
Thickbox 5.x-1.2

^ But now I see there's an update for Thickbox, I will try uc_ajax_cart with that new one.

New version with drag and drop

Hy folks,

I added a new version coming with following new experimental feature:

- drag and drop

Also i clean up some minor issues.

BE CAREFULLY

Drag and drop functionality is only working correct in FF2 , FF3 , Safari. Tested also with thickbox module and attributes. Drag and drop functionality is handled by jquery ui version 1.52 (stable) (http://ui.jquery.com) .

In all IE Browser is a problem with dropping the product into the dropzone (cart). If there is a javascript guru outside, i could need your help ;- )

Great! But why does the new

Great!

But why does the new version(0.7.1) has 2.55MB of data, when the older one (0.7) - 10.89 KB Eye-wink?

Re: Great!But why does the new

Quote:
But why does the new version(0.7.1) has 2.55MB of data, when the older one (0.7) - 10.89 KB ?

This about ui library of jquery. Includes whole package with demos , themes ,images, effects and widgets. Should be move into a new module ;- ).

New Version 0.7.2

Correct drag and drop functionality in IE browsers.

Have fun ;- )

Quote:Should be move into a

Quote:
Should be move into a new module ;- ).

It already is:

http://drupal.org/project/jquery_ui

Re: Ajax Cart

Oh. Thank you. Next version move jquery ui out of this module .

support for product kits?

How possible would it be to add support for product kits?

Got it to list

Alright get this feature in the next release.

text displayed

How can i change the "add to cart..." text that is displayed?

im sure its obvious but im missing it, cheers

Re: text displayed

Hey I found the answer to that question (it was obvious)

but I now have another.

Is there a way to change the settings so that when you add a product to cart, the collapse doesnt change to open

Re: Re: text displayed

Please try the new version.

Updated Drupal CVS

I've just updated the module over on drupal.org, so the latest version (0.8 here) will show up there within the next day as 5.x-1.x-dev. There's a release showing right now, but it's from August.

I'm just starting to work with this now, and I have a question.

On the Drupal installation I'm working with, clicking the button doesn't update the cart. The wait image shows up, but the cart never refreshes with the new contents. If I refresh the page, it does show everything in the cart as expected, but the ajax fun doesn't seem to happen. I'm using UC 1.5 on Drupal 5.11 with PHP 4.4.8. Are there any modules known to conflict with this one?

Project move to drupal.org

Hey folks,

With the help from chellmann this project move to drupal.org . Expect every new release on drupal.org .

Bye

Re: Updated Drupal CVS

Please update new version on drupal.org ;- )

Re: Ajax Cart

Ubercart with all updated modules and jquery update 2.0 installed. But after activating the module i get
Fatal error: Call to undefined function jquery_ui_add() in /home/marlonsd/public_html/portfolio/ubercart/sites/all/modules/uc_ajax_cart 2/uc_ajax_cart/uc_ajax_cart.module on line 43

I've tried uc_ajax_cart-5.x-1.0-beta1.tar , uc_ajax_cart.0.8.zip

Re: Re: Ajax Cart

See new version on http://drupal.org/project/uc_ajax_cart . This version eliminates this bug. ( Wrong call of jquery_ui_add )

Error when adding to cart (Version 0.8)

When I'm adding to cart (having the option: "Make the shopping cart block collapsible by clicking the name or arrow." disabled) it doesn't work and the text "Adding to cart..." just stays on the screen.

I checked with this option enabled and then everything worked fine.

When the error occurs, Firebug gives this error:

collapsed_block is not defined
[Break on this error] if (collapsed_block == true)

New Version

New version on drupal.org.

Go to 1.0 STABLE

Please give me some feedback about the module. So i can make a stable version into next 2 weeks.

Thanks for supporting this module.

Re: Go to 1.0 STABLE

Would love to see the 6.x port of this updated to the 5.x-1.0 feature / bug fixes
;D
great job!

6.x-0.2 seems to not update the block appropriately, but adds to the cart nonetheless

D6 Port

The D6 Port in this thread was a first attempt from axel_b. But when 1.0 STABLE is ready, the next is a port to D6. Normally I work only with D6, so i am like to have this port also ;- )

New Version

Hello folks,

New Version on drupal.org

- Resolve Problem with uc_wishlist module
- add "json_encode" support for older php versions

New Version

Hello folks,

New Version on drupal.org

- Resolve Problem with uc_wishlist module
- add "json_encode" support for older php versions
- remove all json_encode and replace with drupal_to_js

New Module

Hey ubercarts,

I added a new module called "UC Ajac Checkout" here http://www.ubercart.org/contrib/7557 .

So it would be nice to get some feedback.

Cart Block not dis appearing when blank

Just installed module, love it, but one issue. On FF and IE for me. When the cart is empty, I still have a frame around block which is visible, so the cart is not dissapearing.

Re: Cart Block not dis appearing when blank

Ok i see. Problem is when you have block option "Hide block if cart is empty." is activated. I think i have an solution ( means override settings and display cart but i will hide cart with css or js ).

See next RC-2 Release will fix this issue.

Cart block

Hey VitaLife,

See my new version on drupal.org . one thing. block must be generated ( because i must know where to insert my data ). But now i will generate only a empty div as placeholder.

That should work for you.