Category Archives: PHP

For open source codes

Not receive order notification in CS-Cart

Tested the CS-Cart check out function, everything went well when I placed a order myself. And I also received an email from the system with the order information. But the email I used as the orders department did not receive the order notification from CS-Cart.

I spent (and wasted) a lot of time to do the trouble shooting on the issue above. Even I contacted the host provider to see if the email system blocked the emails generated from the CS-Cart code. But the solution actually was simply as the below.

Go to the back-end admin control panel of CS-Cart, click the “Orders” top menu item and then “Order Statuses“. On the new page, click “Edit” or click the “Open” status directly, and check the “Notify orders department” on the next Open Status page.

That is it.

How to enable ratings/comments on all products in CS-Cart

I compared a lot of shopping cart systems, and finally settled down with CS-Cart. If I have time (I wish) I would like to write down some of my comparison of these e-commerce system (Free Open Source ones and paid one). But even with CS-Cart which is not perfect, I had to do some extra work to get it work in the way we need. Today I just wanted to share one of tips I found to do something CS-Cart doesn’t have by default.

In CS-Cart, the review/comments addon has not been enabled by default. So you either do it one by one, or do it in a mass editing way as the below. Continue reading

A good WordPress plug-in recommended

bestwebsoftI should have written this post earlier since I have been using this plug-in for a while. But I didn’t realize its helpful result till recently I checked my comments section in my blogs.

As a lot of bloggers/WordPress Owners on the Internet, I put the comment spammers at the top of our hate list. I had to spend a lot of time to clean up these junk comments (with ads, links) even my WordPress installed the Akismet plug-in by default.

Things changed after I searched and installed a good CAPTCHA plugin from Bestwebsoft’s developer.  The following is what the plug-in description says about itself.

Plugin Captcha intended to prove that the visitor is a human being and not a spam robot. Plugin asks the visitor to answer a math question.

Well, I didn’t test and use other WordPress CAPTCHA plug-ins, so I couldn’t have a good comparison on it. And only thing here I have to say: it works, and works well for me. In the past month, I only had one or two junk comments on all my blogs compared to a few hundreds before without it.

If you are interested, and want to give it a try too. Search BWS CAPTCHA plugin in WordPress plug-in installation directory; or browse its website http://bestwebsoft.com/plugin/. Good luck.

How to get rid of newsletter required error in PrestaShop customer account registration

PrestaShopI used Prestashop for one of my friends e-commerce website. I tested, and everything was okay. But we didn’t like the Required message for the Newsletter checkbox while we tried to register a new account during the checkout.

So we tried to remove the required field. As usual, I searched the Internet for the solutions first. But a lot of search results talking about how to add new required fields for PrestaShop, like the phone number, etc. This needs to hack the Address.php class file. But I didn’t see any answers to my original question: just get rid of the Newsletter required message. Even I did, I would not have considered to do so by hacking the eCommerce system’s core files.

Then I looked up in the modules section, and I tried the different “newsletter” related modules. But unfortunately I still could not find a solution.

Finally, before I almost give up and decided to hack the core files, I found the place to make the change. Here is the how-to:

1, Log into the admin back-up.

2, select the Customers option from the Customers top navigation menu;

3, Click “+Set required fields for this section” button, and you will see “Newsletter” field overthere.

4, Un-check “newsletter” and click “Save” button below to apply your change.

And you are done, didn’t realize it was so easy and it was hidden there.

How to export Chinese characters encoded UTF-8 from MySql to CSV correctly

I am using buddypress with extend profiles in one of my WordPress site to deal with the membership requirement. Now I need to export all members to a CSV file for an event. It is known that buddypress is not easily to be viewed in the list format due to the design of customizable xprofile feature. Fortunately I can easily export the buddypress members into CSV file with a nice BP Export Users plugin.

I downloaded and installed the plug-in, modified the php file with my own extended fields. And ran it, then a good members list with correct profile fields information. But one small problem though, the Chinese characters became these messy characters which could not be recognized after exporting. Even I know the MySql database was set up right with UTF-8 encode. Continue reading

How to change Define Page 2 to another new page in Zen Cart

In free open source shopping cart system Zen-Cart, if you installed sample db, there are some defined pages namely Define Page 2, Page 3, and Page 4. But you need to use them for other names, like About Us etc. I thought I just need to update some language files, but later found out that it is not an easy task to do so.

Here are some how-to steps I used to accomplish the “re-name” task mentioned above, hope it will be helpful to you too.

Overall, I need to take 3 different processes: 1), create new files in modules/pages, language, and template folders; 2), update the definitions in existing files; 3), update the configuration table in mySQL database.

Continue reading

Get the images back which disappeared due to the blogs.php file

I know, I know, it has been a long time for me to update the blogs, and to maintain the WordPress MU platform. Last time, after I updated the WordPress MU, I found I had a problem of displaying images. All uploaded images disappeared from the posts. First, I thought it was because one of my actiated plug-in Drain Hole since it is using the sam directory of my uploaded images. But after I deactivated that plugin, I had the same issue.

Then I guessed it should be the problem of the .htaccess file since I have some re-write rule within. After carefully checking the .htaccess file, I found the glitch. If you have the same situation as mine, you should download the .htaccess file from your server, and open it in notepad or any text editor. And look for the following lines:

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

Replace the “wp-content/blogs.php” with “wp-includes/ms-files.php” since the newer version deprecated the blogs.php file which was pointing to the uploaded image folder. After that, you new lines should be read like the following:

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

After saving the .htaccess file, and uploading to your server, everthing should be fine and your missed images will be back.

How to Setup and Configure PayPal Website Payments Standard Module

Last week, I was asked by a co-worker about how to set up Paypal in his shopping cart web site. I typed the instructions to him and posted here too in case I need it again in the future.

Set up osCommerce store correctly

Before you do anything with the module you need to check that you have setup OSC correctly to the language you are going to use, the Location of your shop and the Currency you are to use or you will get all sorts of funny errors like missing tax, wrong currency, prices missing from your web site etc. So let’s spend a minute looking through the Admin pages making sure the basics are right.

Continue reading

How to resolve the System Cache plug-in causing file quota issue in Joomla

Demo Site Request for ProposalsRecently I tried to boost up the performance for one of my Joomla powered web site. So I enabled the System Cache plug-in through Plug-in Manager which is a separate tool from the regular Cache setting in Global Configuration. What does this cache plug-in do? In one simple sentence, this plug-in creates page-level cache files which can serve to the afterwards visitors to reduce the burden of calling database each time.

At the first few days, everything was working fine with some kind of performance gains on this Joomla site. Even at some times it caused mirror inconveniences when I was updating the contents or modules. I had to delete the cached pages to see my new changes. But I was still happy.

Till last week, some of my other web sites started to act weird. I could not upload new pictures, some of web sites threw the 500 Server error (see the below of an example):

“Error 500 – Internal server error

An internal server error has occured!
Please try again later.

Continue reading

Send Free Text Messages via SMTP in applications

I was thinking to update some of my ASP.net  applications which are sending alerts to subscribers via emails. The update will allow them to send out alerts as SMS (Short Message System) or text messages to users’ mobile phones.

I believe we need some third-party add-ons in the ASP.NET code to accomplish the above. But in North America, there is a work-around to do so since most of the cellular providers have a email-like system for their phone numbers.

Continue reading

How to add your own HTML tag in article content of Joomla 1.5.x

JoomlaI was working on the Joomla 1.5.9 and tried to add one form in an article, but the <form> tag got ripped off. To get it back, you will have to do at least two changes.

  1. Turn off the WYSIWYG Editor (i.e. TinyMCE editor) you were using. To do so, you can update the user profile by choosing no editor for yourself.
  2. Then you need to update the Filterings Options settings in Global Parameter, otherwise all <form> <input> tags will be kept by turning off WYSIWYG editor, but the ACTION attribute in the <form> will be filtered out by Joomla.

Continue reading

Get error 500 in xmlrpc.php file while using Windows Live Writer with WordPress MU 2.6.5

Upgraded the WLW to built 14.0 and tried to open the posts from my WordPress MU 2.6.5 today, but got error message saying “there was error 500 while processing the file xmlrpc.php”.

Double checked my WP settings and found that the xmlrpc had been turned on already. It seemed to me it was a web server parsing php code error.

After poking around the internet, and concluded that there is an issue with the xmlrpc.php code if the server default service is PHP4. That means if your web server parsing your WordPress php code in PHP4 mode, then you would get problems to view blog posts from Windows Live Writer, and in some case you can not upload images in WLW with xmlrpc method.

I hope there will be a fix soon. But right now, I will have to force my web server to call the WordPress codes in PHP5 mode.

To do so, just add the following two lines at the begining of your .htaccess file.

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

 

After that, you just upload the modified .htaccess file and everything should be fine again.

Good Luck!

Fixed Paypal payment method not showing in OSCommerce check-out

OSCI downloaded a OSC template and installed on the server. Since the included OSC is not the latest version, I had to upgrade the Paypal method files. Today, I modified some fields in the Paypal Website Payment Standard, and surprisedly the payment method disappeared from the Check Out page. And I can see an message on the page saying “This is currently the only payment method available to use on this order.” And after I clicked continue, I would get the error of “no payment method selected”.

After playing around, I finally found out the cause. I think there is a bug in the OSC code I have in the template. Since I do not have time to mess up the code, I am using a tip to get the Paypal method back. Hope it will help you too.

Tips: just make sure your Payment Zone of your Paypla method set up to –none–. That is it.