How to apply Coupon on the Specific Products in Magento 2?Discount coupon is not working for minimum subtotalMagento model extension experiment, return: “class does not exist”Is the salesrule_coupon “expiration_date” field used for anything?Doesn't apply coupon on the already discount productsMagento 2.1 Create a filter in the product grid by new attributeHow to apply coupon code if specific products are available on the cart?Magento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.2.5 Mysql add a coupon cart rule to customers accountApply discount on specific product using coupon Magento2Set Coupen for specific Products. Magento 2
Can I ask the recruiters in my resume to put the reason why I am rejected?
What's the point of deactivating Num Lock on login screens?
Perform and show arithmetic with LuaLaTeX
Do I have a twin with permutated remainders?
Unable to deploy metadata from Partner Developer scratch org because of extra fields
Malformed Address '10.10.21.08/24', must be X.X.X.X/NN or
How to determine what difficulty is right for the game?
Important Resources for Dark Age Civilizations?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Cross compiling for RPi - error while loading shared libraries
Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?
Convert two switches to a dual stack, and add outlet - possible here?
How much of data wrangling is a data scientist's job?
LaTeX: Why are digits allowed in environments, but forbidden in commands?
A case of the sniffles
What's the output of a record needle playing an out-of-speed record
A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?
Add text to same line using sed
High voltage LED indicator 40-1000 VDC without additional power supply
How do I deal with an unproductive colleague in a small company?
Has there ever been an airliner design involving reducing generator load by installing solar panels?
Do infinite dimensional systems make sense?
What is the word for reserving something for yourself before others do?
Watching something be written to a file live with tail
How to apply Coupon on the Specific Products in Magento 2?
Discount coupon is not working for minimum subtotalMagento model extension experiment, return: “class does not exist”Is the salesrule_coupon “expiration_date” field used for anything?Doesn't apply coupon on the already discount productsMagento 2.1 Create a filter in the product grid by new attributeHow to apply coupon code if specific products are available on the cart?Magento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.2.5 Mysql add a coupon cart rule to customers accountApply discount on specific product using coupon Magento2Set Coupen for specific Products. Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to apply the coupon on the specific product I tried:
use MagentoSalesRuleModelRule;
public function __construct(
MagentoFrameworkAppHelperContext $helpercontext,
Rule $rule,
)
$this->_rule = $rule;
parent::__construct($helpercontext);
public function setCoupon()
// $this->_state->setAreaCode('adminhtml');
// $this->_state->setAreaCode('frontend');
$coupon['name'] = 'Offer_asad2';
$coupon['desc'] = 'Discount for vip signup coupon.';
$coupon['start'] = date('Y-m-d');
$coupon['end'] = '';
$coupon['max_redemptions'] = 1;
$coupon['discount_type'] ='by_fixed';
$coupon['discount_amount'] = 15;
$coupon['flag_is_free_shipping'] = 'no';
$coupon['redemptions'] = 1;
$coupon['code'] ='NL04-1234'; //this code will normally be autogenerated but i am hard coding for testing purposes
$this->_rule->setName($coupon['name'])
->setDescription($coupon['desc'])
->setFromDate($coupon['start'])
->setToDate($coupon['end'])
->setUsesPerCustomer($coupon['max_redemptions'])
->setCustomerGroupIds(array('0','1','2','3',))
->setIsActive(1)
->setSimpleAction($coupon['discount_type'])
->setDiscountAmount($coupon['discount_amount'])
->setDiscountQty(1)
->setApplyToShipping($coupon['flag_is_free_shipping'])
->setTimesUsed($coupon['redemptions'])
->setWebsiteIds(array('1'))
->setCouponType(2)
// ->setProductIds(array(1,2,3))
// ->setProductIds(array('1','2','3'))
->setProductIds(1)
->setCouponCode($coupon['code'])
->setUsesPerCoupon(NULL);
$this->_rule->save();
Now the issue is this code is applying on every single product->setProductIds(array(1,2,3))
and ->setProductIds(array('1','2','3'))
but this is not working for me,
How can I apply the I set the coupon for the specific products?
magento2 programmatically coupon helper
|
show 4 more comments
I want to apply the coupon on the specific product I tried:
use MagentoSalesRuleModelRule;
public function __construct(
MagentoFrameworkAppHelperContext $helpercontext,
Rule $rule,
)
$this->_rule = $rule;
parent::__construct($helpercontext);
public function setCoupon()
// $this->_state->setAreaCode('adminhtml');
// $this->_state->setAreaCode('frontend');
$coupon['name'] = 'Offer_asad2';
$coupon['desc'] = 'Discount for vip signup coupon.';
$coupon['start'] = date('Y-m-d');
$coupon['end'] = '';
$coupon['max_redemptions'] = 1;
$coupon['discount_type'] ='by_fixed';
$coupon['discount_amount'] = 15;
$coupon['flag_is_free_shipping'] = 'no';
$coupon['redemptions'] = 1;
$coupon['code'] ='NL04-1234'; //this code will normally be autogenerated but i am hard coding for testing purposes
$this->_rule->setName($coupon['name'])
->setDescription($coupon['desc'])
->setFromDate($coupon['start'])
->setToDate($coupon['end'])
->setUsesPerCustomer($coupon['max_redemptions'])
->setCustomerGroupIds(array('0','1','2','3',))
->setIsActive(1)
->setSimpleAction($coupon['discount_type'])
->setDiscountAmount($coupon['discount_amount'])
->setDiscountQty(1)
->setApplyToShipping($coupon['flag_is_free_shipping'])
->setTimesUsed($coupon['redemptions'])
->setWebsiteIds(array('1'))
->setCouponType(2)
// ->setProductIds(array(1,2,3))
// ->setProductIds(array('1','2','3'))
->setProductIds(1)
->setCouponCode($coupon['code'])
->setUsesPerCoupon(NULL);
$this->_rule->save();
Now the issue is this code is applying on every single product->setProductIds(array(1,2,3))
and ->setProductIds(array('1','2','3'))
but this is not working for me,
How can I apply the I set the coupon for the specific products?
magento2 programmatically coupon helper
usesetProductId
, without 's'
– magefms
Mar 15 at 12:12
you use it for one specific product but for more (array of)product, you use with 's'.
– magefms
Mar 15 at 12:29
Yeah at the above scenario its I write it setProductIds n I pass the single product value but at that scenario it not gives me any error but in other cases as I mention above giver me an error Array to String how can I solve this?
– Asad Khan
Mar 15 at 13:06
ahh okay, you have to put it inside bracket to indicate it as an array like this: setProductIds([1, 2, 3])
– magefms
Mar 15 at 13:22
Sir Still have the same Problem Notice: Array to string conversion in /home2/mako/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
– Asad Khan
Mar 15 at 15:09
|
show 4 more comments
I want to apply the coupon on the specific product I tried:
use MagentoSalesRuleModelRule;
public function __construct(
MagentoFrameworkAppHelperContext $helpercontext,
Rule $rule,
)
$this->_rule = $rule;
parent::__construct($helpercontext);
public function setCoupon()
// $this->_state->setAreaCode('adminhtml');
// $this->_state->setAreaCode('frontend');
$coupon['name'] = 'Offer_asad2';
$coupon['desc'] = 'Discount for vip signup coupon.';
$coupon['start'] = date('Y-m-d');
$coupon['end'] = '';
$coupon['max_redemptions'] = 1;
$coupon['discount_type'] ='by_fixed';
$coupon['discount_amount'] = 15;
$coupon['flag_is_free_shipping'] = 'no';
$coupon['redemptions'] = 1;
$coupon['code'] ='NL04-1234'; //this code will normally be autogenerated but i am hard coding for testing purposes
$this->_rule->setName($coupon['name'])
->setDescription($coupon['desc'])
->setFromDate($coupon['start'])
->setToDate($coupon['end'])
->setUsesPerCustomer($coupon['max_redemptions'])
->setCustomerGroupIds(array('0','1','2','3',))
->setIsActive(1)
->setSimpleAction($coupon['discount_type'])
->setDiscountAmount($coupon['discount_amount'])
->setDiscountQty(1)
->setApplyToShipping($coupon['flag_is_free_shipping'])
->setTimesUsed($coupon['redemptions'])
->setWebsiteIds(array('1'))
->setCouponType(2)
// ->setProductIds(array(1,2,3))
// ->setProductIds(array('1','2','3'))
->setProductIds(1)
->setCouponCode($coupon['code'])
->setUsesPerCoupon(NULL);
$this->_rule->save();
Now the issue is this code is applying on every single product->setProductIds(array(1,2,3))
and ->setProductIds(array('1','2','3'))
but this is not working for me,
How can I apply the I set the coupon for the specific products?
magento2 programmatically coupon helper
I want to apply the coupon on the specific product I tried:
use MagentoSalesRuleModelRule;
public function __construct(
MagentoFrameworkAppHelperContext $helpercontext,
Rule $rule,
)
$this->_rule = $rule;
parent::__construct($helpercontext);
public function setCoupon()
// $this->_state->setAreaCode('adminhtml');
// $this->_state->setAreaCode('frontend');
$coupon['name'] = 'Offer_asad2';
$coupon['desc'] = 'Discount for vip signup coupon.';
$coupon['start'] = date('Y-m-d');
$coupon['end'] = '';
$coupon['max_redemptions'] = 1;
$coupon['discount_type'] ='by_fixed';
$coupon['discount_amount'] = 15;
$coupon['flag_is_free_shipping'] = 'no';
$coupon['redemptions'] = 1;
$coupon['code'] ='NL04-1234'; //this code will normally be autogenerated but i am hard coding for testing purposes
$this->_rule->setName($coupon['name'])
->setDescription($coupon['desc'])
->setFromDate($coupon['start'])
->setToDate($coupon['end'])
->setUsesPerCustomer($coupon['max_redemptions'])
->setCustomerGroupIds(array('0','1','2','3',))
->setIsActive(1)
->setSimpleAction($coupon['discount_type'])
->setDiscountAmount($coupon['discount_amount'])
->setDiscountQty(1)
->setApplyToShipping($coupon['flag_is_free_shipping'])
->setTimesUsed($coupon['redemptions'])
->setWebsiteIds(array('1'))
->setCouponType(2)
// ->setProductIds(array(1,2,3))
// ->setProductIds(array('1','2','3'))
->setProductIds(1)
->setCouponCode($coupon['code'])
->setUsesPerCoupon(NULL);
$this->_rule->save();
Now the issue is this code is applying on every single product->setProductIds(array(1,2,3))
and ->setProductIds(array('1','2','3'))
but this is not working for me,
How can I apply the I set the coupon for the specific products?
magento2 programmatically coupon helper
magento2 programmatically coupon helper
edited Mar 15 at 23:02
Ronak Rathod
1,097213
1,097213
asked Mar 15 at 12:03
Asad KhanAsad Khan
1698
1698
usesetProductId
, without 's'
– magefms
Mar 15 at 12:12
you use it for one specific product but for more (array of)product, you use with 's'.
– magefms
Mar 15 at 12:29
Yeah at the above scenario its I write it setProductIds n I pass the single product value but at that scenario it not gives me any error but in other cases as I mention above giver me an error Array to String how can I solve this?
– Asad Khan
Mar 15 at 13:06
ahh okay, you have to put it inside bracket to indicate it as an array like this: setProductIds([1, 2, 3])
– magefms
Mar 15 at 13:22
Sir Still have the same Problem Notice: Array to string conversion in /home2/mako/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
– Asad Khan
Mar 15 at 15:09
|
show 4 more comments
usesetProductId
, without 's'
– magefms
Mar 15 at 12:12
you use it for one specific product but for more (array of)product, you use with 's'.
– magefms
Mar 15 at 12:29
Yeah at the above scenario its I write it setProductIds n I pass the single product value but at that scenario it not gives me any error but in other cases as I mention above giver me an error Array to String how can I solve this?
– Asad Khan
Mar 15 at 13:06
ahh okay, you have to put it inside bracket to indicate it as an array like this: setProductIds([1, 2, 3])
– magefms
Mar 15 at 13:22
Sir Still have the same Problem Notice: Array to string conversion in /home2/mako/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
– Asad Khan
Mar 15 at 15:09
use
setProductId
, without 's'– magefms
Mar 15 at 12:12
use
setProductId
, without 's'– magefms
Mar 15 at 12:12
you use it for one specific product but for more (array of)product, you use with 's'.
– magefms
Mar 15 at 12:29
you use it for one specific product but for more (array of)product, you use with 's'.
– magefms
Mar 15 at 12:29
Yeah at the above scenario its I write it setProductIds n I pass the single product value but at that scenario it not gives me any error but in other cases as I mention above giver me an error Array to String how can I solve this?
– Asad Khan
Mar 15 at 13:06
Yeah at the above scenario its I write it setProductIds n I pass the single product value but at that scenario it not gives me any error but in other cases as I mention above giver me an error Array to String how can I solve this?
– Asad Khan
Mar 15 at 13:06
ahh okay, you have to put it inside bracket to indicate it as an array like this: setProductIds([1, 2, 3])
– magefms
Mar 15 at 13:22
ahh okay, you have to put it inside bracket to indicate it as an array like this: setProductIds([1, 2, 3])
– magefms
Mar 15 at 13:22
Sir Still have the same Problem Notice: Array to string conversion in /home2/mako/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
– Asad Khan
Mar 15 at 15:09
Sir Still have the same Problem Notice: Array to string conversion in /home2/mako/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
– Asad Khan
Mar 15 at 15:09
|
show 4 more comments
1 Answer
1
active
oldest
votes
So at Last I solve this mystery we cannot apply the coupon on the specific product by using getProductIds()
to apply the coupon on the specific product we have to add few conditions after the basic coupon code
$conditions["1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionCombine",
"aggregator" => "all",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
);
$conditions["1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProductFound",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
"aggregator" => "all",
);
$conditions["1--1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
"operator" => "==",
// "operator" => "()",
// "value" => $couponData['general']['product_id']
"value" => $this->getSKUU(),
);
$conditions["1--1--1-1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
// "attribute" => "quote_item_row_total",
"attribute" => "quote_item_qty",
"operator" => "==",
"value" => 1
);
$actions = array(
"1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"aggregator" => "all",
"value" => "1",
"new_child" => false
),
"1--1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
'operator' => '==',
'value' => $this->getSKUU()
)
);
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%2f266095%2fhow-to-apply-coupon-on-the-specific-products-in-magento-2%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
So at Last I solve this mystery we cannot apply the coupon on the specific product by using getProductIds()
to apply the coupon on the specific product we have to add few conditions after the basic coupon code
$conditions["1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionCombine",
"aggregator" => "all",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
);
$conditions["1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProductFound",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
"aggregator" => "all",
);
$conditions["1--1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
"operator" => "==",
// "operator" => "()",
// "value" => $couponData['general']['product_id']
"value" => $this->getSKUU(),
);
$conditions["1--1--1-1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
// "attribute" => "quote_item_row_total",
"attribute" => "quote_item_qty",
"operator" => "==",
"value" => 1
);
$actions = array(
"1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"aggregator" => "all",
"value" => "1",
"new_child" => false
),
"1--1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
'operator' => '==',
'value' => $this->getSKUU()
)
);
add a comment |
So at Last I solve this mystery we cannot apply the coupon on the specific product by using getProductIds()
to apply the coupon on the specific product we have to add few conditions after the basic coupon code
$conditions["1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionCombine",
"aggregator" => "all",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
);
$conditions["1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProductFound",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
"aggregator" => "all",
);
$conditions["1--1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
"operator" => "==",
// "operator" => "()",
// "value" => $couponData['general']['product_id']
"value" => $this->getSKUU(),
);
$conditions["1--1--1-1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
// "attribute" => "quote_item_row_total",
"attribute" => "quote_item_qty",
"operator" => "==",
"value" => 1
);
$actions = array(
"1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"aggregator" => "all",
"value" => "1",
"new_child" => false
),
"1--1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
'operator' => '==',
'value' => $this->getSKUU()
)
);
add a comment |
So at Last I solve this mystery we cannot apply the coupon on the specific product by using getProductIds()
to apply the coupon on the specific product we have to add few conditions after the basic coupon code
$conditions["1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionCombine",
"aggregator" => "all",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
);
$conditions["1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProductFound",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
"aggregator" => "all",
);
$conditions["1--1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
"operator" => "==",
// "operator" => "()",
// "value" => $couponData['general']['product_id']
"value" => $this->getSKUU(),
);
$conditions["1--1--1-1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
// "attribute" => "quote_item_row_total",
"attribute" => "quote_item_qty",
"operator" => "==",
"value" => 1
);
$actions = array(
"1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"aggregator" => "all",
"value" => "1",
"new_child" => false
),
"1--1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
'operator' => '==',
'value' => $this->getSKUU()
)
);
So at Last I solve this mystery we cannot apply the coupon on the specific product by using getProductIds()
to apply the coupon on the specific product we have to add few conditions after the basic coupon code
$conditions["1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionCombine",
"aggregator" => "all",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
);
$conditions["1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProductFound",
"attribute" => null,
"operator" => null,
"value" => 1,
"is_value_processed" => null,
"aggregator" => "all",
);
$conditions["1--1--1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
"operator" => "==",
// "operator" => "()",
// "value" => $couponData['general']['product_id']
"value" => $this->getSKUU(),
);
$conditions["1--1--1-1"] = array
(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
// "attribute" => "quote_item_row_total",
"attribute" => "quote_item_qty",
"operator" => "==",
"value" => 1
);
$actions = array(
"1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"aggregator" => "all",
"value" => "1",
"new_child" => false
),
"1--1" => array(
"type" => "MagentoSalesRuleModelRuleConditionProduct",
"attribute" => "sku",
'operator' => '==',
'value' => $this->getSKUU()
)
);
answered yesterday
Asad KhanAsad Khan
1698
1698
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%2f266095%2fhow-to-apply-coupon-on-the-specific-products-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
use
setProductId
, without 's'– magefms
Mar 15 at 12:12
you use it for one specific product but for more (array of)product, you use with 's'.
– magefms
Mar 15 at 12:29
Yeah at the above scenario its I write it setProductIds n I pass the single product value but at that scenario it not gives me any error but in other cases as I mention above giver me an error Array to String how can I solve this?
– Asad Khan
Mar 15 at 13:06
ahh okay, you have to put it inside bracket to indicate it as an array like this: setProductIds([1, 2, 3])
– magefms
Mar 15 at 13:22
Sir Still have the same Problem Notice: Array to string conversion in /home2/mako/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
– Asad Khan
Mar 15 at 15:09