Stack Exchange Network

Stack Exchange network consists of 175 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.

84
votes
4answers
38k views

Explanation of UI Component Grid in Magento 2

Is there a good explaination and/or sample of the bare minimum configuration needed to create a UI Component Grid in Magento 2? I know there are myriad core components, such as ./vendor/magento/...
70
votes
13answers
28k views

Is Magento ready for PHP 7?

PHP 7 is reaching beta status and lots of testing is going on at the moment. Given that Magento caught up within the last year from "runs only on PHP 5.3" to "fully compatible with PHP 5.6", I would ...
3
votes
2answers
5k views

Magento 2: Save all product data outside Magento with Images

I have below code with Image Upload which is working fine. But images are not stored in Database Table as mentioned in Order. include('app/bootstrap.php'); use Magento\Framework\App\Bootstrap; $...
17
votes
10answers
24k views

Magento 2 - What is the correct way to change default Order Id?

Magento 2. After fresh install the new Order id will be 100000001, 100000002 and so on. What is the correct way to change that increment id so it would be a higher number? For example 155555552, ...
22
votes
1answer
12k views

Magento 2: Adding Arbitrary HTML to the <head> of Every Page?

In Magento 2, is it possible to add an arbitrary bit of HTML to every frontend/cart page's <head/>? I know I can add a block to the content/<body> area with code something like this <...
18
votes
2answers
4k views

Magento 2: what is the $data array constructor parameter?

So I noticed that in most models and blocks, there's this array $data = [] given as the last parameter of the constructor. For example \Magento\Catalog\Block\Product\ListProduct public function ...
10
votes
3answers
14k views

Programmatically create a configurable product and assign the simple product to configurable product in Magento2 product

This is what I've done so far. The simple and configurable products are created. The problem is I cannot assign the simple product to configurable product. Here is the code (ids and attributes works ...
7
votes
2answers
5k views

Impossible to save category with more that 1000 products

This is a known issue caused by PHP 5.3.9 and max_input_vars that by default it is set to 1000. The solution 2 proposed here it is the best in my opinion but doesn't work: for some strange reason it ...
4
votes
2answers
5k views

Share cart in magento 2 multistore

I have a magento 2 website where we want to have 3 different stores on 3 different domains. We want to share cart and customer session on the different websites. Each website/store will have different ...
21
votes
7answers
23k views

I am starting out learning Magento with no PHP experience, what are my options?

I have programming experience and HTML experience and am struggling to find a good guide for beginners. The Magento website seems pitched at experts but I could be looking in all the wrong places. ...
16
votes
3answers
27k views

Magento : Fatal error: Class 'Mage_Giftcards_Helper_Data' not found in …/app/Mage.php on line 546

I have installed one module extension which throws an fatal error "Fatal error: Class 'Mage_Giftcards_Helper_Data' not found in ..../app/Mage.php on line 546" in admin. I have reffered this link ...
5
votes
8answers
11k views

How to add hreflang tags (or other meta tags) to pages in magento?

Hi using info from this site and around the web I have started to add hreflang tags to my magento store. They work and display as they should on the default (American)site, however on the alternate (...
3
votes
3answers
5k views

Magento 2: How to show/hide payment method on basis of amount

I'm using Magento 2 CE Version 2.1.0. I have 2 payment method Paypal Express Checkout & Bank Transfer. When the amount is greater than X then Paypal should not be displayed only Bank Transfer. ...
5
votes
3answers
10k views

How to override an admin theme template?

I would like to override app/design/adminhtml/default/default/template/page.phtml i'm currently using an extension that overrides app/design/adminhtml/default/default/template/page/header.phtml with ...
2
votes
1answer
2k views

Magento 2: Can you Filter By store_id Using a Product Repository

In Magento 2, it's not possible to add a store_id filter to a product collection directly. Instead, you need to use the addStoreFilter method, which adds a special "product limitation filter". It ...
0
votes
2answers
7k views

Moving from http to https - redirect via htaccess file

All my urls were unsecured and was indexed by google like that. Now I'm planning to secure all my pages with https But when the old urls show up on google search they automatically resolve to the ...
15
votes
1answer
15k views

Magento 2 : Add Product Attribute Programmatically

How to create Magento 2 Product Attribute Programmatically with type : Text Area.
11
votes
2answers
7k views

Magento 2: Product Repositories, Filter Groups, and `AND`

I'm trying to use a product repository to fetch a list of products. I want to fetch based on two filters, combined with an AND criteria, but things don't seem to be working. Do I not understand how ...
1
vote
0answers
247 views

Patch Installation - Security Patch SUPEE-10415 return 404 error Both Front-End & Back-End

I try to install Security Patch SUPEE-10415, after successfully installed my front-end and back-end getting 404 error.
7
votes
1answer
2k views

Magento2 :: Accessing $_FILES using Magento Framework [duplicate]

I am current working on a file upload functionality in Magento. Everthing is working great. I am using the \Magento\Framework\File\Uploader and files are getting properly uploaded. The issue I would ...
6
votes
5answers
16k views

Magento 2 - Get Subcategories of Specific Parent Category

What I'd like to do is grab all of the child categories of a specific parent category. I'm assuming the best way to do this is by using the parent's ID and of those child categories that are returned, ...
2
votes
5answers
4k views

Magento 2 Get Currency Symbol from Currency Code

I have below code $currencyManager = $_objectManager->create('Magento\Directory\Model\CurrencyFactory')->create()->getResource(); echo $currencySymbol = $currencyManager->...
24
votes
3answers
4k views

Creating Integration Tests for Magento 2 Modules

So far for my Magento 2 testing needs, I've been using PHP Unit as (more or less) an acceptance tester -- testing results of server and HTML requests made into a system with my module(s) installed. I'...
3
votes
2answers
3k views

Magento 2 - rewrite checkout and account url

What would be the proper way to rewrite/translate Magento 2 checkout and user account URL's to make them localized for my language? 1. Checkout Current checkout URL's are: domain.com/checkout ...
7
votes
5answers
27k views

programmatically adding product to cart returns empty price

i have been trying to programmatically add a product to cart using following lines of code, it seems to work and successfully adds product but for some reason, the price of newly added product always ...
14
votes
3answers
5k views

Magento 2: Syncing Backend and Frontend State/Cache

Does Magento 2 have any systems or abstractions for managing state between the backend and the local storage on the frontend? I'm working on porting a feature for restoring a user's abandoned cart ...
17
votes
3answers
15k views

Importing orders from a CSV into Magento programmatically

We're switching from an old, outdated point-of-sale system to using Magento 1.7 as our POS exclusively. Not unexpectedly, one of the challenges we're facing is how to get almost 20 years of records ...
4
votes
3answers
3k views

How to copy a product's attributes value to another attribute?

i want to copy a product's attribute (weight) to another atribute (general_weight). i found this codes, but i don't know what to do with this codes? or where to copy them? $prod=Mage::getModel('...
5
votes
1answer
3k views

Magento 2 - editing module structure and functions

in Magento 1.x you could duplicate the extensions to app/design/frontend/themeName/default/template/or/layout and then modify it's layout or functionality via xml or phtml files. How do we duplicate ...
3
votes
1answer
1k views

Cron error on line 240 from Mage/Core/Helper/Abstract.php

I will start by saying that I have not overwritten any core files (except the one noted below), and have disabled my theme. I'm am currently running on stock Magento 1.9.1. My website is not live, and ...
9
votes
2answers
5k views

Why doesn't Magento 2.1 support PHP 7.0.3 to 7.0.5?

As you may know Magento 2.1.0 is out. According to the release notes, only PHP 7.0.2 AND PHP 7.0.6 are supported Why aren't PHP 7.0.3 / 7.0.4 / 7.0.5 supported ? Edit: 2.1.2 now supports PHP 7.0.4
4
votes
2answers
9k views

Get all abandoned carts in Magento

How could I get all the abandoned carts with customer's email (programatically)? What does Magento consider as being abandoned? Not updated in the last day?
3
votes
2answers
1k views

Sales : Orders :How to add custom order status programmatically

I need to add custom status for an order programatically I have below controller file to save order status. I need to add custom status as cancel initiated.Provide me a solution... Controller file ...
2
votes
1answer
8k views

Magento2 how to downgrade properly

I had a Magento2 version 2.0.5 and I upgraded it to Magento 2.1.0rc1 using composer. I ran the command for setup upgrade and db schema upgrade. After upgrade I have faced some comparability issues ...
2
votes
4answers
4k views

How to check if a collection has items?

What does a product that is not found return in terms of Object? I'm loading a product like the following: $man_collection = Mage::getModel('catalog/category') ->load($mProduct) ->...
2
votes
2answers
3k views

No Inode space!; How to delete Magento sessions folder's contents?

Hopefully, someone can help me, A Magento website I'm managing keeps going down, I've determined it to be the fact that it has used up all of the Inode space on the server. The output to df -i is ...
1
vote
3answers
9k views

How to correctly update product programmatically - Magento 2

The Context: By decision of the client, the Magento Administrator cannot add products by himself, all he can do is edit them, therefore the addition of products must be done programmatically. There ...
1
vote
1answer
983 views

PDO is required ERROR

I've started getting this error when trying to Access Magento downloader, the rest of the site work: The PDO extension is required for this adapter but the extension is not loaded Been searching ...
24
votes
5answers
10k views

Magento 2: Programmatically Add a Value to `core_config_data`

Does Magento 2 have a high level abstraction that allows end-user-programmers to update configuration values in the core_config_data table? Or is using straight SQL the only way to do this in Magento ...
16
votes
1answer
3k views

Magento 2: Why does a UI Listing Component need Two Collections?

Magento 2 has a new "uiComponent" feature. This allows to you to include a simple <uiComponent/> tag in your layout handle XML files to add things like Grids and forms to your application page. ...
12
votes
3answers
30k views

Magento new custom block module

I'm using Magento version 1.8.1.0. I'm trying to create a new custom block module, which I'll use for creating a new home page. Namespace: Crusader Module: CLHomePage Block Type: crusaderhome Class:...
10
votes
4answers
17k views

Magento 2: How to Filter a Product Collection By Store ID

Using a product factory object, I'm able to create a product, grab a product collection, and fetch the first item of that collection /* var $productFactory \Magento\Catalog\Model\ProductFactory */ $...
5
votes
5answers
1k views

Magento Hacked: displays list of user emails and error message

-My client suspects his site was hacked,I'm not sure, but when I open index.php I get a list of emails and usernames, and what appears to be encrypted passwords (please correct me if I'm wrong). I ...
4
votes
4answers
15k views

Defer parsing of JavaScript in Magento

i analyzed my website on Gmetrix.com for for optimization and the result was this: 361.0KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page ...
20
votes
4answers
8k views

Magento 2: Sending Email Programmatically

Does Magento 2 have any built-in integration with third party transaction email deliverability systems like Amazon SES, Mandrill, etc., or is the built-in email functionality still based around PHP's ...
8
votes
4answers
12k views

Get Price of Configurable Product options

I need to export all products with prices from Magento 1.7. For simple products this is no problem, but for configurable products I have this problem: The price exported is the price set for the ...
6
votes
5answers
9k views

The each() function is deprecated. Magento 2 , php 7.2

I have been getting this error since I changed to PHP-7.2 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/vedic/vendor/...
6
votes
10answers
26k views

Magento Redirects to Old Website regardless of what changes are made!

We are having the strangest Redirection problem on a Magento site. We copied the sites contents from another Magento site to a new URL. We have done this in the past with no problems but for some ...
5
votes
7answers
19k views

Magento2 installation problem

I try to install Magento2 in My local system but I got PHP Extension intl error
10
votes
2answers
2k views

How to hide Magento from CMS detectors?

I have a Magento store and I want to hide it from cms detectors. I mean I don't want anyone to know my website CMS and that my website is built on Magento. There are some websites like http://guess....