Questions tagged [php]

This tag is used for questions that involve PHP code in any way. So as soon there is a PHP Exception returned or error report generated, this question qualifies to be tagged with PHP.

Filter by
Sorted by
Tagged with
0 votes
2 answers
20 views

after upgrade magnento 2 version 2.3.4 to 2.4.6-p6

recently i was upgrade magento 2.4.3 to 2.4.6-p6 for upgrade i fired below cmd composer require magento/product-community-edition 2.4.6-p5 --no-update composer update --ignore-platform-reqs after ...
1 vote
2 answers
179 views

Set website using the CLI

I'm trying CLI coding. I just tried to get all Users, want to load them and list data or do some actions. <?php require_once 'abstract.php'; class Shell_List extends Mage_Shell_Abstract { ...
7 votes
1 answer
1k views

Magento 2.3: Customer ID from Session Returning NULL with Cache Enabled

I'm calling the following helper but getCustomerId is returning NULL when I have cache enabled. If I disable all cache, then I can return the customer's ID. <?php namespace Company\Module\Helper; ...
0 votes
1 answer
1k views

Magento 2 Page builder product attribute cannot render html

In Magento 2.4.3 I have created a page builder product attribute labeled "Before Content" which the admin will populate with html and I want to show in product page. Under child theme I have ...
0 votes
1 answer
3k views

Magento 2: SMTP Email gives error "Could not open socket"

Using Magento 2 Version 2.1.0 on WAMP Windows 10 As continue with this question Magento 2: SMTP Email gives error "Invalid sender data" Now this is my code $storeScope = \Magento\...
0 votes
0 answers
24 views

Display Stock on product widget

I am using magento 2.4.6 with martfury theme. I want to display stock level on product that's displayed via widget. Also, I have MSI enabled for the store. I am using the below code to display the ...
-1 votes
1 answer
963 views

Login Button Not Working

I'm not sure what I did here, but I've killed my Login button when I reworked the login.phtml file. Here is the original code, which works, followed by the reworked code, which everything works on ...
0 votes
1 answer
1k views

magento install "Too many arguments, expected arguments"

I get "Too many arguments, expected arguments" when I use the template php magento/bin setup:install \ --admin-firstname=John \ --admin-lastname=Smith \ [email protected] \ --...
4 votes
4 answers
15k views

Add comments programmatically for an order in admin panel in magento 2

In admin panel Sales->Orders section, while viewing the order, it shows order information like below. How to add comment programmatically? It needs to save (sale_order_status_history) table
1 vote
2 answers
1k views

Currency Symbol is not showing

In my Magento website it does not show the currency symbol next to the price, but this only happens when I click on a product to see the details of it. Otherwise it shows. Magento ver 1.9 link to ...
0 votes
1 answer
1k views

Magefan blog - images not showing after update

I have updated the magefan extension and the images stop showing on blog lists page. When I click on the read more button and go to the post, the image is there, but the small thumbnail image in blog ...
0 votes
4 answers
1k views

Upload CSV file size limit

I have 13mb file I want to upload, I've increased the php.ini file to 100MB but Magento upload page still giving me the warning to make sure the file is less than 8MB. is it possible to upload the CSV ...
2 votes
2 answers
573 views

Images Resize bin/magento catalog:images:resize too slow

Magento 2.4.5 on 4GB RAM 2 CORE CLOUD SERVER Hi When running this command bin/magento catalog:images:resize it has taken 2 days which is 48 hours to complete 50% so another 2 days are needed to ...
0 votes
1 answer
2k views

Upload local file to sever SFTP via curl php

I am trying to implement upload local file to server via sftp curl method but facing File upload error. Error number: 7. Here is my code. <?php $ourFileName = "/var/www/html/example.com/...
0 votes
1 answer
4k views

Magento 2.4: Unable to unserialize value

When i launch a REST API call to see all orders on my site i get this error: main.CRITICAL: Report ID: webapi-62432e964b1e4; Message: Unable to unserialize value. {"exception":"[object] ...
1 vote
2 answers
2k views

Get all categories with custom attributes in Magento 2 REST Api

I am using Magento 2 rest api for listing all the catgories. {{production_url}}/index.php/rest/V1/categories It will return all the categories, { "id": 2, "parent_id": 1, "name": "...
1 vote
4 answers
2k views

Popup form validation in magento2

I have a popup model with following fields name email comment box submit button with input type=”button” I displayed this form in a popup model. Now I need to validate these fields. Is there any ...
1 vote
0 answers
89 views

How to add a text on Homepage using module (code) [closed]

Need help writing a code for adding text on Homepage. I'm running Magento 2 on localhost
0 votes
1 answer
28 views

How to get from_date and to_date of cart_rule and catelog_rule in magento 2?

I'm writing a before plugin and i need to get from_date and to_date of cart_rule and catelog_rule in my plugin code namespace Vendor\CouponBeforePlugin\Plugin; use Magento\Quote\Model\Quote\Item\...
2 votes
2 answers
3k views

Widget Frontend Display

I managed to develop a custom widget, the problem is that its not displaying in the frontend. The goal is to add the widget to a static block and then display the block in frontend. I created the ...
4 votes
1 answer
115 views

Could Not Resolve the Method "hasElementId"

I am confused about this method declaration. In this class Wrapper.php (Mage/Page/Block/Html/) under _toHtml() method, there is a line coded as below. $id = $this->hasElementId() ? sprintf(' id=&...
0 votes
2 answers
3k views

Magento 2 - invalid form key (add/delete from cart)

I have serious problems with custom Magento 2 theme and (probably) formkey cashing. I have 2 views of exactly same e-shop. - View 1: Luma Theme - View 2: Custom Theme (Luma child) - overriding ...
0 votes
1 answer
3k views

Php / Magento 'requires' Fatal Error .... need help interpreting problem

I am trying to install a new theme (not getting a reply from support about this and trying to fix it myself). After SFTP'ing the theme folders to my root folder, I am getting the following error when ...
0 votes
0 answers
8 views

how to customise sorter.phtml in magento2?

i need to customise the magento2 component sorter.phtml so that it displays all available options in a list (instead of a select element) and each element in the list has its own asc and desc arrows. ...
3 votes
3 answers
8k views

Php max_input_vars prevents attribute options saving in M2

Magento 2.2.1. PHP 7.0.26 Nginx After 2 days struggling around with attribute options in M2, I found out where the problem was. I have several custom dropdown attributes with hundreds of options. I ...
1 vote
1 answer
3k views

Magento 2.2.3 Internal Server Error: Read timed out after 10 seconds

I have a magento 2.2.3 shop that is throwing me an internal server error every time I try to edit or create a new product. When I click save, it loads for about 10 seconds this shows internal server ...
0 votes
1 answer
2k views

magento 2: Slick JS does not work when loaded from require JS

There is no error in console and when I tried to put the log "Slick is on "on the on-init function, it displayed correctly. My theme require-config js : var config = { deps: [ "js/mainsite", ...
1 vote
1 answer
2k views

PHP memory limit, Magento 2.3

Trying to fix the PHP memory limit issue when installing an extension. I made all the possible configurations, I do not have access to an SSH but everything seems to have correct values, I made the ...
0 votes
1 answer
2k views

How to implement rich results in magento 2?

Basically I am trying to add structured data such as AggregateRating for products with reviews, Offer – price and priceCurrency, Image(s), SKU, Product name, as JSON-LD code in all products page in ...
1 vote
1 answer
1k views

How to get Product Target Path programmatically in product edit page

I'm trying to get the latest Target Path to show up in the backend of Magento on the product edit page. I've tried everything I can think of to try to get it but I usually get NULL. I've managed to do ...
0 votes
1 answer
3k views

Magento 2: Get Product Collection With Multiple SKUs Filter

I'm trying to get product collection with multiple skus filter, don't know what I'm missing or doing wrong: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $...
0 votes
1 answer
26 views

Magetno 2 how to send the request of place order when user checked on the check box of terms and condtion

I have changed the checkout process into 4 steps Adress Shipping Payment methods and agreement Summary and place order button everything is working fine accept the terms and condition. I have put ...
0 votes
1 answer
20 views

pre order on the category page

How to change the label of add to cart to pre order on all magento 2.4.5 based on the below conditions: if(qty<0 , product is salable and getBackorders()/true ) to show pre order else add to cart. ...
0 votes
1 answer
29 views

Call to an undefined method Magento\Quote\Model\Quote\Address\Rate::setCost()

<?php namespace Ravedigital\Custom\Model; use Magento\Shipping\Model\Rate\Result; /** * Class Checker * * @category Ravedigital * @package Ravedigital_Custom */ class Carrier extends \...
0 votes
1 answer
18 views

Magento2 - How to customization of the invoice pdf deign using php not using phtml

example for this // Add "INVOICE" text above the barcode $font = \Zend_Pdf_Font::fontWithName(\Zend_Pdf_Font::FONT_HELVETICA); $page->setFont($font, 26); $page->setFillColor(new \...
1 vote
3 answers
1k views

CSV product Import stuck on Please wait..." hang

I have a problem with Magento 2 import section. I am trying to import a product from CSV, the page stop loading but the loading icon is always present and Magento don't check data. what is the ...
1 vote
4 answers
1k views

Custom Attribute's Value Null at Frontend

I am new with Magento. Now I'm using magento 1.9 So I add new attribute for my products via backend magento admin. I already assigned that attribute to my product's Attribute sets. the attribute code ...
1 vote
1 answer
2k views

Magento2 : Save Button Not Working in Admin Form Custom Module

I am Working on A magento 2 custom Module i have a Form as well a Product Grid in my form so i created tabs using block but Whenever i click on save button gives me Javascript Error TypeError: $....
0 votes
1 answer
831 views

Magento 2 error: open_basedir restriction in effect

In an existing Magento 2.4.3 instance, I changed its database and connected with another 2.4.3 DB, different extensions and theme. New Magento had been working, but after changing back to the old ...
2 votes
1 answer
4k views

Magento 2 UiRegistry can't get component element

this my checkout_index_index.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/...
0 votes
3 answers
2k views

How can I display the value of an attribute in list.phtml?

I have this attribute CODE PHP: $attributeCode = 'product_text'; if ($_product->getData($attributeCode) !== null){ echo $_product->getAttributeText($...
0 votes
2 answers
31 views

Single store vs Multi store in Magento 2?

We already have a website built using magento 2.0. where in we have an existing product category.Now we have a new requirement where we plan to add a new product type , very different from existing ...
0 votes
1 answer
20 views

How to create a cron job for out of stock

How to create a cron job for out of stock that must daily run and check how many products are out of stock
2 votes
2 answers
16k views

Magento 2.2.3 - main.CRITICAL Notice: Undefined index: websites

I've a strange problem with a project that appeared all of a sudden. When I try to enter the site I get this error: An error has happened during application run. See exception log for details. enter ...
0 votes
1 answer
2k views

How to save uploaded images in a custom folder of pub media in magneto 2?

I want to provide a provision for uploading an image the image, should move/save to the custom folder which I have created in pub/media please be specific while explaining the code it will help me a ...
4 votes
2 answers
1k views

Magento2 site is not loading properly

I have Magento2 site. When I load first time in the browser it's not loading. Complete and show javascript error in the console but when I refresh, it shows correct? What is the issue in Magento 2
1 vote
1 answer
3k views

Configure php-fpm in magento2.4 correctly

php-fpm is consuming a large amount of memory, forcing the instance to restart. The server would like to know the configuration or the procedure for an ideal configuration. server: 4vcore memory: ...
0 votes
1 answer
23 views

Magento 2 How to create order on user demand

Hi I have one requirement where user visit on the website and upload their product image(Like some tool image, Some kind of machinery part etc.) and select some attribute like size,colour,material etc ...
0 votes
1 answer
32 views

Error: Call to a member function setActive() on bool in /var/www/html/project.local/vendor/magento/module-backend/Model/View/Result/Page.php:26

showing this error while clicking on a menu item created for a grid, the code below is my controller <?php namespace Vendor\Grid\Controller\Adminhtml\Grid; class index extends \Magento\Backend\...
1 vote
1 answer
1k views

Magento 2: How to filter orders by order items

In magento 1, I was able to filter orders by the following: $orderitem = Mage::getModel('sales/order_item')->getCollection(); $orderitem->addFieldToFilter('name',array('like'=>'%'.$value.'%')...

1
2 3 4 5
77