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
Email Account under attack (really) - anything I can do?
My colleague's body is amazing
If Manufacturer spice model and Datasheet give different values which should I use?
What typically incentivizes a professor to change jobs to a lower ranking university?
Why is the design of haulage companies so “special”?
I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine
How long does it take to type this?
What would happen to a modern skyscraper if it rains micro blackholes?
Schwarzchild Radius of the Universe
Japan - Plan around max visa duration
How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?
Can I interfere when another PC is about to be attacked?
What is the command to reset a PC without deleting any files
Patience, young "Padovan"
Why has Russell's definition of numbers using equivalence classes been finally abandoned? ( If it has actually been abandoned).
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?
How old can references or sources in a thesis be?
How does one intimidate enemies without having the capacity for violence?
What Brexit solution does the DUP want?
Why are 150k or 200k jobs considered good when there are 300k+ births a month?
Extreme, but not acceptable situation and I can't start the work tomorrow morning
The use of multiple foreign keys on same column in SQL Server
Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?
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,125213
1,125213
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 Apr 4 at 14:51
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