0

How can I pass a node's nid variable to Ubercart so that when the user pays for publishing his node, the nid shows in the cart?

I tried to add a field to the Ubercart Order fields, with widget node reference which is passed by the URL. When my user clicks on "Pay for node" link, it sends him to the Ubercart "node" product page "pay?23" 23 being the node they are paying for. When the user presses Add to Cart, I cannot see this value 23 in any of the user's order or checkout details. How can I get this value attached to the order?

I've googled for a while now and cannot find anything about this for D7. Any help will be much appreciated!

2
  1. If you are using Cart Links (/admin/help/uc_cart_links), you could pass a value for a text-field type of attribute on your product.

  2. You'd have to add an attribute to the product node, and hide it via css or form_alter method on the product view page so that they couldn't overwrite it or delete it.

  3. When they add attribute to the cart with the cart link, you can feed in the value with the url parameter like ( /cart/add/e-p23_q5_aThisNiceEscapedString. ).

  4. Note that you can't just pass an integer to it, or Cart Links will think you are passing the AID (attribute ID)

  • thanks Justin, but I don't see a stable D7 release only D6... – longboardnode Jun 13 '13 at 17:52
  • 1
    for Cart Links? They are part of the UberCart Project and needs to be enabled as a submodule I believe? – Justin C. Miller Jun 13 '13 at 21:47
  • Ok, I see it now! Thanks I'm going to try it out now. – longboardnode Jun 14 '13 at 3:54
  • Perfect, worked like a charm. At first, I thought I had to just add the attribute to the content type, but I then had to add the attribute from the content type to the product itself, and then it worked. I also used the [Field Extra Widgets] (drupal.org/project/field_extrawidgets) module to make it read-only. You pretty much said it in your answer's Point #2, but I thought I'd expand on it a bit in case someone else runs into this. – longboardnode Jun 14 '13 at 19:01
  • cool! glad you got it running! – Justin C. Miller Jul 9 '13 at 15:38
0

I guess you may populate your own custom order field [ admin/store/settings/orders/fields ] from URL.

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.