Product ID in cart items internal metadata + alias support.

The alias support is implemented in products, but not in market.

The product ID in the cart items is useful for plugins that hook the checkout.
This commit is contained in:
Juerd Waalboer 2013-02-28 01:22:55 +01:00
parent 788dc3dc12
commit 551c22c8ba
2 changed files with 9 additions and 6 deletions

View file

@ -27,7 +27,7 @@ sub command :Tab(market) {
$seller = parse_amount($seller) or next;
$space = parse_amount($space) or next;
$cart->add(undef, -($seller + $space), $description);
$cart->add(undef, -($seller + $space), $description, {product_id=>$id});
$cart->add($username, 0+$seller, "\$you bought $description")
if 0+$seller;
return ACCEPT;

View file

@ -20,14 +20,17 @@ sub command :Tab(edit) {
chomp @$_ for @products;
for my $fields (@products) {
my ($id, $price, $description) = @$fields;
my ($ids, $price, $description) = @$fields;
next if $command ne $id;
my @ids = split /,/, $ids;
for my $id (@ids) {
next if $id ne $command;
$price = parse_amount($price) or next;
$price = parse_amount($price) or next;
$cart->add(undef, -$price, $description);
return ACCEPT;
$cart->add(undef, -$price, $description, { product_id => $ids[0] });
return ACCEPT;
}
}
return NEXT;