All Questions
26 questions
0
votes
2
answers
511
views
Convert SQL Select Query to Magento Collection
I have a complex sql select query which actually returns sales report against specified categories. I want to load data as a collection to display but I'm not able to convert the query into Magento's ...
0
votes
1
answer
825
views
How can I insert multiple row at once without for loop using collection in Magento 2?
I want insert multiple record without for loop in Magento 2
my data is as follow,
Array
(
[0] => Array
(
[path] => whatsapp_contact/whatsapp_contact_button_settings/...
1
vote
1
answer
4k
views
Magento 2 Filter product collection by multiple attributes with OR
In Magento 2.3.3, How Can I Filter Product Collection by Multiple Attributes? First attribute SKU needs to check using "IN" second attribute is yes/no value. I need to filter collection by SKU array ...
4
votes
1
answer
1k
views
Custom FilterList incorrectly sets Collection size in Layered Navigation
In order to add a custom filter to the Layered Navigation, I overrode the class Magento\LayeredNavigation\Block\Navigation\Category to load my own FilterList class instead of the one from core.
My ...
0
votes
1
answer
72
views
Not able to save an item magento 2
I have a table which store certain data in database.
First i am checking if the content is already there in the database if yes then update it else insert a new data.
$sync = $this->...
3
votes
2
answers
134
views
Collection fillter not working
I am trying to filter product, I having a list of product ids in an array and i want to filter product base on this ids.
I want to fetch all the product which does not have this ids (Not In)
How can ...
3
votes
3
answers
20k
views
Magento 2 How to get only one field data in collection
I want to get only one field data in my custom module collection. For ex:
getting following data in collection:
Array
(
[0] => Array
(
[banner_id] => 1
[banner_title] =...
0
votes
0
answers
127
views
Magento 2: How to add Join query in a custom module
want to add join query in getPost function in a single view
public function getPost()
{
if ($this->_post === null) {
/** @var Post $post */
$post = $this->...
2
votes
3
answers
4k
views
Magento:2 How to Image upload in custom module
Image upload working fine in tmp folder, then store in DB. I want to after saving data image stored in the base folder pub/media/events
var_dump($data);
" ["events_url"]=> array(1) { [0]=> ...
1
vote
2
answers
9k
views
how to get block data on phtml template in magento 2
what is missing in my code block data not shown in phtml template
block page
namespace xxxx\Trails\Block;
use \Magento\Framework\View\Element\Template;
use \Magento\Framework\View\Element\...
1
vote
1
answer
748
views
How to check if a column filter already applied into collection
I want to check if a column entity_id filter already applied into collection.
For eg: Product collection has already applied entity_id filter where entity_id in (1,2,3) etc.
So i want to check ...
3
votes
2
answers
4k
views
How to get datas from this table 'directory_currency_rate'
Table contains these columns.
I need to get data from this table 'directory_currency_rate'
which is come under this directory
/vendor/magento/module-directory/Model/Currency.php
/vendor/magento/...
1
vote
2
answers
2k
views
Magento 2 get list of the guest orders
I want to show list of the guest user in my custom module. Which is the best way to get the list of the guest order.
How can i get list of the guest orders?
$objectManager = \Magento\Framework\...
7
votes
3
answers
14k
views
Magento 2 - Layered Navigation for Custom Product Collection
I created a CMS page for products that contain a certain attribute (On Sale Items).
I extended the ListProduct class and added filters to the product collection to achieve the desired results. (...
1
vote
1
answer
727
views
Magento 2.2 product collection doesn't return out of stock products
Magento 2.2.* seems to make it very difficult to get out of stock products in a collection! I have the following code which works fine in Magento 2.0 and 2.1:
use Magento\Framework\View\Result\...
0
votes
1
answer
847
views
Check for true or false with AddFieldToFilter method in Magento 2
I want to get the records from database where 'isDefault' returns True.
$project = $this->modelProject->getCollection()
->addFieldToFilter(
'isDefault',
['eq' => true]
);
I tried like ...
2
votes
2
answers
4k
views
Get item collection by sku Magento 2
I try to fetch quote item collection and add some filter like this:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of Object Manager
$newItem = $objectManager->...
0
votes
1
answer
726
views
getCustomAttribute() not working on collection items
If I pull a list of products with the repository I am unable to get any custom attributes.
$searchCriteria = $this->searchCriteriaBuilder->addFilter('type_id', 'simple', 'eq')->create();
...
2
votes
1
answer
1k
views
Add category IDs to product collection
I am injecting this collection into my model:
\Magento\Reports\Model\ResourceModel\Product\Collection $prodCollection
I use it to create an array of all products but I want to add the products ...
0
votes
1
answer
362
views
Get product Image from Review Collection
I have a ReviewCollection, im trying to each "Review/Product" get a product image so i can pass on and display on template file:
public function getCollection()
{
$collection = $this->...
4
votes
3
answers
7k
views
Magento 2 : AND condition in addAttributeToFilter not giving desired result
According to answer to this related question
the AND condition in addAttributeToFilter is added by adding consecutive addAttributeToFilter so my statement is something like;
$_productCollection->...
4
votes
1
answer
3k
views
Load additional product attributes in Wishlist
I want to show some additional product attributes in the wishlist template, but they are not loaded. On the category page it is working, so it is not an index problem.
When I call
$item->...
6
votes
1
answer
12k
views
Magento2: Convert DataObject/Array into magento2 Collection?
How to convert the Data object into Magento2 Collection ?
In Mage1 we could do as below..
Mage1:
$collection = new Varien_Data_Collection();
foreach ($items as $item) {
$...
12
votes
2
answers
16k
views
Magento 2: Filter Product Collection by Multiple Categories (Magento 2.1)
I'm using Magento 2.1.0 and I'm currently having difficulties in filtering product collection with multiple categories. I've used more than a couple of ways to make it work but it won't.
Assuming:
$...
10
votes
3
answers
3k
views
Force products collection to use EAV instead of flat table
In Magento 2, how can I temporarily disable the flat catalog? I have a product collection associated with a frontend store and want it to be loaded via EAV tables.
I looked how the collections ...
1
vote
1
answer
929
views
Magento 2.1 : How to extend Product listing in your custom product list and apply SKU Filter
I have a Custom module which have customer mapped with certain products , I want to show a custom listing of those products with layered navigation
After Extending product list block in my custom ...