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
0answers
9 views

Magento 2 Image resizer error

I've installed a Instagram feed module from Amasty, but am getting this error from a module clash I believe: Error filtering template: Recoverable Error: Object of class Staempfli\ImageResizer\...
0
votes
1answer
4k views

Get customer id from session null [duplicate]

I tried to get customer id from default.phtml in /vendor/magento/module-catalog/view/frontend/templates/product/view/type, but when I use $_SESSION['customer_base'], the customer_id is NULL like in ...
0
votes
1answer
20 views

Magento 2: Create a custom module to see admin viewed order details [on hold]

I want to create a module in Magento 2 where I can display the admin order activities. Like when user login in admin and go to the order history then the logged-in user click on the order that should ...
0
votes
2answers
2k views

Magento 1.9 - Maximum file upload size?

I have to upload photos that are about 5-10mb each,but the default maximum size is 2mb. I've searched in google and found that you have to edit the php.ini file and increase the amount. However, when ...
0
votes
1answer
19 views

Magento 2 - While compiling my model to create (nameOfOrderFactory) by Magento I face { Interceptor generation error} [on hold]

At first, this is my error >> In Generator.php line 139: Class VendorName\ModuleName\Model\NameOfOrderFactory does not exist Class VendorName\ModuleName\Controller\Index\Index\Interceptor ...
0
votes
1answer
741 views

can't get file input when submiting a custom form

I have used this extension HOW TO CREATE A CUSTOM FORM IN MAGENTO ADMIN to create a custom form in my backend and the custom form has only one file input. when i submit the form, it return form key ...
0
votes
2answers
3k views

How to solve 500 internal server error in custom module in magento 2

My php version is 5.6 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/php_curl.dll' - /usr/lib/php/20131226/php_curl.dll: cannot open shared object file: No such ...
0
votes
2answers
22 views

Magento 2.3: How to get tracking info from an order in observer

We use ShipStation to send tracking information to Magento and I'm trying to retrieve the order shipping / tracking information once this is saved to the order. If I use ...
0
votes
0answers
33 views

Magento 2 All Products pages Redirect to catalog search

I am facing an issue which is I am not able to access any products pages. Either trying to access them directly via product url or product page Or via Search Results Or via Site Navigation every ...
18
votes
8answers
6k views

Magento 2: “Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider”

My Magento 2 development environment has started poking me with the following error message Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact ...
2
votes
1answer
615 views

Elegant way of constructor dependency injection when extending abstract class?

I'm wondering what the best way is to add extra dependencies in the constructor of a class when extending another (abstract) class? In follow up to this answer regarding dependency injection when ...
0
votes
0answers
16 views

php code or mysql query to 'bundle' 2 attributes into 1

I would like to know if it's possible to update a text attribute by appending the content of another text attribute. i.e. For all my products, I would like that the new content of attribute1 becomes ...
0
votes
0answers
21 views

How to show Update Totals button on credit memo page in Magento 2

In credit memo page update total button is not showing after installation of the extension. How to add the update total button in that extension code. Please find the layout and template file in that ...
0
votes
1answer
39 views

Magento 2: Error when trying to run command php bin/magento catalog:images:resize

I'm currently trying to run the following command php bin/magento catalog:images:resize But when it gets part way through I get the following error: 587/1490 [>] 39% 9 mins 54.0 MiB | /d/o/...
1
vote
1answer
589 views

Magento ERR (3): Warning: Invalid argument supplied for foreach() in /home/onyxclot/public_html/shell/abstract.php on line 144

I have checked my System.log to find im getting the above error, the below is the code from line 144, would any body be able to advise on how to resolve. foreach ($_SERVER['argv'] as $arg) { ...
1
vote
1answer
582 views

Magento get Customer Data from session id

I've create a login function that make the customer login by email and password and return below response { "status": "success", "message": { "id": "1", "name": "username", ...
0
votes
1answer
39 views

Custom php code in magento not working / magento block path wrong

i am new to magento & using magento 2 . I have to run a php code in my cms page . When i check the website i can understand that the theme is Alothemes Bencher6 . So what i did is app/design/...
1
vote
2answers
1k views

Couldn't reindex stock of one item programmatically

I'm trying to reindex one product only programmatically: $product = Mage::getModel('catalog/product')->load($_productId); $product->setForceReindexRequired(true); Mage::getSingleton('index/...
3
votes
1answer
1k views

Magento 2 call table stock_item from database

I working to Magento 2.0.2 and i trying to call the table stock_item of the product. When i worked in Magento 1.9 i used this code: loadByProduct($_product)->getQty();?> But now the class Mage is ...
2
votes
1answer
651 views

How to Get email template in dynamically choose format(For example Html Or Text) using Magento 2?

I need to get email template in dynamically choose format(For example Html Or Text) while customer orders anything in Magento 2. For Example: Customer account has one option, which Email ...
1
vote
2answers
1k views

Controller 404 Page Not Found [Extension Dev]

I am learning from tuts+ premium tutorials. i am using this link to get some output http://127.0.0.1/folder/mage3/index.php/demo/index/sayHello my xml file in config.xml <frontend> <...
2
votes
2answers
885 views

Ui form: Edit functionality: Image Preview in magento 2

I have created Ui form. In that, I have uploaded a image which is also saved in DB and shows preview in admingrid. It shows image preview for a new action But it is failed to show image preview and ...
0
votes
1answer
26 views

Magento 2: Problem updating Magneto v2.2.1 to v2.3.2

i want to update my Magento to v2.3.2, when i run composer update, i get this error: Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request ...
7
votes
3answers
1k views

SSL Installed Checkout and Account Area Still Using HTTP and not HTTPS

I am running magento 2 ver 2.0.7 I have an HTTPS issue. I'm not quite sure why this is happening but in Stores -> Config -> Web. I have my secure base url set to https://mystore.com/ but when I ...
0
votes
0answers
20 views

Bulk update product price and stock

In the Catalog > Products page you can go to Actions > Update Attributes at the top left and then bulk update product stock/quantity/etc. How can I do this using the Magento PHP PDO but in bulk like ...
1
vote
1answer
703 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
2answers
38 views

I just want to be able to remove the “Filters” button from Catalog > Products page [closed]

I just have this button here in the Catalog > Products page I just want to be able to remove/hide it programmatically.
3
votes
3answers
5k views

Class Mage not found in Magento 2

I'm new to Magento 2. Fatal error: Class 'Mage' not found in \vendor\magento\module-theme\view\base\templates\root.phtml on line 23 Can anybody tell me how to solve this?
0
votes
1answer
18 views

Coupon code doesn't get set, no error

I've created a program to automatically create coupon codes based on certain criteria for a user, the code generation works fine, and I can test that by sending the coupon code in through the URL(like ...
0
votes
0answers
19 views

Searchbox Stays Open After Upgrade to 2.2.9

Extensions Amasty Advance Search Amasty Elastic Search Elasticsearch 5.1 Apache 2.4 PHP 7.1 The search box in my theme stays opened after I upgraded to Magento Community Edit 2.2.9 and has become ...
0
votes
1answer
1k views

Call to a member function extend() issue

I tried to import my Magento project into my local machine (wamp server), But I was not able to access it, i got the following error: Fatal error: Call to a member function extend() on a non-object ...
0
votes
0answers
18 views

Get all bundle option selections regardless of stock

I am done with searching the web and the core for possible solutions. I've found multiple solutions but only one worked (not completely). Now I am about to query them by a raw statement. However I ...
0
votes
3answers
35 views

Parse php plain text to html Magento 2

I have a string HTML and have to convert(parse) it to HTML in PHP. $stringHtml How to convert this to HTML so that it all <p>, <br> tag works this is Riskified decline email, and ...
0
votes
1answer
579 views

upload product image from external url programmatically magento

We have created product programmatically. Also, need to fetch image from below URL http://www.diamondselections.com/Embed/client_assets/images/round@2x.png
0
votes
0answers
28 views

Need to create custom error pages (500, 503) for Magento 2

I want to create custom error pages for HTTP Responses of 500, 503, etc. in a Magento 2 project. After turning on "ProxyErrorOverride" from the virtual host, I found that we can use the below code in ...
22
votes
11answers
28k 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, ...
1
vote
1answer
20 views

How to truncate the name title on related products block magento

<div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($item->...
1
vote
2answers
641 views

Assign a customer group on registration. magento 2

I have a customer registration form, and an additional field I want to assign a customer to specific group id on if he selected the custom field in the form. please suggest any solution for how to ...
1
vote
2answers
598 views

Rewrite ?cat= to seo friendly URL

(Magento) On a category page I can filter products by other categories using the ?cat=... parameter. This works just fine (In combination with Amasty improved navigation). But I would like to make the ...
2
votes
1answer
2k views

Force Customer to register in Magento 2 checkout

What can I do if I want the customer to register in the check out process? Is there any simple way to do it? I want the user register from the billing information where users are required to fill in ...
0
votes
1answer
830 views

Set store cookie not working in Magento 2

I'm trying to make my first Magento 2 module so I'm new to this... Basically what I'm trying to achieve now is: check if a store view was set in a cookie before if yes: do nothing. if not: set ...
0
votes
2answers
649 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 ...
1
vote
2answers
587 views

Updating product in the catalog

I've some code to import some products: if the prodocut is new, I've insert it in the catalog, otherwise, I've to update the product if there are some changes. Code is the following: <?php ...
2
votes
2answers
1k views

How to display all sub categories from one category?

I'm trying to show all the subcategories of the category id3. Category ID3 -> Category Level 2 for Category ID3 -> Category Level 3 (for category Level 2) <?php if (!Mage::registry('...
8
votes
5answers
20k 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, ...
0
votes
1answer
31 views

Running custom php script results in SQLSTATE[40001]

I have created a custom script to reset to the default values for certain attributes across all my products and my 3 store views. Here's the code <?php require_once "../app/Mage.php"; Mage::app()...
0
votes
1answer
34 views

Magento 2 - Delete store view

I want to delete Admin website from my website, but if I delete my admin is not accessible anymore. Any ideas how I can delete that Admin Store safe? This is my database: store table store_group ...
2
votes
3answers
3k views

Select product image using SQL in Magento 2

In Magento 2, how can I get the product image using only MySQL queries? For example, /c/t/ct0126black.jpg. All of my products are configurable products so they have different images for different ...
0
votes
1answer
24 views

Magento 2.2.2 Upgrade to 2.2.6 Not Latest

I want to upgrade a magento 2.2.2 site to 2.2.6 mainly to fix issues with very slow reindex esp for Catalog Search index when Elasticsearch is being used I dont want to upgrade to the latest 2.3.2 ...
2
votes
2answers
60 views

Magento 2.3 Extensions on Ubunu 18.04

I installed Magento 2.3 successfully on my Ubuntu Maschine and tried to start to make my first own module. I followed this tutorial: https://www.cloudways.com/blog/create-module-in-magento-2/. But I ...