Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Packagings display improvements on product page #7938

Merged
merged 3 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/ProductOpener/KnowledgePanels.pm
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ sub create_environment_card_panel ($product_ref, $target_lc, $target_cc, $option
$panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref);

# Create the environment_card panel
create_panel_from_json_template("environment_card", "api/knowledge-panels/environment/environment_card.tt.json",
$panel_data_ref->{packaging_image} = data_to_display_image($product_ref, "packaging", $target_lc),
create_panel_from_json_template("environment_card", "api/knowledge-panels/environment/environment_card.tt.json",
$panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"panel_ids": ["carbon_footprint"],
},
},
[% END %]
[% END %]
[% IF panels.packaging_recycling.defined %]
{
"element_type": "panel_group",
Expand All @@ -40,6 +40,9 @@
"panel_ids": [
"packaging_recycling"
],
[% IF panel.packaging_image.defined %]
"image": [% encode_json(panel.packaging_image) %],
[% END %]
},
},
[% END %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
[% IF packaging.quantity_per_unit %][% packaging.quantity_per_unit %] [% END %]
</strong>
[% IF packaging.material %]
([% display_taxonomy_tag_name('packaging_materials',packaging.material) %][% IF packaging.weight_per_unit %] [% packaging.weight_per_unit %] g[% END %])
([% display_taxonomy_tag_name('packaging_materials',packaging.material) %][% IF packaging.weight_measured %][% sep %]: [% packaging.weight_measured %] g[% END %])
[% END %]
<br>
[% END %]
Expand Down
4 changes: 3 additions & 1 deletion templates/web/panels/image.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

<figure itemprop="image" itemscope="" itemtype="https://schema.org/ImageObject" style="margin-bottom:0">

<img style="border-radius:10px;margin-bottom:0.5rem;" [% IF image.type == 'front' %]id="og_image" [% END %] class="product_image" src="[% image.sizes.400.url %]" width="[% image.sizes.400.width %]" height="[% image.sizes.400.height %]" alt="[% image.alt %]" itemprop="thumbnail" loading="lazy">
<a data-reveal-id="drop_[% image.type %]">
<img style="border-radius:10px;margin-bottom:0.5rem;" [% IF image.type == 'front' %]id="og_image" [% END %] class="product_image" src="[% image.sizes.400.url %]" width="[% image.sizes.400.width %]" height="[% image.sizes.400.height %]" alt="[% image.alt %]" itemprop="thumbnail" loading="lazy">
</a>

<meta itemprop="imgid" content="[% image.type %]">

Expand Down