Forum

Thread tagged as: Shop

Adding fields to product options values?

In the template for product options (perch/templates/shop/products/option.html) is the following block of code:

<!--* Don't change this repeater - it's needed for editing options. *-->
<perch:repeater id="options" label="Values" divider-before="Option values">
    <perch:shop id="title" type="text" label="Option" data-sku="title,skucode,id" />
    <perch:shop id="skucode" type="text" label="SKU code" data-code="1" />
    <perch:shop id="id" type="editcontrol" edit-control="true" />
</perch:repeater>
<!--* / don't change *-->

I was wondering if it would be safe to "add" additional fields to the repeater without touching any of the existing fields, or if it would be unsafe to do so given the "don't change" comments.

My specific use case is that I have an option set for t-shirt colors. I was hoping to add an additional text field to the values repeater so that I can associate a hexidecimal color code, with the Option/SKU. This way, the shirt color radio buttons can be styled with their corresponding hex colors dynamically across multiple products with the client only needing to enter the values in once.

Sorry if this is a mundane question, but I figured I should ask before potentially screwing up the database given the comments in the template.

Cody Sherrod

Cody Sherrod 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think it should be safe to add to it. I can't promise it'll work, but feel free to try.

Well nothing bad happened but I seem to have run in to the same issue that was mentioned in this thread, https://forum.grabaperch.com/forum/05-12-2016-option-image-does-not-save Fields are there but nothing saves. I will look for a workaround.