Displaying MSRP on Label instead of Price

Hello Community,


I am trying to program in a workaround that I need - I want to display the MSRP on my print label instead of the unit price for my products. I have the custom template loaded in the print templates section of lightspeed retail under ItemLabel, but I am struggling to figure out what to change to make this happen. I believe it is something in the section of code from lines 250-268.


      <article>

        <h1>{{ Label.MetaData.title }}</h1>

        <div class="text-wrapper">

          {% if hide_price == false %}

            {% if Label.MetaData.price > 0 %}

              <div class="price">

                {% if price_with_no_cents == true %}

                  <p class="saleprice">

                    <sup class="currency">$</sup>{{ Label.MetaData.price|number_format(0, '', '')|raw }}

                  </p>

                {% else %}

                <p class="saleprice">{{ Label.MetaData.price|money|htmlparsemoney|raw }}</p>

                {% endif %}

                {% if Label.MetaData.msrp %}

                  <p class="msrp">MSRP {{ Label.MetaData.msrp|money }}</p>

                {% endif %}

              </div>

            {% endif %}

          {% endif %}

6 comments

  • ewrewr Member Posts: 1

    Also keen to find this out!

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    Hey @gregarican!

    Thank you for sharing connected threads!

    I'll share here for the rest, it looks like the discussions on labels are quite fragmented:


    @elmills & @ewr to display the MSRP price instead of the default price do the following:

    On line 261 of the customisable Label template:

    Replace

    <p class="saleprice">{{ Label.MetaData.price|money|htmlparsemoney|raw }}</p>

    with

    <p class="saleprice">{{ Label.MetaData.msrp|money }}</p>

    Please note however that wherever the MSRP is greater than the default price, the MSRP will automatically show

    So as a safety net you also might want to hide the default MSRP from showing in those instances, add:

    .msrp {display: none}

    on line https://github.com/merchantos/PrintTemplates/blob/master/label/customizable_label.tpl#L122

    Hope this helps!

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • hitempo_toddhitempo_todd Member Posts: 2
    edited July 7

    I've been attempting to make these changes with no luck. When I put the code changes in the price comes up as $0.00 on the label. When I enable Zebra Browser Print it wont detect my printer. Any and all help would be appreciated.

  • jontylerjontyler Member Posts: 4

    I have the same issue as @hitempo_todd - enabling MSRP options just prints "MSRP $0.00". Are we missing another option somewhere?

  • urbananglerurbanangler Member Posts: 11
    edited November 12

    @jontyler // @hitempo_todd // @ewr // @elmills - here is a patch

    @Adrian Samuel - the data structure seems to have changed and therefore the template manual you linked to is no longer up to date.

    Here is the code with a setting - MSRP doesn't live in the Label.MetaData.msrp array anymore. Instead it lives in the Label.Item.Prices.ItemPrice array which requires a for loop to iterate through the available values and matching keys.

    Changes

    You need to start by adding a new setting param on a new line below the

    hide_barcode_sku param so...

    search for:

    {% set hide_barcode_sku = true %}                  {# Remove the System ID from displaying at the bottom of barcdoes #}
    

    add this line below

    {% set show_MSRP = true %}                            {# Display MSRP instead of Price #}
    


    Then on to the code block

    easiest to replace entire price block (I am deliberately not including a code line ref because that only makes sense if you have not adjusted anything else in the code) - start at the first price if statement after the </h1>

    look for code block between

    <h1>{{ Label.MetaData.title }}</h1>
    

    and

    <p class="description">
    

    replacement block

                            {% if hide_price == false %}
                                {% if show_MSRP == false %}
                                    {% if Label.MetaData.price > 0 %}
                                        <div class="price">
                                            {% if price_with_no_cents == true %}
                                                <p class="saleprice"><sup class="currency">$</sup>{{ Label.MetaData.price|number_format(0, '', '')|raw }}</p>
                                            {% else %}
                                              <p class="saleprice">{{ Label.MetaData.price|money|htmlparsemoney|raw }}</p>
                                            {% endif %}
                                            {% if Label.MetaData.msrp %}
                                            <p class="msrp">MSRP {{ Label.MetaData.msrp|money }}</p>
                                            {% endif %}
                                        </div>
                                    {% endif %}
                                {% else %}
                                    {% for price in Label.Item.Prices.ItemPrice %}
                                        {% if price.useType == 'MSRP' %}
                                            <div class="price">
                                            {% if price_with_no_cents == true %}
                                                <p class="saleprice"><sup class="currency">$</sup>{{ price.amount|number_format(0, '', '')|raw }}</p>
                                            {% else %}
                                              <p class="saleprice">{{ price.amount|money|htmlparsemoney|raw }}</p>
                                            {% endif %}
                                            </div>
                                        {% endif %}
                                    {% endfor %}
                                {% endif %}
                            {% endif %}
    


    Post edited by urbanangler on
Sign In or Register to comment.