This document is maintained.
Note: please refer to http://drupal.org/node/68363 for patch/code history.
I will be providing some standard charge types with Flexicharge. If you have more ideas, please add them as comments. Note, that most of these will all support %, +/-, renaming, cloning, and other features, so you don't need to suggest that stuff.
Simple (example.inc)
Status: complete, in testing
This is a simple charge type that is applied to the whole cart.
By type (per_type.inc)
Status: in development
These charges a good for charges related to different product "groupings".
~ charge by taxonomy
~ charge by ptype (eg. tangible, file...)
~
Shipping related (shipping.inc)
Status: in development
~ charge by weight
~ charge by quantity
~ charge by destination country
~
Procedural (procedural.inc)
Status: planned
These charges take advantage of the ability to order your calculations using flexicharge. The first two are mainly for the visual appearance of giving a good deal! But also it will enable the transaction table to keep a history.
~ rebate previous charge (in calculation order)
~ rebate misc (non-product) charge
~ rebate X if subtotal is greater than Y
~ rebate X if itemtotal is greater than Y
~
Feedback (feedback.inc)
Status: playing with the idea.
I have a requirement to create a very unusual charge that (as part of the requirement) will need the user to make a choice. So here are some other "user-interactive" options that might be on the cards.
~ optional contribution
~
And so on. Remember that you can use more than one of the above charges at a time. There will be times when you want to get really tricky and you'll have to develop your own charge, but hopefully the development process will now be a snap.

Comments
Sounds great!
I love the look of this, nice work! This just saved our butts at work today, as a client wasn't wanting to use the shipping calculator that we had made. I'll be tracking this project. The site we are going to use this for is probably a month away, so when that day comes I'll have a closer look and see if there is anything I can help contribute back.
Thanks,
Rick
Yes, this module looks very
Yes, this module looks very promising. I just got this installed and site-wide cost was added in no time. Next I can figure out what else I can do with this!
thanks for the feedback
Thanks for all positive feedback y'all. Just a short note to say that I'm still here and I'll be keen to incorporate all the ideas that have been posted.
Product-dependent tax and shipping charges
Hi,
I'm trying to achieve the following:
Product 1
Price: $50
Shipping Charge: $5
Tax: 14% (if ordered from Ontario)
Product 2
Price: $20
Shipping Charge: $3
Tax: N/A
Example Transaction: Ordering from Ontario, 2x [Product 1] and 1x [Product 2]
Total = [Price of Products] + [Taxes] + [Shipping Charges]
Total = [($50 x 2) + ($20 x 1)] + [($50 x 2) x .14] + [($5 x 2) + ($3 x 1)]
Are these types of charges already available or in the works? If not, do you have any suggestions of how to handle them?
Sorry for repeating the question but this is probably a better place to post this? (re: my original post http://drupal.org/node/102229)
If you look at
If you look at simple.inc
you'll see that there is not a lot of code to understand and modify. Depending on your php experience you might have no troubles.
Thanks for your help
Thanks for your help sime.
Btw. Should simple.inc be changed to provider.example or sitewide.inc in this doc?
The shipping amount showes ZERO in invoice
Thank you for your nice Flexicharge module.I encountered a problem when I tried to use it:
The shipping amount showes ZERO in transaction view and invoices.
Also I have a suggestions:
By defining several shipping methods with different charges, could it be possible for buyer to choose one the shipping methods and thus just the chosen one be added to subtotal?
Hi can you clarify that
Hi can you clarify that you're using the lastest code from the repository? The zip file in the ticket is redundant now.
I am using the latest module and patches...
Hi, I am using the latest module and patches, the total amount is correct in store/history page but it shows zero in transaction/invoice view.
OK, thanks. I'll check it
OK, thanks. I'll check it out.
bit of explanation?
this module looks really great, but it doesn't seem to be working for me.
I uploaded the module and enabled it, but the settings didn't seem to be configurable very well. So I uploaded example.inc and then I could create a "site wide charge" for 5.00, but it doesn't actually add it. Site wide charge is in the table when checking out, but it is zero value. Any ideas?
Also, It was a bit confusing with the example.inc, is there any documentation anywhere to help out with this a bit better?
I hope to be able to use this because it looks like it will do what I need.
thanks
alynner
Hi I will look at this when
Hi
I will look at this when I make my next push. You were right to upload example.inc. I know it has a weird name (it's so that people look inside) but basically you need at least one .inc file to provide a charge type.
Thanks for having a look, this thread is here if you have a specific charge type you'd like to suggest - so feel free to describe your objective.
thanks, my objective is...
Hi Sime
I would like to be able to charge a flat rate ($5.00) for shipping within cont'l US and another flat rate ($20?) for everywhere else.
To start I would at least like to have a "site wide charge" of $5 for shipping, but it just isn't adding to the checkout. If you could take a look at that, it would be great!
thanks!
alynner
some problems with subtotal options
I got some problems by adding 2 charges,
for example, "tax" and "shipping"
I have checked "Display a subtotal before?" for the "tax" , without checking any option, the "shipping" got a subtotal.
then I have checked "Display a subtotal after?" for the "tax". But No "subtotal" appears
my sys:drupal 4.7 + ec4.7 +cvs flexicharge, It seems like a var-scope problem, but a newbie like me can't work it out, maybe you can give me more suggestion?
btw. I can't waiting for your next update, so I begin to use this nice tool and deactive some modules like shipping and Tax, but the README.txt of ec4.7 said that shipping.module is required. Is there some bad consequences of deactiveing shipping.module ? (i see nothing)
P.S. my invoice doesn't show any calculation of these 2 charges , too (both 0.00)
P.S. How can i get variable for pdf invoice generation?
Any examples of shipping charges?
Hi there.
I have installed flexicharge and need to make a number of shipping rules depending on the buyers country. Does anyone out there have an example file or instructions to work off of?
The rules that I need are very simple:
Canada: $1.50 per an item
US: $1.50 per an item, up to a maximum of $6 charge
Worldwide: $2.50 per an item
Any help out there?
Want to be able to "Free shipping with orders over $X"
So I want to be able to
Free shipping with orders over $X
or
Free gift with purchase – automatically adds ‘free gift’ to order summary page at $0.00 (depending on order size, order value, or a particular product in the cart)
charging payment type
My question: do the charges end up as a separate item (like shipping) in the Invoice? In my opinion this is preferred or at least optional.
Some shopowner would like to charge for payment type. For instance COD is a payment type that has an extra cost involved. Some payment types are free of charge while others can have a percentage charge. Depending on the buyer's choice of payment type, an extra matching charge should be included and visible before confirming the order and in the invoice.
Flexicharge items end up as
Flexicharge items end up as a miscellaneous transaction which can be either included in the price of a product or displayed as new line item.
--
Gordon Heydon
Flexicharge amounts don't yet appear on the invoice
Theres currently a reported bug with Flexicharge items not appearing correctly in invoices, so if invoicing's important to you, you may need to wait till that problem's fixed before using it.
a new idea,
well, nothing novel, but how about adding a charge if subtotal > X? Like say, insurance or COD charges. [like i said, nothing novel. ;)]
will you be continuing to use the partner concept?
that's me
sorry, above comment was me. didn't know that you can comment anonymously on this site.
--
Cheers,
Thong
Website: http://www.edoodle.co.nz
Drupal for artists - demo at Website for artists
Yes, I'm continuing to use
Yes, I'm continuing to use the partner concept. Basically I have added any new charge types yet due to time, a few people are using flexicharge but seem to get what they need out of the existing charge.
Selection between different methods upon checkout.
It's very good, but where is the option for the customer to choice between different shipping methods?
the shipping.module does include functionnallity to list different methods, but none is listed if you enable more than one.
/**
* Build the shipping checkout form, which lists all available shipping options.
*
* @param $txn
* The current transaction.
*/
function shipping_checkout_form(&$txn) {
if (!is_array($txn->items)) {
// No items are defined, we shouldn't be here, just return.
return;
}
else {
$shippable = FALSE;
foreach ($txn->items as $item) {
if (is_array($item->shipping_methods)) {
$shippable = TRUE;
}
}
if (!$shippable) {
// No shippable items are defined, just return.
return;
}
}
drupal_set_title(t('Choose shipping method'));
$form = array();
$options = array();
$rates = module_invoke_all('shipping_checkout_rates', $txn);
if (sizeof($rates) == 1) {
// Only one shipping method, auto select
$rate = array_pop($rates);
$txn->shipping_method = $rate['#service'] .'__'. $rate['#key'] .'__'. $rate['#cost'] .'__'. $rate['#currency'];
shipping_checkoutapi($txn, 'save');
return;
}
foreach ($rates as $rate) {
$options[$rate['#service'] .'__'. $rate['#key'] .'__'. $rate['#cost'] .'__'. $rate['#currency']] = t('%price %currency - %method', array('%price' => $rate['#cost'], '%currency' => $rate['#currency'], '%method' => $rate['#method']));
}
$form['shipping_method'] = array(
'#type' => 'radios',
'#options' => $options
);
$form[] = array(
'#type' => 'submit',
'#default_value' => t('Continue')
);
return $form;
}
It would be very nice to let the customer choice between different shipping methods and actually use the code? It might need a rewrite, but the idea is very good.
Many customers ask for different ways of shipping, some want the goods next day and want to pay for it and others only want is as cheap as possible.
Is shipping.inc still in progress?
Hi,
I just stumbled across this project and I was curious if it was stalled (and perhaps I could help unstall it). I'm pretty sure I could convince a client to give me some hours to finish implementing shipping.inc if someone needs a hand. In the code flexicharge_shipping_checkout_rates appears to be commented out because it claims weight.inc makes it redundant. Is this still the case? Can shipping.inc work without a uncommented flexicharge_shipping_checkout_rates?
Thanks a lot,
Steven
Actually this should be
Actually this should be ready by the next BETA(4).
Please see here for new
Please see here for new flexicharge features (including simple shipping), now in dev version of 4.7v3 and 5v3.
http://drupal.org/node/122769
There are instruction there too for creating custom .inc files.
Flexicharge for Images as Products
I'm actually creating my products as Images and then turning them into products using the Image Attach module.
The only problem is that products of this kind don't display the Flexicharge Attributes in the Add/Edit page where one sets the Product Weight.
Is there a way I can add the Flexicharge Attributes form item to the Add/Edit page of an Image content type?
Thanks