[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] d/l link creation for soft goods with MV/Interchange 4.04
Mike Heins wrote:
> There is a ready-to-go implementation [of soft goods] in the "simple" demo:
>
> ftp://ftp.minivend.com/pub/demos/
Thanks Mike,
I grabbed that and I have been using it as model. At the moment I'm
concentrating on the example code on etc/receipt.html. I see the place
on the page where the "get_download" subroutine is created, but it
doesn't ever appear to be called! The page query/order_details.html has
a similiar structure, and it adds a call to get_download for each item
in the order, as given here.
[calc]
return unless
q{[userdb function=check_file_acl mode=expire location="[sql-param sku]"]};
return get_download(q{[sql-param sku]});
[/calc]
I tried merging this syntax with what was already on etc/receipt.html to
come up with the below code.
My questions are:
1. On etc/receipt.html in the simple demo, how are the download links
created?
2. How can I get mine to show up? :) I followed the simple model
closely, and nothing is displaying on the page, and nothing is reported
in the error logs. Perhaps a more useful question is: When something
like this happens, what I can do to verify that parts of my code are
actually working? The standard Perl tricks I know don't seem to work here...
Thanks much,
-mark
personal website } Summersault Website Development
http://mark.stosberg.com/ { http://www.summersault.com/
### CODE STARTS HERE
[comment] Handle downloadables [/comment]
[set download_present][/set]
[item-list]
[if-item-field download]
[set download_present]1[/set]
[userdb
function=set_file_acl
mode="expire 7 days"
location="[item-code]"
]
[/if-item-field]
[/item-list]
[perl products]
sub get_download {
if (! $Scratch->{download_present}) {
return '(<B>Must pay by credit card to download now.)</B>';
}
my $sku = shift;
return '' unless tag_data('products', 'download', $sku);
my $loc = tag_data('products', 'dl_location', $sku);
my $save = delete $Scratch->{mv_add_dot_html};
my $url = $Tag->area( { href => "deliver/$loc", arg => $sku } );
$Scratch->{mv_add_dot_html} = $save if $save;
return qq{<BR><A HREF="$url">download</A>};
}
return;
[/perl]
[item-list]
[item-quantity]
[item-code]
[item-field title]
[calc]
return unless q{[userdb function=check_file_acl mode=expire
location="[item-field sku]"]};
return get_download(q{[item-field sku]});
[/calc]
[item-price]
[item-subtotal]
[/item-list]
#################################
I also added the appropriate columns to products.txt, with the columns:
download dl_type dl_location
and the values:
1 application/pdf test.pdf
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users