[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Cart programming question
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!
oki,
Steffen
--
Dieses Schreiben wurde maschinell erstellt,
es trägt daher weder Unterschrift noch Siegel.