Closed (duplicate)
Project:
Commerce Core
Version:
7.x-1.0
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2011 at 00:58 UTC
Updated:
9 Oct 2014 at 15:01 UTC
Jump to comment: Most recent
Comments
Comment #1
giorgoskit would be nice if SKU and status and other hardcoded attributes of product were available on
admin/structure/types/manage/product_display/display and still get the ADD TO CART FORM but they aren't
I am on the same boat as you
Comment #2
mr.moses commentedI am looking for something a little different, but I believe the problem is the same: you can only display one item from the product (title, sku, OR add to cart form).
I would like to display the title (from node or product), followed by the SKU (from the product), then a description (node body), then the add to cart form (from product). But right now it seems you can only display one thing from the product (title, sku, OR add to cart). How do you dislpay more than 1 ?
Comment #3
giorgoskthere is no easy way yet
tap into the
function THEMENAME_preprocess_node(&$vars)and use something like this to get SKU into content and let the CART be displayed using the field formatter settings
Comment #4
MickL commentedI am so sad about this!
I can use
print $titleto show the title of the node. But i can't use something similiar to show the title or the sku of the product :(Comment #5
mr.moses commentedI was able to show the sku by adding this into my node template without using any theme preprocess functions:
I have the 'Add to Cart form' selected as the field formatter for the Product reference field on my node. I think you could also get the title of the commerce product like this:
<?php print $content['product:commerce_price']['#object']->title; ?>Comment #6
rszrama commented@benchi - Don't be sad... get involved. Try out others' solutions and eventually we'll work this into the core code itself. : P
If I'm not mistaken, this may be a duplicate of: #983830: Render title/sku data in the product reference formatter instead of just field data
If that were to be fixed, you should have these variables available in your templates, right? If so, we can leave this open as documentation for the short term, but I'll go ahead and tag that one for the 1.1 release. It's long overdue.
Comment #7
MickL commentedprint sku:
this is what i looked for!! fantastic!
But there is a big problem:
Unlike the price:
print render($content['product:commerce_price']);it does not changes dynamically (ajax) !!! :(Comment #8
rszrama commentedRight, that problem would be solved by the other issue I linked to. I think I will go ahead and mark this one a duplicate.
Comment #9
NaliPL commentedplease look here:
admin/structure/types/manage/{uour-display-name}/display then here you have list of fields probably "Product: SKU" is not set to visible,
othervise you could make an hook_preprocess_node() function
/**
* Implements hook_preprocess_node().
*/
function MODULE_NAME_preprocess_node(&$vars) {
if($vars['type'] == 'your_displan_name_here') {
$vars['content']['product:sku']['#access'] = TRUE;
}
}
Comment #10
jnavane commentedHi NaliPL,
Your suggestion(s) solved my problem. Thanks.