Get Wishlist product collection in Controller of Custom module Magento2How to call a model method from controller in Magento2Creating custom module in magento2 show fatal errorMagento2 - Custom Controller throws errorMagento 2 “Recoverable Error: Argument 2 passed” when trying to define model in constructorMagento 2 Custom Module Frontend ErrorMagento 2 Custom Module New Controller IssueMagento 2.1: Invoke urlBuilder->getUrl() in a controller in a custom moduleMagento 2 - Replacing an injected argument via constructor throws an errorInjecting object into a pluiginOverriding the contact form module gets the fatal error in Magento2.2.5?
Promotion comes with unexpected 24/7/365 on-call
How to generate a triangular grid from a list of points
Why can't I share a one use code with anyone else?
Why are lawsuits between the President and Congress not automatically sent to the Supreme Court
Would a "ring language" be possible?
Do high-wing aircraft represent more difficult engineering challenges than low-wing aircraft?
Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?
How to continually and organically let my readers know what time it is in my story?
301 Redirects what does ([a-z]+)-(.*) and ([0-9]+)-(.*) mean
Can I pay my credit card?
Why do galaxies collide?
When the match time is called, does the current turn end immediately?
Is there an academic word that means "to split hairs over"?
What color to choose as "danger" if the main color of my app is red
I recently started my machine learning PhD and I have absolutely no idea what I'm doing
Capital gains on stocks sold to take initial investment off the table
How can I fix the label locations on my tikzcd diagram?
Why is the A380’s with-reversers stopping distance the same as its no-reversers stopping distance?
Why does the U.S military use mercenaries?
Polynomial division: Is this trick obvious?
multiline equation inside a matrix that is a part of multiline equation
Is it possible to pass a pointer to an operator as an argument like a pointer to a function?
Was the dragon prowess intentionally downplayed in S08E04?
"Counterexample" for the Inverse function theorem
Get Wishlist product collection in Controller of Custom module Magento2
How to call a model method from controller in Magento2Creating custom module in magento2 show fatal errorMagento2 - Custom Controller throws errorMagento 2 “Recoverable Error: Argument 2 passed” when trying to define model in constructorMagento 2 Custom Module Frontend ErrorMagento 2 Custom Module New Controller IssueMagento 2.1: Invoke urlBuilder->getUrl() in a controller in a custom moduleMagento 2 - Replacing an injected argument via constructor throws an errorInjecting object into a pluiginOverriding the contact form module gets the fatal error in Magento2.2.5?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to get Wishlist product collection in Custom module controller for the new functionality. I searched in google and I got this:
Inject this class in your constructor:
protected $wishlistProvider;
public function __construct(
...
MagentoWishlistControllerWishlistProviderInterface $wishlistProvider
)
$this->wishlistProvider = $wishlistProvider;
...
and
$currentUserWishlist = $this->wishlistProvider->getWishlist();
if ($currentUserWishlist)
$wishlistItems = $currentUserWishlist->getItemCollection();
I have tried using this code. But its not working. I am getting this error:
Uncaught TypeError: Argument 3 passed to
namespacemodulenameControllerIndexIndex::__construct() must be an
instance of MagentoWishlistControllerWishlistProviderInterface,
none given, called in
/var/www/project_name/var/generation/namespace/modulename/Controller/Index/Index/Interceptor.php
on line 14
Please suggest me a way to do this. Thanks in advance!!
magento2 php module wishlist
add a comment |
I am trying to get Wishlist product collection in Custom module controller for the new functionality. I searched in google and I got this:
Inject this class in your constructor:
protected $wishlistProvider;
public function __construct(
...
MagentoWishlistControllerWishlistProviderInterface $wishlistProvider
)
$this->wishlistProvider = $wishlistProvider;
...
and
$currentUserWishlist = $this->wishlistProvider->getWishlist();
if ($currentUserWishlist)
$wishlistItems = $currentUserWishlist->getItemCollection();
I have tried using this code. But its not working. I am getting this error:
Uncaught TypeError: Argument 3 passed to
namespacemodulenameControllerIndexIndex::__construct() must be an
instance of MagentoWishlistControllerWishlistProviderInterface,
none given, called in
/var/www/project_name/var/generation/namespace/modulename/Controller/Index/Index/Interceptor.php
on line 14
Please suggest me a way to do this. Thanks in advance!!
magento2 php module wishlist
Have you remove var folder?
– Rakesh Jesadiya
Dec 30 '16 at 9:49
1
Just I have removed generation folder in var. I have to remove var folder fully??
– Murali Raj
Dec 30 '16 at 9:50
Trybin/magento setup:di:compile
– lpFranz
Mar 13 '18 at 18:06
add a comment |
I am trying to get Wishlist product collection in Custom module controller for the new functionality. I searched in google and I got this:
Inject this class in your constructor:
protected $wishlistProvider;
public function __construct(
...
MagentoWishlistControllerWishlistProviderInterface $wishlistProvider
)
$this->wishlistProvider = $wishlistProvider;
...
and
$currentUserWishlist = $this->wishlistProvider->getWishlist();
if ($currentUserWishlist)
$wishlistItems = $currentUserWishlist->getItemCollection();
I have tried using this code. But its not working. I am getting this error:
Uncaught TypeError: Argument 3 passed to
namespacemodulenameControllerIndexIndex::__construct() must be an
instance of MagentoWishlistControllerWishlistProviderInterface,
none given, called in
/var/www/project_name/var/generation/namespace/modulename/Controller/Index/Index/Interceptor.php
on line 14
Please suggest me a way to do this. Thanks in advance!!
magento2 php module wishlist
I am trying to get Wishlist product collection in Custom module controller for the new functionality. I searched in google and I got this:
Inject this class in your constructor:
protected $wishlistProvider;
public function __construct(
...
MagentoWishlistControllerWishlistProviderInterface $wishlistProvider
)
$this->wishlistProvider = $wishlistProvider;
...
and
$currentUserWishlist = $this->wishlistProvider->getWishlist();
if ($currentUserWishlist)
$wishlistItems = $currentUserWishlist->getItemCollection();
I have tried using this code. But its not working. I am getting this error:
Uncaught TypeError: Argument 3 passed to
namespacemodulenameControllerIndexIndex::__construct() must be an
instance of MagentoWishlistControllerWishlistProviderInterface,
none given, called in
/var/www/project_name/var/generation/namespace/modulename/Controller/Index/Index/Interceptor.php
on line 14
Please suggest me a way to do this. Thanks in advance!!
magento2 php module wishlist
magento2 php module wishlist
asked Dec 30 '16 at 9:47
Murali RajMurali Raj
98313
98313
Have you remove var folder?
– Rakesh Jesadiya
Dec 30 '16 at 9:49
1
Just I have removed generation folder in var. I have to remove var folder fully??
– Murali Raj
Dec 30 '16 at 9:50
Trybin/magento setup:di:compile
– lpFranz
Mar 13 '18 at 18:06
add a comment |
Have you remove var folder?
– Rakesh Jesadiya
Dec 30 '16 at 9:49
1
Just I have removed generation folder in var. I have to remove var folder fully??
– Murali Raj
Dec 30 '16 at 9:50
Trybin/magento setup:di:compile
– lpFranz
Mar 13 '18 at 18:06
Have you remove var folder?
– Rakesh Jesadiya
Dec 30 '16 at 9:49
Have you remove var folder?
– Rakesh Jesadiya
Dec 30 '16 at 9:49
1
1
Just I have removed generation folder in var. I have to remove var folder fully??
– Murali Raj
Dec 30 '16 at 9:50
Just I have removed generation folder in var. I have to remove var folder fully??
– Murali Raj
Dec 30 '16 at 9:50
Try
bin/magento setup:di:compile
– lpFranz
Mar 13 '18 at 18:06
Try
bin/magento setup:di:compile
– lpFranz
Mar 13 '18 at 18:06
add a comment |
2 Answers
2
active
oldest
votes
In other way you can get wishlist items collection.
Use factory MagentoWishlistModelResourceModelItemCollectionFactory
for getting wishlist product collection and filter that by addCustomerIdFilter($customerId)
protected $_currentUserWishlistCollectionFactory ;
protected $_Customersession;
public function __construct(
MagentoWishlistModelResourceModelItemCollectionFactory $currentUserWishlistCollectionFactory,
MagentoCustomerModelSession $Customersession,
)
....
$this->_Customersession = $Customersession;
$this->_currentUserWishlistCollectionFactory = $currentUserWishlistCollectionFactory;
....
public function getcurrentUserWishlistItems()
$collection = $this->_currentUserWishlistCollectionFactory->create();
$collection->addCustomerIdFilter($this->_Customersession->getCustomerId());
return $collection;
add a comment |
Try to compile your codes:
bin/magento setup:di:compile
Appears to me, that your error will be solved with this.
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%2f152502%2fget-wishlist-product-collection-in-controller-of-custom-module-magento2%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
In other way you can get wishlist items collection.
Use factory MagentoWishlistModelResourceModelItemCollectionFactory
for getting wishlist product collection and filter that by addCustomerIdFilter($customerId)
protected $_currentUserWishlistCollectionFactory ;
protected $_Customersession;
public function __construct(
MagentoWishlistModelResourceModelItemCollectionFactory $currentUserWishlistCollectionFactory,
MagentoCustomerModelSession $Customersession,
)
....
$this->_Customersession = $Customersession;
$this->_currentUserWishlistCollectionFactory = $currentUserWishlistCollectionFactory;
....
public function getcurrentUserWishlistItems()
$collection = $this->_currentUserWishlistCollectionFactory->create();
$collection->addCustomerIdFilter($this->_Customersession->getCustomerId());
return $collection;
add a comment |
In other way you can get wishlist items collection.
Use factory MagentoWishlistModelResourceModelItemCollectionFactory
for getting wishlist product collection and filter that by addCustomerIdFilter($customerId)
protected $_currentUserWishlistCollectionFactory ;
protected $_Customersession;
public function __construct(
MagentoWishlistModelResourceModelItemCollectionFactory $currentUserWishlistCollectionFactory,
MagentoCustomerModelSession $Customersession,
)
....
$this->_Customersession = $Customersession;
$this->_currentUserWishlistCollectionFactory = $currentUserWishlistCollectionFactory;
....
public function getcurrentUserWishlistItems()
$collection = $this->_currentUserWishlistCollectionFactory->create();
$collection->addCustomerIdFilter($this->_Customersession->getCustomerId());
return $collection;
add a comment |
In other way you can get wishlist items collection.
Use factory MagentoWishlistModelResourceModelItemCollectionFactory
for getting wishlist product collection and filter that by addCustomerIdFilter($customerId)
protected $_currentUserWishlistCollectionFactory ;
protected $_Customersession;
public function __construct(
MagentoWishlistModelResourceModelItemCollectionFactory $currentUserWishlistCollectionFactory,
MagentoCustomerModelSession $Customersession,
)
....
$this->_Customersession = $Customersession;
$this->_currentUserWishlistCollectionFactory = $currentUserWishlistCollectionFactory;
....
public function getcurrentUserWishlistItems()
$collection = $this->_currentUserWishlistCollectionFactory->create();
$collection->addCustomerIdFilter($this->_Customersession->getCustomerId());
return $collection;
In other way you can get wishlist items collection.
Use factory MagentoWishlistModelResourceModelItemCollectionFactory
for getting wishlist product collection and filter that by addCustomerIdFilter($customerId)
protected $_currentUserWishlistCollectionFactory ;
protected $_Customersession;
public function __construct(
MagentoWishlistModelResourceModelItemCollectionFactory $currentUserWishlistCollectionFactory,
MagentoCustomerModelSession $Customersession,
)
....
$this->_Customersession = $Customersession;
$this->_currentUserWishlistCollectionFactory = $currentUserWishlistCollectionFactory;
....
public function getcurrentUserWishlistItems()
$collection = $this->_currentUserWishlistCollectionFactory->create();
$collection->addCustomerIdFilter($this->_Customersession->getCustomerId());
return $collection;
edited Dec 30 '16 at 10:49
answered Dec 30 '16 at 10:36
Amit Bera♦Amit Bera
60.6k1682181
60.6k1682181
add a comment |
add a comment |
Try to compile your codes:
bin/magento setup:di:compile
Appears to me, that your error will be solved with this.
add a comment |
Try to compile your codes:
bin/magento setup:di:compile
Appears to me, that your error will be solved with this.
add a comment |
Try to compile your codes:
bin/magento setup:di:compile
Appears to me, that your error will be solved with this.
Try to compile your codes:
bin/magento setup:di:compile
Appears to me, that your error will be solved with this.
answered Mar 12 '18 at 20:43
lpFranzlpFranz
380113
380113
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%2f152502%2fget-wishlist-product-collection-in-controller-of-custom-module-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
Have you remove var folder?
– Rakesh Jesadiya
Dec 30 '16 at 9:49
1
Just I have removed generation folder in var. I have to remove var folder fully??
– Murali Raj
Dec 30 '16 at 9:50
Try
bin/magento setup:di:compile
– lpFranz
Mar 13 '18 at 18:06