Access to this page has been denied.
You have been blocked because we believe you are using automation tools to browse the website.
This may happen as a result of the following:
- Javascript is disabled or blocked by an extension (ad blockers for example)
- Your browser does not support cookies
If you think you have been blocked by mistake, please contact help@drupal.org with the reference ID below.
Reference ID: #e22b3dc9-872c-11ee-9e0d-5b01bcff8bd4
Powered by PerimeterX , Inc.
Drupal Commerce: How to create a payment method?
I’m trying to create a Drupal Commerce payment module for our company’s special payment service, and implementation for Magento was pretty painless, but for Drupal Commerce, it’s been a magical ride of confusion the entire ride, or maybe I’m not used to Drupal Commerce. I’ve set up Drupal Commerce Kickstart and I’m trying to figure out how to set up a skeleton payment module ready to hook into Drupal Commerce, but the documentation i’ve come accross is.. well.. to put it nicely (no need to start a fire): it could use some work. Maybe I’m looking in all the wrong places, but I’m unable to find some clear and to the point documentation about writing payment method modules for Drupal Commerce. Can anyone point me to a ‘Drupal Commerce Payment Method Programming for Dummies’ before I lose the remains of my sanity? 🙂 I’ve read all relevant documentation on the Drupal Commerce website, but it either just talks about payment modules in general or the pages that actually talk about how to create these payment method modules lack information, are really badly written or just plain don’t exist yet. UPDATE: I’ve dropped this project.. IMHO, Drupal Commerce is a complete fail.. my free advice to the world: please use Magento or some other serious E-commerce suite instead of Drupal Commerce.
Henry van Megen
asked Jul 21, 2014 at 13:05
Henry van Megen Henry van Megen
2,157 2 2 gold badges 23 23 silver badges 35 35 bronze badges
I knew this question was kinda hopeless, considering the small userbase of Drupal Commerce, not to mention the lack of developers (and support for them).
Jul 23, 2014 at 11:56
Try these Modules: drupal.org/project/payment drupal.org/project/payment_commerce «Payment is a generic payment platform which allows other modules to use any of the payment methods that plug into Payment.»
Access to this page has been denied.
You have been blocked because we believe you are using automation tools to browse the website.
This may happen as a result of the following:
- Javascript is disabled or blocked by an extension (ad blockers for example)
- Your browser does not support cookies
If you think you have been blocked by mistake, please contact help@drupal.org with the reference ID below.
Reference ID: #e1e7e06c-872c-11ee-9521-a2be68099ea0
Powered by PerimeterX , Inc.
Editing order confirmation email in Drupal 7 Commerce
I am using Drupal 7 with Drupal Commerce (not Kickstart). I am having difficulties editing the order confirmation email. I am hoping to basically «duplicate» the Order review page from the Checkout process to be included in the email (order items, prices, total and billing info). The module I installed is Commerce message and I just had no luck trying to edit the order confirmation email. I do have the Tokens module installed and enabled. I tried to edit the email under Structure -> Message Types, however, the replacement tokens available (for example: [message:message-commerce-line-item] ), don’t seem to output anything in the email. Actually, the token itself is included in the email, like so:
[message:message-commerce-line-item]
I have tried several other tokens with the same result. I tried to select Filtered HTML and Full HTML. Reading through the Drupal Answers I also tried to use !order-summary token, which seems to work, however the email is «unstyled» and includes HTML tags, like so:
testing credit card payment $0.25 1 $0.25
What puzzles me the most is seeing answers like this or this, stating that
You want the Commerce Message module and it’s dependencies. It includes customer emails with a full order details, including customer profiles and all the products purchased
Any ideas on the issue? I failed to find any Commerce message tutorial or the way tokens should be used with it in Drupal Commerce. I’d be happy to go through one if it exists, I would be willing to even write one for future users who might have the same problems once I figure this out. Thanks
asked Jul 3, 2018 at 6:12
153 7 7 bronze badges
2 Answers 2
I the end, I had to install the Mime Mail module. My site uses gmail for the site’s email, so I had to use Mime Mail together with SMTP module.
The emails render html tags and tokens as needed.
For someone who might experience the similar issue, here is how I configured the Mime Mail witih SMTP:
In admin/config/system/mailsystem scroll down to the «New Class» fieldset. Create a new class using MimeMailSystem for format() and SmtpMailSystem for mail() . Use that newly created class for the «Site-wide default MailSystemInterface class.
I’m still not completely satisfied with this solution as I was hoping to make Commerce Message to work. If someone ever gets to respond to this I would be thankful for the answer.
answered Jul 5, 2018 at 12:01
153 7 7 bronze badges
I though I’d put this out there as what worked for me.
I’ve had a storefront running on Commerce 7.x-1.x for four years. The order confirmation emails have always been lame, but now with purchasing shifted to web, that lameness was becoming too obvious.
I didn’t want to install Commerce Message (for whatever reason), so I started with and edited the standard order confirmation email rule at /admin/commerce/config/checkout/rules.
I added a blend of PHP evalution and replacement patterns from the table beneath the Message text area. Here is the result. I’ll comment it a little (a lot).
blah blah blah greetings Here is a listing of your order: commerce_line_items->value(); //loop through each line item foreach($line_items as $line_item)< // I want to know if it's 'product' type cuz I treat them differently than 'shipping'. // you might see code examples which have this as // $line_item->type->value(), but that just gave me errors. $line_item_type = $line_item->type; // again here an . ->amount->value() construction gave me errors $unit_price = $line_item->commerce_unit_price['und'][0]['amount']; // here also $line_item_total = $line_item->commerce_total['und'][0]['amount']; // if it's product . if ($line_item_type == 'product') < // casting to (int) gets rid of .00 in quantity. // you can't do above if you've got fractional quantities anywhere $quantity = (int) $line_item->quantity; // get the product from the line item $product = commerce_product_load($line_item->commerce_product['und'][0]['product_id']); // print out qty and product name separated by a few spaces, "x" and tab echo $quantity . " x\t" . $product->title . "\n"; // on next line start with tab and spaces, then @, then formatted unit price then line total amount echo "\t @ \$" . number_format($unit_price/100, 2) . " ea . \t\$" . number_format($line_item_total/100, 2) . "\n"; > // if it's not 'product' it's 'shipping' and it's always the last one. else < // print tab, then "Shipping: ", then the chosen shipping option, then that unit cost echo ucwords($line_item_type) . ": " . $line_item->data['shipping_service']['display_title'] . " . \$" . number_format($unit_price/100, 2) . "\n"; > > // end foreach loop ?> // end of PHP code insert Total incl. tax: [commerce-order:commerce_order_total] // tax is not available as a distinct element as far as I could tell Payment: [commerce-order:payment-method-display-title] // this one is not very descriptive in practice Your comments: [commerce-order:field_order_comments] Shipping address (if applicable): [commerce-order:commerce_customer_shipping] // this one thankfully spits out all 4-6 lines blah blah blah nice signoff
The end result is an email like so:
blah blah blah greeting Here is a listing of your order: 1 x Vivamus at laoreet orci @ $25.00 ea . $25.00 2 x Donec eleifend rutrum consequat @ $25.00 ea . $50.00 2 x Felis commodo tristique efficitur @ $25.00 ea . $50.00 Shipping: Fedex/UPS/Whatever . $1.23 Total incl. tax: $132.50 Payment: Credit card Your comments: Shipping address (if applicable): Alfred E Neuman 123 Elm St Anytown, KS 12345 987-654-3210 blah blah blah nice signoff
