Drupal commerce line items + images - drupal-7

I have a drupal commerce + line items + taxonomies + fancy attributes.
Product:
-sku
-...
-shape (product line item) - taxonomies (text + image)
And taxonomies images doesn’t display at all (text is ok).
When I do it with product variations (shape (product field) - taxonomies (image)) everything is ok, but I need 3 options of variation with many many attributes and it’s not possible to create million of SKU products for the same item.
How I’ll display the taxonomy image from a line item?
(maybe some other solution?)

Related

How to display all data from a paragraph field in views (Drupal 7)

I am currently a caretaker for a Drupal 7 website and I can't figure out how to group paragraph items in views. I have created a content type Products and one of the fields is called product variation which is field type paragraphs. I have created a paragraph bundle for that field.
Then I created a view to show the products on the front page. To display the paragraph fields I created a content relationship. When I open the relationship option and select delta to display one it only shows one and I can't get data from the others. If I select delta to display all it shows like in the image below (Current view displays like). The goal is shown on the same image. Could someone help me solve this:
My setup on the fields I want to display in the view are setup like this
`content-type: Products
product name - field type: Node module element
proudct image - field type: Image
product variation - field type: paragraph
paragraph bundle: product variations
color (Term reference)
view:
Display: product name, product image,product variation
Relationship: Content: product variation (field_product_variation)
Hopefully, someone can help me solve this problem.

How to display results tagged with just one term ID when there are multiple filters

I have a blog in Drupal 7 and used Views to display the fields. I have 2 sets of tags displayed on the sidebar:
1) SHAPES
Triangle
Square
Rectangle
2) COLOR
Red
Blue
Green
I created the 2 groups of tags via Structure > Taxonomy > Vocabulary > Add Term
For the View, I created one View with two exposed filters (similar to what was done in this tutorial)
VIEW:
Path: '/blog/tag'
Filter Criteria:
1) 'Content: Shape (exposed)'
Exposed form in Block: 'Yes'
Filter identifier: 'shape_id'
2) 'Content: Color (exposed)'
Exposed form in Block: 'Yes'
Filter identifier: 'color_id'
Exposed form style: BEF
The exposed filters are set to the appropriate block region in Structure > Blocks.
If I click 'triangle', only blog posts tagged with 'triangle' should be displayed. Then if I click 'red', only posts tagged with 'red' should be displayed.
It looks like the correct blog posts are being displayed when I click on the terms. The URL gets appended with IDs from both vocabularies, but I can't seem to get the right combos to display.
Desired URL when 'triangle' is clicked: '/blog/tag/?shape_id=1&color_id=All'
Desired URL when 'red' is clicked: '/blog/tag/?shape_id=All&color_id=1'
So, essentially the results should display items tagged with just one term ID.
However, how it is currently working is that if I click 'triangle', and then 'red', both 'triangle' and 'red' have the 'selected' class (are both bolded) and the url is: '/blog/tag/?shape_id=1&color_id=1'
The only way I was able to get the desired URLs is if I have the '-Any-' option displayed. However, the use case I have is to NOT have '-Any-' listed in the list of tags.
Is this even possible without '-Any-' listed in the list of terms? I have never used multiple exposed filters before, so any guidance would be great as I've researched this for almost a week now. I read in another post that contextual filters would allow me to create separate path aliases that are clean urls, but I have not been successfully able to do this.
Any help would be greatly appreciated. Thank you for your time.
I tried using the taxonomy term pages approach, but could not figure out how to get the fields displaying properly. The fields displayed were based on the teaser in my Blog content type. And using exposed filter option was not a solution since my use case was to only display results based on one tag. What worked for me:
1) Add new view to existing Blog View
2) FORMAT: 'Unformatted list'
SHOW: 'Fields'
3) FIELDS: [add fields that you need displayed]
4) FILTER CRITERIA: 'Content: Published (Yes)'; 'Content: Type (= Blog)'
5) PATH: '/blog/[YOUR VOCABULARY NAME]/%'
6) CONTEXTUAL FILTERS: 'Content: Has Taxonomy Term ID'
WHEN THE FILTER VALUE IS NOT IN THE URL: 'Display all results for the specified field'
WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED: select 'Override title' and in the input field, enter: '[YOUR VOCABULARY NAME]/%1'
select 'Specify validation criteria'
Validator drop-down, select 'Taxonomy Term'
Vocabularies: select appropriate Vocabulary name
Filter value type drop-down: 'Term name converted to term ID'
select 'Transform dashes in URL to spaces in term name filter values'
Action to take if filter value does not validate: select appropriate one that works for your needs (in my case: 'Display contents of "No Results found"')
If you need to display the term name in the heading on the results page, in the same view > HEADER > Add 'Global: Unfiltered Text' > then in text area, add something like "VIEWING RESULTS FOR [YOUR VOCABULARY NAME] / %1"
Save the View. Since I had multiple filters, I cloned the above view and renamed everything. So, I ended up adding 3 additional views to my existing Blog View.
I had previously set URL aliases for Taxonomy Term Paths, so I removed these
Also, I had to go back to my Taxonomy Terms individually and delete the URL alias that was generated from the pattern
To have the list of tags displaying on the right with the desired URL structure of /blog/[YOUR VOCABULARY NAME]/[YOUR TERM NAME], I created a separate new view:
SHOW: 'Taxonomy Terms' of type '[YOUR VOCABULARY NAME]'
Create a Block
'Unformatted list' of 'Fields'
FIELDS: 'Taxonomy: Term Name' > click this and unselect 'Link this field to its taxonomy term page'. Then expand "Rewrite Results" section and select 'Output this field as a link' > in the Link path: 'blog/[YOUR VOCABULARY NAME]/[name]' (the [name] at the end of the url structure should appear as you see it with the square brackets) > select 'Replace spaces with dashes' > Transform the case to 'lower case' > click Apply
FILTER CRITERIA: 'Taxonomy vocabulary: Machine Name (= [YOUR VOCABULARY NAME])'
Save the View
Then in Structure > Blocks, place the block in the appropriate region
Hope this helps someone!

Drupal 7 - assign several products (items) under each category

In D7, I have created a taxonomy (say categories) and set some terms (say category 1, category 2 etc) within it. I have also created a 'View' based on the 'categories' taxonomy and show the categories (category 1, category 2 etc) within the sidebar (block) of the website. Just let me know how can I assign several products (items) under each category so that site visitors can see the product lists on clicking a category from the sidebar. Basically I want to develop a catalogue based website to show products/items under each category.
Kindly help me in this regard.
Good morning,
If you have not done yet, you have to create a custom content type (Structure > Content Types > Add content type) and add as many fields as you need. When you are done, you have to add an extra field named Category, of type "Taxonomy Term Reference" (or something similar, I don't know exactly). You can configure this field so that you can assign several categories to a single product.
Once your contents are created, if you access the taxonomy term's URL, all contents assigned to that category should be displayed. However, you could also define a custom view that receives the name of the category as a parameter in the URL, and displays all contents in this category in a grid, table, list, ... whatever.
Hope it helps.

Drupal 7-Views Taxonomy Parent Child URL

Facing an issue with getting views to generate a proper URL similar to the way taxonomy allows me to click on a child term with the path: domain/term/artwork/mirrors (path alias is configured)
Vocabulary:
Product sections
- Artwork
-- Hand Painted
-- Mirrors
- Novelty
-- Ceramic Mugs
-- Stickers
-- Books
- Wearables
-- Shirts
-- Shoes
-- Personalized Shoes
I currently have a taxonomy view with 2 contextual filters: Content: Has taxonomy term ID (with depth) AND Content: Has taxonomy term ID depth modifier
Content: Has taxonomy term ID (with depth) is configured with...
• Depth: 1
• Set the breadcrumb for the term parents
• Display contents of "No results found"
• Specify validation criteria - Taxonomy Term from 'Product Category' vocabulary.
• Filter Value Type: Term name converte to Term ID
• Check Transform dashes in URL to spaces in term name filter values
Page Path: /category/%
With my current setup, I can go to: domain/category/artwork and this displays all content which is categorized under artwork (hand painted and mirrors)
What i need is domain/category/artwork/hand-painted but it displays all artwork regardless if its hand painted or mirrors.
BUT this path, domain/category/hand-painted works correctly. How do i make the url respect the parent term. It seems like views cant interpret a parent - child relationship.
I plan on creating parent term pages outside of this view so the parent term path /category/artwork won't be handled here.
Last thing to note is the node path pattern:
category/[node:field-category:parents:join:/]/[node:field-category:name]/[node:title]
• domain/category/artwork/hand-painted/fancy-painting
I solved my problem by adding the Taxonomy Views Integration module and specifying my existing view page.
-https://www.drupal.org/project/tvi
Next I had to modify the contextual filter to only have 'Basic Validation' and also remove "%" from the page view path.
Now the URL's are exactly what core taxonomy builds but it outputs the view i created
Hope this helps someone else! :-)

Database schema to store configurable sections of a web page

It is not a normal CMS feature where I want to store whole page content in one column in the database.
My ASP.NET MVC project requirement is that users selects a web page template to create a web page.
Template should then be loaded with its relevant sections e.g. Title, Headline, Latest News section having a heading and Text lines, Other Links section containing Links e.g. About Us, Images section containing images, caption etc.
Template has already filled in the sample data into all sections.
All the Page sections and sections' content are configurable. e.g. User choose to add News section. A form will appear having three fields. Title, Text1, Text2 and a button e.g. Add more text. User can then select to add more text or edit text1, text2.
Web Page's main struture is that:
User creates a web page. This page has sections. Sections have links, headline, text, images, video, buttons etc. All sections and their content are configurable.
I am wondering how can this kind of data/configuration be stored in the database. e.g. sql server.
Anyone can please help?
It sounds like a page associated with a template and has a set of named 'sections'
template:
- tid (pk)
- template (blob)
page:
- pid (pk)
- tid (fk to template.tid)
- url (string)
section: (pk=pid + name)
- pid (fk to page.pid)
- name (string)
- content (blob)

Resources