HI all
This is going to be a long post with a lot of code in it.
I am working on a new module that imports CafePress items into the drupal database where you can access them by normal drupal commands. This will give you a lot more flexibility.
I have created a new entity called cp_products. This is saved in a database called cp_products. I created save_product and load_product and everything else i need to have a working entity. I have filled the database successful with information and i am able to read it back from the database.
And everything works fine until i wanted to show the entity it just like the nodes. I want to be able to access the cp_products by going to the url www.example.com/cafepress/1 ( or any ID number you want I have a serial ID number as primary key in the record.).
I have looked at the example code for entity's and lifted what i needed. Or i think i needed.
From that i have written the following code.
/**
* Implements hook_entity_info().
*/
function cafepress_import_entity_info() {
$return['cp_products'] = array(
'label' => t('Products in the stores'),
'controller class' => 'EntityAPIController',
'base table' => 'cp_products',
'uri callback' => 'cp_products_uri',
'view modes' => array(
'full' => array(
'label' => t('Full'),
'custom settings' => FALSE,
),