4 replies [Last post]
elgreco's picture
Offline
Joined: 10/04/2009
Juice: 10
Was this information Helpful?

I have a shop selling e-books. I need to give the book authors the ability to login to the drupal and see the sales of their books, but only their books

is it possible to do it or i shoud write new code for that functionality?

thanks

Axel_Pressbutton's picture
Offline
Joined: 11/30/2008
Juice: 123
You could possibly do this with a view

Hi elgreco,

I've not done it myself but you could probably do this by creating a View as long as you are using the uc_views module.

Someone who is more familiar with this uc_views can probably say for sure but I think you'd need to use something like Order product: order_count (check to see if the 'The number of orderlines with the product' includes multiples of the same product per order as I'm not sure).

You'd probably also need to use the User: Uid Argument and then pull this into the main page of the users profile (probably not an ideal place I guess, but it gives an idea). You can use something like;

<?php
if (function_exists('views_get_view')) {
 
$view = views_get_view('YOUR_VIEW_NAME');
  print
"<div class=\"YOUR-VIEW-NAME\">";
  print
$view->execute_display('default', array($account->uid));
  print
"</div>";
}
?>

This will only show for the user when they are logged in. This is probably not even an accepted way to do this :S

Failing that...the Affiliate module lists sales so you could possibly have a rummage through the code there to see how it was done.

'Hopefully' this is of some help and if I'm way off mark then maybe someone will correct it.

Cayenne's picture
Offline
Joined: 01/01/2009
Juice: 533
Re: enable users to see sales

marketplace will do that. If you fix the little bug (see the issues on Drupal.org), it will work.

elgreco's picture
Offline
Joined: 10/04/2009
Juice: 10
Re: Re: enable users to see sales

Great i will check it out and comment it

elgreco's picture
Offline
Joined: 10/04/2009
Juice: 10
Re: Re: Re: enable users to see sales

the markerplace did the trick! thanks for your help