How to create custom variable programatically for template in magento 2 The 2019 Stack Overflow Developer Survey Results Are Insend custom mail with variable via script{{config path variable not visible in custom variablepass custom variable/parameter from email template to phtml fileHow to include a store variable in the definition of a custom variableCustom Variable Plain Value in Email templateEmail template 'custom/mail/template' is not definedHow to add template in Custom Variable HTML Value in magentoHow to Use Custom Variable in Email Template?magento 2 dynamic value not comes in custom email templateMagento 2 add customer group as Email Template variable
Output the Arecibo Message
Why do UK politicians seemingly ignore opinion polls on Brexit?
Is flight data recorder erased after every flight?
Geography at the pixel level
Can someone be penalized for an "unlawful" act if no penalty is specified?
Is there any way to tell whether the shot is going to hit you or not?
Why did Acorn's A3000 have red function keys?
The difference between dialogue marks
Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?
What is the most effective way of iterating a std::vector and why?
Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?
Did 3000BC Egyptians use meteoric iron weapons?
Delete all lines which don't have n characters before delimiter
Pokemon Turn Based battle (Python)
How technical should a Scrum Master be to effectively remove impediments?
Are there incongruent pythagorean triangles with the same perimeter and same area?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Time travel alters history but people keep saying nothing's changed
Is bread bad for ducks?
Deal with toxic manager when you can't quit
Where to refill my bottle in India?
When should I buy a clipper card after flying to OAK?
How to create custom variable programatically for template in magento 2
The 2019 Stack Overflow Developer Survey Results Are Insend custom mail with variable via script{{config path variable not visible in custom variablepass custom variable/parameter from email template to phtml fileHow to include a store variable in the definition of a custom variableCustom Variable Plain Value in Email templateEmail template 'custom/mail/template' is not definedHow to add template in Custom Variable HTML Value in magentoHow to Use Custom Variable in Email Template?magento 2 dynamic value not comes in custom email templateMagento 2 add customer group as Email Template variable
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
With the all searching so far I have found that we can add custom variable using this:
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$model = $objectManager->get('MagentoVariableModelVariable')->loadByCode('custom-variable-code');
$plain_value = $model->getPlainValue();
but I have no idea where to add this and what to do with plain value.
Please let me know how can I create custom variable which I can use in my email template globally. Thanks
magento2 email-templates
add a comment |
With the all searching so far I have found that we can add custom variable using this:
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$model = $objectManager->get('MagentoVariableModelVariable')->loadByCode('custom-variable-code');
$plain_value = $model->getPlainValue();
but I have no idea where to add this and what to do with plain value.
Please let me know how can I create custom variable which I can use in my email template globally. Thanks
magento2 email-templates
add a comment |
With the all searching so far I have found that we can add custom variable using this:
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$model = $objectManager->get('MagentoVariableModelVariable')->loadByCode('custom-variable-code');
$plain_value = $model->getPlainValue();
but I have no idea where to add this and what to do with plain value.
Please let me know how can I create custom variable which I can use in my email template globally. Thanks
magento2 email-templates
With the all searching so far I have found that we can add custom variable using this:
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$model = $objectManager->get('MagentoVariableModelVariable')->loadByCode('custom-variable-code');
$plain_value = $model->getPlainValue();
but I have no idea where to add this and what to do with plain value.
Please let me know how can I create custom variable which I can use in my email template globally. Thanks
magento2 email-templates
magento2 email-templates
edited yesterday
Stack user
asked yesterday
Stack userStack user
1156
1156
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
To add a custom variable, please follow below admin path.
1) Login in to admin.
2) go to SYSTEM -> Custom Variable (under "Other setting").
3) Click "Add New Variable" button.
4) Enter Variable Code,Variable Name,Variable HTML Value
[optional], Variable Plain Value[optional]
5) Click "Save" button.
but I need to achieve this programatically
– Stack user
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
add a comment |
In your custom module use install script to create progrmatically:
use MagentoVariableModelVariableFactory;
class InstallData implements InstallDataInterface
protected $varFActory;
public function __construct(VariableFactory $varFactory)
$this->varFActory = $varFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$variable = $this->varFActory->create();
$data = [
'code' => '',
'name' => '',
'html_value' => '',
'plain_value' => '',
];
$variable->setData($data);
$variable->save();
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%2f269342%2fhow-to-create-custom-variable-programatically-for-template-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To add a custom variable, please follow below admin path.
1) Login in to admin.
2) go to SYSTEM -> Custom Variable (under "Other setting").
3) Click "Add New Variable" button.
4) Enter Variable Code,Variable Name,Variable HTML Value
[optional], Variable Plain Value[optional]
5) Click "Save" button.
but I need to achieve this programatically
– Stack user
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
add a comment |
To add a custom variable, please follow below admin path.
1) Login in to admin.
2) go to SYSTEM -> Custom Variable (under "Other setting").
3) Click "Add New Variable" button.
4) Enter Variable Code,Variable Name,Variable HTML Value
[optional], Variable Plain Value[optional]
5) Click "Save" button.
but I need to achieve this programatically
– Stack user
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
add a comment |
To add a custom variable, please follow below admin path.
1) Login in to admin.
2) go to SYSTEM -> Custom Variable (under "Other setting").
3) Click "Add New Variable" button.
4) Enter Variable Code,Variable Name,Variable HTML Value
[optional], Variable Plain Value[optional]
5) Click "Save" button.
To add a custom variable, please follow below admin path.
1) Login in to admin.
2) go to SYSTEM -> Custom Variable (under "Other setting").
3) Click "Add New Variable" button.
4) Enter Variable Code,Variable Name,Variable HTML Value
[optional], Variable Plain Value[optional]
5) Click "Save" button.
answered yesterday
Pritam Info 24Pritam Info 24
78417
78417
but I need to achieve this programatically
– Stack user
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
add a comment |
but I need to achieve this programatically
– Stack user
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
but I need to achieve this programatically
– Stack user
yesterday
but I need to achieve this programatically
– Stack user
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
you can check this answer to create custom variable programmatically stackoverflow.com/questions/41760331/…
– Pritam Info 24
yesterday
add a comment |
In your custom module use install script to create progrmatically:
use MagentoVariableModelVariableFactory;
class InstallData implements InstallDataInterface
protected $varFActory;
public function __construct(VariableFactory $varFactory)
$this->varFActory = $varFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$variable = $this->varFActory->create();
$data = [
'code' => '',
'name' => '',
'html_value' => '',
'plain_value' => '',
];
$variable->setData($data);
$variable->save();
add a comment |
In your custom module use install script to create progrmatically:
use MagentoVariableModelVariableFactory;
class InstallData implements InstallDataInterface
protected $varFActory;
public function __construct(VariableFactory $varFactory)
$this->varFActory = $varFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$variable = $this->varFActory->create();
$data = [
'code' => '',
'name' => '',
'html_value' => '',
'plain_value' => '',
];
$variable->setData($data);
$variable->save();
add a comment |
In your custom module use install script to create progrmatically:
use MagentoVariableModelVariableFactory;
class InstallData implements InstallDataInterface
protected $varFActory;
public function __construct(VariableFactory $varFactory)
$this->varFActory = $varFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$variable = $this->varFActory->create();
$data = [
'code' => '',
'name' => '',
'html_value' => '',
'plain_value' => '',
];
$variable->setData($data);
$variable->save();
In your custom module use install script to create progrmatically:
use MagentoVariableModelVariableFactory;
class InstallData implements InstallDataInterface
protected $varFActory;
public function __construct(VariableFactory $varFactory)
$this->varFActory = $varFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$variable = $this->varFActory->create();
$data = [
'code' => '',
'name' => '',
'html_value' => '',
'plain_value' => '',
];
$variable->setData($data);
$variable->save();
answered yesterday
Hassan Ali ShahzadHassan Ali Shahzad
734317
734317
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%2f269342%2fhow-to-create-custom-variable-programatically-for-template-in-magento-2%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