Josh
posted this on September 16, 2011 15:11
Hello, we have been using personified for one of our clients stores, but they are displeased with the way that the orders are coming through as they are difficult to read.
Here is an example of how they are coming through at the moment:
3 x Embroidered Collar, Short Medium for $27.00 each
[1 x Embroidered Collar, Short Medium: collarcolour=Purple Collar; embroidcolour=Fluoro Orange Thread; name=JUDY; number=0400481315][1 x Embroidered Collar, Short Medium: collarcolour=Purple Collar; embroidcolour=White Thread; name=MILLIE; number=0413878258][1 x Embroidered Collar, Short Medium: collarcolour=Royal Blue Collar; embroidcolour=White Thread; name=TOMMY; number=0418481315]
Is it possible to format this info by adding a return between each line to something like this?:
3 x Embroidered Collar, Short Medium for $27.00 each
[1 x Embroidered Collar, Short Medium: collarcolour=Purple Collar; embroidcolour=Fluoro Orange Thread; name=JUDY; number=0400481315]
[1 x Embroidered Collar, Short Medium: collarcolour=Purple Collar; embroidcolour=White Thread; name=MILLIE; number=0413878258]
[1 x Embroidered Collar, Short Medium: collarcolour=Royal Blue Collar; embroidcolour=White Thread; name=TOMMY; number=0418481315]
This is the code that records the values on my cart page:
<script id="p9d-row-template" type="text/html">
<tr id="p9d-${ record.variant }-${ record.ts }" class="p9d-record">
<td class="desc">
<p><span class="collarcolour">${ record.values.collarcolour }</span></p>
<p><span class="embroidcolour">${ record.values.embroidcolour }</span></p>
<p><span class="name">${ record.values.name }</span></p>
<p><span class="number">${ record.values.number }</span></p>
</td>
<td>
<input type="text" size="2" id="p9d-update-${ record.variant }-${ record.ts }" value="${ record.qty }" class="p9d-update" />
<a href="#" id="p9d-remove-${ record.ts }" rel="p9d-update-${ record.variant }-${ record.ts }" class="p9d-remove">{{ 'remove.png' | asset_url | img_tag, 'Remove' }}</a>
</td>
<td></td>
<td></td>
</tr>
</script>
Please help! Many thanks.
Comments
Oh and this is the email notification code:
{% for line in line_items %}
{{ line.quantity }} x {{line.title }} for {{ line.price | money }} each {% capture v %}p9d-attr-{{ line.variant.id }}{% endcapture %}
{{ attributes[v] }}
{% endfor %}
Hi Josh,
So here's a trick I use.
1. First, change your formatter to add a HTML newline <br/> to the variant fields (in cart.liquid):
return fields.join(', ') +'<br />';
2. Go to the notification email and enable the HTML version. For the attributes, use the following:
{{ attributes[v] | remove: '[' | remove: ']' | replace: '=', ' = ' }}
Gavin.
Hi Gavin,
Thanks so much for that, it seems perfect. Unfortunately my Javascript skills leave a lot to be desired, I usually manage to wing it with copy and paste! Could you possibly please tell me exactly where to place the line:
return fields.join(', ') +'<br />';
in
<script id="p9d-row-template" type="text/html">
<tr id="p9d-${ record.variant }-${ record.ts }" class="p9d-record">
<td class="desc">
<p><span class="collarcolour">${ record.values.collarcolour }</span></p>
<p><span class="embroidcolour">${ record.values.embroidcolour }</span></p>
<p><span class="name">${ record.values.name }</span></p>
<p><span class="number">${ record.values.number }</span></p>
</td>
<td>
<input type="text" size="2" id="p9d-update-${ record.variant }-${ record.ts }" value="${ record.qty }" class="p9d-update" />
<a href="#" id="p9d-remove-${ record.ts }" rel="p9d-update-${ record.variant }-${ record.ts }" class="p9d-remove">{{ 'remove.png' | asset_url | img_tag, 'Remove' }}</a>
</td>
<td></td>
<td></td>
</tr>
</script>
Sorry for my lack of knowledge!
Hi Josh,
That line is part of the formatter function (in cart.liquid):
Thanks, Gavin.
Hi Gavin,
Thank you for that. Sorry to be a pain, but may i ask you one last thing:
My current formatter code reads:
Do I replace the whole thing or just replace the line:
with
Once again, I apologise for the hassle, I just don't want to break the client's store!
Hi Gavin,
My apologies for harrassing you, but is there any chance you could help me with the above post?
Hi Josh,
Sorry for the delay - thought I'd answered this already.
The code you need to replace is:
Thanks, Gavin.
Awesome, much appreciated, thank you!