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:
parent
788dc3dc12
commit
551c22c8ba
2 changed files with 9 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue