Drupal Commerce Issue Queue

Commit database transaction after inserting payment transaction

Fri, 01/17/2014 - 08:14

I ran into an interesting problem and I'm not sure that this is the best solution but it does seem to work. On our store, we make an API call to another site of ours whenever an order is completed and there was a problem with that site. As a result, an Exception was thrown which would cause the database transaction to be reverted. However, the payment transaction had already been completed. This resulted in the payment having been processed on the payment gateways side, but showing a full balance on our store. In response, some users attempted to pay for their order several times which caused their card to be charged multiple times.

We have taken measures to better handle the exception from our API, but this has revealed to us the bigger problem that if there are any errors after a payment has been processed, we could lose record of that transaction. In an attempt to avoid this issue, we decided it would be best to commit the database transaction after the payment transaction has been written to the database to ensure that we maintain that record. I considered writing a custom entity controller to handle this, but I thought others may run into this issue so I patched the existing controller instead.

Categories: Issue Queues

Not showing commerce product as an option on filter criteria, contextual filter, sort criteria and fields in views

Fri, 01/17/2014 - 06:45


We are installaing commerce on a drupal 7 site and want to use commerce but it is not showing the commerce fields or products when setting up some views.

What did we do wrong?


Categories: Issue Queues

From add_to_cart_form, could not refresh unit price using line item field.

Wed, 01/15/2014 - 08:45

step 1: setup a vocabulary "store", and add some terms for "store".

step 2: add "field_store" field into line item type, field type is "Term Reference", vocabulary set to "store", widget set to "Select list"

step 3: alter the add_to_cart form let select store will refresh the price:

function store_form_alter(&$form, &$form_state, $form_id) {
  if (strpos($form_id, 'commerce_cart_add_to_cart_form_') === 0) {
    $form['line_item_fields']['field_store']['und']['#ajax'] = array(
      'callback' => 'commerce_cart_add_to_cart_form_attributes_refresh',

step 4: add a rule to calculate the unit price from store:

function store_rules_action_info() {
  $actions['store_retail_price'] = array(
    'label' => t('Set the unit price by store\'s retail price'),
    'parameter' => array(
      'commerce_line_item' => array(
        'type' => 'commerce_line_item',
        'label' => t('Line item'),
    'group' => t('Store'),
  return $actions;
* Rules action: set the unit price by store's retail price.
function store_retail_price($line_item) {
  if (isset($line_item->field_store)) {
    // !!! alway going to here, because there has no field_store in $item_item object !!!
Categories: Issue Queues

"Administer products" permission required to display 'Add a product' in admin navigation

Tue, 01/14/2014 - 09:59

Updated: Comment #N


I'm trying to make it so that my users can create products. I only want them to be able to create products of my own predefined type, not including the default 'product' type. However, the 'Store->Products->Add a product' option is not visible in the admin navigation bar unless I enable the permission 'Administer products' for the user role. Once you do so, however, the user can create products of all types, including ones that they supposedly should not have permission to.

This is only for the top navigation drop down. When the user does not have 'Administer products', but has permissions for the product type set appropriately, the page admin/commerce/products/add is correctly visible, and the appropriate product types show up. 'product' is not present unless permissions have been granted.

Proposed resolution

Make "Add products" portion of the "Store" drop down visible for users with permissions other than 'Administer products'.

Original report by aron.beal
Categories: Issue Queues

Provide an easy to edit button on product display pages when displaying product variation field

Fri, 01/10/2014 - 09:59

Currently out of the box installation there is no easy way to edit the products on the product display pages. I think it would be ideal to add an edit button next to the add to cart button when logged in as admin.


I could do it in javascript as the product id's resides in the form input element, but would be better if it was in the core also. I know there is a few modules that provide this already, but thought it would make more sense if it was in core commerce for something simple like this.

Categories: Issue Queues

Filter by order balance

Thu, 01/09/2014 - 05:24

I'd like to create a view that shows all orders with an order balance above 0, however I cant seem to access the Commerce: Odrder Balance field in the filters section

Is there an easy way to do this, ordoes itinvolve custom code?

Categories: Issue Queues

Clear out the revision ID in the entity controller

Wed, 01/08/2014 - 17:20

While going through some existing Customer Profile code, I noticed that all code unsets both the $profile->profile_id and $profile->revision before saving a profile 'as a copy'.

Messing with profiles (copying to a new object) is a common-ish operation and will be done by more contrib people; maybe someone will want to mass-create similar entities using some script. So what happens when they only unset the ID and not the revision ID?

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
Duplicate entry '2958' for key 'revision_id': INSERT INTO ...

Ah. Well, it doesn't cause data corruption if a developer is being sloppy. Good news. But still, maybe the following patch is a good idea?

(Entity API does basically the same thing - that is, it always clears out the revision ID. Not the log.)


PS: the deleted 2 comment lines don't have anything to do with this patch but they were confusing / didn't contain useful info for that point in the code.
"create the row in the base table, then save the revision" is always done.

Categories: Issue Queues

Anyway to display just "subtotal" in a view?

Wed, 01/08/2014 - 08:30

Is there any way to display just the subtotal portion of the commerce order->order total in a view?

I want to just display the total of the products prior to the Shipping and Tax calculations. If I use the Commerce Order: Order total or Commerce Order: Order Balance fields in my view - I get the full total price (including shipping and taxes).


Categories: Issue Queues

4 Digit Security Codes

Tue, 01/07/2014 - 05:59


I want to start by thanking you for this wonderful framework!

In Iceland there is a company called Greiðsluveitan(http://greidsluveitan.is/Fyrirtaekid/Forsida/). It's role is to audit all websites before payment gateways can give websites access to their api's.

According to them the credit card form has to accept 4 digit security codes for all card types, their argument is such that in the future cards will be issued with 4 digit codes and websites have to start supporting them by allowing a 0 before the 3 current digit codes.

Greiðsluveitan will not accept websites without 4 digit support, so what is it we need to do to get this compliance in to commerce?

Best Regards,
Helgi Jónsson.

Categories: Issue Queues

Show attribute for single product in add_to_cart_form

Mon, 01/06/2014 - 08:25

When I have only one product for a display, and check "Show attribute widgets even if the Add to Cart form only represents one product." in the display of the related line item's product field, it is still a hidden field and not a select list with one option.

Categories: Issue Queues

Not able to override line item title

Sun, 01/05/2014 - 18:54


I am trying to alter the line item title as specified in this related support request:


But it's not working. It seems like hook_commerce_line_item_type_info_alter is being called but not the title callback:

* Implimentation of hook_commerce_line_item_type_info_alter()
* Override the default title callback so we can use our own
function client_specific_commerce_line_item_type_info_alter(&$line_item_types) {
  $line_item_types['product']['callbacks'] = array('title' => '_client_specific_commerce_product_line_item_title');
* Returns an appropriate title for this line item
function _client_specific_commerce_product_line_item_title($line_item) {
  return 'HELLO!';

Anyone know what might be going on?


Categories: Issue Queues

print product $title from page.tpl.php

Sun, 01/05/2014 - 08:37

I need to print the $title of the product on a different region from the rest of the product fields but when a product is displayed on full content, the value of $title in page.tpl.php is missing.

The $title from node.tpl.php is not equal substitute because you cannot print it on a different region from the rest of the node content.

Categories: Issue Queues

"Change History" on product form has not enough weight and shows up between fields

Fri, 01/03/2014 - 05:27

When creating a product with many fields, the "Change History" widget shows up in the middle of them, and it should be always before the action buttons

Categories: Issue Queues

commerce_order_state_reset and commerce_order_status_reset try to delete from non-existant tables.

Mon, 12/30/2013 - 06:36

Just a heads up that the following functions try to delete from undefined tables unless I'm missing something.
Is this legacy or placeholder code?

In commerce_order.module:

* Resets an order status by name to its module defined defaults.
function commerce_order_status_reset($name) {
    ->condition('name', $name)
* Resets an order state by name to its module defined defaults.
function commerce_order_state_reset($name) {
    ->condition('name', $name)
Categories: Issue Queues

how to attach content to taxonomy term fields? I succeeded but am unsure if it is the right way. Help!!

Sat, 12/28/2013 - 14:03

I created products as well as product displays. Now I can display them fine using views, by selecting a relationship of referenced products, and am also able to link them to the product display. But When I click on the taxonomy term it says no associated content. I fixed this by adding the existing fields in the content types, and selecting the terms in the field again. but Is this the right way ? Or can I reference them all somehow, because just by referencing them as a product does not reference the individual fields, or so I think.

Categories: Issue Queues

Selling membership (user role) several at once

Fri, 12/27/2013 - 02:19

Thanks for Drupal Commerce.
we are selling product, which gives access to particular content of site, using roles.
Is it possible to sell several (10 or 20) product instances at once?
for example teacher buys product (qty 10 ) and after gives access to 10 students, using single instance of product for every student.
How assign several accounts creation when buy 10(as example) product's instances at once? did someone had something similar?


Categories: Issue Queues