Discussions

Creating DC View with prices and pictures

Hi!

Im still trying to make it work - simple view with product's
1. thumbnails as a links to node, which display product
2. prices
3. title as a links to node, which display product
4. taxonomy term as a links to all products of that category

What i have made so far:
Node-base view with
1. thumbnails attached to nodes, which display each product.
3. titles coming from nodes, which display each product.
4. node taxonomy term

But where and how i should get prices?? If even price field should be dublicated and on a Node-level, why i need whole product-entity with all it's fields i can't use then?
Maybe i can make some kind of relation in my view with product-entity and get some fields (price) from there?

http://saleaway.ru/

Posted: Mar 1, 2011

Comments

thepauly on March 1, 2011

I created this:

http://www.demo.stanleygeorge.com.au/shop/categoryone

by cloning the taxonomy_term "page" view, changing the style to grid, adding a filter for node type = product display, then reordering this view to the top.

I think this view is displaying whatever you have set in /admin/structure/types/manage/product_display/display/teaser

Hope this helps...

bradhawkins on March 3, 2011

I think I'm having the same problem.

In my case, I'd like to use views (and Panels) to completely replace the default product display. Ultimately I want to have a grid of specifications and other elements that are too complicated to achieve simply via the default product display and CSS.

Here's what I've done thus far:

1. created a "node" type view
2. linked that view (via arguments) to the node being viewed
3. placed that view in a panel that replaces the default node display

Everything works, except that I don't have access (in views) to the Price and/or other "fields" created at the product level.

However, when I create a "commerce line item" type of view I do have access to those fields. Is there anyway to have the same access when using a "node" type view?

If not, is there a way to have a "commerce line item" type of view linked (presumably via arguments) to the node being viewed? I can't seem to make that work either.

bradhawkins on March 5, 2011

Thanks Ryan, that does the trick, but now I've got just one small problem...

When I (as the user) choose my product specification (like small, medium, large) from the dropdown list, the price, sku, and other details (in my custom view) do not update accordingly. The same details in the original node display do update, but in my custom "View" section they do not.

Is this a problem inherent in Views, or have I done something wrong?

I'll attach a screen grab of my views settings, maybe that will shed some light on it.

Thanks again!

sonar_un on March 11, 2011

I was working with this same issue. It turns out you need to reference the "Fields: field_product - product_id", not the delta.

When I added the relationship, I had 3 choices with the same name

"Fields: Referenced product
Appears in: product_display, node (product_display)"

I had to pick and chose until I found the proper one. When I referenced the product_id instead of the -delta, everything worked like a charm!

I hope this helps!

bradhawkins on March 14, 2011

Interesting, I gave it a try but for some reason I still can't make it work on my end. If you don't mind, can I ask a few questions about your setup?

-Do you have any arguments turned on?
-How are you integrating the view (via panels, blocks, other)?
-Is there an AJAX setting or something like that, that I might be missing?

Thanks for the help!

sonar_un on March 14, 2011

- No, I don't have any arguments
- I am integrating the view with a page view
- There isn't an AJAX setting that needs to be set, AJAX is only used to dynamically resort a view once it is in a page, so it doesn't have to be set in order to see a preview.

Are you getting any error messages? Can you send another screenshot after your changes?

bradhawkins on March 14, 2011

I tried turning off my arguments (I was using Product ID) and that resulted in the view displaying all my products and their variants (everything in the store, albeit the store is only 3 products right now).

I also tried setting up a page view like you're using, but that didn't solve it either. I was previously using panels, but neither seems to be the problem or solution.

Attached is a screengrab of my current view configuration, and a text file of the export - maybe you can spot any errors I might have.

Let me know if any other information might be helpful, I'd be glad to give more details on the store, but don't want to bog down the thread unnecessarily.

sonar_un on March 14, 2011

I think I finally understand what you are trying to do, but I am not sure if I can help further as I haven't delved into that functionality too much.

But it looks to me like you want the view to update the product information from the drop-down from your custom view, same as if you were viewing the node display.

I think the only way would be to create a separate field altogether that would help you to filter out the variants. Then expose that field filter to help narrow down the product to the proper one. Though I think all of that would be futile and there must be a better way to do it.

I am sorry, I wish I could help further. I will keep an eye on this thread though as it would be very interesting to see how this could be accomplished.

bradhawkins on March 14, 2011

You're exactly right, I can get it to display the product information, but it doesn't update upon selecting an alternate drop-down item.

That custom filter idea could work, I might look into that if no other (simpler/cleaner) solution presents itself.

Thanks for the help anyway, at least I know I'm not crazy and that the drop-down menu update/refresh is not working for others as well.

latulipeblanche on May 12, 2011

I'm looking to do the same thing. To replace the dropDown-menu by thumbs, representing the colors of the products, working like the dropDown-menu..

What I did so far. I created a product-display for e.i. T-shirts (Red and Orange).

I DownLoaded Commerce Cart Option (http://drupal.org/sandbox/ryan.armstrong/1146154) to replace the dropdown-menu by "radio-buttons"

Next I put an image, representing the color to replace the radio-button. But this is done fixed.

<?php
function commerce_cart_options_form_alter(&$form, &$form_state, $form_id) {
if (strpos($form_id, 'commerce_cart_add_to_cart_form_') === 0) {
$form['submit']['#value'] = t('Add to Cart');
$form['product_id']['#type'] = 'radios';
$form['product_id']['#options'][5] = '<img src="/path/to/image/product_images/colors/tshirt-red.jpg" />';
$form['product_id']['#options'][6] = '<img src="/path/to/image/product_images/colors/tshirt-orange.jpg" />';
}
}

What I need to finish the whole thing is to know how to get the links to be dynamicaly instead of fixed, relative to the url. The url to the product-display looks like this : ~/content/tshirt .

So, if someone can tell me (the Commerce community) how to make these links-to-the-thumbs dynamically, please help.

By using the product-display (and I used Commerce-Kickstart) everything CrazyDiamond is looking for works well.