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?
What effect does the “loading” weapon property have in practical terms?
What tool would a Roman-age civilization have to grind silver and other metals into dust?
Why isn't airport relocation done gradually?
What is the use of option -o in the useradd command?
On the insanity of kings as an argument against monarchy
Extreme, unacceptable situation and I can't attend work tomorrow morning
What does "rabbited" mean/imply in this sentence?
Is bread bad for ducks?
Falsification in Math vs Science
Where to refill my bottle in India?
Output the Arecibo Message
How long do I have to send payment?
Unbreakable Formation vs. Cry of the Carnarium
Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?
Does a dangling wire really electrocute me if I'm standing in water?
aging parents with no investments
Why did Howard Stark use all the Vibranium they had on a prototype shield?
Realistic Alternatives to Dust: What Else Could Feed a Plankton Bloom?
Is it possible for the two major parties in the UK to form a coalition with each other instead of a much smaller party?
How to manage monthly salary
What is the steepest angle that a canal can be traversable without locks?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
A poker game description that does not feel gimmicky
Manuscript was "unsubmitted" because the manuscript was deposited in Arxiv Preprints
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 5 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