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.

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; $...
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. ...
3
votes
11answers
23k views

set always_populate_raw_post_data to -1 doesn't work

I got a big problem. When I first installed Magento I got the error set always_populate_raw_post_data to -1, which I did and it worked. Now I am trying to install some sample data into Magento and ...
3
votes
2answers
5k views

Remove required fields from magento admin panel

My client ask me to remove the required option from some fields in the product form from magento admin panel, because he don't want to fill this fields. I need to say to magento that the field Short ...
3
votes
2answers
1k views

How to deactivate the user automatically after 90 days if he had no purchase with in 90 days

How to deactivate or inactive the user automatically after 90 days if he had no purchase with in 90 days. in our website
3
votes
2answers
2k 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 ...
3
votes
4answers
2k views

Quantity increment button

I have configured a product with the "Qty increments" (100) / and " Minimum Qty Allowed in Shopping Cart" (100). When I go to the product page, the quantity is 100 by default but when I click on "+", ...
3
votes
2answers
561 views

Magento 2: Clear Direction on Controller Result Factories

In a controller's execute method, has there been any clear guidance from the Magento core team if client developers should Be using the individual PageFactory, JsonFactory, RawFactory, etc objects ...
3
votes
2answers
5k views

Fatal error memory exhausted Zend Pdo

I am having an error with memory while browsing my site - my server has increased memory allocation to a large enough level (I think). Does anyone know why I'm getting these errors whilst browsing? ...
3
votes
3answers
1k views

Standalone file in root to create a category attribute:

Hi I am trying to create a file in root of magento installation to add a category attribute. I don't know what i am doing wrong. Here is the code: <?php require_once('app/Mage.php'); // Include ...
3
votes
1answer
5k views

Submit action form

when i submit form don't submit to acion Save. what wrong. Source <div class="edit-slide"> <?php $model = $this->getModelEdit();?> <form id="edit_form_slideshow" method="post" ...
3
votes
5answers
731 views

How do I override a model in Magento 2?

I want to override the model for an optional lastname. di.xml: <type name="Magento\Customer\Model\Address\AbstractAddress"> <plugin name="aroundAddressValidation" type="Xxx\...
3
votes
1answer
390 views

Magento 2: What is purpose of .php_cs file?

The .php_cs file can be found on the root of the Magento installation. I'd like to know how can I use it as well.
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?
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 ...
3
votes
2answers
347 views

Custom CMS markup tag in Magento?

A company that I'm working for has 20+ stores in the UK and are starting to frequently open more and more. There's a lot of traces of words throughout the CMS in category descriptions, pages and even ...
3
votes
3answers
9k views

Magento 1.9.1 Helper Class not found error

While creating the new page in Admin panel, getting the error as Fatal error: Class 'Ddevs_Ebayaff_Helper_Data' not found in /var/www/html/bitkarshop/app/Mage.php on line 547 My config files are as ...
3
votes
3answers
6k views

how to set base image in coding while adding image programmatically

I added the code to update the product images programmatically. Please refer the below code $firstProduct = Mage::getModel ('catalog/product') ...
3
votes
5answers
6k views

Can i import the bundle products in magento by using csv?

i want to import the bundle products by using csv in magento.i am import the bundle products by using dataflows its import the bundle products but its not show the bundle items in backend. headers my ...
3
votes
2answers
146 views

unable to get order status in sales_order_place_after event in magento 1.9

Hello I am unable to get the order status in the observer sales_order_place_after I also tried other events like checkout_onepage_controller_success_action, checkout_type_onepage_save_order_after. ...
3
votes
4answers
211 views

If statement for translatable product attribute values

I'm using this kind of statements on other places in the webshop (product detail page) but I want to use this one is on the category page: <?php if ($_product->getAttributeText('...
3
votes
1answer
1k views

Why my bin/magento setup:upgrade is really slow?

Running this command seems incredibly slow taking around half an hour+. I feel like it didn't always take this long and am wondering if this is normal and if not what can cause this? This is a very ...
3
votes
1answer
646 views

Magento 2: the phpserver/router.php file

So according to the README, the purpose of this file is to implement the PHP built-in webserver. However, when you open the file, you can see the following from line 35: /** * Caution, this is very ...
3
votes
3answers
1k views

Save Magento 1.9.2 contact form data in database?

I want to store Magento 1.9.2 contact form data into database? I have create a New DB Table and create new Module on local Pool but Controller overwrite is not working. I want to send email as well ...
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
59 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
3k 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
797 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
10k 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
150 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
3k views

Magento 2: How to Automatically Create Invoice from Order Observer

I'm testing on Magento 2.2.3 and I've created an observer for the event sales_order_save_after which I'm using to automatically create an invoice. Here is the current error that I'm receiving after ...
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
3answers
552 views

Magento : Not able to set posted value in the observer

I am trying to modify the product price when user hit the add to cart button on product view page. For this I did some jQuery and hidden fields. Once user hit the add to cart button, I receive the ...
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
707 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
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 ...
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
229 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
95 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
581 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
2k 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
1answer
76 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 ...