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

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

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?