I recently had to transfer files as well as simple text parameters from a Java application to a PHP script. Hence, I wanted the files to be available in the global $_FILES array and the simple parameters in the global $_POST array. Unfortunately, the task is not as easy as it sounds. One has to use MIME multipart messages. And there is no native support for MIME multipart in Java. Sending Complex Data From Java to PHP via a POST Request weiterlesen
Kategorie: PHP
Producing The Same SHA-512 Hash In Java And PHP
I needed to calculate the same SHA-512 hashes in Java and PHP. I thought that this would be a quite easy exercise. Unfortunately, it was not, so I decided to publish the code that finally produces the same hashes. First, let us have a look at the PHP code, which is really easy: Producing The Same SHA-512 Hash In Java And PHP weiterlesen
Sending Simple Data From Java to PHP via a POST Request
In my bachelor thesis, I develop an interface between a Java and a PHP application. Hence, I have to transfer data between the two applications. I decided to use a POST request in order to transfer data from the Java to the PHP application. Since sending a POST request from Java is not documented that good yet, I would like to show you my working code: Sending Simple Data From Java to PHP via a POST Request weiterlesen
Magento Programmatically Create Order
I just had to massively rework an interface to another shopping site for a customer. Therefore, I had to programmatically create orders in Magento, which is really an awful challenge. A pretty nice help for this was the code of Vinai Kopp, published under Pastebin.
A little extension for Vinai’s code: If you already have a customer object $customer
and want to use the default billing and shipping address, you can set it like that (compare with line 42/43 of Vinai’s code):
$quote->getBillingAddress()->importCustomerAddress($customer->getPrimaryBillingAddress()); $quote->getShippingAddress()->importCustomerAddress($customer->getPrimaryShippingAddress());
Hope this helps someone 🙂
Magento Tier Prices for Configurable Products
The way Magento handles tier prices related to configurable products is a little bit strange. Assuming we have a basic T-Shirt which is available in red and blue and normally costs 10 Euro. If you purchase 10 or more shirts, the price is only 9 Euro. I (and many others of you out there, too!) would expect to get the cheaper price if you buy e.g. 6 blue and 4 red shirts. Anyways, this is not the case in Magento. In order to achieve this behaviour, the guys from Tridian wrote a nice piece of code. Unfortunately, it seems to be old and unsupported. So I updated the script to Magento 1.4.1.1 and removed a little bug. The script from Tridian works fine for configurable products that have tiering prices. Sadly, there are problems with configurable products that do not have tier prices but a special price. In my version below, this bug is fixed. Magento Tier Prices for Configurable Products weiterlesen
Magento: Barzahlung nur bei Selbstabholung aktivieren
Ich werde hier immer mal wieder Magento Module, die ich geschrieben habe, vorstellen. Heute geht es los mit einem kleinen Modul, das die Zahlungsart „Barzahlung“ nur dann aktiviert, wenn als Versandart „Selbstabholung“ ausgewählt wurde. Das Modul lässt sich einfach an individuelle Anforderungen anpassen.
Magento: Barzahlung nur bei Selbstabholung aktivieren weiterlesen