How to duplicate sales rule programmatically in Magento2 The 2019 Stack Overflow Developer...
How to make payment on the internet without leaving a money trail?
Why is the maximum length of OpenWrt’s root password 8 characters?
How to change the limits of integration
How to manage monthly salary
Lethal sonic weapons
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Why did Howard Stark use all the Vibranium they had on a prototype shield?
JSON.serialize: is it possible to suppress null values of a map?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Understanding the implication of what "well-defined" means for the operation in quotient group
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Patience, young "Padovan"
"To split hairs" vs "To be pedantic"
How are circuits which use complex ICs normally simulated?
What is the meaning of Triage in Cybersec world?
Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?
Output the Arecibo Message
How can I create a character who can assume the widest possible range of creature sizes?
Deadlock Graph and Interpretation, solution to avoid
Where to refill my bottle in India?
Does a dangling wire really electrocute me if I'm standing in water?
Is domain driven design an anti-SQL pattern?
Can't find the latex code for the ⍎ (down tack jot) symbol
"What time...?" or "At what time...?" - what is more grammatically correct?
How to duplicate sales rule programmatically in Magento2
The 2019 Stack Overflow Developer Survey Results Are Inproblem with configurable productsHow to create sales rule programmatically in Magento2Magento 2.x default setup with custom extensionHow to set default value in config.xml file for tables in Magento2 backend system configurationWhy save and duplicate completely messes up the product URL?Sales Order Grid Custom Field value not savedMagento 2 - Removing swatches.css from themeUpdate Product programmatically - Invalid method MagentoEavModelEntityAttribute::isScopeGlobalPrivate Function rewrite in magento2How to check “Save & continue” button is pressed in observer Magento 2?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Im try to duplicate some salesrule exist, i can duplicate this, but i can't use setConditionsSerialized and setActionsSerialized with getCondition and getActionCondition, its dont working
$id = 1;
$getRule = $this->_ruleRepostitory->getById($id);
$ruleModel = $this->_ruleFactory->create();
$Default = 'ABCZXC';
$randomNumber = random_int(000, 999);
$ruleModel->setName($getRule->getName())
->setDescription($getRule->getDescription())
->setCouponType(2)
->setConditionsSerialized(json_encode($getRule->getCondition()))
->setActionsSerialized(json_encode($getRule->getActionCondition()))
->setCouponCode($random = $Default . " - " . $randomNumber)
->setFromDate($getRule->getFromDate())
->setToDate($getRule->getFromDate())
->setUsesPerCustomer($getRule->getUsesPerCustomer())
->setCustomerGroupIds($getRule->getCustomerGroupIds())
->setIsActive($getRule->getIsActive())
->setStopRulesProcessing($getRule->getStopRulesProcessing())
->setIsAdvanced($getRule->getIsAdvanced())
->setProductIds($getRule->getProductIds())
->setSortOrder($getRule->getSortOrder())
->setSimpleAction($getRule->getSimpleAction())
->setDiscountAmount($getRule->getDiscountAmount())
->setDiscountQty($getRule->getDiscountQty())
->setDiscountStep($getRule->getDiscountStep())
->setSimpleFreeShipping($getRule->getSimpleFreeShipping())
->setApplyToShipping($getRule->getApplyToShipping())
->setTimesUsed($getRule->getTimesUsed())
->setIsRss($getRule->getIsRss())
->setWebsiteIds($getRule->getWebsiteIds())
->setUsesPerCoupon($getRule->getUsesPerCoupon());
$ruleModel->save();
magento2
add a comment |
Im try to duplicate some salesrule exist, i can duplicate this, but i can't use setConditionsSerialized and setActionsSerialized with getCondition and getActionCondition, its dont working
$id = 1;
$getRule = $this->_ruleRepostitory->getById($id);
$ruleModel = $this->_ruleFactory->create();
$Default = 'ABCZXC';
$randomNumber = random_int(000, 999);
$ruleModel->setName($getRule->getName())
->setDescription($getRule->getDescription())
->setCouponType(2)
->setConditionsSerialized(json_encode($getRule->getCondition()))
->setActionsSerialized(json_encode($getRule->getActionCondition()))
->setCouponCode($random = $Default . " - " . $randomNumber)
->setFromDate($getRule->getFromDate())
->setToDate($getRule->getFromDate())
->setUsesPerCustomer($getRule->getUsesPerCustomer())
->setCustomerGroupIds($getRule->getCustomerGroupIds())
->setIsActive($getRule->getIsActive())
->setStopRulesProcessing($getRule->getStopRulesProcessing())
->setIsAdvanced($getRule->getIsAdvanced())
->setProductIds($getRule->getProductIds())
->setSortOrder($getRule->getSortOrder())
->setSimpleAction($getRule->getSimpleAction())
->setDiscountAmount($getRule->getDiscountAmount())
->setDiscountQty($getRule->getDiscountQty())
->setDiscountStep($getRule->getDiscountStep())
->setSimpleFreeShipping($getRule->getSimpleFreeShipping())
->setApplyToShipping($getRule->getApplyToShipping())
->setTimesUsed($getRule->getTimesUsed())
->setIsRss($getRule->getIsRss())
->setWebsiteIds($getRule->getWebsiteIds())
->setUsesPerCoupon($getRule->getUsesPerCoupon());
$ruleModel->save();
magento2
add a comment |
Im try to duplicate some salesrule exist, i can duplicate this, but i can't use setConditionsSerialized and setActionsSerialized with getCondition and getActionCondition, its dont working
$id = 1;
$getRule = $this->_ruleRepostitory->getById($id);
$ruleModel = $this->_ruleFactory->create();
$Default = 'ABCZXC';
$randomNumber = random_int(000, 999);
$ruleModel->setName($getRule->getName())
->setDescription($getRule->getDescription())
->setCouponType(2)
->setConditionsSerialized(json_encode($getRule->getCondition()))
->setActionsSerialized(json_encode($getRule->getActionCondition()))
->setCouponCode($random = $Default . " - " . $randomNumber)
->setFromDate($getRule->getFromDate())
->setToDate($getRule->getFromDate())
->setUsesPerCustomer($getRule->getUsesPerCustomer())
->setCustomerGroupIds($getRule->getCustomerGroupIds())
->setIsActive($getRule->getIsActive())
->setStopRulesProcessing($getRule->getStopRulesProcessing())
->setIsAdvanced($getRule->getIsAdvanced())
->setProductIds($getRule->getProductIds())
->setSortOrder($getRule->getSortOrder())
->setSimpleAction($getRule->getSimpleAction())
->setDiscountAmount($getRule->getDiscountAmount())
->setDiscountQty($getRule->getDiscountQty())
->setDiscountStep($getRule->getDiscountStep())
->setSimpleFreeShipping($getRule->getSimpleFreeShipping())
->setApplyToShipping($getRule->getApplyToShipping())
->setTimesUsed($getRule->getTimesUsed())
->setIsRss($getRule->getIsRss())
->setWebsiteIds($getRule->getWebsiteIds())
->setUsesPerCoupon($getRule->getUsesPerCoupon());
$ruleModel->save();
magento2
Im try to duplicate some salesrule exist, i can duplicate this, but i can't use setConditionsSerialized and setActionsSerialized with getCondition and getActionCondition, its dont working
$id = 1;
$getRule = $this->_ruleRepostitory->getById($id);
$ruleModel = $this->_ruleFactory->create();
$Default = 'ABCZXC';
$randomNumber = random_int(000, 999);
$ruleModel->setName($getRule->getName())
->setDescription($getRule->getDescription())
->setCouponType(2)
->setConditionsSerialized(json_encode($getRule->getCondition()))
->setActionsSerialized(json_encode($getRule->getActionCondition()))
->setCouponCode($random = $Default . " - " . $randomNumber)
->setFromDate($getRule->getFromDate())
->setToDate($getRule->getFromDate())
->setUsesPerCustomer($getRule->getUsesPerCustomer())
->setCustomerGroupIds($getRule->getCustomerGroupIds())
->setIsActive($getRule->getIsActive())
->setStopRulesProcessing($getRule->getStopRulesProcessing())
->setIsAdvanced($getRule->getIsAdvanced())
->setProductIds($getRule->getProductIds())
->setSortOrder($getRule->getSortOrder())
->setSimpleAction($getRule->getSimpleAction())
->setDiscountAmount($getRule->getDiscountAmount())
->setDiscountQty($getRule->getDiscountQty())
->setDiscountStep($getRule->getDiscountStep())
->setSimpleFreeShipping($getRule->getSimpleFreeShipping())
->setApplyToShipping($getRule->getApplyToShipping())
->setTimesUsed($getRule->getTimesUsed())
->setIsRss($getRule->getIsRss())
->setWebsiteIds($getRule->getWebsiteIds())
->setUsesPerCoupon($getRule->getUsesPerCoupon());
$ruleModel->save();
magento2
magento2
asked 7 mins ago
wightmanwightman
11
11
add a comment |
add a comment |
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
});
}
});
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%2f269442%2fhow-to-duplicate-sales-rule-programmatically-in-magento2%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
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%2f269442%2fhow-to-duplicate-sales-rule-programmatically-in-magento2%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