New answers tagged

1

Ok, I finally found my mistake(?!) - I can get the applied filters in my data-provider php file by using the SessionManagerInterface: use Magento\Framework\Session\SessionManagerInterface; class YourClassname extents AbstractDataProvider { protected $session; public function __construct( $name, $primaryFieldName, $...


1

I solved the slow loading by indexing paymentID column in my custom payement table.


0

You may also use Magento\Catalog\Api\ProductAttributeRepositoryInterface to determine the product attribute try { $this->attributeRepository->get('custom_attribute'); } catch (NoSuchEntityException $e) { //To-do create attribute } This is verified on 2.3.2


1

You can use code as shown below. Do not forget to override this file. vendor/magento/module-sales/Model/ResourceModel/Order/Grid/Collection.php protected $authSession; public function __construct( ... \Magento\Backend\Model\Auth\Session $authSession, ... ) { ... $this->authSession = $authSession; ... } protected function ...


1

Try This code into your collection file <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Sales\Model\ResourceModel\Order\Grid; use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy; use Magento\Framework\Data\Collection\EntityFactoryInterface as ...


1

In your function the join is fine protected function _prepareCollection() { $collection = Mage::getResourceModel($this->_getCollectionClass()); $collection->getSelect()->joinLeft('custompayment_nestpay', 'main_table.increment_id = custompayment_nestpay.paymentID', 'card_name'); $this->setCollection($collection); return parent::...


1

Here, I’m going to share the custom code which you can implement to UI component grid collection in Magento 2. Paste the below code in UI component grid xml <dataSource name="test_comments_listing_data_source"> <argument name="dataProvider" xsi:type="configurableObject"> <argument name="class" xsi:...


0

->addFieldToFilter( 'visible_stores', [ [ array('finset' => $this->getStoreId()) ], [ array('like' => '%0%') ] ] );


0

Turns out $collection->addFilter('my_custom_attribute', my_custom_value) returns the correct filtered data. I still don't know why the other method does not work though.


0

Try something like: public function execute() { $collection = $this->collectionFactory->create(); foreach ($collection as $item) { if ( date("Y-m-d") > $item->getData("exp_date") ) { $item->setCustomColumn('Data')->save(); } } } If your column name is status, then $item->setStatus('inActive')->save();


1

Redirection from observer specailly checkout_onepage_controller_success_action is not right way. Instead of using observer, use Around Plugin on \Magento\Checkout\Controller\Onepage\Success::execute is best. Create di.xml at app/code/VendorName/ModuleName/etc/frontend/ Add below code <?xml version="1.0" ?> <config xmlns:xsi="http://...


1

You can simply use foreach and if conditions to get the order filter by Payment method. $customerOrderCollection = $this->orderCollectionFactory->create()->addFieldToFilter('customer_id', $customerId)->addFieldToFilter('status','pending'); foreach($customerOrderCollection as $customerOrder) { if($customerOrder->...


1

In your Collection.php which you are using for the Grid add below function code protected function _initSelect() { parent::_initSelect(); $this->getSelect() ->columns('eas.attribute_set_name') ->join( ['cpe' => $this->getTable('catalog_product_entity')], 'main_table.sku = cpe.sku', []...


0

Not sure to really understand your issue. To give you a strict answer the attribute set is stored in the table eav_attribute_set where you can find the columns attribute_set_id and attribute_set_name Now if what you try to do is add that value into a grid, we need more information and code about what you've done.


0

Did you run bin/magento di:compile ? If not please run that command once. If the problem still persist then just let me know.


0

$whereClause = " status = 'processing' and created_at < (TIMESTAMPADD(MINUTE, -30, CURRENT_TIMESTAMP))"; $collection->getSelect()-> where($whereClause);


Top 50 recent answers are included