Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% if cart['shipping'] %}
- {% for line in cart['shipping'] %}
- <tr>
- <td colspan="7">Shipping ({{ line['text'] }})</td>
- <td>US${{ line['money'] }}</td>
- </tr>
- {% endfor %}
- {% endif %}
- <html>
- <body>
- <h3>Order #{{ purchase.number }} was cancelled</h3>
- <p>Order content:</p>
- <table>
- <tr>
- <th>Line</th>
- <th>Item #</th>
- <th>Product Name</th>
- <th>Shipping</th>
- <th>UOM</th>
- <th>Unit Price</th>
- <th>Quantity</th>
- <th>Subtotal</th>
- </tr>
- {% for line in cart['cart'] %}
- <tr>
- <td>{{ line['LineNo'] }}</td>
- <td>{{ line['ItemNo'] }}</td>
- <td>{{ line['ProductName'] }}</td>
- <td>{{ line['Shipping'] }}</td>
- <td>{{ line['UOM'] }}</td>
- <td>US${{ line['UnitPrice'] }}</td>
- <td>{{ line['Quantity'] }}</td>
- <td>US${{ line['Subtotal'] }}</td>
- </tr>
- {% endfor %}
- {% if cart['shipping'] %}
- {% for line in cart['shipping'] %}
- <tr>
- <td colspan="7">Shipping ({{ line['text'] }})</td>
- <td>US${{ line['money'] }}</td>
- </tr>
- {% endfor %}
- {% endif %}
- <tr>
- <td colspan="7"><b>Order Item Total:</b></td>
- <td>US${{ cart['total'] }}</td>
- </tr>
- </table>
- </body>
- </html>
- <h3>Order #{{ purchase.number }} was cancelled</h3>
- <p>Order content:</p>
- {% for line in cart['cart'] %} {% endfor %} {% if cart['shipping'] %} {% for line in cart['shipping'] %} {% endfor %} {% endif %}
- <table>
- <tbody>
- <tr>
- <th>Line</th>
- <th>Item #</th>
- <th>Product Name</th>
- <th>Shipping</th>
- <th>UOM</th>
- <th>Unit Price</th>
- <th>Quantity</th>
- <th>Subtotal</th>
- </tr>
- <tr>
- <td>{{ line['LineNo'] }}</td>
- <td>{{ line['ItemNo'] }}</td>
- <td>{{ line['ProductName'] }}</td>
- <td>{{ line['Shipping'] }}</td>
- <td>{{ line['UOM'] }}</td>
- <td>US${{ line['UnitPrice'] }}</td>
- <td>{{ line['Quantity'] }}</td>
- <td>US${{ line['Subtotal'] }}</td>
- </tr>
- <tr>
- <td colspan="7">Shipping ({{ line['text'] }})</td>
- <td>US${{ line['money'] }}</td>
- </tr>
- <tr>
- <td colspan="7"><b>Order Item Total:</b></td>
- <td>US${{ cart['total'] }}</td>
- </tr>
- </tbody>
- </table>
- {% if cart['shipping'] %}
- {% for line in cart['shipping'] %}
- <tr>
- {% for line in cart['cart'] %} {% endfor %} {% if cart['shipping'] %} {% for line in cart['shipping'] %} {% endfor %} {% endif %}
- CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
- CKEDITOR.config.entities = false;
- CKEDITOR.config.forcePasteAsPlainText = false; // default so content won't be manipulated on load
- CKEDITOR.config.basicEntities = true;
- CKEDITOR.config.entities = true;
- CKEDITOR.config.entities_latin = false;
- CKEDITOR.config.entities_greek = false;
- CKEDITOR.config.entities_processNumerical = false;
- CKEDITOR.config.fillEmptyBlocks = function (element) {
- return true; // DON'T DO ANYTHING!!!!!
- };
- CKEDITOR.config.protectedSource.push(/{%s.+s%}/g);
- CKEDITOR.config.protectedSource.push(/{{s.+s}}/g);
- CKEDITOR.config.protectedSource.push(/{%s.+s%}/g);
- /**
- * Before we persist the data, we need to clean up any twig tags in there as the editor encodes html entities...
- *
- * @param Request $request
- * @param $form
- * @param EmailTemplates $entity
- */
- public function onBeforePersist(Request $request, $form, $entity)
- {
- $template = $entity->getView();
- $re = '/{({|%)([^{}]|(?R))*(}|%)}/';
- preg_match_all($re, $template, $matches, PREG_SET_ORDER, 0);
- // We only want the first element of each match - I don't like closures as a rule on readability grounds, but this is small enough to be ok.
- array_walk($matches,function(&$value) {
- if (array($value)) {
- $value = $value[0];
- }
- });
- // Now do a replace on them
- foreach ($matches as $match) {
- $decoded = html_entity_decode($match,ENT_QUOTES);
- if ($match != $decoded) {
- // Only replace if we have actually changed the string
- $template = str_replace($match, $decoded, $template);
- }
- }
- // Update the View...
- $entity->setView($template);
- }
- CKEDITOR.config.protectedSource = [
- /{{[sS]*?}}/g,
- /{%[sS]*?%}/g,
- /{#[sS]*?#}/g,
- ];
- CKEDITOR.config.entities = false;
- CKEDITOR.config.entities = true;
- CKEDITOR.config.protectedSource.push(/{{[sS]*?}}/g);
- CKEDITOR.config.protectedSource.push(/{%[sS]*?%}/g);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement