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

syndicateStorm’s picture

Did you ever make any progress on this?

ebeyrent’s picture

This was a long time ago, and I honestly can't remember what I ended up doing...

syndicateStorm’s picture

Should 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.

socialnicheguru’s picture

Wouldn't it be easier to enable views integration and just setup some default views?

ebeyrent’s picture

I'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!

syndicateStorm’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
3dloco’s picture

Title: Seller Reports in Blocks » Seller Reports in Blocks - Views Integration
Issue tags: +blocks, +views, +integration

+1

syndicateStorm’s picture

Status: Active » Fixed

Fixed in dev. It will show up in the next beta after I've done some more testing. Cheers.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Tafa’s picture

so, 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

Tafa’s picture

Okay, 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

// $Id$
/**
* @file
* UCmarketplace reports
*/

/*******************************************************************************
* Hook Functions (Drupal)
******************************************************************************/

/**
* Display help and module information
* @param path which path of the site we're displaying help
* @param arg array that holds the current path as would be returned from arg() function
* @return help text for the path
*/

function UCmarketplace_reports_help($path, $arg) {
    //$output = '<p>'.  t("UCmarketplace reports is a module that moves ubercart marketplace reports in blocks so it can be used elsewhere than in the original module place");
    //    The line above outputs in ALL admin/module pages
    switch ($path) {
        case "admin/help/UCmarketplace reports":
        $output = '<p>'.  t("UCmarketplace reports is a simple module to test functions and pages in Drupal") .'</p>';
            break;
    }
    return $output;
} // function UCmarketplace_reports_help



function UCmarketplace_reports_quicktabs_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;
  }
}
Tafa’s picture

okay, 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

Tafa’s picture

Okay, 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

Tafa’s picture

Status: Closed (fixed) » Active

I thought I should re-open this issue as I am not sure whether the dev version includes a block section.

Tafa’s picture

Good 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

Tafa’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -blocks, -views, -integration

Automatically closed -- issue fixed for 2 weeks with no activity.