I like the reports that uc_marketplace has to offer, but I'd like to put together a custom landing page for sellers with these reports displayed as blocks. Setting up the blocks is easy enough by calling the functions that produce the reports as block content:
function mymodule_block($op='list', $delta=0, $edit=array()) {
global $user;
$blocks = array();
switch($op) {
case 'list':
$blocks[]['info'] = t('Seller Sales Summary');
$blocks[]['info'] = t('Seller Products List');
return $blocks;
case 'view':
switch($delta) {
case 0:
$block = array(
'subject' => t(''),
'content' => mp_reports_summary($user->uid)
);
break;
case 1:
$block = array(
'subject' => t(''),
'content' => mp_products_selling($user->uid)
);
break;
}
return $block;
}
}
However, these functions are writing breadcrumbs that point to the user account page.
Any way to override the breadcrumbs?
Comments
Comment #1
syndicateStorm commentedDid you ever make any progress on this?
Comment #2
ebeyrent commentedThis was a long time ago, and I honestly can't remember what I ended up doing...
Comment #3
syndicateStorm commentedShould we pursue this or close it out? I'm open to either but am trying to clean things up for the 6.x production release and beyond.
Comment #4
socialnicheguru commentedWouldn't it be easier to enable views integration and just setup some default views?
Comment #5
ebeyrent commentedI'd like to see these functions simply output their reports and nothing else. The menu callback should set the breadcrumbs and get the reports. That way, these report functions become more portable.
Thanks for all your work on this module!
Comment #6
syndicateStorm commentedComment #7
3dloco commented+1
Comment #8
syndicateStorm commentedFixed in dev. It will show up in the next beta after I've done some more testing. Cheers.
Comment #10
Tafa commentedso, is this issue fixed. I just downloaded the dev version and I did not see the blocks nor the views. Perhaps I am not doing something correctly. Please let me know.
Thanks
T
Comment #11
Tafa commentedOkay, I created a custom module with the following in the .module file. However, I cannot see the blocks in my blocks section. Can anyone help me with me please?
Thanks
T
Comment #12
Tafa commentedokay, the module was incomplete and adding a hook block to the mp_reports.module file proved to be cumbersome for me. Can anoyone tell me if they've managed to turn these reports in blocks in another way than through going under the hood?
Thanks
T
Comment #13
Tafa commentedOkay, I re-created another custom module but no luck. I called two functions from mp_reports module and all I get in my blocks are the term "array" and the number "1" in the second block. Module file is included below for reference
<?php
// $Id$
/**
* @file
* TODO: Enter file description here.
*/
/**
* Implementation of hook_block().
*/
function ubercart_marketplace_report_blocks_block($op='list', $delta=0, $edit=array()) {
global $user;
$blocks = array();
switch($op) {
case 'list':
$blocks[]['info'] = t('Seller Sales Summary');
$blocks[]['info'] = t('Seller Products List');
return $blocks;
case 'view':
switch($delta) {
case 0:
$block = array(
'subject' => t('Seller sales summary'),
'content' => mp_reports_can_view_reports($seller)
);
break;
case 1:
$block = array(
'subject' => t('Seller Products list'),
'content' => mp_reports_get_sales($uid, $time, $period = 'day')
);
break;
}
return $block;
}
}
I would love some help or advice on this as I am not familiar with module creation and so on despite my efforts spent perusing the literature on d.o
Thanks
T
Comment #14
Tafa commentedI thought I should re-open this issue as I am not sure whether the dev version includes a block section.
Comment #15
Tafa commentedGood news, I managed to crack it. If I get it all done, I'll post a zip file with the module I created for it.
T
Comment #16
Tafa commented