Static text blocks between simple product's custom options
I like to add static Text fields (output not user input) between simple product's custom options. After long research I could find a proper extension or a solution for this..
The text parts will be different for each product.
custom-options
add a comment |
I like to add static Text fields (output not user input) between simple product's custom options. After long research I could find a proper extension or a solution for this..
The text parts will be different for each product.
custom-options
You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve.
– Fabian Blechschmidt
Aug 18 '13 at 8:24
The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent()))
– user18600
Dec 19 '14 at 1:53
add a comment |
I like to add static Text fields (output not user input) between simple product's custom options. After long research I could find a proper extension or a solution for this..
The text parts will be different for each product.
custom-options
I like to add static Text fields (output not user input) between simple product's custom options. After long research I could find a proper extension or a solution for this..
The text parts will be different for each product.
custom-options
custom-options
edited 10 mins ago
Teja Bhagavan Kollepara
2,94841847
2,94841847
asked Aug 17 '13 at 11:49
stefanstefan
1
1
You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve.
– Fabian Blechschmidt
Aug 18 '13 at 8:24
The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent()))
– user18600
Dec 19 '14 at 1:53
add a comment |
You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve.
– Fabian Blechschmidt
Aug 18 '13 at 8:24
The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent()))
– user18600
Dec 19 '14 at 1:53
You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve.
– Fabian Blechschmidt
Aug 18 '13 at 8:24
You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve.
– Fabian Blechschmidt
Aug 18 '13 at 8:24
The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent()))
– user18600
Dec 19 '14 at 1:53
The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent()))
– user18600
Dec 19 '14 at 1:53
add a comment |
1 Answer
1
active
oldest
votes
I'm not 100% sure what you are trying but if you want a static block per product per custom option you should use the file frontend/base/default/template/catalog/product/view/options.phtml
, copy it to your custom template directory and then add the following code to the bottom (replacing the old code starting from around line 189
<?php foreach($_options as $_option): ?>
<?php
$block_id = "custom_opt_{$_option->getData('product_id')}_{$_option->getData('option_id')}";
$block = Mage::getModel('cms/block')->load($block_id);
if (!is_null($block->getContent())
{
echo $block->getContent();
}
?>
<?php echo $this->getOptionHtml($_option) ?>
<?php endforeach; ?>
</dl>
<?php endif; ?>
Now you can add a static block in the backend with the identifier custom_opt_[product_id]_[custom option id]
which will be displayed above the corresponding custom option
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f6855%2fstatic-text-blocks-between-simple-products-custom-options%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm not 100% sure what you are trying but if you want a static block per product per custom option you should use the file frontend/base/default/template/catalog/product/view/options.phtml
, copy it to your custom template directory and then add the following code to the bottom (replacing the old code starting from around line 189
<?php foreach($_options as $_option): ?>
<?php
$block_id = "custom_opt_{$_option->getData('product_id')}_{$_option->getData('option_id')}";
$block = Mage::getModel('cms/block')->load($block_id);
if (!is_null($block->getContent())
{
echo $block->getContent();
}
?>
<?php echo $this->getOptionHtml($_option) ?>
<?php endforeach; ?>
</dl>
<?php endif; ?>
Now you can add a static block in the backend with the identifier custom_opt_[product_id]_[custom option id]
which will be displayed above the corresponding custom option
add a comment |
I'm not 100% sure what you are trying but if you want a static block per product per custom option you should use the file frontend/base/default/template/catalog/product/view/options.phtml
, copy it to your custom template directory and then add the following code to the bottom (replacing the old code starting from around line 189
<?php foreach($_options as $_option): ?>
<?php
$block_id = "custom_opt_{$_option->getData('product_id')}_{$_option->getData('option_id')}";
$block = Mage::getModel('cms/block')->load($block_id);
if (!is_null($block->getContent())
{
echo $block->getContent();
}
?>
<?php echo $this->getOptionHtml($_option) ?>
<?php endforeach; ?>
</dl>
<?php endif; ?>
Now you can add a static block in the backend with the identifier custom_opt_[product_id]_[custom option id]
which will be displayed above the corresponding custom option
add a comment |
I'm not 100% sure what you are trying but if you want a static block per product per custom option you should use the file frontend/base/default/template/catalog/product/view/options.phtml
, copy it to your custom template directory and then add the following code to the bottom (replacing the old code starting from around line 189
<?php foreach($_options as $_option): ?>
<?php
$block_id = "custom_opt_{$_option->getData('product_id')}_{$_option->getData('option_id')}";
$block = Mage::getModel('cms/block')->load($block_id);
if (!is_null($block->getContent())
{
echo $block->getContent();
}
?>
<?php echo $this->getOptionHtml($_option) ?>
<?php endforeach; ?>
</dl>
<?php endif; ?>
Now you can add a static block in the backend with the identifier custom_opt_[product_id]_[custom option id]
which will be displayed above the corresponding custom option
I'm not 100% sure what you are trying but if you want a static block per product per custom option you should use the file frontend/base/default/template/catalog/product/view/options.phtml
, copy it to your custom template directory and then add the following code to the bottom (replacing the old code starting from around line 189
<?php foreach($_options as $_option): ?>
<?php
$block_id = "custom_opt_{$_option->getData('product_id')}_{$_option->getData('option_id')}";
$block = Mage::getModel('cms/block')->load($block_id);
if (!is_null($block->getContent())
{
echo $block->getContent();
}
?>
<?php echo $this->getOptionHtml($_option) ?>
<?php endforeach; ?>
</dl>
<?php endif; ?>
Now you can add a static block in the backend with the identifier custom_opt_[product_id]_[custom option id]
which will be displayed above the corresponding custom option
answered Aug 18 '13 at 20:58
Sander Mangel♦Sander Mangel
34.7k470137
34.7k470137
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f6855%2fstatic-text-blocks-between-simple-products-custom-options%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve.
– Fabian Blechschmidt
Aug 18 '13 at 8:24
The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent()))
– user18600
Dec 19 '14 at 1:53