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
2answers
81 views

Issue: Magento import limited to 100 records

It's been two weeks since I'm facing Registry key "movement_data" already exists error while importing a CSV file greater than 100 records. My Entity type is Products and, import behavior is ...
0
votes
0answers
13 views

Add New Sales Rule Action Logic

I need to add logic to a new action that I have added to the dropdown of a sales rule. Essentially I need to change the Buy X get Y Free rule so that it works differently. So I have added a new action ...
0
votes
1answer
26 views

Magento 2 : Can We Add Data From Custom Module to Core Database?

If I want to insert form data in to the "customer_entity" table How can we achieve that? I have mentioned all fields in the form as "create an account", and rather than creating a ...
0
votes
2answers
32 views

Do a action before insert products by endpoint magento 2

I wanna make a verification before inserting products on my Magento 2.3 in the default endpoint. Here is a sample: I post a product on rest/default/V1/products endpoint, but I want to check if this ...
0
votes
1answer
95 views

How to override Magento 2 graphql resolver with custom plugin

Im trying to override the resolver by using a plugin in Magento 2 to change text. vendor/magento/module-quote/Model/CouponManagement.php - I need to change this class ApplyCouponToCart implements ...
0
votes
1answer
70 views

How to disable Mega Menu on Magento2 Porto theme

I have one CMS page and I would like to disable the mega menu on it, but not the other pages? How can I do this? and I want to disable the buttons that I mention in the picture attached. Many Thanks!
0
votes
0answers
20 views

Error 500 - module error

We get a strange issue with, for me, it looks like it might be a missing closing tag, however, I can't see any missing closing tags. PHPerror.log: PHP Fatal error: Uncaught TypeError: strpos() ...
0
votes
1answer
54 views

Magento 2.4.4: Register is deprecated

I recently noticed the line $this->registry->register with register striked through. Mouseover displayed a message saying Register is deprecated. Could you please direct me to what is the ...
0
votes
3answers
75 views

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)?

I installed Magento 2.4.3 in ubuntu, but when I run the below command it gave me errors like, SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) Command: php bin/...
0
votes
1answer
41 views

Detect IE11 browser and show cms block modal with phtml script tag

I have a modal that pops up when the site detects it's on IE11. The modal is in a cms block so that the client can edit it. I have created a reference container with a custom phtml and put the script ...
0
votes
0answers
16 views

Magento 2 : Error Message Debug how not to abbreviate / truncate paths with

Not sure if this is Magento 2 or a general PHP question but I will have stack traces and sometimes those stack traces will abbreviate the full path of the class or filename with ... but I want to see ...
0
votes
1answer
35 views

Magento 2 : Override the Shipping Method Managment Model

I need to override the shippingmethodmagament.php file which is in the model file in the magento this path vendor\magento\module-quote\Model\ShippingMethodManagement.php but the interfaces is applied ...
0
votes
1answer
34 views

array_search() PHP fucntion not working on array

I am unable to have the array_search() working. I have a string from an API call in a variable $myresp [{"name":"product 1","order_id":1,"product_type":"...
0
votes
0answers
14 views

Set country of origin

there is a task to create an attribute country of origin and fill it in in accordance with the attribute country of manufacture, for example (Germany -> DE), and the question arose where to get the ...
0
votes
0answers
17 views

install Magento2 enterprise cloud extension on local

I have our Magento2.3.4 enterprise all downloaded onto my local mac. I do not have the site actually running on my mac just the files downloaded so I can git pull and push it up to the staging. My ...
0
votes
0answers
57 views

Magento 2.4.3 admin redirect from observer

I'm using Magento 2.4.3 and I'm trying to redirect from admin page to other. Below is my code, <?php namespace Mycompany\Mymodule\Model\Observer; use \Magento\Framework\Event\Observer; use ...
0
votes
0answers
24 views

Magento 2 | Flush catalog images in production mode

I updated the photos of the products already existing on my site in Magento2 and they are in production mode. Unfortunately I don't see the updated photos, not even when I clear all the cache so I ...
0
votes
0answers
11 views

Magento2 Need to connect Magento with Oracle

I need to get the Oracle data in my Magento env. Can someone please guide me on this? I tried to do with PHP OCILogon() but it gives Fatal error: Uncaught Error: Call to undefined function OCILogon() ...
0
votes
1answer
56 views

Magento 2 API Order Items, convert Json to table using php

I am tring to create a table dinamically with the products of a Magento order using API result. I have the following PHP code to dinamically generate a table with Json content $data = json_decode($...
0
votes
0answers
12 views

Magento 2 disable X-Frame-Options and use CSP frame-ancestors instead

We need one of our website available in a iframe on a different domain. The problem is that X-Frame-Options blocks the request and you can not use the * or ALLOW-FROM uri anymore. Please see link for ...
0
votes
0answers
11 views

Getting 400 bad request with GuzzleHTTP when trying to POST new product

I'm trying to use the /product endpoint but keep getting `400 Bad Request` response: {"message":"\"%fieldName\" is required. Enter and try again.","parameters":{...
0
votes
1answer
21 views

How to execute clientside javascript from php plugin file

Is it possible to call a frontend javascript function from a plugin php file? The js function should be executed in the browser. view/frontend/web/js/send.js function send() { console.log("...
0
votes
1answer
194 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
1answer
23 views

How can I get the url of my new module?

This is a simple Hello World in a Block, I would like how can I get the URL of this, to check the website this HelloWorld. I don't know to check my exercises, because I don't know how to get the URL ...
0
votes
3answers
35 views

Magento 2 css from php

Who can tell me how to change the link from PHP. $this->pageConfig->addPageAsset('') I already tried but not working. $this->getUrl('https://...') Thank you!
0
votes
1answer
24 views

magento 2.3.6 - Error: cannot call methods on priceBox prior to initialization

I try to add configurable options in a custom modal page (quick view). But when I open that modal I have the following error: Error: cannot call methods on priceBox prior to initialization and the ...
0
votes
0answers
25 views

Magento 2.3.5: Creating a custom category bottom toolbar

I'm trying to create a custom category bottom toolbar without the h1 title. I've done the following. Created a module with the following structure /app/code/Vendor/ToolbarBottom /app/code/Vendor/...
0
votes
0answers
22 views

Magento 2 import special with scheduled update dates via CSV

Good afternoon everyone, Apologies if this has been asked before but I have a site that I would like to import special price via CSV import but with scheduled update dates. I am aware that the only ...
0
votes
0answers
242 views

get magento to use Composer 2

I'm actually having this issue but first I want to resolve why it's still looking at Composer 1. me@server:/.../magentoproject$ sudo ./bin/magento sampledata:deploy [sudo] password for me: <warning&...
0
votes
0answers
30 views

Backorder return null qty when place order?

I'm using magento 2.3.5 , and my PJ have 2 site include AU using default source and NZ using nz source , so i have a product like this then i enable backorders per product , so when i place order in ...
0
votes
1answer
60 views

Magento 2 Insert / Move page.main.title inside my custom block

I have create a custom xml for Category Page and I need to move the Category Title inside my Block. This is my custom.xml code: <?xml version="1.0"?> <page xmlns:xsi="http://...
0
votes
1answer
13 views

Magento apptha extension frontend not navigable after installation

I am using the Apptha module for magento2 , I had installed the module as well and it appears in my admin panel , but when I navigate to http://localhost:8080/marketplace , I see this result : Apptha ...
1
vote
1answer
50 views

Magento 2.4 - PayPal Smart Button Style

I want to change the button style of the PayPal Express Checkout, but is not work, I have create a module to rewrite the PayPal but how I can add my changes there? I create di.xml file on following ...
0
votes
0answers
53 views

Magento 2: Month Range In Date Picker

I'm made custom report, I added date-picker, I just want to add Month Range, like User can only able to generate any three months report. but I can't figure out how to do that. Here's my code: HTML &...
0
votes
1answer
37 views

Magento 2 - How I can rewrite this file

I want to change the following file: vendor/magento/module-paypal/Model/SmartButtonConfig.php but if I made the modifications directly in the vendor file when I will upgrade my store this ...
0
votes
1answer
30 views

Magento 2.36 - How to sort printout of Invoice, Shipments and Credit Memos based on custom filter on SKU column/field?

The items in printout of the invoices, shipments and credit memos are sorted by sequences as to when they are added in the order. My question is how do I go about sorting them. For example how do I go ...
0
votes
0answers
20 views

Why update cart for configurable product gives error? Magento 2

Basically I am getting error We can't find the quote item after update cart for configurable product. There are no issues in adding item to cart. Also I am not getting any error's or warnings while ...
0
votes
0answers
11 views

Add multiple carriers (get from API) in the same module

Magento 2: I would like to 'generate' a new section in the admin side > Stores> Configuration> Sales> Delivery Methods. The sections would be generated based on the carriers available I ...
0
votes
0answers
15 views

Magento 2: Custom Product List Not Rendering

I'm using Magento 2.3.4, I have a page to view all sellers product list, but when I hit button to display product list, It shows a page like this: I checked exception.log and found this error: main....
0
votes
0answers
12 views

I can't associate simple products to configurable ones if they have 0 quantity

I use the following code to associate (I call it from a loop) simple products to a configurable one. it works fine except if the id of the product correspont to a product with 0 quantities, in which ...
0
votes
0answers
32 views

Size of product collection using getSize() method and using foreach loop is different-different Magento 2

I am using Magento version 2.4.2 We have total 278 configurable products showing in admin panel. I want to get all configurable product collection in root using below code. When I try to get total ...
0
votes
1answer
15 views

Magento 1.9 update street adress line 2 via PHP

I'm writing some codes to update customer address using php, but the site use 2 street fields, when i set it like $address->setStreet1('test 1'); it's not working $address->setStreet('test 1'); ...
0
votes
1answer
27 views

How can I add PHPExcel_IOFactory in my custom module class in Magento 2?

In this I need to add use PHPExcel; use PHPExcel_IOFactory; This two class in my module model file can any one guide me how can I add this two one in my model class I already added that but got ...
0
votes
1answer
26 views

Magento 1.9 set exisiting address as default billing and shipping address

I'm writing some magenta 1.9 codes for set existing customer address to set as default billing and shipping address <?php $customerId = Mage::getSingleton('customer/session')->getCustomer(); $...
0
votes
1answer
38 views

custom module stop working after Magento 2.4.3 upgrade

I have a module that extend the functionality of other module, in fact it display the product name and product price as a variable, after I upgrade the Magento to 2.4.3 this module stop working and I ...
0
votes
1answer
23 views

1 exception(s): Exception #0 (LogicException): Front controller reached 100 router match iterations

I am getting this error that I couldn't know from where it is generated 1 exception(s): Exception #0 (LogicException): Front controller reached 100 router match iterations I think it is coming from .....
0
votes
0answers
28 views

Magento 2 Invalid state change requested after redirect from third party payment gateway

I am facing this error when webhook hits to place an order in magento 2 after redirecting from the custom gateway page. "Invalid state change requested" Anyone knows how to fix this? I am ...
0
votes
1answer
36 views

Magento 2 get tax class id by product in website scope

I have a product that belongs to All store views and India website and the config for tax class in All store views is different from India website And I'm using $product->getTaxClassId() so it only ...
0
votes
0answers
39 views

Php script for import categories Magento2

Using a php script for my categories CSV and are "Default Category/Clothing/Shirts/Dress/Casual/Designers/Barba/Handmade shirts", but i need "Default Category/Clothing/Shirts/Dress/...
0
votes
2answers
34 views

Change order status for custom module

I want to use one offline payment method module, I install this module is there any way to change the status of the order to be Processing instead of Pending? Right now all my orders have status ...

1
2
3 4 5
74