CVS edit link for david.mann

Dear Drupal community,

We need CVS access to commit our "easyrec for ubercart" plugin.

http://easyrec.org/easyrec-6.x-dev.rar
http://easyrec.org/easyrec-7.x-dev.rar

===================================================================================================

Drupal:
Describe what modules, themes, or translations you want to maintain and why.
Please provide as much information as possible along with appropriate links, if available.

Answer:

This plugin will integrate basic easyrec®(http://easyrec.org/) functions to an ubercart shop.

easyrec® for ubercart connects an ubercart shop to an instance of the open source recommender system easyrec.
The access to easyrec® is provided by the easyrec Javascript
API(http://sourceforge.net/apps/mediawiki/easyrec/index.php?title=JavaScript...).
This Plugin sends view and buy actions to the easyrec® server the shop owner chooses and provides many blocks to display
the recommendations based on user actions.

Available Blocks:
* easyrec: other users also bought
* easyrec: other users also viewed
* easyrec: recommendations for user
* easyrec: most bought items
* easyrec: most viewed items

The Blocks are fully styleable using the plugin administration interface. The Plugin also comes with 3 standard
display styles:
* list
* picture list
* carousel

To use the "easyrec for ubercart" plugin a shop owner needs access to an easyrec server. It's possible to register
a free easyrec account at http://easyrec.org/ if the owner cannot host his/her own. After creating an account on the
easyrec server and a 'tenant' account for the specific shop, the shop owner just copies the tenant id and apiKey
into the easyrec administration interface to enable recommendations for the ubercart shop.

===================================================================================================

Drupal:
If your contributions implement existing functionality explain why you want to duplicate it,
or why you cannot extend any of the existing projects.

Answer:

There are serval recommendation modules:

http://drupal.org/project/recommender Recommender API - provides several core algorithms
http://drupal.org/project/uc_rec Ubercart Products Recommender - uses the Recommender API to display recommendations

our plugin provides javascript REST calls to our server which calculates recommendations and sends them back to the webpage.
Its just a basic connector module like the google analytics module which can also recive data. All calculations for similarity
are calculated at our servers. You also need no Java on your server.

The Recommender API calculates recommendation rules when the cron job is called. Since our system cannot
be merged with this approach we had to create a new plugin using our basic javascript API
(http://sourceforge.net/apps/mediawiki/easyrec/index.php?title=JavaScript...)

Comments

david.mann’s picture

Component: Miscellaneous » miscellaneous
StatusFileSize
new5.8 KB
new9.23 KB
david.mann’s picture

Status: Postponed (maintainer needs more info) » Needs review
tr’s picture

Status: Needs review » Needs work

ZIP files in #1 are corrupt - can't review.

Ivo.Radulovski’s picture

just downloaded and installed it....works fine for now - waiting for first real results now.

tr’s picture

@segments: You downloaded it from where? The .rar files referenced in the OP? A hex dump of the .zip files attached to #1 shows they aren't zip files at all ...

Bottom line, a proposed project needs to be posted here in the forum, not as a link to some other site.

david.mann’s picture

ups i just renamed the rar files to zip files .... I will re-upload them, sorry

david.mann’s picture

StatusFileSize
new6.28 KB
new9.79 KB

@ segments

to get a "otherUserAlsoViewed" Recommendation you must view at least 2 items with 2 different users.

just checked our database ... looks like you didn't viewed anything yet ...

to test all recommendations set up a test shop with 2 users:

look at three products with both of them
buy three products with the two users

now you have to wait until our easyrec.org server starts his cron job to calculate the recommendations. (2:00AM GMT +01)

if you downloaded easy rec from source-forge you could to to the admin interface and click compute rules.

Ivo.Radulovski’s picture

Status: Needs review » Needs work

@TR I had them from here...but probably I was able to open them because I use winrar.

Ivo.Radulovski’s picture

Status: Needs work » Needs review

@david.mann Thx for the support.

david.mann’s picture

Status: Needs work » Needs review
StatusFileSize
new6.33 KB
new9.78 KB

just checked our system and found a bug in the sendActions part .. your product is in

/en/drupal-day-21012011
but our module only sends
drupal-day-21012011

i uploaded the new version of the module ... by the way: you will need a third item to get recommendations.

@segments
we have problems with your Cyrillic texts too ... we are working on it .. must be somthing with our mysql setup .. you know which char set is the best for supporting Cyrillic characters ?

tr’s picture

Status: Needs review » Needs work

You need to run the Coder module to bring your code up to Drupal coding standards: http://drupal.org/coding-standards

The parameters "configure" and "files[]" aren't valid in a Drupal 6.x .info file.

david.mann’s picture

StatusFileSize
new9.82 KB

just finished the drupal 6 module! it told me everything is okay now ...
http://imm.io/3G5R

i will do the drupal 7 module at Monday

david.mann’s picture

Status: Needs work » Needs review
david.mann’s picture

StatusFileSize
new6.36 KB

i just finished the drupal 7 module ...

now the Coder module didn't found anything in both modules!

arianek’s picture

Status: Needs review » Postponed

Hi. Please read all the following and the links provided as this is very important information about your CVS Application:

Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:
Migrating from CVS Applications to (Git) Full Project Applications

  • The status of this application will be put to "postponed" and by following the instructions in the above link, you will be able to reopen it.
  • Or if your application has been "needs work" for more than 5 weeks, your application will be marked as "closed (won't fix)". You can still reopen it, by reading the instructions above.
david.mann’s picture

Project: Drupal.org CVS applications » Drupal.org security advisory coverage applications

Hi!
Great move, switching to git!
here's the sandbox project: http://drupal.org/sandbox/david.mann/1079756

best,
David

david.mann’s picture

Status: Postponed » Needs review
tr’s picture

Status: Needs review » Needs work

Your project structure is a little messed up.

You have three branches: master, 6.x-dev, and 7.x-dev.

First, your development branches should be named 6.x-1.x and 7.x-1.x, that way drupal.org can automatically create development snapshots for your project. Second, if you're not going to use master (and most people don't), you should not have anything in master except for perhaps a README.txt explaining that you have to checkout one of the named topic branches to get the code. Deleting master is not an option because by default git clone will check out the master branch. When following the clone instructions at the top of your sandbox page, for example, it gets master by default, which doesn't contain anything meaningful.

Second, your folders look like this:

easyrec_for_ubercart/            <-- Why is everything in this directory?
  easyrec_for_ubercart.info      <-- What is this?
  easyrec/                       <-- Why isn't this the top-level directory?
    easyrec.admin.inc
    easyrec.info
    easyrec.install
    easyrec.js
    easyrec.module

I see you're missing a project README.txt in the easyrec/ directory. Also, you still really need to read all of http://drupal.org/coding-standards and try to make your code comply with that as much as possible. You still have a ways to go ... In particular, your indents are wrong and inconsistent (sometimes you use 4, sometimes you use 2, sometimes you mix 4 and 3 and 2...) You also have a lot of trailing spaces and lines with nothing but spaces on them, all throughout all of your code. They should be removed. It's hard to read and evaluate your code when it looks like this.

You have dynamically-named variables that need to be removed in hook_uninstall().

david.mann’s picture

Status: Needs work » Needs review

Hello,

thanks for your detailed feedback!

This time i used IntelliJ code format and the coder module didn't found anything (at the first time i did everything by hand via the windows editor). I had few problems with the GIT branches but i fixed them now and the folder structure now looks like you suggested it.

best,
David

david.mann’s picture

here are some screen-shots of the module...

Ivo.Radulovski’s picture

Component: miscellaneous » new project application

I think David got the idea about how Drupal modules are handled and this project has made a good progress so it can go into production as a Drupal module. :)

david.mann’s picture

great! how i can convert my sandbox to a real project ?

tim.plunkett’s picture

Title: david.mann [davidmann] » easyrec for Ubercart

updating title

berdir’s picture

Status: Needs review » Needs work

Some feedback. I only reviewed the 7.x-1.x version, some things also apply to 6.x-1.x, others don't.


files[] = easyrec.module
files[] = easyrec.admin.inc
files[] = easyrec.install

version = 7.x-1.0

- Only add files to files[] when they contain classes (for example test or views integration classes).
- Do not add a version, that will automatically be added when a release is created by the packaging script


/**
 * Implementation of hook_requirements().
 */
function easyrec_requirements($phase) {

The coding standard for Drupal 7 suggests the shorter "Implements hook_something()." now. Also, other hook implementations in the .install file are missing the docblock completely. Please add a similar docblock to all hook implementations


function easyrec_permission() {
    return array(
        'administer  easyrec' => array(
            'title' => t('Administer easyrec'),
            'description' => t('Perform maintenance tasks for easyrec.'),
        ),
    );
}

There are two spaces in the permission name. But there aren't when you use that permission for example in hook_menu().

    $items['admin/config/system/easyrec'] = array(

The system category isn't really the correct place for this. I would suggest Web Services (services). D7 only.

        if (arg(0) == 'node' && is_numeric(arg(1))) {
            $node = node_load(arg(1));

- I suggest you use "if ($node = menu_get_object())" instead of this.

/**
 * Implements hook_block_info().
 */
function easyrec_block_info() {
    $blocks['otherUsersAlsoViewed']['info'] = t('easyrec: other users also viewed');
    $blocks['otherUsersAlsoBought']['info'] = t('easyrec: other users also bought');
    $blocks['recommendationsForUser']['info'] = t('easyrec: recommendations for user');

    $blocks['mostViewedItems']['info'] = t('easyrec: most viewed items');
    $blocks['mostBoughtItems']['info'] = t('easyrec: most bought items');

    return $blocks;
}

I think you should at least set the cache property too, see http://api.drupal.org/api/drupal/modules--block--block.api.php/function/.... It defaults to cache per role which is probably not what you want.

            '#size' => 45,
            '#maxlength' => 45,
            '#description' => 'An parameter to determine the number of results returned.',
        );

The description isn't translated here. Same for all other block configure form elements I think, maybe others too. Make sure all text strings can be translated.

            if ($node->type == 'product' || $delta == "recommendationsForUser") {

I think there is a uc_is_prodct() function or something like that. AFAIK, you can have many product node types, not just a single one.

- From what I see, the admin settings allow to configure the javascript used, which obviously means that one should be very careful with giving that permission away. In D7, you can set 'restrict access' in hook_permission to true, which will display a warning to users. See http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...

berdir’s picture

One more.


function easyrec_admin_settings_form_validate($form, &$form_state) {
    // Trim some text values.
    $form_state['values']['easyrec_tenantId'] = trim($form_state['values']['easyrec_tenantId']);
    $form_state['values']['easyrec_apiKey'] = trim($form_state['values']['easyrec_apiKey']);
    $form_state['values']['easyrec_url'] = trim($form_state['values']['easyrec_url']);
    $form_state['values']['easyrec_drawDrupalCustom'] = trim($form_state['values']['easyrec_drawDrupalCustom']);

}

You should use form_set_value() instead of directly overwriting form_state['values']-

david.mann’s picture

Status: Needs work » Needs review

okay i changed everything like you told me ... thx for all the tips!

berdir’s picture

http://api.ubercart.org/api/function/uc_product_is_product/2

This is the function I mean for checking the node type.

+    $blocks['otherUsersAlsoViewed'] = array('info' => t('easyrec: other users also viewed'),
+                                            'cache' => DRUPAL_NO_CACHE);

Should look more like this:

$blocks['otherUsersAlsoViewed'] = array(
  'info' => t('easyrec: other users also viewed'),
  'cache' => DRUPAL_NO_CACHE,
);
         if (arg(0) == 'node' && is_numeric(arg(1))) {
-            $node = node_load(arg(1));
+            $node = menu_get_object();

Not what I meant :)

You just need:

if ($node = menu_get_object()) {

That's the same as your code. There is also a similar one in hook_page_alter().

- * @return
- *   String containing a Drawback alias
+ * @return  String containing a Drawback alias

The old code was actually correct here, it should be on a new line, intended with two spaces and ending with a .

+/**
+ * This function returns a Javascript string which sends a buy action to
+ * the easyrec server.
+ * @param  $order  the order object to get the product information
+ * @return string  the easyrec javascript
+ */

Same here, should be like this:

/**
 * This function returns a Javascript string which sends a buy action to
 * the easyrec server.
 * @param $order
 *   The order object to get the product information.
 * @return
 *   The easyrec javascript.
 */
berdir’s picture

Status: Needs review » Needs work
david.mann’s picture

Status: Needs work » Needs review

okay i hope everything is okay now :)

i had some troubles with the git ... but it seems that everything is committed correctly.

berdir’s picture

Ok, the code looks good to me now (note that I only reviewed the D7 part, but I saw that 6.x has been updated too where appropriate and they shouldn't be too different). So from a technical point, this is RTBC I think.

However, I haven't used or even installed the module, so it would be great if someone could do that and try it out. If everything works as it should, this can be marked as RTBC. It might be rather hard to properly test this module because I assume that you need a real site with data, so that easyrec can do it's job.

However, a quick check to verify that it can be installed and configured properly should be enough I guess.

david.mann’s picture

Okay here is a "Quick guide" to test the module:

Install Drupal
Install Ubercart
Install easyrec for ubercart

create an account at http://easyrec.org/
sign in and create a tenant
copy the api key & tenantid to the easyrec config.

create 4 products
place all easyrec blocks
view each product with 3 different user to generate VIEW actions ...

wait for the cron ( i think 2:00am ) or write it here and i will start the cron manually .

check if the blocks display recommendations.

catch’s picture

Status: Needs review » Reviewed & tested by the community

I don't think it should be a requirement of these applications that the project be actually installed and tested by a human - if the code passes visual code review, then the maintainer ought to be able to make it work. Manual testing is just extra work for a process that is a huge bottleneck.

So I'm just going to mark this RTBC.

rfay’s picture

Status: Reviewed & tested by the community » Fixed

OK, Git vetted user role granted.

Thanks for your present and future contributions and for your patience during this process!

Please review others' applications so we can get this queue down.

Status: Fixed » Closed (fixed)

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