Forum OpenACS Development: Re: Ecommerce under 5.9

Collapse
3: Re: Ecommerce under 5.9 (response to 1)
Posted by Benjamin Brink on
Hi Iuri,
Much of the underlying code in ecommerce has been depricated. This error is likely the tip of an iceberg of issues anyone will encounter when using ecommerce with OpenACS 5.9.

Most likely, there is less work in refactoring the parts you need into a new package or packages.

Most of the key components exist as monolithic processes that can be extracted into new packages. Refactoring using the newer coding standards with the existing data model will likely avoid most issues.

The ecommerce templating system has been refactored into a wiki: Q-Wiki. Depending on the organizational environment, xowiki may be more suitable.

If payment processing is external, such as with PayPal, the cl-custom package may be a solution.

Stable versions of Q-Wiki and cl-custom are at https://github.com/openacs-ecg2

If you have experience with the mature OpenACS object system, it may make sense to use its features to define a new product data model.

As for a more elaborate system, I'm (still) re-writing ecommerce into a suite of packages that includes porting sql-ledger.

cheers,
Ben

Collapse
4: Re: Ecommerce under 5.9 (response to 3)
Posted by Benjamin Brink on
ps, for cl-custom package, iirc, the datamodel does not automatically load during install. This is fixed for the version at github.com/tekbasse/cl-custom
cheers,
Ben
Collapse
5: Re: Ecommerce under 5.9 (response to 4)
Posted by Iuri Sampaio on
Ben,

Why does ad_proc [ec_get_user_session_id] returns "0" instead of just 0?

set user_session_id [ec_get_user_session_id]
ns_log Notice "USESSION_ID: $user_session_id"

Log file returns:
[06/Nov/2016:22:32:37][7947.abc23b70][-conn:evex:3-] Notice: USESSION_ID: "0"

There ins't anything wrong with its source.

ad_proc ec_get_user_session_id {} { Gets the user session from cookies } {
ns_log Notice "Running ad_proc ec_user_session_id"

set headers [ns_conn headers]
set cookie [ns_set get $headers Cookie]

# grab the user_session_id from the cookie
if { [regexp {user_session_id=([^;]+)} $cookie match user_session_id] } {
return $user_session_id
} else {
return 0
}
}

Best wishes

Collapse
6: Re: Ecommerce under 5.9 (response to 5)
Posted by Iuri Sampaio on
Thanks Gustaf!

I'll keep digging and fixing ecommerce tcl scripts, using your samples, in order to get them working under oacs-5.9.

I've written a palliative using lindex to remove "".

Best wishes,

Collapse
7: Re: Ecommerce under 5.9 (response to 5)
Posted by Benjamin Brink on
Hi Iuri,

Why does ad_proc [ec_get_user_session_id] returns "0" instead of just 0?

Looking at the code for ec_get_user_session_id, if the expression matches with:

user_session_id="0"

Then, $user_session_id will return "0" including quotes.

Changing the regular expression to something like this should remove those:

{user_session_id=[\"]?([^;\"]+)}

..but I am sure there is a better way of doing this.

oacs-5-9 has passed a bunch of security tests, so consider looking at sec_login_read_cookie and friends.

cheers,
Ben