Hi,
this module looks fantastic and I would like to install it on the new ecommerce website I prepare.
It could be really great if this module become compatible with another ecommerce system which looks very good : Ubercart
thanks
zmove
Hi,
this module looks fantastic and I would like to install it on the new ecommerce website I prepare.
It could be really great if this module become compatible with another ecommerce system which looks very good : Ubercart
thanks
zmove
Comments
Comment #1
jredding commentedChanging category to Feature Request. Maybe someone will come along and build userpoints_ubercart.
Comment #2
bmagistro commentedI have started on this it can be tracked here
http://www.ubercart.org/forum/development/896/userpoints_module
so far it just adds points when someone makes a purchase. i would like some feed back on what else it should offer...
Comment #3
vm commentedmaybe a purchase points ?
or a method to use points as a coupon ?
Comment #4
bmagistro commentedI am thinking of the coupon one where once you reach a certain amount of points you get a certain coupon code but i am not sure how i would go about this.
Comment #5
bmagistro commentedi have a working points module, please see the ubercart site for the current list of features, todos and wishlist. I am not releasing it yet as alpha because there is still a couple things I want to do...
Comment #6
bmagistro commenteddone, it should be tested a little more before being included..
http://www.ubercart.org/forum/development/896/userpoints_module
Comment #7
jredding commentedI took at a look at the code (just a visual review) and I noticed inconsistencies in the use of some of the userpoints API calls.
Specifically
userpoints_get_current_points($uid = $curUserId, $tid = NULL);
is called in uc_points_payment.inc
This is a 3.x API call incompatible with 2.x
and
userpoints_userpointsapi('points',$points, $uid, 'uc_earn','Ubercart Transaction ID ' . $txnid)
is called in userpoints_ubercart.module.
This is a 2.x API call incompatible with 3.x
Which version are you coding for? I'd suggest coding for version 3.x even though its currently in BETA as it will be stabilizing soon.
Comment #8
bmagistro commentedI am currently using version 3, I was basing my api calls off of other userpoints modules, that can be fixed quickly. Is there an updated api listing somewhere?
unrelated I also noticed some of the totaling for the logs shows as 0 and not what it should be.
Comment #9
jredding commentedThe calls shouldn't have even worked if you're using version 3. The new API requires an array to function correctly.
It should also be noted that the contrib modules for version 2.x are NOT compatible with version 3.x. They have all been upgraded to use the new API however. Please review the README.txt file included with the module on how to use the new API.
In short though the new API takes an array
so
$params = array(
'points' => 5,
'event' => 'purchase',
'uid' => $user->uid,
);
userpoints_userpointsapi($params);
However event is most likely going to change to 'operation' fairly shortly. Check the feature requests for a discussion on this.
Thanks for cranking out this module. its much appreciated by several people!
Comment #10
bmagistro commentedi think its all fixed and updated. I know you were talking about the $op and that changing, but i will wait on that and see where it goes. the update notes and files are on the ubercart site
Comment #11
jredding commentedbmagistro: Awesome thanks for updating your module. The changes have been made to v3
http://drupal.org/node/184896#comment-623189
The DB is at a frozen state and I believe all features are frozen now for v3. Please check to see if you need to make any changes to your module (you may not need to).
Comment #12
bmagistro commentedi did make a change to my module but forgot to link it on here. it is on the ubercart site. the change is in an if statement to adjust the visibility of a payment method. has there been any api changes up to this point? if not I think it is good to go. Please wait till i post alpha3 up there since you changed event and added the fields.
Thanks
Comment #13
jredding commentedThere have been API changes but I'm not sure if they affect your modules.
The API was modified to also allow the user of
entity_id
entity_type
operation
The event parameter was renamed to operation.
entity_id holds the id of the database entity (for example $node->nid, $user->uid, $comment->cid, etc.)
entity_type would hold "node" "user" "comment" respectively to match the id to proper item in the id field
operation say what happened (insert, published, moderated, deleted, etc.)
So if you GRANT points for making a purchase you might want to add an id of the shopping cart (or order details) to entity_id, a pointer in entity_type, and the operation might be "purchase". If your cart is a node then it would be
entity_id = $node->nid
entity_type = "node"
operation = "insert" (<-- not "purchase" b/c this is a node and its an insert of a node)
although userpoints_basic should take care of all of that for you if you're using userpoints_basic.module
If you're not granting points then just take note of the change from event to operation.
Any reason why your module isn't posted on drupal.org? Seems like it would make sense to have it either be a contribute module within this module or branched off into its own project (if you're going to do constant maintenance on this, accept feature requests, etc. etc. I'd suggest creating a whole project for it and making UP a dependency)
Comment #14
bmagistro commentedAlpha 3 has been posted on the ubercart site. I hadn't thought about creating one on here yet. Alpha 3 addresses the entity_id & _type fields as well as operation per your previous post. The module grants and takes points, however I make all my calls to userpoints_userpointsapi and my operations are not insert, published, etc they are as follows: Point Earnings(purchase), Point Purchase(paying with points), Point Refund(payment via points order cancel), Point Repossession(order delete and cancel)
If those will not work ok for some reason let me know. As of the quick testing I had done it appears they are ok. the userpoints_basic module is not even enabled on my test site. I will be looking into adding it to the drupal site. I don't mind doing basic maintenance on it since I will be using in production when this site launches shortly but do not want it to hog all of my time.
Comment #15
jredding commentedIf the entity is a custom entity (i.e its not a node, user or comment) then you use what make sense to you, your module and those writing reports. Being succinct and consistent with other modules (node, comment, etc.) is appreciated though.
If you are creating a node and entity_id is a $node->id then you should use the standard terms (as per hook_nodeapi; which is insert, update, etc.)
Comment #16
bmagistro commentedthats where it gets confusing since this runs parallel to the shopping cart and is not necessarily needed for that to function. for the entity_id i am using the ubercart transaction id which does map to an order id. the entity type is 'Ubercart Transaction'
I am not sure how much reporting other than the details provided by the existing userpoints that list why points were added/removed. That is something i will review, but i would like to get some additional input first.
Comment #17
jredding commentedThese fields are for existing reports but, mostly, for those that you can not anticipate. This method is directly ripped-off (lovingly, of course) from the voting API and the location module.
For example right now when a user views their individual report they will only see that they have received point, however, if you want a simple hook in your module you can turn the "Operation" field into a link out to the cart (sorry I don't have an example to copy and paste but check the latest userpoints.module under the userpoints_list_users function, you'll see the hook).
Also someone may want to do a custom report showing only the points gained by shopping.
Ideally, and keeping consistent with other modules, the entity_type would map to the name of the custom table you created to store your data. This is how voting api and the location module does it and is consistent with the node, comment, user modules (each having a table named exactly as the type). For example CCK types are always an entity_type of node because you start from the node table and work outward. This will developer to create custom module on top of this data.
Hope that helps.
Comment #18
bmagistro commentedThere is a new release of this posted on the ubercart site. I have not created it on the drupal site yet, but plan to do so tomorrow if time allows. Please see the notes posted there.
Comment #19
kbahey commentedMoving to the correct project.
If this is working, then please attach it and specify if it is 2.x or 3.x.
Comment #20
kbahey commentedThis is now separately maintained in its own project.
Comment #21
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.