Currently there is a flaw in the translation of the title field when an entity's cache is used / reset during script execution. As far as I know atm. the basket and cart views are affected by this.

The title module provides the possibility to react on such cache usage / resets but to do so the module has to integrate the entitycache module.
CommerceProductEntityController has to extend EntityCacheDefaultEntityController to do so, what means that on an update existing installations will break if entitycache isn't in place. Ideas how to come around this?

The attached patch does the necessary integration but there are other open patches for the title and entitycache module that have to be committed first to make it really working:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Status: Needs review » Needs work

Do we really need to introduce a dependency on EntityCache? I'm not sure if that's a good idea or not, especially since we haven't been testing with it this entire time. Additionally, if we were to extend that controller, then we wouldn't be able to extend the EntityAPIDefaultEntityController as requested more generally.

das-peter’s picture

I would also prefer not to add another dependency - unfortunately I couldn't figure out a better way how to get this working :|
I'll try to take a closer look this week again.

plach’s picture

This is not a Title-specif issue: #1165930: Compatibility with Entity API.

catch’s picture

Subscribing to see what happens.

guy_schneerson’s picture

Subscribing to see what happens.

GiorgosK’s picture

I can't see entity translated product title_field on the cart view

will this be solved a different way ? (not depending on entitycache ?)
it seems all the related issues have been resolved

guy_schneerson’s picture

I get around this by updating all the cart views to use the products title field instead of the line_item title.

GiorgosK’s picture

@guy_schneerson
the view itself would not allow me to add fields other than of type "line item" ?!!

guy_schneerson’s picture

@GiorgosK
You need to create a relationship between the line item and the product, its under the advanced section of the view.

GiorgosK’s picture

@guy_schneerson thanks

Added relationship > Commerce Line item: Referenced product & field > field: Title

but
my product is untranslated
and my product display is translated using entity translation & title

but I can't get translated title in the cart view

any ideas

guy_schneerson’s picture

GiorgosK: make sure you are using the correct title field, you are using the node title you should be using the title field

jkthng’s picture

@guy_schneerson, if I use the product title, that means I have to allow annoymous users to "view product product"? Else the cart would be empty and no products will show even when I add products to the basket. Is it right?

jkthng’s picture

@guy_schneerson Solved it after a couple of hours. I realised that you need to enable the permission "Translate any entity" for the annoymouse users. Hope this saves someone some time.

guy_schneerson’s picture

@jkthng that doesn’t sound right, an anonymous user shouldent be able to translate content under any normal circumstances.
the only relevant permission i believe is "View published content"

jkthng’s picture

@guy_schneerson Oh. Then perhaps I am wrong. If I don't assign that permission the view doesn't show at all. Did I get my views right?

This is a paste bin of my shopping cart block. http://pastebin.com/a4UPWxXV

OnkelTem’s picture

@das-peter

The patch couldn't be applied on the latest Commerce. The problem comes at the last chunk:

-class CommerceProductEntityController extends DrupalDefaultEntityController {
+class CommerceProductEntityController extends EntityCacheDefaultEntityController {

as CommerceProductEntityController now extends DrupalCommerceEntityController, not DrupalDefaultEntityController.

das-peter’s picture

Status: Needs work » Needs review
FileSize
2.97 KB

Rerolled. As I currently use to unpatched version I didn't test in detail if it's really applicable to change the DrupalCommerceEntityController.
Further Ryans question is still very relevant:

Do we really need to introduce a dependency on EntityCache?

Unfortunately I still don't know if there's a possibility to have something like a soft dependency.

Set status to needs review to see if the tests pass.

OnkelTem’s picture

@das-peter
For me this is a case when until something gets resolved in the Right Way, we can use some temporary solution. Thank you.

The last submitted patch, commerce_product-integrate-entitycache-1157446-17.patch, failed testing.