Добавление произвольного поля из оформления заказа в накладную

Добрый день, подскажите пожалуйста, в настройках оформления заказа, в контактной информации добавляю новое поле, например - "Серия и номер паспорта", его айди получается - data-field-id="seriya-i-nomer-"

для накладной я использую плагин простая накладная, подскажите какой именно код нужно вставить что бы он выводил данные из поля "Серия и номер паспорта" в накладной.

Спасибо.

7 ответов

  • 1
    Genasyst 11 августа 2016 15:15 #

    в шаблон плагина из данных контакта подставить поле. тк все поля сохраняются в контакте. если бы был у меня плагин, я бы посмотрел.

    • +1
      the_simpler the_simpler 11 августа 2016 15:26 #

      Вот код того что он цепляет из информации контакта

      div id="customer">

      <div id="shipping">

      <h3>{_wp('Consignee')}</h3>

      {if !empty($order.shipping_address.name)}{$name = $order.shipping_address.name}{else}{$name = $order.contact_name}{/if}

      {if !empty($name)}<p class="name">{$name|escape}</p>{/if}

      {if !empty($order->contact_company)}<p class="company">{$order->contact_company|escape}</p>{/if}

      {if !empty($order.shipping_address.address)}{$address = $order.shipping_address.address}{else}{$address = $order.contact_address}{/if}

      {if !empty($address)}<p class="address">{$order.shipping_address.address|escape}</p>{/if}

      {$phone = $order->getContactField('phone', 'html')}

      {if !empty($phone)}<p class="phone">[`Phone`]: <span>{$phone|escape}</span></p>{/if}

      {*if !empty($order.shipping_name)}<p class="method">{_w('Delivery type')}: <span>{$order.shipping_name}</span></p>{/if*}

      </div>

      • +1
        Genasyst Genasyst 11 августа 2016 16:58 #

        Вот почти готово у тебя!!!!

        Если поле в адресе

        {if !empty($order.shipping_address.ТУТ_ID_ПОЛЯ)}

        {$pole_custom = $order.shipping_address.ТУТ_ID_ПОЛЯ}

        {var_dump($pole_custom)}

        {/if}


        Если поле в контакте:

        {if !empty($order.contact_.ТУТ_ID_ПОЛЯ)}

        {$pole_custom = $order.contact_ТУТ_ID_ПОЛЯ}

        {var_dump($pole_custom)}

        {/if}


        Вот так попробуй вывести, id поля это его название в input

        Допустим поле квартира

        <input name="customer_[shipping_address][kvartira]" />

        id - kvartira



        • +1
          the_simpler the_simpler 11 августа 2016 17:37 #
          если добавляю {if !empty($order.contact_.ТУТ_ID_ПОЛЯ)}

          {$pole_custom = $order.contact_ТУТ_ID_ПОЛЯ}

          {var_dump($pole_custom)}

          {/if}

          или

          {if !empty($order.shipping_address.ТУТ_ID_ПОЛЯ)}

          {$pole_custom = $order.shipping_address.ТУТ_ID_ПОЛЯ}

          {var_dump($pole_custom)}

          {/if}

          заменив айди поля то вылазит синтаксическая ошибка(

          • +1
            Genasyst Genasyst 11 августа 2016 17:50 #

            {if !empty($order.contact_ ->.<- ТУТ_ID_ПОЛЯ)}

            {$pole_custom = $order.contact_ТУТ_ID_ПОЛЯ}

            проблема в точке

        • +1
          the_simpler the_simpler 11 августа 2016 17:42 #

          и я верно понял что и тот и тот код в одно место вставлять?

          вот весь исходник без вставленного тобой кода

          <!DOCTYPE html>

          <html>

          {if empty($settings.CURRENCY)}{$settings.CURRENCY = $order.currency}{/if}

          <head>

          <title>{_wp('Invoice')}</title>

          <meta charset="UTF-8">

          <style>{literal}

          body{font-family: "Helvetica Neue", "Liberation Sans", Arial, sans-serif;font-size: 3.7mm}

          h1{font-size: 8mm}

          h2{font-size: 7.5mm}

          #close a {display: inline-block;border: 1px solid #036;padding: 7px 15px;color:firebrick;font-weight:bold;font-size:20px;background-color: #ffeaea;text-decoration:none}

          #close a:hover {color: #777;background-color: #eee;}

          #header:before,#header:after {content: " ";display: table}

          #header:after {clear:both}

          #header h1 {margin-top:0}

          #header h1 small {display: block;font-size: 4.5mm}

          #header .address {font-size: 4.3mm}

          #customer {display:table;width: 100%}

          #shipping,#billing {display:table-cell;width:50%;padding: 1em 2em 1em 0;}

          #shipping p,#billing p {margin: 2mm 0}

          #shipping p.name,#billing p.name {font-weight: bold;font-size: 4.2mm;}

          #shipping p.company,#billing p.company {font-size: 4.2mm;}

          #billing {padding-right: 0;}

          #order-comment {border: 1px solid #333;padding: 0.5em 1em;margin: 0.5em 0;}

          #order-items {margin-top: 2em;position: relative}

          #order-items > table {width: 100%;border-collapse: collapse}

          #order-items > table thead,#order-items > table tbody,#order-items > table tr {border: 1px solid #333;border-collapse: collapse}

          #order-items > table thead {border-bottom: 2px solid black;}

          #order-items > table tbody tr {border-bottom: 1px solid #333;}

          #order-items > table th {background-color: #ddd;padding: 1mm 3mm;}

          #order-items > table td {padding: 1mm 3mm;}

          #order-items > table td[colspan="4"] {border-color: transparent transparent white white;}

          #order-items > table #totals {border: none;border-collapse: collapse;}

          #order-items > table #totals tr,#order-items > table #totals td {border: none;border-collapse: collapse;}

          #order-items > table #total {font-size: 5.9mm;border-top: 2px solid #333;}

          #order-items > table #total .amount {border: 2px solid #333;font-weight: bold;}

          #order-items .quantity,#order-items .price,#order-items .amount {text-align: right;white-space: nowrap;}

          #order-items .name {width: 9cm;}

          #company {float:left;width:50%;}

          #details {float:right}

          #details h2 {margin-top: 0;text-transform: uppercase;}

          #details th {text-align: right;padding-right: 1em;}

          #details table {font-size: 4.3mm;}


          @media print {

          @page {margin: 1cm}

          .no-print {display: none}

          #shipping h3,#billing h3 {background-color: transparent;padding: 0;border-bottom: 2px solid #333}

          }

          @media screen {

          #shipping h3,#billing h3 {background-color: #ddd;padding: 0.5em;}

          }

          {/literal}

          {include file="./css/printform.css" inline}{* <== For compatibilty with previous versions *}

          </style>

          </head>

          <body onload="window.print();">

          <p id="close" align="right" class="no-print">

          <a href="javascript: window.close();">× {_wp("Close")}</a>

          </p>

          <div id="details">

          <p>ОПТ</p>

          <table width="100%" border="1">

          <tr>

          <td>Подарок</td>

          <td>Дозвонились</td>

          <td>Отправляем</td>

          </tr>

          <tr>

          <td> </td>

          <td> </td>

          <td> </td>

          </tr>

          </table>



          <table>

          <tr class="date">

          <th>{_wp('Date')}</th>

          {* @todo Спросить у пользователя или получить автоматом из локали *}

          <td>{$order.datetime|date_format:'Y-m-d'}</td>

          </tr>

          <tr class="order_no">

          <th>{_wp('Order #')}</th>

          <td>{$order.id_str|default:'1234567890'|replace:'#':''}</td>

          </tr>

          </table>

          {$order.params.shipping_name}<br>

          {wa_currency($order.total / 2, $order.currency)}


          </div>

          </div>

          <div id="customer">

          <div id="shipping">

          <h3>{_wp('Consignee')}</h3>

          <div class="field" data-field-id="seriya-i-nomer-"></div>

          {if !empty($order.shipping_address.name)}{$name = $order.shipping_address.name}{else}{$name = $order.contact_name}{/if}

          {if !empty($name)}<p class="name">{$name|escape}</p>{/if}

          {if !empty($order->contact_company)}<p class="company">{$order->contact_company|escape}</p>{/if}

          {if !empty($order.shipping_address.address)}{$address = $order.shipping_address.address}{else}{$address = $order.contact_address}{/if}

          {if !empty($address)}<p class="address">{$order.shipping_address.address|escape}</p>{/if}

          {$phone = $order->getContactField('phone', 'html')}

          {if !empty($phone)}<p class="phone">[`Phone`]: <span>{$phone|escape}</span></p>{/if}

          {*if !empty($order.shipping_name)}<p class="method">{_w('Delivery type')}: <span>{$order.shipping_name}</span></p>{/if*}

          </div>

          </div>

          {if !empty($order.comment)}

          <div id="order-comment">

          {$order.comment|escape}

          </div>

          {/if}

          <div id="order-items">

          <table>

          <thead>

          <tr>

          <th>#</th>

          <th class="description">{_wp('Name')}</th>

          <th>{_wp('Qty')}</th>

          <th>{_wp('Price')}</th>

          <th>{_wp('Amount')}</th>

          </tr>

          </thead>

          <tbody>

          {foreach $order.items as $oi}

          <tr>

          <td class="index">{$oi@index+1}</td>

          <td class="name">{$oi.name|default:" "}{if $oi.sku} ({$oi.sku}){/if}</td>

          <td class="quantity">{$oi.quantity|string_format:"%d"}</td>

          <td class="price">{shop_currency($oi.price, $order.currency, $settings.CURRENCY)}</td>

          <td class="amount">{shop_currency($oi.total, $order.currency, $settings.CURRENCY)}</td>

          </tr>

          {/foreach}

          </tbody>

          <tbody id="totals">

          <tr>

          <td colspan="4">{_wp('Subtotal')}</td>

          <td class="amount">{shop_currency($order.subtotal, $order.currency, $settings.CURRENCY)}</td>

          </tr>

          {if $order.discount > 0}

          <tr>

          <td colspan="4">{_wp('Discount')}</td>

          <td class="amount">−{shop_currency($order.discount, $order.currency, $settings.CURRENCY)}</td>

          </tr>

          {/if}

          {if $order.shipping > 0}

          <tr>

          <td colspan="4">{_wp('Shipping')} {$order.shipping_name|escape}</td>

          <td class="amount">{shop_currency($order.shipping, $order.currency, $settings.CURRENCY)}</td>

          </tr>

          {/if}

          {*if $order.tax > 0*}

          <tr>

          <td colspan="4">{_wp('Tax')}</td>

          <td class="amount">{shop_currency($order.tax, $order.currency, $settings.CURRENCY)}</td>

          </tr>

          {*/if*}

          <tr id="total">

          <td colspan="4">{_wp('Total')}</td>

          <td class="amount">{shop_currency($order.total, $order.currency, $settings.CURRENCY)}</td>

          </tr>

          </tbody>

          </table>

          </div>

          </body>

          </html>

  • 1
    Genasyst 11 августа 2016 17:46 #

    скинь сайт я посмотрю поля и напишу, какое поле надо?

Добавить ответ

Чтобы добавить комментарий, зарегистрируйтесь или войдите