1 reply [Last post]
renewkb's picture
Offline
Joined: 09/08/2011
Juice: 40
Was this information Helpful?

Module to be developed:

I'm using Ubercart 6 ,UC Market Place, UC Adaptive Paypal andDomain Access

Seeking to change the behavior of the add to cart submit handler.

The site is using domain access where each subdomain is a store selling various gift certificates of different sellers . Product Class: straight_reach_card.
Following is the change to the submit handler I'm seeking (or I believe it is there).

1. Have a product class/type straight_reach_card. with a field called field_donation_amount

2. Have a product class/type donation. each item has a sell_price of $1 and a field_donation_domain_id

User clicks on add to cart.
Case product type 'straight_reach_card' or product type

$nid = SELECT 'nid'
FROM `content_type_donation`
WHERE `field_donate_domain_id_value` = domain_id of the site the user is on
LIMIT 0 , 1

If the search returns no result user gets message. "Unable to add Reach Cards at this time. Try back another time.". Then an email gets sent to admin saying: domain_id has no donation. No items get added to cart and user is redireted

$qty = field_donation_amount

uc_cart_add_item($nid,$qty) (Have been trying to use this with hook_add_to_cart with no success.)

then the normal submit handler is executed.

The end result being the original product is placed in the cart and donation is added to the cart.

This is the basic idea. Not knowing the ins and outs, I don't know what I'm missing.

Offering a $50 bounty.

PatchRanger's picture
Offline
Joined: 08/15/2012
Juice: 50
Here is a solution

For everybody, who is wondering the same question, it has been already implemented as a built-in Ubercart-ViewsBulkOperations(VBO) integration feature: see Add actions for Views Bulk Operations for details.

--
PatchRanger - the first crowdfunded Drupal freelancer.