Skip featured image on individual product page with Prestige Theme

callumw6__
New Member
1 0 0

Hi guys!

Have trawled through just about every discussion post out there for an answer to this but no luck so far. Hoping someone can help.

I'm trying to do the following:

  • I want the 'featured' image to appear on collection pages (e.g. /all) 
  • But I want this featured image to be hidden once the customer actually clicks through to the product page

The reason for this is that I have smaller, white background images that look neat on the collection/catalog page. But once a customer lands on the product page, I want to show the higher quality, bigger images of the product (which are positioned as image number 2, 3, 4... on the product). 

I'm using Prestige Theme.

My page is booksbyshelf.com and the password is booksbyshelf.

Code for the product.template.liquid (which I think I need to edit) is here

{%- capture section_settings -%}
{
  "enableHistoryState": true,
  "templateSuffix": {{ product.template_suffix | json }},
  "showInventoryQuantity": {{ section.settings.show_inventory_quantity | json }},
  "showSku": {{ section.settings.show_sku | json }},
  "stackProductImages": {{ section.settings.stack_images | json }},
  "showThumbnails": {{ section.settings.show_thumbnails | json }},
  "enableVideoLooping": {{ section.settings.enable_video_looping | json }},
  "inventoryQuantityThreshold": {{ section.settings.inventory_quantity_threshold }},
  "showPriceInButton": {{ section.settings.show_price_in_button | json }},
  "enableImageZoom": {{ section.settings.enable_image_zoom | json }},
  "showPaymentButton": {{ section.settings.show_payment_button | json }},
  "useAjaxCart": {% if settings.cart_type == 'drawer' %}true{% else %}false{% endif %}
}
{%- endcapture -%}

<section class="Product Product--{{ section.settings.image_size }}" data-section-id="{{ section.id }}" data-section-type="product" data-section-settings='{{ section_settings }}'>
  <div class="Product__Wrapper">
    {%- capture action_list_items -%}
      {%- if section.settings.enable_image_zoom -%}
        <div class="Product__ActionItem hidden-lap-and-up">
          <button class="RoundButton RoundButton--small RoundButton--flat" data-action="open-product-zoom">{% render 'icon' with 'plus' %}</button>
        </div>
      {%- endif -%}

      {%- if section.settings.show_share_buttons -%}
        <div class="Product__ActionItem hidden-lap-and-up">
          <button class="RoundButton RoundButton--small RoundButton--flat" data-action="toggle-social-share" data-animate-bottom aria-expanded="false">
            <span class="RoundButton__PrimaryState">{% render 'icon' with 'share' %}</span>
            <span class="RoundButton__SecondaryState">{% render 'icon' with 'close' %}</span>
          </button>

          {%- assign share_url = shop.url | append: product.url -%}
          {%- assign twitter_text = product.title -%}
          {%- assign pinterest_description = product.description | strip_html | truncatewords: 15 | url_param_escape -%}
          {%- assign pinterest_image = product.featured_media | img_url: '1024x' | prepend: 'https:' -%}

          <div class="Product__ShareList" aria-hidden="true">
            <a class="Product__ShareItem" href="https://www.facebook.com/sharer.php?u={{ share_url }}" target="_blank" rel="noopener">{%- render 'icon' with 'facebook' -%} Facebook</a>
            <a class="Product__ShareItem" href="https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }}" target="_blank" rel="noopener">{%- render 'icon' with 'pinterest' -%} Pinterest</a>
            <a class="Product__ShareItem" href="https://twitter.com/share?{% if twitter_text != blank %}text={{twitter_text}}&{% endif %}url={{ share_url }}" target="_blank" rel="noopener">{%- render 'icon' with 'twitter' -%} Twitter</a>
          </div>
        </div>
      {%- endif -%}
    {%- endcapture -%}

    {%- comment -%}
    --------------------------------------------------------------------------------------------------------------------
    PRODUCT GALLERY
    --------------------------------------------------------------------------------------------------------------------
    {%- endcomment -%}

    {%- assign initial_media_id = product.featured_media.id -%}
    {%- assign initial_media_index = 0 -%}
    {%- assign media_count = 0 -%}

    {%- capture slideshow_media -%}
      {%- for media in product.media -%}
        {%- if media.alt == 'featured' or media.alt == 'featured mobile' -%}
          {%- continue -%}
        {%- endif -%}

        {%- if product.selected_variant and media.id == product.selected_variant.featured_media.id -%}
          {%- assign initial_media_index = media_count -%}
          {%- assign initial_media_id = media.id -%}
        {%- endif -%}

        {%- capture supported_sizes -%}{%- render 'image-size', sizes: '200,400,600,700,800,900,1000,1200,1400,1600', image: media -%}{%- endcapture -%}

        {%- case media.media_type -%}
          {%- when 'image' -%}
            <div id="Media{{ media.id }}" tabindex="0" class="Product__SlideItem Product__SlideItem--image Carousel__Cell {% if initial_media_id == media.id %}is-selected{% endif %}" data-media-type="image" data-media-id="{{ media.id }}" data-media-position="{{ media.position }}" data-image-media-position="{% increment image_position %}">
              <div class="AspectRatio AspectRatio--withFallback" style="padding-bottom: {{ 100.0 | divided_by: media.aspect_ratio }}%; --aspect-ratio: {{ media.aspect_ratio }};">
                {% assign image_url = media | img_url: '1x1' | replace: '_1x1.', '_{width}x.' %}

                <img class="Image--lazyLoad Image--fadeIn" data-src="{{ image_url }}" data-widths="[{{ supported_sizes }}]" data-sizes="auto" data-expand="-100" alt="{{ media.alt | escape }}" data-max-width="{{ media.width }}" data-max-height="{{ media.height }}" data-original-src="{{ media | img_url: 'master' }}">
                <span class="Image__Loader"></span>

                <noscript>
                  <img src="{{ media | img_url: '800x' }}" alt="{{ media.alt | escape }}">
                </noscript>
              </div>
            </div>

          {%- when 'external_video' -%}
            <div id="Media{{ media.id }}" tabindex="-1" class="Product__SlideItem Product__SlideItem--video Carousel__Cell {% if initial_media_id == media.id %}is-selected{% endif %}" data-media-type="external_video" data-media-id="{{ media.id }}" data-media-position="{{ media.position }}" data-video-host="{{ media.host | escape }}" data-video-id="{{ media.external_id | escape }}">
              <div class="Image--lazyLoad Image--fadeIn" data-expand="-100">
                <div class="VideoWrapper">
                  {{- media | external_video_tag: image_size: '1024x' -}}
                </div>
              </div>
            </div>

          {%- when 'video' -%}
            <div id="Media{{ media.id }}" tabindex="-1" class="Product__SlideItem Product__SlideItem--video Carousel__Cell {% if initial_media_id == media.id %}is-selected{% endif %}" data-media-type="video" data-media-id="{{ media.id }}" data-media-position="{{ media.position }}">
              <div class="Image--lazyLoad Image--fadeIn" data-expand="-100">
                <div class="VideoWrapper VideoWrapper--native" style="padding-bottom: {{ 100.0 | divided_by: media.aspect_ratio }}%">
                  {{- media | video_tag: image_size: '1024x', controls: true -}}
                </div>
              </div>
            </div>

          {%- when 'model' -%}
            <div id="Media{{ media.id }}" tabindex="-1" class="Product__SlideItem Product__SlideItem--model Carousel__Cell {% if initial_media_id == media.id %}is-selected{% endif %}" data-media-type="model" data-media-id="{{ media.id }}" data-media-position="{{ media.position }}">
              <div class="Image--lazyLoad Image--fadeIn" data-expand="-100">
                <div class="ModelWrapper">
                  {{- media | model_viewer_tag: image_size: '1024x', reveal: 'interaction', toggleable: true -}}
                </div>
              </div>
            </div>
        {%- endcase -%}

        {%- assign media_count = media_count | plus: 1 -%}
      {%- endfor -%}
    {%- endcapture -%}

    {%- if product.media.size > 0 -%}
      <div class="Product__Gallery {% if section.settings.stack_images %}Product__Gallery--stack{% endif %} {% if section.settings.show_thumbnails and media_count > 1 %}Product__Gallery--withThumbnails{% else %}Product__Gallery--withDots{% endif %}">
        <span id="ProductGallery" class="Anchor"></span>

        {%- if action_list_items != blank -%}
          <div class="Product__ActionList hidden-lap-and-up {% if product.media[initial_media_index].media_type != 'image' %}is-hidden{% endif %}">
            {{ action_list_items }}
          </div>
        {%- endif -%}

        {%- capture slideshow_nav -%}
          {%- if media_count > 1 -%}
            {%- if section.settings.show_thumbnails -%}
              <div class="Product__SlideshowNav Product__SlideshowNav--thumbnails">
                <div class="Product__SlideshowNavScroller">
                  {%- for media in product.media -%}
                    {%- if media.alt == 'featured' or media.alt == 'featured mobile' -%}
                      {%- continue -%}
                    {%- endif -%}

                    {%- capture nav_item_badge -%}
                      {%- case media.media_type -%}
                        {%- when 'model' -%}
                          <span class="Product__SlideshowNavBadge">{% render 'icon', icon: 'media-model-badge' %}</span>

                        {%- when 'video' or 'external_video' -%}
                          <span class="Product__SlideshowNavBadge">{% render 'icon', icon: 'media-video-badge' %}</span>
                      {%- endcase -%}
                    {%- endcapture -%}

                    {%- if section.settings.stack_images -%}
                      <a href="#Media{{ media.id }}" data-offset="-25" data-focus-on-click data-media-id="{{ media.id }}" class="Product__SlideshowNavImage AspectRatio {% if forloop.first %}is-selected{% endif %}" style="--aspect-ratio: {{ media.preview_image.aspect_ratio }}">
                        <img src="{{ media | img_url: '160x' }}" alt="{{ media.alt | escape }}">
                        {{- nav_item_badge -}}
                      </a>
                    {%- else -%}
                      <a href="{{ media | img_url: '1024x' }}" data-media-id="{{ media.id }}" class="Product__SlideshowNavImage AspectRatio {% if forloop.first %}is-selected{% endif %}" style="--aspect-ratio: {{ media.preview_image.aspect_ratio }}">
                        <img src="{{ media | img_url: '160x' }}" alt="{{ media.alt | escape }}">
                        {{- nav_item_badge -}}
                      </a>
                    {%- endif -%}
                  {%- endfor -%}
                </div>
              </div>
            {%- endif -%}

            {%- if section.settings.stack_images -%}
              <div class="Product__SlideshowNav Product__SlideshowNav--dots">
                <div class="Product__SlideshowNavScroller">
                  {%- for media in product.media -%}
                    {%- if media.alt == 'featured' or media.alt == 'featured mobile' -%}
                      {%- continue -%}
                    {%- endif -%}

                    <a href="#Media{{ media.id }}" data-offset="-25" data-focus-on-click class="Product__SlideshowNavDot {% if forloop.first %}is-selected{% endif %}"></a>
                  {%- endfor -%}
                </div>
              </div>
            {%- endif -%}
          {%- endif -%}
        {%- endcapture -%}

        {%- if section.settings.stack_images -%}
          {{- slideshow_nav -}}
        {%- endif -%}

        {%- capture flickity_options -%}
        {
          "prevNextButtons": false,
          "pageDots": false,
          "adaptiveHeight": true,
          "watchCSS": true,
          "dragThreshold": 8,
          "initialIndex": {{ initial_media_index }},
          "arrowShape": {"x0": 20, "x1": 60, "y1": 40, "x2": 60, "y2": 35, "x3": 25}
        }
        {%- endcapture -%}

        <div class="Product__Slideshow {% if section.settings.enable_image_zoom %}Product__Slideshow--zoomable{% endif %} Carousel" data-flickity-config='{{ flickity_options }}'>
          {{ slideshow_media }}
        </div>

        {%- comment -%}Add the "view in your space" button, which allows to show the product in customer's environment (if the device supports it){%- endcomment -%}
        {%- assign first_3d_model = product.media | where: 'media_type', 'model' | first -%}

        {%- if first_3d_model -%}
          <button class="Product__ViewInSpace Button Button--full" data-shopify-xr data-shopify-model3d-id="{{ first_3d_model.id }}" data-shopify-model3d-default-id="{{ first_3d_model.id }}" data-shopify-title="{{ product.title | escape }}" data-shopify-xr-hidden>
            {%- render 'icon', icon: 'media-view-in-space' -%} {{- 'product.general.view_in_space' | t -}}
          </button>
        {%- endif -%}

        {%- if media_count > 1 -%}
          {%- comment -%}
            IMPLEMENTATION NOTE: The reason we create ourselves our own UI instead of relying of the built-in feature of Flickity is that,
            since the media API, Shopify requires to add arrows next to the dot. Unfortunately this layout is not
            achievable easily using Flickity options only, so we have to run our own
          {%- endcomment -%}

          <div class="Product__SlideshowMobileNav {% if section.settings.stack_images or section.settings.show_thumbnails %}hidden-desk{% endif %}">
            <button class="Product__SlideshowNavArrow Product__SlideshowNavArrow--previous" type="button" data-direction="previous" aria-label="{{ 'general.accessibility.previous' | t }}">
              {% render 'icon' with 'media-arrow-left' %}
            </button>

            <div class="flickity-page-dots">
              {%- for i in (1..media_count) -%}
                <button type="button" class="dot {% if forloop.index0 == initial_media_index %}is-selected{% endif %}" data-index="{{ forloop.index0 }}"></button>
              {%- endfor -%}
            </div>

            <button class="Product__SlideshowNavArrow Product__SlideshowNavArrow--next" type="button" data-direction="next" aria-label="{{ 'general.accessibility.next' | t }}">
              {% render 'icon' with 'media-arrow-right' %}
            </button>
          </div>
        {%- endif -%}

        {%- unless section.settings.stack_images -%}
          {{- slideshow_nav -}}
        {%- endunless -%}
      </div>
    {%- endif -%}

    {%- capture product_aside -%}
      {%- comment -%}
      --------------------------------------------------------------------------------------------------------------------
      PRODUCT TABS
      --------------------------------------------------------------------------------------------------------------------
      {%- endcomment -%}

      {%- render 'product-tabs' -%}

      {%- comment -%}
      --------------------------------------------------------------------------------------------------------------------
      PRODUCT WEAR IT WITH

      We allow merchants to add a tag that looks like __with:product-handle to feature an additional product
      --------------------------------------------------------------------------------------------------------------------
      {%- endcomment -%}

      {%- for tag in product.tags -%}
        {%- if tag contains '__with' -%}
          {%- assign product_handle = tag | split: '__with:' | last -%}
          {%- assign associated_product = all_products[product_handle] -%}

          {%- if associated_product != empty -%}
            <div class="Section Section--spacingNormal">
              <header class="SectionHeader SectionHeader--center">
                <h3 class="SectionHeader__Heading Heading u-h4">{{ 'product.buy_it_with.title' | t }}</h3>
              </header>

              {% render 'product-item', product: associated_product, use_horizontal: true, show_labels: false, show_product_info: true, show_vendor: false, show_price_on_hover: false %}
            </div>

            {%- break -%}
          {%- endif -%}
        {%- endif -%}
      {%- endfor -%}
    {%- endcapture -%}

    <div class="Product__InfoWrapper">
      <div class="Product__Info {% if media_count == 0 %}Product__Info--noGallery{% endif %}">
        <div class="Container">
          {%- render 'product-meta', product: product, show_description: true -%}

          {%- if product.template_suffix != 'coming-soon' -%}
            {%- render 'product-form', product: product -%}
          {%- endif -%}

          {%- if section.settings.description_below_add_to_cart -%}
            <div class="ProductMeta__Description">
              <div class="Rte">
                {%- comment -%}
                We have figured out that some merchants were copy-pasting huge chunk of code into the product description,
                which can make the theme crashes if it contains some special attributes used by the theme. We therefore make sure to process this
                {%- endcomment -%}

                {{ product.description | replace: 'data-section-type', 'data-section-type-placeholder' }}
              </div>

              {%- if section.settings.show_share_buttons -%}
                <div class="ProductMeta__ShareButtons hidden-pocket">
                  <span class="ProductMeta__ShareTitle Heading Text--subdued u-h7">{{ 'product.form.share' | t }}</span>

                  {%- assign share_url = shop.url | append: product.url -%}
                  {%- assign twitter_text = product.title -%}
                  {%- assign pinterest_description = product.description | strip_html | truncatewords: 15 | url_param_escape -%}
                  {%- assign pinterest_image = product.featured_image | img_url: 'large' | prepend: 'https:' -%}

                  <div class="ProductMeta__ShareList Text--subdued">
                    <a class="ProductMeta__ShareItem" href="https://www.facebook.com/sharer.php?u={{ share_url }}" target="_blank" rel="noopener" aria-label="Facebook">{%- render 'icon' with 'facebook' -%}</a>
                    <a class="ProductMeta__ShareItem" href="https://twitter.com/share?{% if twitter_text != blank %}text={{twitter_text}}&{% endif %}url={{ share_url }}" target="_blank" rel="noopener" aria-label="Twitter">{%- render 'icon' with 'twitter' -%}</a>
                    <a class="ProductMeta__ShareItem" href="https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }}" target="_blank" rel="noopener" aria-label="Pinterest">{%- render 'icon' with 'pinterest' -%}</a>
                  </div>
                </div>
              {%- endif -%}
            </div>
          {%- endif -%}

          {%- if section.settings.stack_images and product_aside != blank and media_count > 0 -%}
            <div class="Product__QuickNav hidden-pocket">
              <div class="Product__QuickNavWrapper">
                <a href="#ProductAside" class="Heading Link Link--secondary u-h7">{{ 'product.form.view_info' | t }} {% render 'icon' with 'select-arrow-right' %}</a>
                <a href="#ProductGallery" class="Heading Link Link--secondary u-h7">{{ 'product.form.view_images' | t }} {% render 'icon' with 'select-arrow-right' %}</a>
              </div>
            </div>
          {%- endif -%}
        </div>
      </div>
    </div>

    {%- if product_aside != blank -%}
      <div class="Product__Aside">
        <span id="ProductAside" class="Anchor"></span>
        {{- product_aside -}}
      </div>
    {%- endif -%}
  </div>
</section>

{%- comment -%}
--------------------------------------------------------------------------------------------------------------------
FEATURED IMAGE

We allow merchants to use one image as a "featured image" by adding the alt tag "featured"
--------------------------------------------------------------------------------------------------------------------
{%- endcomment -%}

{%- for media in product.media -%}
  {%- if media.alt == 'featured' -%}
    {%- assign desk_featured_media = media.preview_image -%}
  {%- endif -%}

  {%- if media.alt == 'featured mobile' -%}
    {%- assign mobile_featured_media = media.preview_image -%}
  {%- endif -%}
{%- endfor -%}

{%- if desk_featured_media or mobile_featured_media -%}
  {%- assign mobile_featured_media = mobile_featured_media | default: desk_featured_media -%}
  {%- assign desk_featured_media = desk_featured_media | default: mobile_featured_media -%}

  <div class="Product__FeatureImageWrapper" style="background: url({{ desk_featured_media | img_url: '1x1', format: 'jpg' }})">
    <div class="Product__FeatureImage Product__FeatureImage--{{ section.settings.featured_image_size }} Image--lazyLoad Image--zoomOut hide-no-js" data-expand="-25" data-bgset="{{ mobile_featured_media | img_url: 'x850' }} [(max-width: 640px)] | {{ desk_featured_media | img_url: '1500x' }}"></div>

    <noscript>
      <div class="Product__FeatureImage Product__FeatureImage--{{ section.settings.featured_image_size }}" style="background-image: url({{ desk_featured_media | img_url: '1500x' }})"></div>
    </noscript>
  </div>

  <style>
    #shopify-section-{{ section.id }} + .shopify-section--bordered {
      border-top: 0;
    }
  </style>
{%- else -%}
  <style>
    /* This is a bit hacky but allows to circumvent the complete independency of section (as next section included in the page does not know anything about this page) */

    @media screen and (max-width: 640px) {
      #shopify-section-{{ section.id }} + .shopify-section--bordered {
        border-top: 0;
      }

      #shopify-section-{{ section.id }} + .shopify-section--bordered > .Section {
        padding-top: 0;
      }
    }
  </style>
{%- endif -%}

{%- comment -%}
--------------------------------------------------------------------------------------------------------------------
PHOTO SWIPE

This is the root container for the zoom functionality. Must not be removed, as order element is important.
--------------------------------------------------------------------------------------------------------------------
{%- endcomment -%}

{%- if section.settings.enable_image_zoom -%}
  <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

      <!-- Container that holds slides. Do not remove as content is dynamically added -->
      <div class="pswp__container">
        <div class="pswp__item"></div>
        <div class="pswp__item"></div>
        <div class="pswp__item"></div>
      </div>

      <!-- Main UI bar -->
      <div class="pswp__ui pswp__ui--hidden">
        <button class="pswp__button pswp__button--prev RoundButton" data-animate-left title="{{ 'product.slideshow.previous' | t }}">{% render 'icon' with 'arrow-left' %}</button>
        <button class="pswp__button pswp__button--close RoundButton RoundButton--large" data-animate-bottom title="{{ 'product.slideshow.close' | t }}">{% render 'icon' with 'close' %}</button>
        <button class="pswp__button pswp__button--next RoundButton" data-animate-right title="{{ 'product.slideshow.next' | t }}">{% render 'icon' with 'arrow-right' %}</button>
      </div>
    </div>
  </div>
{%- endif -%}

{% schema %}
{
  "name": "Product page",
  "class": "shopify-section--bordered",
  "settings": [
    {
      "type": "checkbox",
      "id": "show_share_buttons",
      "label": "Show social sharing buttons",
      "default": true
    },
    {
      "type": "checkbox",
      "id": "show_vendor",
      "label": "Show vendor",
      "default": true
    },
    {
      "type": "checkbox",
      "id": "show_sku",
      "label": "Show SKU",
      "default": false
    },
    {
      "type": "checkbox",
      "id": "show_taxes_included",
      "label": "Show price taxes notice",
      "default": false
    },
    {
      "type": "checkbox",
      "id": "description_below_add_to_cart",
      "label": "Description below add to cart",
      "default": false
    },
    {
      "type": "select",
      "id": "selector_mode",
      "label": "Selector type",
      "options": [
        {
          "value": "block",
          "label": "Block"
        },
        {
          "value": "dropdown",
          "label": "Dropdown"
        }
      ],
      "default": "dropdown"
    },
    {
      "type": "checkbox",
      "id": "show_color_swatch",
      "label": "Show color swatch",
      "default": false,
      "info": "Some colors appear white? [Learn more](http://support.maestrooo.com/article/80-product-uploading-custom-color-for-color-swatch)."
    },
    {
      "type": "checkbox",
      "id": "show_color_carousel",
      "label": "Show color carousel",
      "info": "A pop-up selector with variant images for choosing colors. Only enables when color swatch is disabled.",
      "default": false
    },
    {
      "type": "checkbox",
      "id": "show_quantity_selector",
      "label": "Show quantity selector",
      "default": true
    },
    {
      "type": "checkbox",
      "id": "show_inventory_quantity",
      "label": "Show inventory quantity",
      "info": "Make sure that your inventory is tracked. [Learn more](https://help.shopify.com/manual/products/inventory#set-up-inventory-tracking).",
      "default": false
    },
    {
      "type": "range",
      "id": "inventory_quantity_threshold",
      "label": "Inventory quantity threshold",
      "info": "Only show inventory quantity if below threshold. Choose 0 to always show.",
      "min": 0,
      "max": 50,
      "step": 1,
      "default": 0
    },
    {
      "type": "checkbox",

 

Replies 0 (0)