Currently all our entities support being viewed by entity_view(), but most of them do not have a dedicated theme hook and template.

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new2.72 KB

Patch for the product entity. The others need the same sort of treatment.

rei’s picture

where is the view path ? still admin/commerce/products/1 ?
is this patch suppose to be able viewing the product without product reference /product display for single product ?

rszrama’s picture

Category: bug » task
Priority: Normal » Major
Status: Needs review » Needs work

@rei: There actually is no view path for products, but the template would still be usable if a View or some other code wanted to display a rendered product.

I was wondering how people were supposed to use template to theme our entities. I always just assumed it would automagically happen thanks to our Entity API integration. : )

Moving this to "needs work" to capture the rest of 'em.

rszrama’s picture

Component: Product » Developer experience
Issue tags: +low-hanging fruit

Tagging.

Molfar’s picture

Status: Needs work » Active

I use views to render a single commerce product page (not product display page). And I need a custom template fom commrece_product entity commerce_product.tpl.php. The global template entity.tpl.php works fine, but what about more specefic templates like commerce_product--my_product_bundle.tpl.php ?

joshmiller’s picture

Status: Active » Needs work

Off the top of my head we could include templates for the following ... am I missing any?

  • Line Items
  • Orders
  • Payment Methods
joshmiller’s picture

Status: Needs work » Needs review
StatusFileSize
new5.03 KB

Updated patch for product template and added support for line items. I'm afraid this entire concept is slightly above my head ... For example, we don't implement templates for customer profiles, but we have two view modes that work out of the box? I can't even find the functions that output the html for customer profiles.

Anyway, I copied Damien's approach for line items. Unless I can wrap my head around this hook_theme situation, I'm afraid this may be over my head.

joelpittet’s picture

Issue summary: View changes

This looks good, just a couple of things because i've seen a fair share of templates:S

  1. +++ b/modules/line_item/theme/commerce-line-item.tpl.php
    @@ -0,0 +1,48 @@
    +<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
    
    +++ b/modules/product/theme/commerce-product.tpl.php
    @@ -0,0 +1,48 @@
    +<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
    

    Do we need a clearfix? It would be nice to avoid putting those in.

  2. +++ b/modules/line_item/theme/commerce-line-item.tpl.php
    @@ -0,0 +1,48 @@
    +  <div class="content"<?php print $content_attributes; ?>>
    
    +++ b/modules/product/theme/commerce-product.tpl.php
    @@ -0,0 +1,48 @@
    +  <div class="content"<?php print $content_attributes; ?>>
    

    If content_attributes has a class attribute this will double up.

chris matthews’s picture

Priority: Major » Normal
Status: Needs review » Needs work

The 6 year old patch in #7 applied cleanly to the latest commerce 7.x-1.x-dev, but looks like it needs work per the comments in #8.