[ic] Cart programming question

Joachim Leidinger interchange-users@interchange.redhat.com
Thu Feb 14 15:45:01 2002


Steffen Dettmer wrote:
> 
> Hi,
> 
> ... and my loved customers have a requirement.
> There are multiple (shop-) users organized in groups. Now it's
> possible that a user A saves a cart or a recurring order. Now it
> should made possible that a customer B (which is in the same
> group as user A) can get the carts A saved.
> 
> Here I see two possibilities: I could make a page that loads the
> cart value from userdb from the other user (A), parse it in some
> way, and add the selected cart to the value in userdb for this
> user (B). The second possibility: I could add some new button
> which stores the contents of "uneval $Carts->{'main'}" into a
> database table (I would use my groups-table I think).
> 
>         $cart_string = uneval $Carts->{'main'};
>         query "insert into group_carts ( content, group_id )
>                 VALUES ( $cart_string, $group_id )";
>         #   (or some Data-Tag instead of query)
> 
> So far this shouldn't be a problem. For loading/getting, I think
> I just need somethink like
> 
>         $db_field_content = query "select content from group_carts
>                 where group_id = $group_id
>                   and cart_id  = $cart_to_load";
>         #   (or some Data-Tag instead of query)
>         $Carts->{'main'} = eval $db_field_content;
> 
> Now my questions:
> 
>         - Is there a better third way to do it?
> 
>         - Would method 2 work if I program a global user tag for
>           it (inside pages or catalog.cfg "eval" wouldn't work
>           beacuse of Safe, is this correct)?
> 
>         - Is there a better way to "reload" this cart than with
>           eval?
> 
>         - I never wrote into a table from IC. Do I have to expect
>           problems here (catalog.cfg permissions or similar)?
> 
>         - Should I use another approach by editing UserDB.pm and
>           modify get_cart (and others) in a way, that they handle
>           group-assigned carts on this level?
> 
> I don't have the right idea, since the cart functionality is part
> of the IC core and cannot be modified easily, so I would prefere
> method 2 (saving a uneval $Carts->{'main'}, and for reloading it
> doing a eval $field_content).
> 
> Any suggestions? Thank you!

Hi,

I'm looking for that kind of solution too, to store and get the carts
outside of userdb table. Are there any tricks to tell IC, in which table
has the carts to saved and from which table can IC to load. I've more
than 22 000 users in userdb and a lot of them use the saved carts and
save the carts very very often. Sometimes, the userdb table is broken
and I lost a lot of users from the userdb table. If I switch off the
codes to save or to load the carts, I've no problems with userdb and
don't lost any users from that table.

Thanks!

Joachim


-- 
Hans-Joachim Leidinger | Dipl.-Phys.Ing. Entwicklung eCommerce
[leidinger@bpanet.de] 
Black Point Arts Internet Solutions GmbH
http://www.bpanet.de