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.

PHP is the Programming Language Magento is written in, at least the part of Magento which runs directly on the Server.

Most of the users of the Magento Stack Exchange are developers who have some or good knowledge of PHP and may expect the same from you. So try to always get all the needed information if you have a PHP related problem. Try to get error messages as detailed as possible, the stack trace is also often helpful (the many lines of file paths usually stored in the error report or the exception.log) or explicit code examples describing what you are working on when you are a programmer yourself.

3842 questions
7
votes
3 answers

How to know if an order is from existing customer or new customer?

I have the following code: $lastOrderId = Mage::getSingleton('checkout/session') ->getLastRealOrderId(); $orderId = Mage::getModel('sales/order') ->loadByIncrementId($lastOrderId) ->getEntityId(); $order =…
Luis Valencia
  • 303
  • 1
  • 4
  • 15
4
votes
3 answers

Implementing enhanced ecommerce with Google Tag Manager

I want to implement enhanced ecommerce with Google tag manager on Magento. I'm not a developer but i can play around with files and backend if instructed. I don't know how to send dataLayer for enhanced ecommerce through magento. I want to do it…
Gill
  • 41
  • 1
  • 4
4
votes
3 answers

Magento how to get subtotal session value in custom module?

I am currenly working on one custom module for magento 1.9.1 I am stuck on getting the session value of the checkouts subtotal. I know how to get it in a template file but i have to get in in a simple php file. This is the code that i am tring to…
Venelin
  • 121
  • 2
  • 3
  • 5
3
votes
2 answers

How to update cart Quantity

I use this code to create and add an item into the cart. Here it is:
Venelin Vasilev
  • 1,062
  • 4
  • 33
  • 60
3
votes
2 answers

Difference between Absolute and Fixed Product Custom Option Price Type Magento

Can anyone tell me the difference between absolute and fixed product custom option pricing in Magento? I have used fixed price before, but I am not able to understand the working of absolute pricing, it doesn't add in product price when I add the…
karan adhikari
3
votes
4 answers

Magento Website Hacked - encryption code in all php files

Our website getting hacked again and again with some encryption code in all php files. I don't know why and how it's hacked. I want to know if someone can debug and provide some needy solutions. Here is encryption code sample which is on eav
3
votes
2 answers

Filter Magento collection with nested "OR" "AND" filter

I am trying to determine how to filter a Magento collection from a flat table that would produce a WHERE clause with an AND that is followed by expression with a nested OR, which has nested ANDs, such as: SELECT * FROM `my_model_flat_table` WHERE…
robenecker
  • 31
  • 2
3
votes
2 answers

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 Description is not required, how can i do this?
Gabriel Buzzi Venturi
2
votes
1 answer

How to set up a custom variable in custom Adminhtml form and then parse it to the Observer

I am working on a custom Magento extension. Version: 1.9.0.1. I have a custom Adminhtml form, here it is: Here is the Form code:
Venelin Vasilev
  • 1,062
  • 4
  • 33
  • 60
2
votes
2 answers

PHP & Magento. Adding convert multiple PHP strings for a Helper/Data.php

I have this PHP code (found of Stackoverflow): This shows the available attributes on the catalog view page in Magento. isConfigurable()): ?>
Ronny
  • 433
  • 10
  • 26
2
votes
2 answers

Magento - Set GrandTotal

I'm using magento 1.9.1 I have a script which is getting the magento session GrandTotal outside the magento system. I mean i have php file called grandtotal.php and i have placed it to the magento main directory. Here is the code in…
Venelin Vasilev
  • 1,062
  • 4
  • 33
  • 60
2
votes
3 answers

Show excerpt of short description

On my webshop I have the option to quickshop from the category overview, which opens a lightbox if the product have different sizes. In this lightbox I have added the short description for the given product, but the text gets too long. Therefor i…
McKeene
  • 501
  • 2
  • 9
  • 25
2
votes
2 answers

How to make some parameters editable via admin

I created a module that looks like this: http://screencast.com/t/TG7brmUi And the code looks like this: he code is as follows: Luisvalencia_Affiliate.xml
Luis Valencia
  • 303
  • 1
  • 4
  • 15
2
votes
2 answers

failed to open stream on magento module

I am trying to create an observer on a specific event to save on session the url referrer. I created this structure: http://screencast.com/t/TG7brmUi The module seems OK, I can see on magento config. http://screencast.com/t/5d4FXIJwrGk the code is…
Luis Valencia
  • 303
  • 1
  • 4
  • 15
2
votes
2 answers

Warning: strlen() expects parameter 1

Im constantly seeing the following error in system.log I've gone into the file but cant see anything wrong can any one help me? Warning: strlen() expects parameter 1 to be string, array given in…
Will Wright
  • 624
  • 1
  • 5
  • 17
1
2 3 4 5 6 7