Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [php]

This tag is used for questions which 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.

1
vote
0answers
16 views

How many ways are there to create a controller and what are they?

I have been developing with Magento 1.9 for the last two weeks. I have found several problems to develop each project (probably because my first project with magento had a high level...). I come ...
2
votes
0answers
22 views

How to create a custom payment method module

I was trying something new on the payment method where people can upload receipt and it will appear in backend I was thinking about editing the amazon pay and put my own code to it ,I am totally new ...
1
vote
1answer
47 views

Magento 2.3.0 - Can't login to admin

I can't login to admin panel on Magento 2.3.0 version. After I press Sign In button I have this message: "Invalid Form Key. Please refresh the page." and in the system.log file I have this: [2019-02-...
1
vote
2answers
43 views

Magento 2 - Get country name from country code

I want to get country name from country code, in Magento 1.9 I use the code like this to get country name: $countryCollection = Mage::getModel('directory/country_api')->items(); foreach($...
1
vote
2answers
35 views

Magento 2 run custom PHP script

I want to run a custom PHP script in Magento 2 webshop using a custom module. But I want it to run only when installing or during installation of my custom module. To be specific, during ...
0
votes
1answer
22 views

Magento 2.3 Very High PHP-FPM CPU Usage

Using Magento 2.3 and after some extensive digging, it seems that either fotorama or another that loads the images on product list and product page runs several instances of PHP-FPM all at high usage, ...
2
votes
0answers
44 views

PHP Fatal error: Cannot declare class Zend_Mail_Message after composer update Magento 2.2.7

Does anybody know how to fix this? When running the index PHP Fatal error: Cannot declare class Zend_Mail_Message I already tried Deletion of cache, redis, generated folder etc Setup upgrade and ...
1
vote
0answers
13 views

Cannot make transaction paypal magento

I am trying to check out through paypal, I have put all the details in the paypal configuration in magento like username password etc. The issue is when i login through paypal and then click continue ...
1
vote
1answer
24 views

Customer edit tab showing blank page

I am getting this error in my logs PHP Fatal error: Declaration of Mage_Customer_Model_Customer_Attribute_Source_Website::getAllOptions() must be compatible with ...
2
votes
1answer
20 views

CSS and JS Files Not Found Magento

Magento CSS and JS files are not found. I have just installed Magento 2.3, The issue is that the JS and CSS files are not located at what they are supposed to be and because of that i am getting not ...
0
votes
1answer
33 views

Add custom button on add/edit product page

How to add a custom button, in add/edit product page (magento2). I need to open popup on clicking of the button.
0
votes
2answers
34 views

Contact Page URL Change: Magento 2

I have tried to changed the default URL of contact page in magento2 to my custom URL but it is not working at all. I have tried as follows: Put the following code in my custom module.xml <config ...
0
votes
1answer
46 views

How can I edit files like frontend/…/category/view.phtml?

I have been trying to edit some files from the frontend folder. On this folder I have the following folders: base, default, rwd and typologancee. I have to create a specific filter which is going ...
0
votes
0answers
14 views

save php curl output , create xml file and save int it [closed]

I want to save my php curl output. I am hitting a url and I am looking for a script to create a new xml file and save the output of that curl url. This is the output on browser after hitting the url....
0
votes
0answers
29 views

Multi website languages switcher, how to show flags?

How to show flags in this code? <?php $stores = Mage::getModel('core/store')->getCollection()->addFieldToFilter('is_active', 1)->addFieldToFilter('store_id', array('neq'=>0));?> <...
0
votes
1answer
19 views

Invalid Argument Supplied for foreach() in /…/Importblock.php on Line 67

I am using a theme and trying to import blocks has this warning popup: Warning: Invalid argument supplied for foreach() in /home/pluslivi/public_html/app/code/Rokanthemes/RokanBase/Controller/...
0
votes
0answers
13 views

Intercept any exception

how are you? So, I've been work in integration between Magento 2 and Microsoft Azure Application Insights to log the errors. There is the possibility to listen to all the exception that can occur in ...
0
votes
0answers
34 views

How to get loggedin user session in magento

I created a module,that show list of user . I want to show that page to any user who is logged-in magento2 admin panel // world.php <?php namespace Pulsestorm\HelloWorldMVVM\Controller\Hello; use ...
3
votes
1answer
45 views

Magento 2 - looking for faster and better way to deploy static content

I am using a multi store setup with Arabic and English and everything is working well including building modules and template building. However, if I make a change to any less file or JS file (...
3
votes
0answers
37 views

Magento 2 - Event dispatched when user click “Proceed To Checkout”

What is the name of the event that is dispatched when a customer clicks on "Proceed To Checkout" after adding stuff to their cart? I want to register that a user started a checkout process for ...
3
votes
1answer
32 views

Memory limit set to -1 is the good approach?

In one of my custom script a memory exhaust issue showing.so i did set memory_limit to -1 now it is working fine.But is this the good approach to do this or need to increase the size of memory_limit ...
0
votes
0answers
11 views

What Is Use Of Update Wishlist Button in Magento 2?

I Have an issue in this functionality. When I have Click On It But No Effect on any Product of wishlist
0
votes
1answer
27 views

Why does this require “..path” is returning a fatal error (PHP)?

my question is simple but I have not found a form to solve it. I am trying to include a library located on the magento's module which I am developing. $simple_excel_path = Mage::getBaseDir('code')."/...
0
votes
2answers
47 views

Proper way to call a model constant in Magento 1

I have the class below: class Company_Module_Model_Somemodel extends Mage_Core_Model_Abstract { const SOME_CONST = 'constant_text'; } What is the proper and correct way to call the constant ...
1
vote
1answer
19 views

Invalid method Magento\Framework\View\Element\Template::showCaptcha

I am having problems to show my captcha in my form. I have my showCaptcha function declared in Block directory, but it keeps me showing the next error , can anyone please help me?: here is my block: ...
0
votes
0answers
32 views

How to remove /magento2/ parameter from URL?

Current URL : http://localhost/magento2/rest/V1/products/options/types I want to use without /magento2/ i.e. http://localhost/rest/V1/products/options/types I am using XAMPP server with ...
0
votes
0answers
7 views

Transfer Customer Data From Custom System to Magento2, possible?

I know there's a way to transfer data from Magento1 to Magento2 but I'm interested if there's a way to transfer data from custom system to Magento2?
0
votes
0answers
40 views

Export Category name in xml feed Magento 1.9.2

I have the script below for exporting product xml feed for magento 1.9.2 The problem is that I cannot export the category name for each product The scipt is: require 'app/Mage.php'; Mage::app(); $...
0
votes
0answers
32 views

Magento 2 - (Shipping Address) Custom city dropdown validation not working in checkout page

I followed this link. I created a custom shipping method and I need the city to be required for my shipping rates to be calculated. My problem is my shipping-rates-validation doesn't get trigger it ...
0
votes
0answers
21 views

Magento 2.2.5 Class 'IntlDateFormatter' not found

I'm running ubuntu 18.04, using php7.0 and i get this error even though i installed all the extensions while installing magento, is there anyway to fix this, php -i | grip intl shows /etc/php/7.0/...
0
votes
1answer
47 views

Magento 2 - Add subcategories images in Top Navigation Menu

I want to add subcategories images in Top Navigation Menu, I found this module but display only parents categories, I need to be on subcategories. I want to be like this:
7
votes
1answer
120 views

Why does adding constructor parameters require my to clear /generated

I'm using Magento 2.2 in development mode. I have a controller class class MyController { public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\...
0
votes
0answers
8 views

Magento 2 user field validation using an API

In a dedicated data table where we stored customer's privilege card number in order to validate them with users that they enter to a field called "privilege card no" On such an occasion I'll have to ...
0
votes
1answer
17 views

What are the preferred server resources needed to run a magento 2 ecommerce site? php memory limit, virtual and physical memory? ,

When updating magento to 2.3, warning was given to set php memory to a minimum of 2048. Wondering what the preferred settings/resources are and if hosting on a shared server is fine.
1
vote
0answers
38 views

How to create a custom discount “Gift card” in Magento 1.9 at cart page

The functionality will be = Enter Gift Card number(16 digit) Enter Gift Card Pin(6 digit) Enter Amount(amount entered by user) I have already created the above mentioned input fields in the cart ...
0
votes
1answer
25 views

Migration from 1 to magento 2

I am trying to migrate a magento 1 to magento 2. Both database are on my local system. When I run the migration tool I don't get any error messages but when I check the products in the magento 2 ...
0
votes
1answer
39 views

Magento 2.3.0 - Create Product Page H1 title with product name and attribute name

I have created two phtml files that can be called from within a CMS Block on a product page to echo the product name and an attribute name. As follows: Product Name {{block class="Vendor\...
0
votes
0answers
8 views

Magento 1.9.2. - foreach remove duplicate from options attribute value

I'm pulling out all the values ​​of the color attribute of the products associated with the product configurable with this foreach. foreach($simple_collection as $simple_product){ echo $...
0
votes
2answers
48 views

Magento 2.3.0 - Add custom block after product description tabs

I've created a CMS block called km_product_page_short_description I want to call this CMS block in a custom block below the product description tabs (where the blue line is) as shown in the ...
0
votes
2answers
77 views

How to use require_once in magento 2

I'm trying to include a PHP class in magento 2. I use a require_once and create a folder lib in the root of my module and there I put the folder that contains the class lib/Meli/Meli.php Also try in ...
1
vote
0answers
10 views

Sub Category - Load By Attribute (name) URL issue, how to resolve?

Mage::getModel('catalog/category')->loadByAttribute('name', $val)->getUrl(); The above code won't work correctly in my PHP code when I have multiple categories & sub-categories with the same ...
0
votes
1answer
17 views

How to catch exeption in unit test and check it

I have a model class, that throw exception if some value is null. How I can test, that it condition is ok. $contact = $this->contactFactory->create() ->setEmail('testdelete@...
0
votes
1answer
27 views

How to get products from wishlist using customer id

Magento 2.3 PHP 7.1 I trying to get products from customer wishlist in Model but $products array is empty. $products = []; $items = $this->wishlist->loadByCustomerId(1, true)-&...
0
votes
1answer
61 views

Magento 2: Get Order Info From Invoice

Using Magento 2.3, I'm trying to get a custom attribute from the order and save it to the invoice when the invoice is first created. I already have the custom attributes setup and saving to the ...
0
votes
0answers
11 views

How to edit category in Magento 1 using PHP using path (Not ID)

I need to be able to revise Magento 1 categories externally. When products are created using Magmi it creates the category, during the process, I store the path used to create the category. I want to ...
1
vote
2answers
78 views

Magento 2.3.0 Get product attribute name in phtml in CMS Block

I have a attribute called Artist It has several artist names XYZ ABC RST I need to be get the artist name associated to the current product page via a call to a phtml in a CMS Block. What do ...
0
votes
0answers
40 views

Quantity not getting validated (the way it should) for numbers between 1 - 9

I have problem with quantity increments, unable to increase the quantity for a product in the cart by increasing the quantity number in the input field, the input field for quantity does not seem to ...
1
vote
1answer
17 views

Magento 2: Admin user with restricted access can access everything via API?

I have created an admin user to manage my orders and granted the access for order view action only. (as below) But the user can generate token via API and access all order i.e view, delete, etc ...
0
votes
1answer
71 views

Magento 2.3.0 Get Country Name

I'm trying to insert the current store country name through a CMS Page/Block by following this article. I've created a Block file countryname.php in app/code/Vendor/Countryname/Block with the ...
1
vote
0answers
12 views

Generate xml php code problem

I am using a php script to generate an xml from my magento 1.9 to a comparison engine. I have a field in the engine called mpn which need to be filled from my product's SKUs $aData['id']=$iProduct; $...