I'm very excited to see UC now in Drupal 7 - it's working very well for me. But my client really has a need for this functionality, to add a fee in checkout. Any chance someone can port this module to Drupal 7? Thanks!

Comments

mattm007’s picture

If there isn't a port, how about an alternative solution?

christelle41’s picture

Subscribing

tr’s picture

You can port this module yourself, or you can sponsor someone to port it for you, or you can wait until someone else does it. Since you have a client that needs this, that seems an obvious source of money for sponsorship, if you can't do it yourself. Porting modules like this to D7 are generally a pretty short and simple task.

Taxoman’s picture

Title: Update to Drupal 7? » D7 port of Ubercart_Fee
Component: Miscellaneous » Code
Category: feature » task
a.knutson’s picture

Does anyone have any plans to port this to D7 UC3? I'm compiling a list of Ubercart related modules and trying to get an idea of what still needs to get ported over.

Thanks in advance!!

maverick619’s picture

Version: 6.x-2.x-dev » 6.x-1.0-beta2
Status: Active » Needs review
StatusFileSize
new57.87 KB

I've made a D7 version of the module which has been patched from 6.x-1.0-beta2 for use on a platform I'm developing. Please test and let me know if there are any issues.

mdrons’s picture

The patch did not apply clean, but I merged the changes manually. I get the module to load and I can add a Fee, but I cant edit the rules for the fee. I see this error. Any thoughts?

Page not found
The requested page "/admin/config/workflow/rules/reaction/manage/uc_fee_1" could not be found.

Thanks, Mike

maverick619’s picture

Hi Mike,

I've fixed the page not found problem. The cache needs to be flushed after the fee is created so I've added that function. I've also changed the rule a little so I'll need people to check if that works.

I've now moved the whole D7 version into a sandbox which can be found at http://drupal.org/sandbox/maverick619/1897212. You can find the complete module in the 7.x-1.x branch.

mdrons’s picture

I am not able to get a fee to show up in the checkout process (I assume I should see it there). I defined 2 fees and set the rules for them. When I checkout the fees do not show up. I have some PHP experience, but I am new to drupal and dont have the debug experience for drupal. Tell me where/what to look at and I can assist in fixing issues.

Mike

maverick619’s picture

Hi Mike,

I've fixed the fees showing up on checkout. I originally used the old D6 version which ran it with ajax to enter it into the database which meant it was getting added after the page was generated. I've changed it to use hook_uc_order so that it runs the calculation whenever the order is saved. I also found and fixed an issue where line items were constantly being added instead of updated so it now checks if the fee exists and updates it instead on adding a new one every time you refresh the page or save the order.

The only issue now (which I'll eventually find time to fix) is updating the line item on the order edit page in admin after the order is complete. For some reason the order object keeps the old value instead of updating to the new one. Hopefully you should be able to get by with the fees until I've sorted it out.

mdrons’s picture

I posted a new bug in the sandbox. Is that the best place for them? or should I post them on this thread?

mdrons’s picture

I having difficulty with the rules. I trying to charge a handling fee to recover the cost of boxes. I use 4 different boxes when I ship at 4 different prices. The choice of box is dependent on the size of the product. How do I write a rule and what field should I be looking at for the rules?

Also, is it possible to sum the fees and display a single fee?

Thanks, Mike

dewolfe001’s picture

I have been trying to get the D7 port of this working :

Contribution Handling Fee:	$0.20
Subtotal:	$10.00
Subtotal excluding taxes:	$10.20
GST :	$0.51
Order total:	$10.51

It's getting the tax to factor in the handling fee, but the order total does not. When it goes to Paypal and comes back completed, there is an error from Drupal because of the discrepancy. I wish I were more familiar with how Ubercart works, but I cannot figure out how to get the $order->order_total that is eventually passed to the payment gateway to total from the sub-total excluding taxes + the tax to get a proper total.

Any advice?

Thanks in advance,

Shawn

dewolfe001’s picture

Version: 6.x-1.0-beta2 » 6.x-2.x-dev
Issue tags: +Ubercart, +paypal, +uc_fee
StatusFileSize
new13.13 KB

This is an altered version of the D7 port of uc_fee (the Version of 6.x-2.x-dev is to be ignored).

I think I made some progress with this code to get it to behave, but I really did feel like I was poking through it blindly. That said, I think I have this working. Also, I think I have a form_alter in there to push the fee into the handling_cart value for uc_paypal_wps use cases.

All the best,

Shawn

dzepol’s picture

I've installed and tested this a bit. Here are some things I've found while using it.

On product override page the form is expanded regardless if the box is checked.

If you do check the box, override a fee, and save it, it does save it but it doesn't show the fee you entered once the form reloads, it still shows $0.00.

I also had a couple of these errors come up in my logs after install. I'll try to test some more.
Notice: Undefined index: fees in uc_fee_admin_form_submit() (line 112 of /Web/sites/store/www/sites/all/modules/uc_fee/uc_fee.admin.inc).

Warning: Invalid argument supplied for foreach() in uc_fee_admin_form_submit() (line 112 of /Web/sites/store/www/sites/all/modules/uc_fee/uc_fee.admin.inc).

Notice: Undefined variable: fees in uc_fee_javascript() (line 687 of /Web/sites/store/www/sites/all/modules/uc_fee/uc_fee.module).

muhammad.tanweer’s picture

Hello Everyone,

Thanks for the hardwork of putting this module up for D7. Here is what I found.

I got the module from here http://drupal.org/sandbox/maverick619/1897212
Installed it and then created a few fees (I needed 3). My fees needed to be applied when product with a specific attribute was added to the order. Everything else worked pretty good but there was one error.

Illegal string offset 'value' in uc_fee_action_apply_fee() line 93 of uc_fee.rules.inc

So I debugged it, and found out that the $fid which is passed to the uc_fee_action_apply_fee() function, doesn't have a key "value". This $fid comes from the action when you add a rule. In my case $fid = the id of fee . So I commented this line

$fid = $fid['value']; (line 93). which makes my uc_fee_load() function work with the $fid which is passed as argument to the function. No problems were encountered. Hope this helps someone.

Thanks
Muhammad Tanweer
www.app-desk.com

jasonglisson’s picture

Issue summary: View changes

Anyone successfully using this port to Drupal 7?

I'm trying to use it, and for the most part it's working. But now I'm seeing that Paypal is not seeing this additional fee. It also looks like, if this fee is added to an order, the shipping gets removed somehow.

jasonglisson’s picture

I did end up getting this to work with Paypal. If anyone is interested in the fix for this or possibly collaborating on a port to Drupal 7, please let me know.

Joebawca’s picture

Used the module from comment #14, but it is not working properly. The module shows up under the admin/modules panel, but there are no visible selections under admin/store/fees or at the product level. To elaborate more on this, when I go to www.example.com/admin/store/fees, I get redirected to the dashboard. No visible errors are showing. I tried clearing my cache to no avail. I am using Drupal 7.24.

Edit: The issue seemed to correct itself out. I cleared my cache multiple times and the menu is showing correctly.

jdcllns’s picture

Is anyone still working with the D7 version of this module?

jerry’s picture

I'm using it successfully in at least one non-demanding application.

jdcllns’s picture

With PayPal? Where the product has Attributes, Options, and Adjustments? Handling is not getting passed to PP when a certain Option is selected. I've added watchdog code to log as much as I can. Everything looks fine right up to the point where the Submit Order button gets clicked. Once the Submit Order button is clicked, the PP screen appears but nothing is written to the log. I cannot tell what Drupal's last steps are before sending the data off to PP. We're using WPS.

jerry’s picture

With PayPal?

Yes, WPS.

Where the product has Attributes, Options, and Adjustments?

No, not in my application.

BTW, do you have "Submit the whole order as a single line item" selected in the PayPal payment module configuration? I have a dim memory of that being necessary, though I could be confusing this with a different situation.

jdcllns’s picture

"Submit the whole order as a single line item" Didn't help. Thanks for the suggestion though.

Does anyone know how exactly what steps happen as the sale is sent to PayPal? Is there any way to write that to the log?

jdcllns’s picture

Fixed! PayPal wants to see only strict dollars and cents, ex: 1.34. The routine that figures the percentage may return numbers not of that format, ex: .339. It needs a rounding function somewhere. In uc_fee.module I altered line 172:

Original: $fees_total += $line['amount'];

New: $fees_total += round($line['amount'],2);

Everything seems to be working now.

prageeth’s picture

Hi All,
I have used uc_fees module in d6 ubercart 2 for applying fees based on the customer's state.(eg.. IL,WA etc..).Now I have migrated my whole site to d7 ubercart 3 and I want the fees to be applied on my product. What shall I do now ? I can use the above module or any alternative modules are available . Please advise me thanks.