New answers tagged

0

public function getData() { $items = $this->collection->getItems(); //Replace icon with fileuploader field name foreach ($items as $model) { $this->loadedData[$model->getId()] = $model->getData(); if ($model->getPromoImage()) { $m['promo_image'][0]['name'] = $model->...


0

Put your patch file at root folder and run this command, I have apply patch successfully using this command. Ex. patch -p1 < MDVA-14172_EE_2.2.6_COMPOSER_v1.patch patch -p1 < your patch file name


0

<?php namespace My\Module\Controller\Adminhtml\Test; use Magento\Backend\App\Action; use My\Module\Model\Save as Contact; use My\Module\Model\Savee as Contactt; use My\Module\Model\ResourceModel\Save\Add\Collection as listCollectionFactory; class NewAction extends \Magento\Backend\App\Action { /** * Edit A Contact Page * * @return \Magento\Backend\...


0

Can you share some code? Can be a possible security issue?


0

You can change/resize the logo by using admin panel. Go to Content->configuration->click on edit button on your theme ->Under header upload the required logo ->Put required width and length in logo attribute width and logo attribute length respectively. Save the Settings and clean cache!


0

This is due to the wrong ownership. So please assign correct user and web group to the project directory. I have followed these steps in my ubuntu OS cd <root directory of magento> find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; chown -R magento:...


1

You can check my repo: CustomLog Still facing any problem add comment.I will try to help you.


0

die() will not work. Use logger concept. This is the wrong files name etc/frontend/dii.xml it should be etc/frontend/di.xml. using SortOrder value 1 is very dangerous. In this case routing should be between 60(cms route) and 100 (default route). See https://devdocs.magento.com/guides/v2.3/extension-dev-guide/routing.html


0

Currently, I dont see the updated_at being updated at all times. This is not reliable and is updated only on a direct product update (through the edit function). Either that was the design goal or this is a grave bug. I tried upgrading and testing to various magento versions and could confirm this behavior. Leaving this as the answer so that any one who ...


0

Hiding of special character is not a solution for your store bot attack. You need to implement web Firewall for your website. You can use services like Cloudflare and Sucuri web firewall. This hacking need to prevent at the network level. Not the application level. I have faced the same type of issue, it is resolved by Web firewall.


0

You're using a non-injectable object Product $product to fetch the product object and it might cause issue sometimes. Instead, we should use ProductFactory Can you try the following snippet? <?php namespace MassiveArt\ShoppingCart\Controller\Index; use Magento\Catalog\Model\ProductFactory; use Magento\Checkout\Model\Cart; use Magento\Framework\App\...


1

This can not be done without writing a custom module to override the delivery process. The Multishipping Setting only allows you to deliver your products (more than 1 product or more than 1 quantity for the same product) to different addresses only.


0

This issue is down to the extension you have installed not setting the correct tab ID within the extension if you go into the etc/adminhtml/ folder and edit system.xml just below the variable you should see something like <tab id="vendor_name_here" translate="label" sortOrder="10"> if there is on make sure that the options are associated to this ...


1

As you might know mini cart renders from local storage. So after performing ajax request you need to reload mini cart to update qty. For that you need to create section.xml file. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd"> <action name="...


0

Try to run this command: bin/magento rm -rf generated/* var/* && chmod -R 777 generated


0

You can use below code to get random product id from a category. $productIds = array_column($_productCollection->getData(), 'entity_id'); $randomProductId = $productIds[array_rand($productIds)]; echo $randomProductId; Example code in a block file: <?php namespace Amit\Test\Block; use Magento\Framework\View\Element\Template; use Magento\Catalog\Model\...


0

It seems thank the problem come from the data export: -Two product had no sku, and two had duplicate sku -one customer attribute and one used in entity attribute where not in eav_attribut table. It works now after i've corrected those problem.


0

Assuming you use PayPal Express, you will need to change the following from $quote->setPaymentMethod('checkmo'); //payment method to $quote->setPaymentMethod('paypal_express'); //payment method


0

Please check the catalog_product_link table and link_type_id field equal to 5 is cross_sell product type, for other related types you can refer to catalog_product_link_type table. public function getCrossSellProducts(){ /*$currentProduct = $this->_registry->registry('current_product'); $collection = $currentProduct->...


0

Thanks for the Code-Migration toolkit. It does not really work, getting errors while running this: bin/migrate.php: line 1: ?php: No such file or directory bin/migrate.php: line 2: /bin: Is a directory bin/migrate.php: line 3: app: command not found bin/migrate.php: line 4: app: command not found bin/migrate.php: line 5: app/: Is a directory bin/migrate.php:...


0

Use below code use Magento\Framework\View\Result\PageFactory; protected $_timezone; /** * @param \Magento\Backend\App\Action\Context $context */ public function __construct( Context $context, \Magento\Framework\Stdlib\DateTime\DateTime $timezone, PageFactory $resultPageFactory ) { $this->_timezone = ...


0

Please try with below code : $_productCollection = $this ->getCategory($catid) ->getProductCollection() ->addAttributeToSelect('*') ->setPageSize(5); $_productCollection->getSelect()->orderRand(); $products = $_productCollection->getItems(); hope its work for you.


1

You can only set 1 default billing address within magento but you can add additional addresses to get the customers address's you can do this by using Magento\Customer\Api\Data\CustomerInterfaceFactory and with implimenting the below code $customer = $this->_customerRepository->getById($customerId); $addresses = $customer->getAddresses(); // ...


0

Create module.xml in app/code/Test/Testmodule/etc <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Test_Testmodule" setup_version="1.0.1"> </module> </config> Create registration.php in app/code/Test/...


0

As far as I know, there is a store configuration in Admin > Stores > Configuration > Catalog > Catalog > Rule-based Product Relations. Please review your configuration for Show Cross-Sell Products in it. There are three options like Selected, Rule-based and Both. Selected means it will show you products which are selected from the admin ...


0

Your method is correct, but it will only return all child category ID's in comma-separated numbers. If you want to get sub-category information, then you need to write down a custom module with webapi.xml for your custom route to write a logic for this. This is not possible without doing customization in interface method. Thanks Rahul Anand


1

For creating new products the following fields are required as part of the import csv sku, name, price, product_type, attribute_set_code, product_websites, qty, additional_attributes If you are updating products the following fields are required but always recommended to include sku, price, name, qty, product_websites


0

Can't find answer for this anywhere, so will leave my solution on this old thread: <field formElement="input" name="field_name"> <settings> <label translate="true">Field label</label> <dataScope>field name</dataScope> <elementTmpl>ui/form/element/text</elementTmpl> </settings&...


0

<field formElement="input" name="field_name"> <settings> <label translate="true">Field label</label> <dataScope>field name</dataScope> <elementTmpl>ui/form/element/text</elementTmpl> </settings> </field> This makes it as you want: just label + text instead of input ...


1

To get the name and ID of te categgory you need to call below rest API: local.magento2.3.1.com/rest//V1/categories/2 using GET method to get details of the category and all its child. If you want parent and child segregation then you need to write down a module with webapi.xml file and declare your endpoint and method in it. In that method you need to ...


1

Following 4 fields are required in your case (provided you are using default stores). sku, price, name, qty


1

There are a few online tools mentioned below which you can use to create basic extensions/modules with front-end page, back-end page, cron jobs etc. https://www.silksoftware.com/magento-module-creator/magento2-module-creator.php https://cedcommerce.com/magento-2-module-creator/ https://mage2gen.com/


-1

Please try with below url : Step 1: Create controller Firstly, We will create a controller to call the layout file .xml File: app/code/Mageplaza/HelloWorld/Controller/Index/Display.php <?php namespace Mageplaza\HelloWorld\Controller\Index; class Display extends \Magento\Framework\App\Action\Action { protected $_pageFactory; public function ...


0

Below solution worked for me just try it. go to app/etc/di.xml find the line Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and Replace it with Magento\Framework\App\View\Asset\MaterializationStrategy\Copy


3

Create one observer file : Namespace\Module\Observer\SalesOrderPlaceBefore.php namespace Namespace\Module\Observer; use Magento\Framework\Event\ObserverInterface; class SalesOrderPlaceBefore implements ObserverInterface { public function execute(\Magento\Framework\Event\Observer $observer) { $order = $observer->getEvent()->...


0

Thank you all, you guys. I have checked it by this code: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); $data = $product->getTypeInstance()->getConfigurableOptions($product); $show_size = false; foreach ($data as $key => $value) ...


0

Navigate to Admin Panel => Stores => Settings => Configuration => General => Web Update Base URL and Base Secure URL to the https version. E.g. https://screencast.com/t/bTYqhe6Ymi


1

What you're describing is a limitation of the html 5 element, not of Magento or your process. That is indeed the location you would need to change, and when I make the edit you described I see it on my front-end when I view source. The problem you're describing is that the input type "number" ignores maxlength. There are solutions at this thread on regular ...


0

add attribute to the product. For example I add Barcode attribute. Edit: /app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php Add the filter, for example I add Barcode filter: $this->addColumn('barcode', ['header' => __('Barcode'), 'index' => 'barcode']); 3.Run: rm -rf var/page_cache/* rm -rf var/cache/* rm -rf generated/* rm -...


0

Think of what happens, when you put microcache on top of Varnish ESI based cache. Take the homepage for example. There are several cached objects in Varnish for it, namely: homepage itself (full page cache), it will have the default TTL as you set in the backend (long term). It's "partially full page", because it will have <esi: references instead of ...


0

The requested class did not generate properly, because the 'generated ' directory permission is read-only. The error message says Magento cannot write interceptor in generated directory. You can solve this issue by giving read and write permissions of current web-server user to the generated directory. If you use Apache2 web-server (default apache web-...


0

So after a bit of debugging I found out it was a Related Product Rule in Magento by following the backtrace. The target-rule index, even if it was only updating 10 products, the rule matched all products for some reason. The rule we had was for all products, and it was basically set to show 7 random related products where the matching rule was within the ...


0

i just have the same issue, in the magento documentation if we set visible to false, it should apply a css class to display none, but it's not the case. What i did is use and hidden input. Like that : <field name="position" formElement="hidden"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> ...


0

are your images uploaded well ? If it's the case, this is how you can save images in your database : When you are saving you should call something like this : $data = $this->getRequest()->getPostValue(); Just debug $data. Normally you will see an array with all data you need from your form. Just get the field name of your upload file field, pass it to ...


0

I was having the same problem and I moved the Custom Attribute to the "General" group and the values started showing up.


0

Was able to grab tracking info using the event sales_order_shipment_save_after and the following in my observer: $shipment = $observer->getEvent()->getShipment(); foreach ($shipment->getAllTracks() as $track) { $tracking = $track; } And as it turns out, this event / observer was actually being called by the ShipStation API however the shipment ...


0

I believe, by transaction_email you meant customer email and by transaction status you meant a way to identify whether order was placed successfully or not. Customer email is present in sales_order table. Generally when you click the "Place Order" button, order status is pending and when you make the payment successfully, order status changes to processing....


1

I've saved the custom attribute value to the product with the below code. class FilterProduct implements ObserverInterface { /** * @var \Magento\ConfigurableProduct\Model\Product\Type\ConfigurableFactory */ protected $configurableProductProductTypeConfigurableFactory; public function __construct( \Magento\ConfigurableProduct\...


0

There is an error in magento 2 It's resolved in this PR: https://github.com/magento/magento2/pull/16386/files/90e37b59cce7e07a4aee3a5bbc9a00b10aaa58a6 If you want fix this bug in your project you can override the plugin vendor/magento/module-customer/Model/Plugin/CustomerFlushFormKey.php and change the condition in line 48 to if (isset($beforeParams['...


0

Run php bin/magento indexer:reindex


Top 50 recent answers are included