3 replies [Last post]
Paul D'Ambra's picture
Offline
Joined: 05/21/2012
Juice: 23
Was this information Helpful?

I have a site where the products in the cart are related to webform submissions. I want to be able to display a link under each item so that customer with multiple products can see which product relates to which submsision.

I tried using

<?php
function my_module_product_description($product) {
// if (isset($product->data['sid']) &&
   // isset($product->data['nid'])) {
   
$element = array();
   
$element['submission_url'] = array(
     
'#markup' => l("view your entry",'node/'.$product->data['nid'].'/submission/'.$product->data['sid'])
    );
    return
$element;
 
//}
}
?>

but I don't see any output so I guess I'm misunderstanding something...

Any help appreciated!

DanZ's picture
Offline
Joined: 08/07/2011
Juice: 1738
Re: Adding a link underneath items in the cart

Display functionality is generally added through theming.

Where exactly do you want this link to show up?

Paul D&#039;Ambra's picture
Offline
Joined: 05/21/2012
Juice: 23
Hi dan, If you look here for

Hi dan,

If you look here for context http://imgur.com/c9tjMAX the basket in question contains four entries.

I can let people delete them because I can just show a warning that the associated webform submission will be deleted too.

You can't edit the basket here because that wouldn't edit your webform submissions so I'd like to have a link to the webforms submission listed alongside the attributes. If they go back to the submission and edit it then the price and required cart items are recalculated and updated accordingly.

The data attribute of the items has the nid and sid of the submission so making the link is trivial but I can't figure out how to write _product_description (which may well be barking up the wrong tree Smiling)

Paul D&#039;Ambra's picture
Offline
Joined: 05/21/2012
Juice: 23
Re: Adding a link underneath items in the cart

If you look here http://www.ubercart.org/docs/api/hook_cart_display

_product_description looks to be the way to get the data I want in...