2

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?

1
  • Welcome to Drupal Answers! Notice you aren't asking any explicit question. Stack Exchange sites don't work well with implicit questions. Also, I want to do this. Any idea is welcome. is usually too broad. – kiamlaluno May 30 '16 at 7:17
1

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).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.