Drupal Commerce Issue Queue

Add access checks to prevent the rendering of entity links in Views whose pages we know aren't accessible

Tue, 05/20/2014 - 14:15

I added this field to my view:

Commerce Order: Link

This provides a link to administer an order. However, even users without permission to administer orders are shown the link in the rendered view.

Categories: Issue Queues

Make a read more button for product list

Tue, 05/20/2014 - 10:49

Hello,

I'd like to make a "Read more" button for my slider view, which display a rendered entity of product list -- how can i do this, has anyone maybe done this ?

Thanks,

Martin

Categories: Issue Queues

Sell custom entity via custom line item

Mon, 05/19/2014 - 13:09

Hello,

I find myself in a vicious circle trying to sell custom entity via custom line item.
Not sure if this was covered already somewhere.
The goal here is to avoid adding the custom entity via Commerce Product because it will bring another layer to the already existing&complicated data structure.

I have a custom line item that has reference to my custom "for sale" entity.

1. If the custom line item is not product type: The problem is that you can't checkout if you do not have at least one product type line item in your order.

2. If the custom line item is a product type: Since I don't actually have a reference to a product(field is empty), the system will fail when trying to calculate the prices throwing some SQL Exception. If I would populate the commerce product reference field this will mess up / overwrite my custom prices.

I am not sure what is the best way to be able to have custom line items, referencing my own entities.
I ended up doing ugly things like having a fake-product present in all orders that is always hidden... :)

Any insight?
Thanks,
Mihai

Categories: Issue Queues

Sell custom entity via custom line item

Mon, 05/19/2014 - 13:09

Hello,

I find myself in a vicious circle trying to sell custom entity via custom line item.
Not sure if this was covered already somewhere.
The goal here is to avoid adding the custom entity via Commerce Product because it will bring another layer to the already existing&complicated data structure.

I have a custom line item that has reference to my custom "for sale" entity.

1. If the custom line item is not product type: The problem is that you can't checkout if you do not have at least one product type line item in your order.

2. If the custom line item is a product type: Since I don't actually have a reference to a product(field is empty), the system will fail when trying to calculate the prices throwing some SQL Exception. If I would populate the commerce product reference field this will mess up / overwrite my custom prices.

I am not sure what is the best way to be able to have custom line items, referencing my own entities.
I ended up doing ugly things like having a fake-product present in all orders that is always hidden... :)

Any insight?
Thanks,
Mihai

Categories: Issue Queues

Translation of Commerce Product Quantity Label

Mon, 05/19/2014 - 11:48

The Commerce Cart Block view does not allow for direct translation of the 'Item' or 'Items' string, despite those values already being available via Drupal translations.

I submit to you a bug fix via the enclosed patch which solves this problem by running the appropriate string through translation and calling it prior to being sent to the theme layer. Please review.

Categories: Issue Queues

Error on install "FieldException: Attempt to create an instance of field commerce_unit_price without a bundle. in field_create_instance()"

Mon, 05/19/2014 - 07:20

Hi all.

On a fresh Drupal install, when enabling Commerce 1.9 (several modules at once), we get the following error:

FieldException: Attempt to create an instance of field commerce_unit_price without a bundle. in field_create_instance()

Uninstalling all Commerce related modules and reverting to 1.8 fixed it. Any ideas of what could have triggered this ?

Categories: Issue Queues

Error on install "FieldException: Attempt to create an instance of field commerce_unit_price without a bundle. in field_create_instance()"

Mon, 05/19/2014 - 07:20

Hi all.

On a fresh Drupal install, when enabling Commerce 1.9 (several modules at once), we get the following error:

FieldException: Attempt to create an instance of field commerce_unit_price without a bundle. in field_create_instance()

Uninstalling all Commerce related modules and reverting to 1.8 fixed it. Any ideas of what could have triggered this ?

Categories: Issue Queues

commerce_entity_access_query_alter can sometimes choose the wrong base table

Sun, 05/18/2014 - 17:48

I noticed this when using addressbook with Commerce 1.9 and dev. Here is probably the best way to reproduce this:

1) Make a user role that has edit/view own and create shipping and billing
2) Install addressbook
3) Have the user make two billing profiles (one will become default)

You will see that the non-default one does not show in the second addressbook view on the addressbook tab.

For whatever reasons, Views is doing this join pattern:

commerce_customer_profile -> LEFT JOIN -> commerce_addressbook_defaults -> INNER -> commerce_customer_profile

commerce_entity_access_query_alter is choosing the second commerce_customer_profile table as the alias for "base_table". Thus for any rows where the first LEFT JOIN found no key in commerce_addressbook_defaults, the ownership conditions that commerce_entity_access_query_alter puts in will cause the row to get left out.

I have attached a patch to fix.

Categories: Issue Queues

commerce_entity_access_query_alter can sometimes choose the wrong base table

Sun, 05/18/2014 - 17:48

I noticed this when using addressbook with Commerce 1.9 and dev. Here is probably the best way to reproduce this:

1) Make a user role that has edit/view own and create shipping and billing
2) Install addressbook
3) Have the user make two billing profiles (one will become default)

You will see that the non-default one does not show in the second addressbook view on the addressbook tab.

For whatever reasons, Views is doing this join pattern:

commerce_customer_profile -> LEFT JOIN -> commerce_addressbook_defaults -> INNER -> commerce_customer_profile

commerce_entity_access_query_alter is choosing the second commerce_customer_profile table as the alias for "base_table". Thus for any rows where the first LEFT JOIN found no key in commerce_addressbook_defaults, the ownership conditions that commerce_entity_access_query_alter puts in will cause the row to get left out.

I have attached a patch to fix.

Categories: Issue Queues

Delete line item button doesn't get $order

Fri, 05/16/2014 - 06:16

I'm using customized commerce cart view. I added delete button to cart, after clicking on it, I get the usual
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 736 of /home/szantogabor/public_html/stocklogos/stocklogos/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).
error.

It seems, the form of delete button doesn't contain the $order object, so the first arg of rules event After removing a product from the cart is FALSE.

I'm not sure, it is the proper way, but I could make it work with this:

--- a/modules/line_item/includes/views/handlers/commerce_line_item_handler_field_edit_delete.inc
+++ b/modules/line_item/includes/views/handlers/commerce_line_item_handler_field_edit_delete.inc
@@ -40,6 +40,8 @@ class commerce_line_item_handler_field_edit_delete extends views_handler_field {
     // in order to get the base key value (for example, nid for nodes).
     foreach ($this->view->result as $row_id => $row) {
       $line_item_id = $this->get_value($row);
+      $line_item = commerce_line_item_load($line_item_id);
+      $form_state['order'] = commerce_order_load($line_item->order_id);
       $form[$this->options['id']][$row_id] = array(
         '#type' => 'submit',
Categories: Issue Queues

Delete line item button doesn't get $order

Fri, 05/16/2014 - 06:16

I'm using customized commerce cart view. I added delete button to cart, after clicking on it, I get the usual
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 736 of /home/szantogabor/public_html/stocklogos/stocklogos/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).
error.

It seems, the form of delete button doesn't contain the $order object, so the first arg of rules event After removing a product from the cart is FALSE.

I'm not sure, it is the proper way, but I could make it work with this:

--- a/modules/line_item/includes/views/handlers/commerce_line_item_handler_field_edit_delete.inc
+++ b/modules/line_item/includes/views/handlers/commerce_line_item_handler_field_edit_delete.inc
@@ -40,6 +40,8 @@ class commerce_line_item_handler_field_edit_delete extends views_handler_field {
     // in order to get the base key value (for example, nid for nodes).
     foreach ($this->view->result as $row_id => $row) {
       $line_item_id = $this->get_value($row);
+      $line_item = commerce_line_item_load($line_item_id);
+      $form_state['order'] = commerce_order_load($line_item->order_id);
       $form[$this->options['id']][$row_id] = array(
         '#type' => 'submit',
Categories: Issue Queues

Make total amount as returned by commerce_line_items_total() available to commerce line item summary template

Wed, 05/14/2014 - 06:11
Problem/Motivation

Currently it is difficult to influence the formatting of the total amount when using the line item summary views area (e.g. in the shopping cart block).

Proposed resolution

Make total amount as returned by commerce_line_items_total() available in commerce-line-item-summary.tpl.php

Remaining tasks User interface changes API changes
Categories: Issue Queues

Make total amount as returned by commerce_line_items_total() available to commerce line item summary template

Wed, 05/14/2014 - 06:11
Problem/Motivation

Currently it is difficult to influence the formatting of the total amount when using the line item summary views area (e.g. in the shopping cart block).

Proposed resolution

Make total amount as returned by commerce_line_items_total() available in commerce-line-item-summary.tpl.php

Remaining tasks User interface changes API changes
Categories: Issue Queues