Thursday, June 3, 2010

How to set the decimal points or decimals in Magento

I was screwing around with Magento to attempt on getting the decimal places to work.

Searching online, I found a solution: to edit a particular line of code in /public_html/lib/Zend/Currency.php.

All you have to do is to change line 62, "'precision' => 2" to "'precision' => 0" or to a number that you want. However this solution is purely hard-coded.



What if you have multiple websites that uses the same Magento system?

Here's the solution to it, I have created some code to assign the precision value:
*** WARNING: Perform a backup of Currency.php in the event something goes wrong! ***

- Firstly, open up /public_html/lib/Zend/Currency.php

-Add this line of code after around line 90, you should see several similar lines like:
$this->_options

Code to add
$this->_options['precision'] = self::getPrecision($currency, $this->_locale);

-Next, just add in the next block of code within the class itself. If you're not sure where to put it, you can just paste it just before the lines of code above
public function toCurrency

Here's the code:

public function getPrecision($currency = null, $locale = null)
{
if (($currency === null) and ($locale === null)) {
return $this->_options['symbol'];
}

$params = self::_checkParams($currency, $locale);

//get the precision
$format = Zend_Locale_Data::getContent($locale, 'currencynumber');

iconv_set_encoding('internal_encoding', 'UTF-8');
if (iconv_strpos($format, ';')) {
$format = iconv_substr($format, 0, iconv_strpos($format, ';'));
}

//knowing the number of digits after the decimal point
if (iconv_strpos($format, '.') == null) {
$precision = 0;
} else {
$precision = iconv_strlen($format)- 1 - iconv_strpos($format, '.');
}

return $precision;
}

- Next, save your Currency.php file and upload it back to /public_html/lib/Zend
- Lastly, edit the appropriate xml files to have the decimals set.

For example, here's the code for en_AU.xml which I am currently testing on.
Note that I have changed the angle brackets to square brackets for documentation purposes on a blog.

[?xml version="1.0" encoding="UTF-8" ?]
[!DOCTYPE ldml SYSTEM "http://www.unicode.org/cldr/dtd/1.5/ldml.dtd"]
[ldml]
[identity]
[version number="$Revision: 1.46 $"/]
[generation date="$Date: 2007/08/21 16:11:36 $"/]
[language type="en"/]
[territory type="AU"/]
[/identity]
[numbers]
[currencyFormats]
[currencyFormatLength]
[currencyFormat]
[pattern]¤#,##0.00[/pattern]
[/currencyFormat]
[/currencyFormatLength]
[/currencyFormats]
[/numbers]
[/ldml]

Friday, February 12, 2010

Chords: 陈伟联 - 我只在乎你

Youtube link:
http://www.youtube.com/watch?v=zdM7hBvewSE&feature=related

Intro
C Em Dm G

C Em Am Em
如果沒有遇見你 我將會是在那裡
F Em Dm G
日子過得怎麼樣 人生是否要珍惜
C G Am Em
也許認識某一人 過著平凡的日子
F C Dm G
不知道會不會 也有愛情甜如蜜

C Am
任時光匆匆流去 我只在乎你
C Am
心甘情願感染你的氣息
F Em Am
人生幾何 能夠得到知己
Dm G E
失去生命的力量也不可惜

Am Am/G# Am/G D/F#
所以我求求你 別讓我離開你
C Em Am Dm G C
除了你我不能感到一絲絲情意

C Em Am Em
如果有那麼一天 你說即將要離去
F Em Dm G
我會迷失我自己 走入無邊人海裡
C G Am Em
不要什麼諾言 只要天天在一起
F C Dm G
我不能只依靠 片片回憶活下去

Thursday, January 28, 2010

Wednesday, January 20, 2010

Moving on...

Hey blog...

Haven't been posting on you... No one reads anyway... I hope to be reading you in the future when my memory goes bad...

Anyway... I have been moving on with life, everything is moving on other than I'm romantically zero. Single-hood and no target in sight. Not that I'm actively looking, I'm not in the mood for it anyway. I don't move on as fast as Ms. Toh. That's less than 3 months.

I'm quite tempted to see her latest updates on Facebook... Very very tempted but I shall not. It brings back the pain in a way... She dropped me for financial reasons, not that she's materialistic but she has a bad shadow or trauma on poverty. Can't say I blame her but she's not being sensible or having a common sense.

When she wasn't doing well in her insurance I had to lend her cash occasionally. I even paid for most of her laptop and then she almost wanted to buy a car. Imagine the financial burden and outlook at that point of her insurance career. Did I drop her for financial reasons? Definitely not...

Of course it almost evened out later when I was still looking for a job in the economic depression.

Looking at my point in life right now, I'm much better off. Financially, materialistically, physically. Romantically zero. Not that I'm looking for a relationship but it's like I've gained a lot more but lost happiness. Not that there will be much happiness if we didn't break up, but I've definitely lost happiness.

Time to move on, I have a schedule meet, improvements to work on. I just need to move on with motivation and positivity. But the human, the carnal and emotional me wishes for Ms. Toh to suffer once what she has made me suffer through.

Evil? Vengeance? Hell hath no fury like a human betrayed and scorned. Of course that is bullshit, I'm not that evil, I just want her to stop standing on her tower of pride. That tower of pride has stood between us since a long time ago. And my only wish is to see the proud humbled.

God grant me this wish.

Thursday, January 7, 2010

Sleeping woes

Been taking power naps in exchange for my sleeplessness in the day...

Of course I do my work... I come in early to do work before I touch my power naps.

In any case, even naps are kind of screwed up... I'll fall asleep inconsistently.
It'll be like a semi-conscious state where you are resting able to perceive auditory information yet rest. Yet it is not a complete rest...

Anyway I had a dream of her again. In this dream I was in a car with her, where she needed my help to do some mundane chore (pick up her auntie from the airport) even though we have broken up and stuff. So I sort of confronted her and asked her many questions that I would have asked if she were to seek me out for a talk.

Fucking dream felt real and waking up just leaves me confused and tired.

Fitness and Hunkness in 7 months

I've 'concocted'/drew up a 7 month plan for my bodybuilding journey, set to end by July 2010.

Originally slated to end by Dec 18 2010, I have actually calculated it to end by July 2010 because of IPPT, I will have to do the actual training.

For example, currently I'm doing jump ropes instead of running. When my training regime ends, I will be doing the running and chin ups etc instead of weight training and jump ropes etc.

Most likely I will have passed IPPT because there is an ICT in April. No matter, my training is for CDO gold so press on!!!

Right now all I need is to take a before/after photo... Need to get a nice 'before' photo haha...

Wednesday, January 6, 2010

To 2010 and beyond!

Hi my dear blog.

It's the first post of 2010...
Many things happened last year... and many more will happen this year. Good or bad, it will come.

I am currently heading on to complete Project Hunk in time for Dec 18 2010 and some other stuff...

I went back to church, through a friend who was there for me at the right time...

I'm also silently waiting for the time of reprisal, a time of revenge, though it's not right to be doing that, but I have every right to do so after being thrown away and left to die emotionally. I want YOU to feel that pain. Until then, like my friend Serene says, I should live my life better and improve it to the point where Ms Toh will regret her decision, as a form of revenge. Or maybe I misunderstood what Serene has said but I'm partially blinded by revenge.

Woops a long line on revenge... Let's not lose focus on my own personal life.

Exercise and work, let's go. Keep the money rolling in, even if it's little by little... I still have the installments on Kaelyn to finish.