Display SKU for Selected Customizable Option

I am trying to display the SKU of a customizable option, I currently have the following code in options.phtml which shows all the SKUs but how can I show the SKU of the selected option?

    $  _product = $  block->getProduct(); foreach ($  _product->getOptions() as $  o) {     foreach ($  o->getValues() as $  value) {         print_r($  value->getData());     } } 

many thanks Richard

Design a SaaS based web system with customizable modules

Currently, in the beginning of designing a SaaS system, that provide web-based systems for tenants.

About the system

There are a set of existing components, each tenant might want different components in their system, and they should be able to customize which components to use & show in their pages.

The customization should be done via an admin page, without development from the tenant.

And, should be able to develop new components (by SaaS provider or tenants), to extend the platform, with minimal effects, based on the common API/Standard.

Current draft design

  • For frontend
    • Create reusable widgets, that each represnt a component for the site.
      (e.g js/css utils)
    • In the admin page, user could choose which widgets to use, and could customize each widget via the params provided by widget.
  • For backend
    • Create each function as a micro-service. (e.g spring-boot applications)
    • Widgets from frontend has callbacks to call these services.
  • For extension components.
    • Wrap underlying resources (e.g data storage), and expose them in a standard way, so that simplify component developer’s work.

The questions are

  • In frontend part, is there a good library or solution to assemble those widgets?
    I only have limited experience with frontend programming (js / css / html), not sure how to do this properly & efficiently.
  • Is there any other ways to achieve the goal of assembling a webpage / website from small widgets / functionalities.
  • Any other suggestion on the design?

Magento 2 – Include Customizable Options in Email Template

I need to include product Customizable Options with price in order email template. For this I have modified the code and added the Customizable Options code. All are showing fine but the Customizable Options is not showing.

Here is my code added in module-sales/view/frontend/templates/email/items.phtml file

<?php $  _order = $  block->getOrder() ?> <?php if ($  _order): ?>     <?php $  _items = $  _order->getAllItems(); ?>     <table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">         <thead>             <tr>                 <th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">                     <?= /* @escapeNotVerified */  __('Items') ?>                 </th>                 <th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">                     <?= /* @escapeNotVerified */  __('SKU') ?>                 </th>                 <th class="item-qty" align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">                     <?= /* @escapeNotVerified */  __('Qty') ?>                 </th>                 <th class="item-price" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">                     <?= /* @escapeNotVerified */  __('Price') ?>                 </th>             </tr>         </thead>         <?php foreach ($  _items as $  _item): ?>             <?php if (!$  _item->getParentItem()) : ?>                 <tbody>         <tr>             <td class="item-info" style="padding:3px 9px;font-size:11px;font-weight:700;"><?= /* @escapeNotVerified */  $  _item->getName() ?>         <?php if ($  block->getItemOptions()): ?>             <dl class="item-options">             <?php foreach ($  block->getItemOptions() as $  option): ?>                 <dt><strong><em><?= /* @escapeNotVerified */  $  option['label'] ?></em></strong></dt>                 <dd>                     <?= /* @escapeNotVerified */  nl2br($  option['value']) ?>                 </dd>             <?php endforeach; ?>             </dl>         <?php endif; ?>         </td>             <td class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */  $  _item->getSku() ?></td>         <td align="center" class="item-info" style="font-size:11px;"><?= /* @escapeNotVerified */  $  _item->getQtyOrdered() ?></td>             <td class="item-info" style="font-size:11px;">Rs: <?= /* @escapeNotVerified */  $  _item->getPrice() ?></td>         </tr>                 </tbody>             <?php endif; ?>         <?php endforeach; ?> <tfoot class="order-totals">   <tr class="subtotal">         <th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">             <?= /* @escapeNotVerified */  __('Subtotal') ?>          </th>         <td>            <span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */  $  _order->getSubtotal() ?></span>          </td>   </tr>   <tr class="shipping">         <th style="padding-right:20px;font-weight:normal;font-size:11px;" align="right" colspan="3" scope="row">            <?= /* @escapeNotVerified */  __('Shipping & Handling') ?>                             </th>         <td>            <span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */  $  _order->getShippingAmount() ?></span>          </td>    </tr>    <tr class="grand_total">         <th style="padding-right:20px;font-size:11px;" align="right" colspan="3" scope="row">             <strong><?= /* @escapeNotVerified */  __('Grant total') ?></strong>         </th>         <td>             <strong><span style="font-size:11px;" class="price">Rs: <?= /* @escapeNotVerified */  $  _order->getGrandTotal() ?></span></strong>         </td>     </tr> </tfoot>     </table>     <?php if ($  this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $  _order, $  _order->getStore()) && $  _order->getGiftMessageId()): ?>         <?php $  _giftMessage = $  this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($  _order->getGiftMessageId()); ?>         <?php if ($  _giftMessage): ?>             <br />             <table class="message-gift">                 <tr>                     <td>                         <h3><?= /* @escapeNotVerified */  __('Gift Message for this Order') ?></h3>                         <strong><?= /* @escapeNotVerified */  __('From:') ?></strong> <?= $  block->escapeHtml($  _giftMessage->getSender()) ?>                         <br /><strong><?= /* @escapeNotVerified */  __('To:') ?></strong> <?= $  block->escapeHtml($  _giftMessage->getRecipient()) ?>                         <br /><strong><?= /* @escapeNotVerified */  __('Message:') ?></strong>                         <br /><?= $  block->escapeHtml($  _giftMessage->getMessage()) ?>                     </td>                 </tr>             </table>         <?php endif; ?>     <?php endif; ?> <?php endif; ?> 

Can anyone let me know what’s the issue and how to include custom options with price in this template.