- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
New Product Custom Blocks
Happy New Year everyone! Using Magento 2.4.7 p3
Two questions:
1. What is the function of the 2 custom block sections in admin product page?
2. If I remove the Stripe Subscription from Default Attribute Set, how do I get it back to add to other attribute sets?
Thanks for your attention. Wishing you and your families a Joyful, Healthy and Prosperous 2025 and beyond! :=)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: New Product Custom Blocks
1. The Custom Block in you Product Edit come form product Attribute with type Page Builder
This may have been created by the Admin user or an extension you installed.
This attribute does not automatically show in the frontend.
2. If you remove the Stripe Subscription from the Default Attribute Set,
to make it show again:
- Method 1: Create a new file in the StripeIntegration\Payments module.
- Old file
StripeIntegration\Payments\Setup\Patch\Data\InitialInstall
- New file
StripeIntegration\Payments\Setup\Patch\Data\ReInitialInstall
And edit the file to be the ReInitialInstall class.
- Method 2: Create a new file in your custom module and ensure that the StripeIntegration\Payments\Setup\Patch\Data\ReInitialInstall file can be run.
3. Let run
bin/magento se:up
Mageplaza | Top-Rated Magento Extension and Solution Provider
Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: New Product Custom Blocks
Thanks consultant07db for your response.
How do I get the contents in the custom blocks to show on product page in the frontend?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: New Product Custom Blocks
To show it in Product Page
1. Add XML Layout. Update catalog_product_view.xml
<referenceContainer name="content"> <block class="Magento\Catalog\Block\Product\View" name="custom.product.block" template="Magento_Catalog::product/custom-block.phtml"/> </referenceContainer>
2. Create Magento_Catalog/templates/product/custom-block.phtml
<?php
// get Block from Registry of magento $pageBuilderContent = $product->getData('custom_block_attribute_code'); if ($pageBuilderContent): echo $block->getLayout() ->createBlock(\Magento\Cms\Block\Block::class) ->setData('content', $pageBuilderContent) ->toHtml(); endif; ?>
3. If can not get custom_block_attribute_code
$productRepository = \Magento\Framework\App\ObjectManager::getInstance()->get(ProductRepositoryInterface::class); $product = $productRepository->getById($productId); $customBlockContent = $product->getData('custom_block_attribute_code');
Mageplaza | Top-Rated Magento Extension and Solution Provider
Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com