Ajax Cart

Contrib type: 
Module
Status: 
Complete and working
Moderation: 
Awaiting moderation

Downloads


Compatibility: 
Ubercart 1.x
Compatibility: 
Ubercart 2.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

CACHE AND Ubercart 2

Please read this issue: http://drupal.org/node/377798

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 For Ubercart 1.0
* jquery_ui Removed.


Dubs's picture
Offline
Joined: 11/20/2007
Juice: 79
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
Thank you

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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

jarula's picture
Offline
Joined: 09/02/2008
Juice: 4
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

jarula's picture
Offline
Joined: 09/02/2008
Juice: 4
problem solved

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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
Tank's for the answer

Ok, i added jquery_update to module dependencies.

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4111
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.

--
Help directly fund development: Donate via PayPal!

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

talbone's picture
Offline
Joined: 06/06/2008
Juice: 87
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

freshcode's picture
Offline
Joined: 09/16/2008
Juice: 2
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
New version released

Version 0.7

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

fossie@drupal.org's picture
Offline
Joined: 11/20/2007
Juice: 48
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

axel_b's picture
Offline
Joined: 09/23/2008
Juice: 7
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.zip 7.04 KB
axel_b's picture
Offline
Joined: 09/23/2008
Juice: 7
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.zip 10.93 KB
cloudmine's picture
Offline
Joined: 07/16/2008
Juice: 72
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.).

cloudmine's picture
Offline
Joined: 07/16/2008
Juice: 72
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.

erikseifert's picture
Offline
Joined: 09/29/2008
Juice: 2
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.

cloudmine's picture
Offline
Joined: 07/16/2008
Juice: 72
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.

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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 ;- )

cloudmine's picture
Offline
Joined: 07/16/2008
Juice: 72
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?

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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 ;- ).

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
New Version 0.7.2

Correct drag and drop functionality in IE browsers.

Have fun ;- )

cloudmine's picture
Offline
Joined: 07/16/2008
Juice: 72
Quote:Should be move into a
Quote:

Should be move into a new module ;- ).

It already is:

http://drupal.org/project/jquery_ui

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
Re: Ajax Cart

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

slake's picture
Offline
Joined: 10/09/2008
Juice: 19
support for product kits?

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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
Got it to list

Alright get this feature in the next release.

simplekid's picture
Offline
Joined: 10/30/2008
Juice: 23
text displayed

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

im sure its obvious but im missing it, cheers

simplekid's picture
Offline
Joined: 10/30/2008
Juice: 23
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
Re: Re: text displayed

Please try the new version.

chellman@drupal.org's picture
Offline
Joined: 09/18/2008
Juice: 34
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?

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
Re: Updated Drupal CVS

Please update new version on drupal.org ;- )

gizmatix's picture
Offline
Joined: 09/09/2008
Juice: 159
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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 )

cloudmine's picture
Offline
Joined: 07/16/2008
Juice: 72
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)
netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
New Version

New version on drupal.org.

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

c0psrul3's picture
Offline
Joined: 10/07/2007
Juice: 95
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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 ;- )

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
New Version

Hello folks,

New Version on drupal.org

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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

VitaLife's picture
Offline
Bug Finder
Joined: 10/29/2007
Juice: 257
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.

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
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.

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
New Version

Hey ,

New version is submited on

http://drupal.org/project/uc_ajax_cart

- add support for catalog "buy it now forms"
- add support for uc_marketing module
- overwork javascript because no unique form id's are provided from drupal/ubercart

Please Test and have fun. Next version is only bugfixing and preparing for 1.0 STABLE .

netslave's picture
Offline
Joined: 05/22/2008
Juice: 187
First 6 BETA

First BETA for drupal 6 is on the way. Feedback is welcome ;- )

ARray's picture
Offline
Joined: 12/03/2008
Juice: 2
How to enable ajax support in views and product lists?

I've just installed beta for D6:
http://drupal.org/node/341959