I have a view that lists all my products, I want to display the word "Added" below every product that has already been added to the shopping cart.
How can I accomplish this?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have a view that lists all my products, I want to display the word "Added" below every product that has already been added to the shopping cart.
How can I accomplish this?
Sorry for the late answer, I meant to answer this, but for some reason got lost and today this Q just randomly popped into my mind.
If you think creatively, you can accomplish this using CSS like this:
1) Create an attachment clone of your cart, by clicking the +Add button and selecting attachment. Remove all fields and add a unique field to it, such as SKU. (Make sure you use For: this attachment override, so you don't affect your actual cart view).
2) Rewrite your SKU field to be like this
<style>
.[field_sku]:before { content: "Added"; position: absolute; }
</style>
3) In in the header section of your products view, add the attachment clone of your cart.
4) In your Products view, wrap each product inside a div class that has the SKU#
<div class="[field_sku]">...</div>
You could try doing the re-writes through the Views UI, else you can use a template file (hopefully you know how to use template files in Views).