I just searched for a solution to surcharge customers for a certain PSP in Magento. The only thing I could find a module which priced at USD 49. I also found a lot of argument about whether card payment surcharge is illegal or against PSP’s policy, to which I do not care. What I do care is a free and easy solution to do the job.
Looking at Promotions -> Shopping Cart Price Rules, we can give discount for some kinds of payment method. But the discount can not be minus, which makes it work as surcharge. However, Magento only validates discount must be positive when saving a shopping cart price rule to database. It does not validate again when applying this rule. Therefore, we can make up a rule, enter discount with a positive value, then change the value to minus in database. That’s all you need to do to surcharge customers.
By the way, I think Magento validation on discount limits its usability. Why not use the salesrule module for both promotions and surcharges? I really like to see the menu Promotions be replaced by Sales Rules. (The word salesrule is already being used as table name and in script.)
I had an email from PayPal a while ago. I believe it was sent by some careless staff of PayPal.
PayPal always remind people aware of phishing emails. At the bottom of the email, it says – How do I know this is not a spoof email? Spoof or ‘phishing’ emails tend to have generic greetings such as “Dear PayPal member”. Email from PayPal will always address you by your first and last name.
However, this particular email address me “Dear First Name Last Name”.
Today I did something CSS cross-browser testing. Here are some of my findings today.
Validate Xhtml / Html before styling. I put form element between table and tr element which make it an invalid xhtml document and cause CSS rendering in a strange way in IE. (IE is generally bad in W3C standards but this time it is good – it reminds me to validate xhtml.)
is for Sarifi and Chrome only, making elements “shrink”, even block elements.
> selector can’t be understand by IE6 and under.
Few people are using IE5.5 or under, so I decide not to bother about layout in IE5.5 or under.
Block elements have overflow by default to show in IE6, So if I want to set the height of a block element, I need also set
Cleaning elements with
to clear floating elements above better be placed inside the same parent element of floating elements, otherwise in IE6, the elements after cleaning elements will not align nicely. for example:
$_product = $this->getProduct(); //$_product is 甲产品
$_option = current($_product->getOptions()); //because only one option
$_selection = current($_option->getSelections()); //because only one selection
$_qty = $_selection->getSelectionQty();
If server_name is something like “*.mydomain.com”, $server_name is exactly “*.mydomain.com”. If $server_name is passed on to fastcgi_param as SERVER_NAME, in the program, for example, php $_SERVER[‘SERVER_NAME’] will be exactly “*.mydomain.com”. However, _SERVER[“HTTP_HOST”] shows the value most of us would expect, i.e. the host name in the address bar.
In Nginx, I have set up a mechanism to install some popular scripts once, and use in multiple websites. I do not want people to find these websites are run under one roof. But if I write multiple websites in one line:
server_name domain1.com domain2.com domain3.com;
$_SERVER[‘SERVER_NAME’] is always assigned domain1.com no matter the host is domain2.com or domain3.com.
To avoid that, I have to break three websites into three server block in nginx.
$_SERVER[‘HTTP_HOST’] is always the host. But I can not control how people write the script. Breaking hosts into separate server blocks is recommended.
Nautilus is quite good, easy to use in regards to its mount feature. It can automatically “mount” Windows Share via smb:// protocol. However, some software, e.g. FileZilla (now 188.8.131.52) can not read from or write to smb:// protocol. A genuine Linux mount is more helpful than Nautilus mount.