Add product description on product page
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 30 Apr 2016 15:02:39 +0000 (16:02 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 30 Apr 2016 15:02:39 +0000 (16:02 +0100)
lib/App/Web/Oof.pm
tmpl/details.html

index e7d93f5d856a10621d526b79a6a3194eb86130c4..c2344c65aa28a0386c59cec3c48ebcc8e4710b67 100644 (file)
@@ -226,11 +226,12 @@ sub details_app {
        $db{$$} //= DBIx::Simple->connect($ENV{OOF_DSN} // 'dbi:Pg:');
        my $tree = $details->clone;
        my ($id) = $env->{PATH_INFO} =~ m,^/(\d+),;
-       my $title = $db{$$}->select(products => 'title', {product => $id})->list;
+       my ($title, $summary) = $db{$$}->select(products => [qw/title summary/], {product => $id})->list;
        my @pics = <static/fullpics/$id-*>;
        my $slug = make_slug $title;
        $tree->find('title')->replace_content("Pictures of $title | ledparts4you");
        $tree->find('h2')->replace_content($title);
+       $tree->fid('summary')->replace_content($summary);
        $tree->look_down(rel => 'canonical')->attr(href => "/details/$id/$slug");
        $tree->fid('pictures')->find('li')->iter3(\@pics, \&details_list_element);
 
index 418fec80920f9222af94ea69faa841234c671d55..ec99046a5b899ae69194c3bbbe83ea287b6385ce 100644 (file)
@@ -8,6 +8,8 @@
 <div id="subtitle">Issues/Questions? Contact us at <a href="mailto:orders@ledparts4you.uk.to">orders@ledparts4you.uk.to</a></div>
 
 <h2>Item</h2>
+<p>Go to <a href="/">order form</a>.
+<p id="summary"></p>
 <ul id="pictures"><li><a href="https://example.org"><img src="https:/example.org"></a></ul>
 
 Go to <a href="/">order form</a>.
This page took 0.011837 seconds and 4 git commands to generate.