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.

Filter by
Sorted by
Tagged with
0
votes
1answer
28 views

Layout XML Error - Magento 2

I change the deploy mode to developer on Magento 2 and now I see the following error: 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is ...
2
votes
2answers
93 views

Migration from 1.9.x to Magento 2.3.x issue

I try to migrate data from my old Magento store 1.9.3.10 to the new Magento 2.3.2 but when I run: php bin/magento migrate:data --auto -r vendor/magento/data-migration-tool/etc/opensource-to-...
0
votes
0answers
27 views

Magento 1.9 Configurable Products Options and cart issue

I'm working on a magento 1.9 site, it have strange issue, we we go to a configurable product page it don't show the product options and ad to cart button. -The list pages show the other two option ...
1
vote
1answer
23 views

Magento 2 error report add prefix in file name

How i can add prefix for error report file name located in /var/report/? Like : prefix_979188230854 Any suggestions please?
3
votes
0answers
20 views

Redirect old page to new html page using .htaccess

We have a static HTML website having MicrosoftDynamics.html page recently we changed to MicrosoftDynamicsNav.html. But when we searched in google the page URL is showing old one, If we clicked the ...
0
votes
0answers
19 views

Shipping fees not get updated when quantity get increased in magento 2

In the admin configuration, I set a minimum order amount of free shipping is 1000 INR and flat rate shipping as 50 INR per order. In my cart page when I order a product below 1000 INR, the shipping ...
1
vote
1answer
34 views

Getting Null on Quote Collection by Reserved Order Id

I am trying to get quote data By reserved_order_id I tried this code protected $_quoteFactory; public function __construct( \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $...
0
votes
0answers
12 views

Magento 2: Add to cart button in category page with pre-selected attributes of configurable child

I want to create an add to cart button for a child of a configurable product in the category page. I'm trying with this code where I add the super_attribute hidden fields with the values of the ...
3
votes
0answers
27 views

Magento 2 admin in invoice total section grand total not get reduced

When creating an invoice for the order from Magento 2 admin panel, the grand total not get reduced with my store credit value.
2
votes
2answers
149 views

Magento2 - New order e-mail for us

we have an extension that sends out a new order e-mail to our own private mailbox. Which is different from the ones that customers get. We print these mails automatically on a receipt printer. We use ...
1
vote
1answer
57 views

Magento 2 Override ListProduct.php Block File

I am trying to override ListProduct.php file in my custom module, Steps: File: etc/frontend/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
22 views

Magento 1.x Get customer billing address

Magento 1.x How to get a customer billing address in my custom module controller file?
3
votes
1answer
48 views

Magento 2 Updating Other Products in catalog_product_save_after event Observer

I had created an Observer of this event:catalog_product_save_after I am trying to update other products and loading them on the basis of their id, but it is giving me an error. I am Sharing my code ...
0
votes
1answer
16 views

magento 1.x When a full refund complete of the order need to generate custom mail

Please any one help me on this point ,i want to generate a custom mail when get full refund of the order.Any idea on this please help me.i m new in this field..
2
votes
0answers
42 views

How to Remove a Block From layout Programatically in magento 2

i am trying to remove a Crossell from cart page in my phtml file how i can do this when i researched i found crosssell products are viewed in checkout_cart_index.xml file as <...
0
votes
1answer
16 views

Magento 1.x How to get customer paid amount in my custom module file?

How to get customer paid amount for the order? i want to validate the Order total amount and customer paid amount. can anyone please help me to solve this. Thanks in advance
2
votes
2answers
18 views

Magento 1.x How to get order Total amount in my custom module page?

How to get order total amount in my custom file ?
2
votes
0answers
23 views

How to get the applied custom discount amount in observer?

I followed the steps in the below link to apply custom discount [https://magento.stackexchange.com/a/93349/21007][1]. But I need to get the applied custom discount amount in the observer event of ...
0
votes
0answers
8 views

Not getting any value while searching the products using REST API

I am searching product as per product sku and name using the end point API of magento2 but for some search text no value is coming. I am explaining my code below. There is one product present which ...
1
vote
1answer
22 views

How to pass array value in url

Array :- foreach ($relatedProducts as $relatedProduct) { $_product = $objectManager->create('Magento\Catalog\Model\Product')->load($relatedProduct->getId()); $skus = $...
0
votes
0answers
44 views

Getting PHP Fatal error: Class 'IntlDateFormatter' not found

When I execute the phpunit cases for one of the model, I'm getting the error below, PHP Fatal error: Class 'IntlDateFormatter' not found in /Users/userone/Sites/Magento-CE/vendor/phpunit/phpunit-...
0
votes
0answers
19 views

Magento double cart

How to build a Magento double cart by sorting the vendors. one should normal process another one has added a product that is not available from this site. in detail, we build a site with multiple ...
0
votes
0answers
21 views

How to update the order total dynamically when I click to apply button in store credit section

I am trying to update the order total when I click to apply button in store credit section using knockout js.
0
votes
1answer
53 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
3answers
31 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\...
0
votes
1answer
26 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\...
0
votes
0answers
20 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?
1
vote
1answer
45 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="...
4
votes
2answers
173 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
1answer
37 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
28 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
27 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
28 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
1answer
25 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
2answers
24 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 ...
3
votes
1answer
50 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
28 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
39 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
13 views

How to add magento 2 location based search product

Like this how to do in magento 2 location based product search
0
votes
0answers
26 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
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
51 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 ...
1
vote
0answers
23 views

Attribute value shows 'no' when it is 'yes' on category listing frontend Magento 2

I have a very strange issue with my store. I have an attribute (yes/no value) and when I echo the value on the listings page on the frontend of my Magento 2 store all products show the value as 'no'. ...
1
vote
2answers
50 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
1answer
50 views

How to pass params to uiComponent without caching?

I have some issue with initialization uiComponent and passing parameters to component. So I have code, example below: <?php // @codingStandardsIgnoreFile /** @var \Magento\Wishlist\Block\...
3
votes
0answers
23 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 ...
3
votes
1answer
59 views

Move block inside another block

I want to put the header.links into another block. this is the icon.phtml file: <div data-block="dropdown" class="minicart-wrapper"> <i class='fas fa-user-circle action' data-trigger='...
0
votes
1answer
39 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 ...