Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Can anyone suggest how to amend the "Variant" option, so we can offer products at the gross price, rather than at a +/- option price ?

For example, at the moment, let's say a "1Kg Hammer" costs £9.95. If the customer wants to select the 2Kg hammer, which actually costs £14.85, when this is added as a "Variant" option the site shows it as "2Kg Hammer [+£4.9]" (it also omits the trailing 0 as in "£4.90"). This can make it look to the customer that it costs £4.90. When there are several variants (3Kg, 4Kg, 5Kg etc) it's even more confusing because each variant is an additional price to the base 1Kg hammer price....

So changes would need to be made to the admin "Variant" entry (some symbol needed to identify the price as the gross price) and to the front-end output so the site calculates the price correctly.

Unless there's a better way of course... ?
Hi Tony :)

Displaying the gross price instead of the price difference is purely a front-end matter and wouldn't require any mod to do so.

As also explained in the docs (http://docs.couchcms.com/concepts/shopp ... g-products), the <cms:pp_option_values> can be instructed not to automatically generate any markup and then we can use our own HTML to show the variants in any manner desired.

Taking the example of the sample code used in the docs, following is the manner we are displaying the variants -
Code: Select all
<cms:pp_product_options >
    <label><cms:show option_name />:</label><br>
    <cms:pp_option_values /><br>
</cms:pp_product_options >

The <cms:pp_option_values /> above is self-closing and this makes it output the default markup for the variants.

Since that markup does not suit us, we can configure the tag to allow us to take over and use our own HTML for display.

Following is the code that you use in place of the code above to output the gross price -
Code: Select all
<cms:pp_product_options >
  <cms:if option_type='list'>
    <cms:if option_modifier='*' || option_modifier='**'>
        <label><cms:show option_name />:</label><br>
        <input type="hidden" name="on<cms:show k_count />" value="<cms:show option_name />" style="display:none;">
        <cms:set radio_input_name="os<cms:show k_count />" />
        <cms:pp_option_values>
            <label class="radio-label">
                <input type="radio" name="<cms:show radio_input_name />" value="<cms:show k_count />"<cms:if k_count='0'> checked="true"</cms:if>>
                <cms:show option_val />
                <cms:if option_price >
                        <cms:set my_price="<cms:if option_price_sign='+'><cms:add pp_price option_price /><cms:else/><cms:sub pp_price option_price /></cms:if>" />
                        [<cms:pp_config 'currency_symbol' /><cms:number_format my_price />]
                    <cms:else />
                        [<cms:pp_config 'currency_symbol' /><cms:number_format pp_price />]
                    </cms:if>
            </label>
            <cms:if option_modifier='*'><br/></cms:if>
        </cms:pp_option_values>
    <cms:else />
        <label><cms:show option_name />:</label><br>
        <input type="hidden" name="on<cms:show k_count />" value="<cms:show option_name />" style="display:none;"> 
        <select name="os<cms:show k_count />">
            <cms:pp_option_values>
                <option value="<cms:show k_count />">
                    <cms:show option_val />
                    <cms:if option_price >
                        <cms:set my_price="<cms:if option_price_sign='+'><cms:add pp_price option_price /><cms:else/><cms:sub pp_price option_price /></cms:if>" />
                        [<cms:pp_config 'currency_symbol' /><cms:number_format my_price />]
                    <cms:else />
                        [<cms:pp_config 'currency_symbol' /><cms:number_format pp_price />]
                    </cms:if>
                </option>
            </cms:pp_option_values>
        </select>
    </cms:if>
  <cms:else />
    <label><cms:show option_name />:</label><br>: 
    <input type="hidden" name="on<cms:show k_count />" value="<cms:show option_name />" style="display:none;">
    <input type="text" name="os<cms:show k_count />" maxlength="200">
  </cms:if> 
</cms:pp_product_options>

Using the custom code above, suppose the variants setting for the item was as follows -
Code: Select all
Size[Large | Medium=+1.2 | Small=-2]*

The original display:
a.png
a.png (3.95 KiB) Viewed 1271 times

- now becomes:
b.png
b.png (4.01 KiB) Viewed 1271 times


Incidentally, that also takes care of the missing trailing zero you mentioned.
Hope it helps.
2 posts Page 1 of 1
cron