strife's devLog

javaDynamic variables FOP / XSLT – font changing problem (switching font languages)

I’ve been working on the PDFs once again and I’ve spotted that I have a problem with changing languages depending on the variables. In other words if somebody speaks Asian languages font should be different than Arial.ttf which is as defualt.

To solve this problem we need to change our XML file which is used for populating all fields in the PDF to add to them another option indicates language parameter. Below you’ll find my quick solution for this problem. I assume that you’ve already configurated your envirovement and FOP / PDF thing.

In Java, first I’m getting XML and parse it putting the value indicates language in the XML. Something like this

In my XML file the first node within the root is tag.

So I’m dynamically changing language node to the language parameter and in XSL file I am just choosing in using the structure that I’ve written above. And that’s all.

Share

scripts-drupal-logoDrupal, UberCart – How to return / get back the cart from database

I’ve tried to found the solution how to revert the cart that is already in the database but as always I didn’t found any good solution though. I was looking the files which can help me to regenerate it and finally I’ve found it! Below you got the code that get any cart from the db and populate it.

Enjoy!

Share

prestashop-logoHow to Change the Original Price in Prestashop

That’s a really useful snipet for anybody who wants to change the original price to the new one.

Solution for this is very easy …

Ok .. here it is:

Product.php, line 1686

:)

Share

Paypal-logoUsing PayPal WPP (Express Checkout) with Django

A couple days ago I had to deal with PayPal WPP (Express Checkout) for some application and I found the module in the GitHub: https://github.com/dcramer/django-paypal.

Which works great but it was very hard to find how to set up the PayPal Payment Pro with Express Checkout method and fill customer forms in PayPal. I decided to find how to deal with it and I figured out how to do that.

After all developing stuff related to install this module to your django aplication you need to know how to send requests to PayPal using this method. And here’s the answer:
Read the full article »

Share

mysql-logoMySQL: How to Round Prices to Nine Ninety Nine at the end (9.99)

Hi there,

Here’s the example how to round values to 9.99 at the end. For example if we have a price 45023.12 and we wanna change it to 45029.99, we should simple use this code:

See ya!

Share