Forum OpenACS Q&A: Errors in ecommerce module

Collapse
Posted by Piyush Shah on
Hi all. First, just a big thank you to all of you working so hard on
this OpenACS system. I've sort of been lurking on these forums for a
while as I've not had the time to start learning/using the system.
However I finally managed to get it all up and running a few weeks
ago and have been venturing into some of the scripts/procedures to
get a better idea of how it all works and how it should best be setup
for real use.

My first question is has anyone actually used the OpenACS ecommerce
module to setup a test/real site?

I have been trying to understand how it all works and in beginning to
use this particular module, have started to com across problems. I'm
not quite sure whether it is something to do with my setup or if
there is something wrong within any of the current code - so here
goes:

- After creating a few user classes (www/admin/ecommerce/user-
classes), if you go back to that page, it should show you the classes
that have just been created, but it doesn't. Looking at the index.tcl
page, it seems that the first select which uses a union to get the
outer join of the ec_user_classes table isn't pulling in the user-
classes that have no users in them. I modified the second select and
it all seems to work now. I'm not sure if anything was wrong in the
first place since I'm still a newbie at this and therefore haven't
put this into the bug tracking system. This is why I'd appreciate
whoever may have already used this module to verify first.

- I'm using the cybercash-stub utility to test complete orders.
However after hitting submit on the last page of the order process, I
get  'Error: Ns_PgExec: result status: 7 message: ERROR:  <unnamed>
referential integrity violation - key referenced from
ec_customer_serv_interactions not found in users' - this seems to be
coming out of a sub-procedure (ec_customer_service_simple_issue ?)
when the system tries to email the order confirmation back to the
customer. The proc is sending an empty string in as
customer_service_rep which fails on the ref. integrity with the users
table as there are no null user_id records. Am I even on the right
track here? If I comment out the 'ec_email_new_order $order_id' line
in www/ecommerce/finalize-order.tcl, then the order seems to be
entered fine (without the person getting a confirmation email of
course).

Second question - apart from 'the book', the problems sets, and the
myriad of aD documents, does anyone have good suggestions/other links
to help newbies to come upto speed with the whole system?

Collapse
Posted by Ben Adida on
You shouldn't be shy, you're actually finding bugs, and you
should definitely report them on the bug tracker. The second bug
you're seeing probably comes from the early days of the
ecommerce module used on 6.5.3 without referential integrity
checking, and the first is just a stupid bug.

Ecommerce is a huge module that unfortunately doesn't get
tested enough because of its largeness. If you have the time to
test it more and report bugs, that would be great! I would like to
focus some time this weekend on cleaning up ecommerce, so
go crazy with the SDM :)

Collapse
Posted by Don Baccus on
I expect to spend time cleaning up e-commerce this weekend, too, since  I'll be setting it up for a friend's business so he can start customizing it (he's an experienced hacker, no worries).
<p>
The second bug probably stems from either of these:
<ul><li>Postgres doesn't allow one to pass NULLs into PL/pgSQL functions, weird things happen if you do
<li>Oracle very incorrectly treats the empty string '' as a synonmym for NULL.  Postgres correctly treats it as, well, the empty string.  This is a subtle porting issue that's easy to overlook when one hacks through the code modifying queries.
</ul>
Take your choice.  Maybe it's a combination of both.
Collapse
4: Errors in ecommerce module (response to 1)
Posted by Piyush Shah on
Thanks for the encouragement. I have logged those two errors into the SDM. I am now actively trying to setup the ecommerce module and will log problems as I find them. Here is another odd one that I've just logged but maybe someone can explain the strange behaviour in the meanwhile?

I have been bulk uploading some products, categories and product-category map information using the upload scripts and csv files. However any products that are imported in instead of being entered individually and manually (via the admin/ecommerce/products/add.tcl pages) just do not get found by the default search tool on the product pages. I have looked at the tables and all the data is definitely there and I can find products using a LIKE search. It seems the pseudo_contains procedure is not matching the search string with any products even though it seems it should. I have looked at add-4.tcl to see what might be different about entering a single product rather then importing a load of them from a csv file but there doesn't seem to be anything out of the ordinary. Any info on this will be much appreciated!

Collapse
Posted by Don Baccus on
Well, just log it into the SDM as well, with an example CSV entry (should only take one row, right?)  Might as well include the details you've given here, too, as that helps quicken the fixit work.

Then we can take a look and it won't get forgotten.

Collapse
Posted by Don Baccus on
Well, just log it into the SDM as well, with an example CSV entry (should only take one row, right?)  Might as well include the details you've given here, too, as that helps quicken the fixit work.

Then we can take a look and it won't get forgotten.

I'm glad we have a real user of e-commerce, it's a great help uncovering bugs even if you don't figure out how to fix them on your own.

Collapse
Posted by Grant Schofield on
We are now back into ACS big time over here and are trying to get the ecommerce module configured and working. First problem is the bulk upload of products. I keep getting SQL insert errors - specifically, the postgres log says
ERROR: ExecAppend: Fail to add null value in not null atribute product_id
And in the browser window...
FAILURE! SQL: insert into ec_products (creation_date, available_date, 
dirname, last_modified, last_modifying user, modfied_ip_adress)
 values(sysdate(), sysdate(), '', sysdate(), 4,'192.168.10.150')
The CSV file was generated by Excel to test the system with. I tried loading the CSV from a windows box, and it spat out the file 'Cannot read file'. I created a sample csv file with VI, and it too was rejected.

I have played around with the format of the CSV file, tried inserting '''s around the values, etc., all to no avail. Does anyone have any ideas?

Ps I'm using the latest ACS (which is excellent btw!!!), the lastest postgres, and the latest AOLserver.

thanx

grant

Collapse
Posted by Dan Wickstrom on
You're missing a product_id which is a required column for the upload.
Collapse
Posted by Grant Schofield on
Hi Dan,

Our CSV looks has the following format (I am going with getting the most basic configuration up and running first)....

product_id, product_name, price
ACC-CAB-1002,PARALLEL PRINTER CABLE - 3.0M,3.5
Am i missing something here?
Collapse
Posted by Dan Wickstrom on
From looking at the documentation and the code, it seems that your file format is ok.  The product_id and the product_name should have been appended onto the insert that failed.  It seems that there must be a bug in .../admin/ecommerce/products/upload-2.tcl.  I'm not set up to debug this, so I probably can't be much more help right now.
Collapse
Posted by Grant Schofield on
Thanks anyway dan...<p>

I can add products one at a time with no problems, its just the bulk upload that's giving the problems. I'm going to go through the docs again step by step to see if I missed anything that could be causing the problems....<p>
I am wondering if anyone has succesfully managed to play do a bulk upload, it certainly sounds like Piyush has it working in some way....<p>grant

Collapse
Posted by Piyush Shah on
Hi Grant,

I did manage to do a few bulk uploads but have not really had time to continue working with/testing the ecommerce module recently. Unfortunately I don't have access to my test system just now, but it looks like the product_id needs to be an integer (check out the table definition in www/doc/sql/ecommerce.sql). Also another problem I had encountered was something to do with the ns_queryget csvfile not working with nsd8x and I had to run the nsd76 aolserver instead. Hope this helps. I'll be able to look at specifics on my own setup tomorrow if you have any other questions. I had also created additional pages to help bulk upload the categories and subcategories that I can send you if you like.

Collapse
Posted by Grant Schofield on
Piyush, thanks a ton. I did notice the integer constraint, and created a test CSV file using integers, but with the same lack of success. I would never even have though of trying nsd72! I will give it a go as soon as I get back to my test machine...<p>
I would be very interested in your additional pages, and thanks for the offer. It is nice to know that some others are working seriously with the ecommerce module. I would be most happy to share any learning and tips and tricks we pick up as we start to rigorously put this module through it paces over the next month or so...
<p>
grant
Collapse
Posted by Paul Doerwald on

I've been bitten by a bug in AOLserver 3: ns_getcsv doesn't work. The ecommerce module (at least in ACS Classic) uses ns_getcsv.

I posted a http://www.arsdigita.com/bboard/q-and-a-fetch-msg.tcl?msg_id=0007mN question about this bug in the photo.net bboard, and a guy responded with a patch that mostly works, at least for 3.0RC2.

Maybe that will help you out...

Collapse
Posted by Paul Doerwald on
ah, crap. The bboard notification didn't send the actual link though for my post about ns_getcsv:

http://www.arsdigita.com/bboard/q-and-a-fetch-msg.tcl?msg_id=0007mN

Have fun...

Collapse
Posted by Grant Schofield on
Ta for the Paul. I actually managed to get a basic csv file uploaded using nsd76 as Piyush suggested. When I switched to nsd82, then the same problems occurred. Puzzling.... I'm going to play around with the patch tommorrow and see how it goes...