1
Answers
Vote up!
0
Vote down!

Donation Page

I have created a product type donation, and modify it following the line item tutorial so the user can select one value or input his own.

I have 30 nodes of a certain content type.
I wan on each of those nodes a donation button to appear and send to the donation page the title of the node.
That node title needs to be added to the cart.
donation page = a node of content type donation( that node has a product reference of donation)

The issue that i need help with is that i don't know how can i add that title to the cart.
The cart system works now, it adds a Donation of x to the cart but i need the title added also.

Thank You

Asked by: dan florin
on August 27, 2014

1 Answer

Vote up!
0
Vote down!

The cart display is a View, which lets you create relationships to related entities. If the donation product is being referenced on a 1:1 basis with a page, then you could do a reverse relationship from line item -> product -> node that references that product.

If that is too complicated or doesn't work because you use the same donation product multiple times, you can do the following:

1. Add a custom entity reference field on your line item called "Reference Node"

2. Create a rule that fires on "After adding a product to the cart" that saves the referencing node to an entity reference field

* NOTE: This is pretty challenging because IF it exists in the rule, it exists in the line-item's display path value as "node/#" and rules requires a module or two to get that path to turn into an actual number that can be used to set the value of a custom entity reference. Possibly more complicated than the custom Views reverse reference mentioned above.

Josh Miller
Answer by: Josh Miller
Posted: Aug 28, 2014

Comments

Thanks for the reply i have manage to solve it yesterday.
This was the solution:

Made a Product Type : Donation
After that i created Products of : 2 USD, 10 USD etc.
Created a donation page of form : /donation/*
When i reference the donation page from the node page the links looks like this: /donation/%nid
On the donation page i create a custom form and there i modify the submit function.

- dan florin on August 29, 2014