cancel
Showing results for 
Search instead for 
Did you mean: 

Magento2 update price in admin panel

Magento2 update price in admin panel

Hi, I have a problem in magento 2.3.4. Well, I have created a new product type and I am handling it while ordering from user side and everything is working fine. However, when I try to place an order from the admin panel, when I select a product and choose its option, I get information that optionsPrice is not defined. I created a js file for it based on configurable.js from Magento/ConfigurableProduct

 

In the .phtml I have:

 

<script>
require([
"Vendor_Product/js/type",
"Magento_Catalog/catalog/product/composite/configure"
], function(){
var config = <?= /* @noEscape */ $block->getJsonConfig() ?>;
if (window.productConfigure) {
config.containerId = window.productConfigure.blockFormFields.id;
if (window.productConfigure.restorePhase) {
config.inputsInitialized = true;
}
}
ProductConfigure.spConfig = new Product.Config(config;)
});
</script>.


And the moment where it gets off to me is this:

 

optionsPrice.changePrice(
'config', {
'price': 'price',
'oldPrice': 'oldPrice',
'inclTaxPrice': 'inclTaxPrice',
'exclTaxPrice': 'exclTaxPrice'
}
);
optionsPrice.reload();


Does anyone have any ideas? I have the whole thing based on ConfigurableProduct so I think it should work this optionsPrice but unfortunately it doesn't. In the js itself it is defined like this: /* global Product, optionsPrice */.