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.

-1
votes
0answers
4 views

Magento1.9, Where do I place scripts to run custom php scripts

I am running Magento 1.9 . I am a beginner to Magento and PHP and wanted to start working on PHP in the Magento environment to test what I am creating thus learning Mage and PHP at the same time. I ...
6
votes
5answers
19k 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, ...
3
votes
0answers
16 views

magento 1.9 special offer timer for first time user

For my Magento 1.9 website, I want to set the special offer timer. In which I want to display this timer to first time user (new visitor) only and it will use this offer within an hour only. After an ...
0
votes
1answer
802 views

get Qty Increments

Do you know how I can get the "Qty Increments" on the product page? Product page back end: Code 'addtocart.phtml': With this code, I have a blank field. Thanks in advance.
0
votes
2answers
788 views

Magento/php: adding product to cart with custom details and price

(Magento 1.9) I created a form to be able to customize a product and generate a preview sketch of what the end result would look like with a cost (this was done outside of Magento as an individual ...
0
votes
3answers
27 views

Magento 2: Get Product Collection by Dropdown Value

How do you get a collection of products based on the drop down attribute value instead of the id? .... protected $collectionFactory; public function __construct( ... \Magento\Catalog\Model\...
4
votes
2answers
156 views

How to Convert an Object into Array in magento 2

i Need All cms pages in an array I got All in an object but the format i got is not that I expected $cms = $this->collectionFactory->create()->toOptionIdArray(); echo "<pre>"; print_r($...
0
votes
2answers
25 views

Call to a member function toHtml() on null Magento 2

I am trying to show Product Collection in .phtml file of custom module <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product photo product-item-photo"> ...
0
votes
1answer
877 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, ...
0
votes
2answers
765 views

How to get information about product in cart

I want to get information about product in cart such as customer_firstname, customer_email. I use this code: $carts = Mage::getModel('checkout/cart')->getQuote(); foreach( $carts->...
0
votes
1answer
21 views

How to Get Recently viewed Products in Magento 2

i want to get all data from magento core table table name is report_viewed_product_index i searched on stakeexchange and found some solution but havn't for success class Wbtab extends \Magento\...
3
votes
3answers
716 views

problem adding items to cart from outside magento

I'm having this problem and getting pretty annoyed by it. here's the situation. I was running a website on the codeigniter framework, and our customer wanted to add a shop to sell a couple of ...
0
votes
0answers
8 views

Magento 2 - Disable Text Swatch in Category Pages

I setup "size" attribute as Text Swatch and Use in Layered Navigation: Filtrable (with results). Is there any way to be Text Swatch only in the Product View Page? I need in the Layered Navigation to ...
86
votes
4answers
40k 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/...
0
votes
0answers
15 views

How can i add checkbox under email copy of credit memo need to show (Refund to store credit) in credit memo page in magento 2?

In my custom module, I need to add checkbox under email copy of credit memo with a value field like(Refund to store credit) shown in the picture. How can I achieve this?
0
votes
1answer
809 views

Magento2 Check value of attribute for IF statement

I am trying to check if an attribute is set to yes then show this block. <?php if($_item->getAttributeText('free_shipping_toggle')=='1'): ?> <?php echo $this->getLayout()->...
1
vote
1answer
32 views

how to get value of selected option using jquery

I need to get selected value from select field using jquery in magento <field name="slider_location"> <argument name="data" xsi:type="array"> <item name="...
1
vote
4answers
2k views

how to fix php curl extension error while installing magento 2

How to fix php curl extension error while installing magento 2? I attached the Screenshot
0
votes
0answers
17 views

Delete a single item from cartshop PHP [closed]

i want to delete a single item from my cartshop but i don't know how it's possible. Maybe a solution? <?php session_start(); $ok=0; $database_name = "publictransport_db"; $con = mysqli_connect("...
2
votes
2answers
864 views

Admin Panel Style is not working

Admin Panel all functionalities are working but the style is not working. The console shows the following errors: public_html/skin/adminhtml/default/default/boxes.css Failed to load resource: the ...
2
votes
1answer
1k 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/...
25
votes
12answers
41k views

Magento 2 Allowed Memory exhausted error when compile code

I have error when i add module.. Please re-run Magento compile command so i run below command but also display error that below when run command from root, php magento setup:di:compile Compilation ...
0
votes
1answer
17 views

Add Rich Snippets Magento 2

I have the following code, which I have appended to the opengraph/general.phtml file in Magento 2. I am hoping this will add the rich snippet data required by Google, but I am receiving an error (...
0
votes
2answers
759 views

.php file auto converting to php.suspected

I am facing new problem within 2 days. My Many PHP file are showing extension as suspected. However, i renamed all as earlier , it again came as php.suspected within 8 hrs. Kindly Suggest me the ...
0
votes
1answer
34 views

phpcs possible raw SQL statement

In my code I've got a $connection->query("TRUNCATE TABLE $tableName"); Works great. However using the official https://github.com/magento/magento-coding-standard ruleset it showed the following ...
0
votes
1answer
21 views

Invalid argument supplied for foreach() in /var/www/html/app/code/Ves/Megamenu/Model/Config/Source/StoreCategories.php on line 284

I have this error when I add special characters to menu or categories like "&" It's from module Ves Megamenu. Warning: Invalid argument supplied for foreach() in /var/www/html/app/code/Ves/...
0
votes
1answer
862 views

How to disable Orders and Returns: “/sales/guest/form/”

I notice that magento 1.7 offers an option on the frontend where customers can look up their orders using email, order number and billing name. The form is usually located here: domain.com/sales/...
0
votes
1answer
19 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
1answer
19 views

Magento 2: How to get individual review rating

I'm trying to get each individual review rating on a product, but currently I am only able to return the product's overall average rating. Here is what I have so far to build my collection of reviews ...
0
votes
1answer
21 views

magento 2 getting error on update product action in admin panel

I am getting the below error in the magento admin panel while editing the product options from the action dropdown. Catalog - products. Select a product or 2. Then actions menu select change attribute ...
0
votes
2answers
23 views

How can I configure my computer for checking My Magento Extension is Compatible with multiple Magento versions with php versions?

I have developed an extension for Magento Marketplace. For this, I had installed code sniffer Magento coding standard. But Marketplace checks All the Standards and Compatibility of Extension with ...
1
vote
1answer
798 views

Help me on CORS Access Control Allow Origin

I have one domain having mywebsite.com and there would be multiple subdomains like subdomain.mywebsite.com , subdomain1.mywebsite.com , subdomain2.mywebsite.com and so on. In htaccess file I have ...
1
vote
1answer
808 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": "...
2
votes
1answer
37 views

phpcs Use ::class notation instead warning on attribute source field

I've created a setup script to load from a source model $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, 'location_reference', [ 'type' => 'varchar', ...
0
votes
0answers
23 views

Magento 2 PHPMD and Coupling Between Object classes (CBO)

I'm working on a Magento 2 CRUD functionality following the best practices (best described here). On the project I'm working on we are using PHPMD (php mess detector). Among other rules, we have the ...
0
votes
1answer
805 views

Magento2 - How can I display a product attribute value in Order Summary block?

I am trying to display a product attribute value - SKU in Order Summary block. I have found the template where it is displayed: vendor/magento/module-checkout/view/frontend/web/template/summary/item/...
1
vote
2answers
1k views

How to get Custom HTTP header in Magento2 controller?

I'm accessing my controller via postman tool (Postman) I've passed custom header as shown in image and trying to access it in controller through this code: $this->_response->getHeader('APP_ID'...
10
votes
4answers
18k 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 */ $...
0
votes
0answers
242 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: $....
4
votes
1answer
850 views

cannot get extension attributes value

The value can post However,I cannot get Extension attributes on my plugin which intercept Checkout success controller code. getExtensionAttributes always return null <?php namespace Genning\...
0
votes
1answer
28 views

Magento 2.3.1 - Configurable products auto select first option

how I can auto select the first associated product in configurable product on Magento 2.3.1. Thank you
0
votes
1answer
12 views
0
votes
0answers
25 views

How to send a javascript variable to a PHP file in Magento project?

I have this file that contains a javascript variable: src/app/design/adminhtml/default/default/template/smv/order/sales/creditmemo/refund.phtml <p> <select name="creditmemo[reason]"> ...
0
votes
1answer
24 views

How to move first element of object to first Magento 2

My object is something like this object(Magento\Framework\Data\Collection)[8565] protected '_items' => array (size=3) 15841610 => object(Magento\Framework\DataObject)[8701] ...
0
votes
2answers
996 views

CONNECT ERROR: The 'local' channel is not installed. Please use the MAGE shell script to install the 'local' channel

I am kind of new to magento and php. I am getting the below error I found many solutions which says that in order to fix the above error we should do following steps: chmod 777 mage ./mage mage-...
0
votes
1answer
1k views

magento 2 doesn't copying product picture in tmp folder

I creating a product pro grammatically in magento2. The issue is that i can't set addImageToMediaGallery. I always receive error: The file "/home/xxx/pub/media/tmp/catalog/product/t/e/test.jpg" ...
0
votes
1answer
33 views

Magento 2 - Configurable how to get Name of first associated product

I need to get the name and assigned attributes value of the first associated product of configurable in Magento 2. I use something like this: $_product->getResource()->getAttribute('color')-&...
0
votes
0answers
10 views

Plugin supporting Magneto 2.0-2.2 is being reviewed for non-supporting php versions?

I have been trying to publish a plugin which is intended to support Magento versions 2.0 - 2.2 and was submitted to technical review. As per my understanding, Magento 2.0-2.2 supports following php ...
1
vote
2answers
45 views

M2 | How to create global variable that can be used only in the same class?

The scenario is I have multiple if-conditions to create product programmatically or load at controller action. I need a single variable who's value should be updating through different functions. I ...
1
vote
2answers
29 views

Magento 2 get Simple product url from configurable

I am extending Magento_ProductAlert module. By default when subscribing to product it saves configurable product id but I have managed to get selected simple product ID. And later I know that I can ...