Magento 2.3.1 : how to get custom options html with price variation assigned to it?Magento 2 Custom New Block without moduleMagento after upgrading to 2.2 issue coming while editing productadmin grid not workingHow to get customer gender options Magento 2Magento2: Fatal error: Uncaught Error: Call to a member function setProduct()Removing “category.description” blockMagento 2 Create new “Catalog Input Type for Store Owner” AttributeMsrpPriceCalculator ExceptionCall to a member function getId() on null - module-catalog/Helper/Product.phpMagento 2: sellrapido import product using brandsdistribution

Polar contour plot in Mathematica?

How to render "have ideas above his station" into German

How to use the passive form to say "This flower was watered."

Photoshop older default brushes

Parse a simple key=value config file in C

Representing an indicator function: binary variables and "indicator constraints"

Airline power sockets shut down when I plug my computer in. How can I avoid that?

Adding things to bunches of things vs multiplication

Build a mob of suspiciously happy lenny faces ( ͡° ͜ʖ ͡°)

Why was ramjet fuel used as hydraulic fluid during Saturn V checkout?

What would cause a nuclear power plant to break down after 2000 years, but not sooner?

Unconventional examples of mathematical modelling

Designing a prison for a telekinetic race

Combinatorial Argument for Exponential and Logarithmic Function Being Inverse

What's the relationship betweeen MS-DOS and XENIX?

Ending a line of dialogue with "?!": Allowed or obnoxious?

Are unaudited server logs admissible in a court of law?

Why can't I see 1861 / 1871 census entries on Freecen website when I can see them on Ancestry website?

Tikz: The position of a label change step-wise and not in a continuous way

Unsolved Problems due to Lack of Computational Power

Heyawacky: Ace of Cups

Is it alright to say good afternoon Sirs and Madams in a panel interview?

How do I answer an interview question about how to handle a hard deadline I won't be able to meet?

Eric Andre had a dream



Magento 2.3.1 : how to get custom options html with price variation assigned to it?


Magento 2 Custom New Block without moduleMagento after upgrading to 2.2 issue coming while editing productadmin grid not workingHow to get customer gender options Magento 2Magento2: Fatal error: Uncaught Error: Call to a member function setProduct()Removing “category.description” blockMagento 2 Create new “Catalog Input Type for Store Owner” AttributeMsrpPriceCalculator ExceptionCall to a member function getId() on null - module-catalog/Helper/Product.phpMagento 2: sellrapido import product using brandsdistribution






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1
















I tried with this code




public function getCustomOptionsHtml($product)


$_product = $this->_objectManager->create('MagentoCatalogModelProduct')->load($product);
$layout = $this->layoutFactory->create();

$blockOptionData = $layout->createBlock("MagentoCatalogBlockProductViewOptions")->setProduct($_product)->setTemplate('Magento_Catalog::product/view/options.phtml');

$block_links1 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDefaultType', 'default')->setTemplate('Magento_Catalog::product/view/options/type/default.phtml');
$blockOptionData->setChild('default', $block_links1);


$option_price_renderer_block = $layout
->createBlock(
"MagentoFrameworkPricingRender", "product.price.render.default", [
'data' => [
'price_render_handle' => 'catalog_product_prices',
'use_link_for_as_low_as' => 'false'
]
]
)
->setData('area', 'frontend');

$option_price_renderer_block->setProduct($_product);
$blockOptionData->setChild('product.price.render.default', $option_price_renderer_block);


$block_links2 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeText', 'text')->setTemplate('Magento_Catalog::product/view/options/type/text.phtml');
$blockOptionData->setChild('text', $block_links2);


$block_links3 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeFile', 'file')->setTemplate('Magento_Catalog::product/view/options/type/file.phtml');
$blockOptionData->setChild('file', $block_links3);

$block_links4 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeSelect', 'select')->setTemplate('Magento_Catalog::product/view/options/type/select.phtml');
$blockOptionData->setChild('select', $block_links4);

$block_links5 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDate', 'date')->setTemplate('Magento_Catalog::product/view/options/type/date.phtml');
$blockOptionData->setChild('date', $block_links5);

return $blockOptionData->toHtml();






show error like this




Fatal error: Uncaught Error: Call to a member function renderAmount()
on boolean in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php:161
Stack trace:
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(95):
MagentoCatalogBlockProductViewOptionsAbstractOptions->_formatPrice(Array,
false)
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(43):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->processSelectOption(Object(MagentoFrameworkViewElementHtmlSelect),
Object(MagentoCatalogModelProductOption))
/home/manishm/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select.php(79):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->_toHtml()
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/view/frontend/templates/product/view/options/type/select.phtml(21):
Magento in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php
on line 161












share|improve this question





















  • 1





    In Magento 2.3 working fine.

    – Manish Maheshwari
    Aug 6 at 8:38











  • In Magento 2.3.0 working fine. but not working in 2.3.1 & 2.3.2

    – Divyesh Rana
    Aug 6 at 9:20

















1
















I tried with this code




public function getCustomOptionsHtml($product)


$_product = $this->_objectManager->create('MagentoCatalogModelProduct')->load($product);
$layout = $this->layoutFactory->create();

$blockOptionData = $layout->createBlock("MagentoCatalogBlockProductViewOptions")->setProduct($_product)->setTemplate('Magento_Catalog::product/view/options.phtml');

$block_links1 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDefaultType', 'default')->setTemplate('Magento_Catalog::product/view/options/type/default.phtml');
$blockOptionData->setChild('default', $block_links1);


$option_price_renderer_block = $layout
->createBlock(
"MagentoFrameworkPricingRender", "product.price.render.default", [
'data' => [
'price_render_handle' => 'catalog_product_prices',
'use_link_for_as_low_as' => 'false'
]
]
)
->setData('area', 'frontend');

$option_price_renderer_block->setProduct($_product);
$blockOptionData->setChild('product.price.render.default', $option_price_renderer_block);


$block_links2 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeText', 'text')->setTemplate('Magento_Catalog::product/view/options/type/text.phtml');
$blockOptionData->setChild('text', $block_links2);


$block_links3 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeFile', 'file')->setTemplate('Magento_Catalog::product/view/options/type/file.phtml');
$blockOptionData->setChild('file', $block_links3);

$block_links4 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeSelect', 'select')->setTemplate('Magento_Catalog::product/view/options/type/select.phtml');
$blockOptionData->setChild('select', $block_links4);

$block_links5 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDate', 'date')->setTemplate('Magento_Catalog::product/view/options/type/date.phtml');
$blockOptionData->setChild('date', $block_links5);

return $blockOptionData->toHtml();






show error like this




Fatal error: Uncaught Error: Call to a member function renderAmount()
on boolean in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php:161
Stack trace:
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(95):
MagentoCatalogBlockProductViewOptionsAbstractOptions->_formatPrice(Array,
false)
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(43):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->processSelectOption(Object(MagentoFrameworkViewElementHtmlSelect),
Object(MagentoCatalogModelProductOption))
/home/manishm/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select.php(79):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->_toHtml()
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/view/frontend/templates/product/view/options/type/select.phtml(21):
Magento in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php
on line 161












share|improve this question





















  • 1





    In Magento 2.3 working fine.

    – Manish Maheshwari
    Aug 6 at 8:38











  • In Magento 2.3.0 working fine. but not working in 2.3.1 & 2.3.2

    – Divyesh Rana
    Aug 6 at 9:20













1












1








1


1







I tried with this code




public function getCustomOptionsHtml($product)


$_product = $this->_objectManager->create('MagentoCatalogModelProduct')->load($product);
$layout = $this->layoutFactory->create();

$blockOptionData = $layout->createBlock("MagentoCatalogBlockProductViewOptions")->setProduct($_product)->setTemplate('Magento_Catalog::product/view/options.phtml');

$block_links1 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDefaultType', 'default')->setTemplate('Magento_Catalog::product/view/options/type/default.phtml');
$blockOptionData->setChild('default', $block_links1);


$option_price_renderer_block = $layout
->createBlock(
"MagentoFrameworkPricingRender", "product.price.render.default", [
'data' => [
'price_render_handle' => 'catalog_product_prices',
'use_link_for_as_low_as' => 'false'
]
]
)
->setData('area', 'frontend');

$option_price_renderer_block->setProduct($_product);
$blockOptionData->setChild('product.price.render.default', $option_price_renderer_block);


$block_links2 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeText', 'text')->setTemplate('Magento_Catalog::product/view/options/type/text.phtml');
$blockOptionData->setChild('text', $block_links2);


$block_links3 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeFile', 'file')->setTemplate('Magento_Catalog::product/view/options/type/file.phtml');
$blockOptionData->setChild('file', $block_links3);

$block_links4 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeSelect', 'select')->setTemplate('Magento_Catalog::product/view/options/type/select.phtml');
$blockOptionData->setChild('select', $block_links4);

$block_links5 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDate', 'date')->setTemplate('Magento_Catalog::product/view/options/type/date.phtml');
$blockOptionData->setChild('date', $block_links5);

return $blockOptionData->toHtml();






show error like this




Fatal error: Uncaught Error: Call to a member function renderAmount()
on boolean in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php:161
Stack trace:
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(95):
MagentoCatalogBlockProductViewOptionsAbstractOptions->_formatPrice(Array,
false)
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(43):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->processSelectOption(Object(MagentoFrameworkViewElementHtmlSelect),
Object(MagentoCatalogModelProductOption))
/home/manishm/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select.php(79):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->_toHtml()
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/view/frontend/templates/product/view/options/type/select.phtml(21):
Magento in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php
on line 161












share|improve this question

















I tried with this code




public function getCustomOptionsHtml($product)


$_product = $this->_objectManager->create('MagentoCatalogModelProduct')->load($product);
$layout = $this->layoutFactory->create();

$blockOptionData = $layout->createBlock("MagentoCatalogBlockProductViewOptions")->setProduct($_product)->setTemplate('Magento_Catalog::product/view/options.phtml');

$block_links1 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDefaultType', 'default')->setTemplate('Magento_Catalog::product/view/options/type/default.phtml');
$blockOptionData->setChild('default', $block_links1);


$option_price_renderer_block = $layout
->createBlock(
"MagentoFrameworkPricingRender", "product.price.render.default", [
'data' => [
'price_render_handle' => 'catalog_product_prices',
'use_link_for_as_low_as' => 'false'
]
]
)
->setData('area', 'frontend');

$option_price_renderer_block->setProduct($_product);
$blockOptionData->setChild('product.price.render.default', $option_price_renderer_block);


$block_links2 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeText', 'text')->setTemplate('Magento_Catalog::product/view/options/type/text.phtml');
$blockOptionData->setChild('text', $block_links2);


$block_links3 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeFile', 'file')->setTemplate('Magento_Catalog::product/view/options/type/file.phtml');
$blockOptionData->setChild('file', $block_links3);

$block_links4 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeSelect', 'select')->setTemplate('Magento_Catalog::product/view/options/type/select.phtml');
$blockOptionData->setChild('select', $block_links4);

$block_links5 = $layout->createBlock('MagentoCatalogBlockProductViewOptionsTypeDate', 'date')->setTemplate('Magento_Catalog::product/view/options/type/date.phtml');
$blockOptionData->setChild('date', $block_links5);

return $blockOptionData->toHtml();






show error like this




Fatal error: Uncaught Error: Call to a member function renderAmount()
on boolean in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php:161
Stack trace:
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(95):
MagentoCatalogBlockProductViewOptionsAbstractOptions->_formatPrice(Array,
false)
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select/Multiple.php(43):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->processSelectOption(Object(MagentoFrameworkViewElementHtmlSelect),
Object(MagentoCatalogModelProductOption))
/home/manishm/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/Type/Select.php(79):
MagentoCatalogBlockProductViewOptionsTypeSelectMultiple->_toHtml()
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/view/frontend/templates/product/view/options/type/select.phtml(21):
Magento in
/home/userdrive/www/magentoproject/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php
on line 161









magento2 magento2.3.2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 6 at 9:11









Manish Maheshwari

17613 bronze badges




17613 bronze badges










asked Aug 6 at 7:00









Divyesh RanaDivyesh Rana

388 bronze badges




388 bronze badges










  • 1





    In Magento 2.3 working fine.

    – Manish Maheshwari
    Aug 6 at 8:38











  • In Magento 2.3.0 working fine. but not working in 2.3.1 & 2.3.2

    – Divyesh Rana
    Aug 6 at 9:20












  • 1





    In Magento 2.3 working fine.

    – Manish Maheshwari
    Aug 6 at 8:38











  • In Magento 2.3.0 working fine. but not working in 2.3.1 & 2.3.2

    – Divyesh Rana
    Aug 6 at 9:20







1




1





In Magento 2.3 working fine.

– Manish Maheshwari
Aug 6 at 8:38





In Magento 2.3 working fine.

– Manish Maheshwari
Aug 6 at 8:38













In Magento 2.3.0 working fine. but not working in 2.3.1 & 2.3.2

– Divyesh Rana
Aug 6 at 9:20





In Magento 2.3.0 working fine. but not working in 2.3.1 & 2.3.2

– Divyesh Rana
Aug 6 at 9:20










0






active

oldest

votes














Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284523%2fmagento-2-3-1-how-to-get-custom-options-html-with-price-variation-assigned-to%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284523%2fmagento-2-3-1-how-to-get-custom-options-html-with-price-variation-assigned-to%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form