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
3
votes
2answers
4k views

How to update cart Quantity

I use this code to create and add an item into the cart. Here it is: <?php error_reporting(E_ALL | E_STRICT); $mageFilename = 'app/Mage.php'; require_once $mageFilename; $app = ...
3
votes
2answers
63 views

I uninstall smashingmagazine_brand, but I still have this error when I tried to edit a product

I have removed all files of smashingagazine_brand and also i deleted tables 'smashingmagazine_branddirectory_brand' and deleted following from core_resource table: '...
3
votes
1answer
5k views

Check if user logged on to admin or not, stops working after installation of Redis Session Cache

I have this code, found on the Internet, to check if a user is logged on to the admin pages or not. I recently installed Redis Session Cache successfully, and now these lines of code doesn't work ...
3
votes
2answers
4k views

Cron Constantly Running

I am having issues with cron.php constantly running. I never had an issue with this until I upgraded to Magento CE 1.9.1.1. My hosting provider actually had to disable cron.php because it was causing ...
3
votes
2answers
822 views

How to customize subtotal in shopping cart

I re-wrote updatePostAction() in a new class extended from Mage_Checkout_CartController. It has a special formula to calculate its subtotal. In debug mode, it calculates correctly, but the correct ...
3
votes
3answers
11k views

Magento white page at backend and frontend

After customizing some files last week, both the backend and frontend of the site I’m developing for went blank. I have already searched the internet and tried out some possible solutions, but none of ...
3
votes
1answer
371 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', ...
3
votes
1answer
178 views

After uploading a premium theme, Magento website doesn't work although admin dashboard is working fine [closed]

I'm a bit new to php and trying to install Magento 2.1.6 with a premium theme. I'm using GCP, using their Marketplace solution for Magento. After I upload theme to Magento root (copying app, pub and ...
3
votes
1answer
4k views

How to override private function in Model (Magento-2)

My di.xml file <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> ...
3
votes
1answer
1k views

How to redirect from model

I want to do redirect after do function from model. I already tried both code below, both works redirect, but both return error too. Redirect 1 : $this->_redirect('*/*/addresses'); Redirect 2 : ...
3
votes
2answers
5k views

Zend_Db_Adapter_Exception pdo_mysql extension is not installed

ralfe@ralfe:/opt/lampp/htdocs/amboim$ bin/magento setup:di:compile Compilation was started. Proxies code generation... 0/7 [>---------------------------] 0% 1 sec 42.0 Mi Proxies code generation.....
3
votes
1answer
2k views

Custom Page in My Account

I am trying to create a custom page that will show in the customers My Dashboard area. The page will be similar to the My Orders page however it will show different information. On the website we list ...
3
votes
2answers
806 views

Call to undefined method Mage_Sales_Model_Resource_Order::getCollection()

I am having issues getting a collection from the DB in Magento. I am trying to pull the field rx_queue from the table sales_flat_order (it's a custom column we added). When I run the function that ...
3
votes
1answer
3k 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 ...
3
votes
1answer
1k views

Magento 2: Serializing a Category Tree as Primitive Types

In Magento 2, I can get a category tree with the following $tree = $this->treeFactory->create(); var_dump( $tree->getTree( $tree->getRootNode() )-&...
3
votes
2answers
242 views

Responsive Best seller [closed]

I have added best seller on my homepage referring to this link https://blog.amasty.com/how-to-display-bestselling-products-in-magento-source-code/ but it is not responsive, I want to make it ...
3
votes
3answers
1k views

Magento contact us custom transactional email: Customer received plain html codes

I have created a custom transactional email for contact us and applied this on the admin contact. The emails are successfully received on our test email. However, the email contains all the html codes....
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 ...
3
votes
2answers
2k views

How to set “Display Product Options In:” to “Product Info Column” by default

How to set Catalog-> Manage Products-> X product-> Design-> Display Product Options In: to Product Info Column by default. i want apply it to all products.
3
votes
3answers
97 views

Is it possible to execute code for every fired event without too much boilerplate code?

This is mostly out of curiousity, as I think it would be very useful in some situations. Is there are a way in Magento to execute a piece of code every time an event is fired, regardless of the event? ...
3
votes
2answers
3k views

Magento 1.9 : Getting customer information on magento success page

How can i get the both guest and registered customer details such as Firstname and Telephone number on success page ? I am having order# on that page, So can i get the customer information from ...
3
votes
1answer
599 views

Magento get list of products which never ordered

I am using magento 1.8 and want to generate a list of products which never ordered on our site. Can you please give some idea on it. I am open to use any code as well as any sql which can be directly ...
3
votes
2answers
3k views

Magento collection classes confusion

I confused by following collection classes $orders = Mage::getResourceModel('sales/order_item_collection'); $orders = Mage::getResourceModel('sales/order'); $orders = Mage::getResourceModel('sales/...
3
votes
1answer
3k views

Magento: Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance()

I am getting the following error message: Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance() in /var/www/html/app/code/core/Mage/Catalog/Model/Product.php on line ...
3
votes
1answer
1k views

How to edit SQL error generated by PDO.php?

I started with this exception: exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds ...
3
votes
1answer
12k views

How to get all the customer wishlist items in magento

I want to get all the product ids from wishlist in magento. I tried with below code but I am getting only one product id. public function GetWishlistProductId($productId) { $customer = Mage::...
3
votes
2answers
78 views

Magento 2.3: How to hide only free shipping methods based on postal code

In the below code, I am hiding all shipping methods based on postal code 2nd value is 0. In this case, all shipping methods are removing. but I want to remove only free shipping. Can you explain how I ...
3
votes
2answers
41 views

How do I get connection to database by entering Database details in Magento 2?

I want to get custom database connection by adding database details in my custom script without using ResourceConnection. In Magento 1 we can do like this $conn = new \mysqli($servername, $username, ...
3
votes
1answer
220 views

Get all 3rd level categories

is there any chance how to get ALL third level categories available? I have searched whole internet and found only getting categories based on parent category but it doesnt return whole store 3rd ...
3
votes
2answers
1k views

How to cache a block in block_html cache type in Magento 2?

I have a block file that does heavy data processing due to which my product page PHP rendering time increases above 2 seconds. I have disabled page_cache in my Magento 2 system so i cannot use ...
3
votes
1answer
326 views

Overwrite Constructor to inject custom module helper

I have created a custom module. which rewrites \Magento\Checkout\Block\Onepage\Success class by creating a custom module. and i am able to make changes in prepareBlockData function but i want to ...
3
votes
2answers
3k views

Php max_input_vars prevents attribute options saving in M2

Magento 2.2.1. PHP 7.0.26 Nginx After 2 days struggling around with attribute options in M2, I found out where the problem was. I have several custom dropdown attributes with hundreds of options. I ...
3
votes
1answer
3k views

Array to string conversion in Magento 2

Notice: Array to string conversion in /home/pacifi48/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2999 Magento 2 Version 2.2.2 How to solve???
3
votes
1answer
2k views

Product page 404 error only sometimes [closed]

I have a weird problem I can say. I'm using Magento 1.9.3.6, and SOMETIMES, NOT ALWAYS, when I want to access the product page, of any product, it gives me an 404 page not found error and if I ...
3
votes
1answer
1k views

How do I check if page has certain ID

I have a page that needs to behave a little different than similair pages, so I want to add an if else statement for only one ID. How can I do that for magento 1.9? On the view.phtml I need to add ...
3
votes
2answers
2k 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'...
3
votes
1answer
32 views

Magento 2.1 security: Arbitrary PHP from database fields

I have a basic security question about Magento 2.1 Do any of the modules in a default installation allow the execution of arbitrary PHP code directly from a database field? I'm assuming not, but I ...
3
votes
1answer
408 views

Magento php wrong version detected

I work in ubuntu 14 server. The problem is that in the console i see the version of my php is 7.0.14, and in the magento2 setup it says my version is 5.5.9 I appreciate any help
3
votes
1answer
6k views

How do I set a custom Magento session variable outside of Magento

The Magento System is in "web/shop". How do I set a session variable outside of it (e.g. in "web/index.php")? And how do I read it inside of Magento (e.g. in "web/shop/app/...")? The scenario is the ...
3
votes
2answers
2k views

Invalid carrier specified - Cannot add tracking to shipment

I'm trying to add tracking to orders via the SOAP (V1) interface using the sales_order_shipment.addTrack method - but as the title suggests I'm getting the following error: Invalid carrier specified ...
3
votes
1answer
660 views

How to assign product category during products import

I've to import some products from a txt file where, for every row, there's product sku, product name, product description, short description, price and category id. The products are imported but price ...
3
votes
1answer
944 views

How to Get links from Magento customer menu?

I'm trying to get url's from Customer Menu (My Account) from Dashboard, in a controller that extends Mage_Customer_AccountController. I've tried this: class Namespace_Module_AccountController ...
3
votes
4answers
6k views

Cannot correct php.ini error in Magento 2.0.2

Hello I'm using the latest magento source files from magento website. I've installed the files via directions on the support documentation of magento website and at the Readiness Check point i get the ...
3
votes
2answers
138 views

Where Does Magento use Composer's `type` Attribute — Is this Required?

In my experiments with Magento 2 composer packages, I've been able to get a package up and running without using composer's type attribute. However, this class file #File: vendor/magento/framework/...
3
votes
2answers
8k views

How to make Payment Gateway in Magento 2?

Please provide any official documents or any demo/tutorials mode for this (How to make Payment Gateway in Magento 2). I was referring to http://inchoo.net/magento-2/implementing-payment-gateway-...
3
votes
1answer
525 views

iterate over array value not display in phtml

I´m trying to display Ebay GetSingleItem response (http://developer.ebay.com/devzone/shopping/docs/callref/GetSingleItem.html) and I´m having problems displaying array ["ItemSpecifics"]. The call is ...
3
votes
2answers
2k views

Getting all rows from database

i have an array string with id numbers example: $taxIds=array(9,13) how to fetch all record with this query?? $connection = Mage::getSingleton('core/resource')->getConnection('core_read'); $sql ...
3
votes
2answers
4k views

Get average review star rating score in text

I want to echo the average review star rating of a product in text. Currently it is displayed in width % to display the review stars. But I want to display it like: Reviewscore is 4.7 / 5 How can ...
3
votes
1answer
2k views

company name in place of first/last name for Business customer group?

How can i make the customer group Business request a Company Name instead of First Name or Last Name. this way when signing up a company i can put in the company info since there wont be any first/...
3
votes
1answer
5k views

Modify custom option of product in cart

I have this code in checkout/cart/item/default.phtml $allProductOptions = $_item->getProduct()->getTypeInstance(true)>getOrderOptions($_item->getProduct()); $productOptions = $...

1 4 5 6 7 8 66