We have a module that create quotes that very simaler like create orders from backend, add customer, add product/s by select them so you can see them as a list in the backend before you create the order and submit them.
I tried to add more 2 attributes with price value, I can see them under any product on backend with their value. But when I want to see them in the list on backend I got 0$ instead the value of the attribute.
I added to code :
<strong><?php echo $block->escapeHtml(__('Extra Price 1: ')); ?></strong>
<?php $pricingHelper = $this->helper(\Magento\Framework\Pricing\Helper\Data::class); ?>
<?php echo $pricingHelper->currency($product->getData('price_tier_1'), true, false); ?>
<br />
<strong><?php echo $block->escapeHtml(__('Extra Price 2: ')); ?></strong>
<?php $pricingHelper = $this->helper(\Magento\Framework\Pricing\Helper\Data::class); ?>
<?php echo $pricingHelper->currency($product->getData('price_tier_2'), true, false); ?>
any idea why? suggest to solve it and see the correct value that appear in the product information in the backend?
Thanks!
Here is all the code that i used (phtml) and the js script part that Hamendra Sunthwal suggested, and it still not show up the value in salesrep_approval_tier_1 / salesrep_approval_tier_2 attrbites.
<?php
$item = $block->getItem();
$product = $item->getProduct();
$tierItem = $item->getTierItem();
?>
<?php $block->setPriceDataObject($item->getTierItem()); ?>
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
<?php ?>
<?php if ($block->displayBothPrices()) : ?>
<span class="label"><?php echo $block->escapeHtml(__('Excl. Tax')) ?>:</span>
<?php endif; ?>
<?php echo $block->displayPriceAttribute('original_price'); ?><br /><br />
<strong><?php echo $block->escapeHtml(__('Approval Tier 1: ')); ?></strong>
/** This is the script that I added - but still it is not show me the value in attrbute 'salesrep_approval_tier_1' */
<script type="text/javascript">
require(["jquery"],function($) {
$(document).ready(function() {
var dividprice1= $('salesrep_approval_tier_1').val();
$('salesrep_approval_tier_1').val(dividprice1);
});
});
</script>
/** This is the end of script that I added */
<br />
<strong><?php echo $block->escapeHtml(__('Approval Tier 2: ')); ?></strong>
/** In this soultion - it is show me 0$ instead the value in 'salesrep_approval_tier_2' attribute */
<?php $pricingHelper = $this->helper(\Magento\Framework\Pricing\Helper\Data::class); ?>
<?php echo $pricingHelper->currency($product->getData('salesrep_approval_tier_2'), true, false); ?>
/** This is the end to show 'salesrep_approval_tier_2' attribute */
<?php endif; ?>
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
<?php if ($block->displayBothPrices($block->getStore())) : ?>
<br /><span class="label"><?php echo $block->escapeHtml(__('Incl. Tax')) ?>:</span>
<?php endif; ?>
<?php echo $block->displayPrices(
$block->getBaseOriginalPriceInclTax($tierItem),
$block->getOriginalPriceInclTax($tierItem)
); ?>
<?php endif; ?>
<?php if ($block->getIsSelectedTier() && $product->hasTierPrice() && !empty($product->getTierPrice())) :?>
<a id="quote-view-advanced-pricing-hover" class="quote-view-advanced-pricing-hover">advanced pricing</a>
<div id="quote-view-advanced-pricing" class="quote-view-advanced-pricing" hidden>
<?php echo $block->escapeHtml(__('Advanced Pricing')); ?>
<ul>
<li><?php echo __('Catalog price: %1', $block->formatPrice($product->getPrice())); ?></li>
<?php foreach ($product->getTierPrice() as $advancedPrice) :?>
<li>
<?php echo __(
"Qty %1: %2",
(int)$advancedPrice['price_qty'],
$block->formatPrice($advancedPrice['price'])
); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif;?>