Coupon Admin fixes
This is the fix for Coupon Admin Zencart V1.5.3. If the option “All coupons” were selected, there’s no record display. This is incorrect. The coupons table has 5 valid coupons and in status “Y” and 1 coupon in status “N”. This option should display all records no matter what status it is.
File changed: /admin/coupon_admin.php
$status_array[] = array('id' => '', 'text' => TEXT_COUPON_ALL);
Use this query instead:
$cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from " . TABLE_COUPONS. " where coupon_type != 'G'";
How to debug Email in Zen-Cart
If you have an issue sending out an email from ZenCart such as order notification, regular marketing mails,… you may want to add this file into extra_datafiles, so that you’ll see the list of errors displayed on your browser.
If you’re sending email from ZenCart Admin, place the file inside admin directory.
– /myadmin/includes/extra_datafiles/email_debug.php
If you’re sending email from Customer interface, place the file inside includes/extra_datafiles directory. The file contains this line of codes:
define('EMAIL_SYSTEM_DEBUG','5');// set to 0 to turn it off again
Zen-cart email wasn’t sent thru SMTP Mail server
I hope my discovery can help some of you on Zen-Cart 1.5.3 running on Window XP. To send mail out successfully, your Windows server has to have Visual C++ 2008 redistribution package installed, OpenSSL for Windows, and some config in php.ini and Apache bin directory.
1. Enable php_openssl.dll and sockets from php.ini if phpinfo only displays “tcp, udp,” in Registered Stream Socket Transports.
extension=php_openssl.dll
extension=php_sockets.dll
2. Make sure that the extension_dir points to my extension directory, not the default ./ location.
extension_dir = “c:/php53/ext”
3. Rename these 2 files so the same files are loaded from c:\php53 (This step is important if you see multiple ssleay32.dll in Apache & in PHP)
C:\Apache2\bin\ssleay32.dll => old-ssleay32.dll
C:\Apache2\bin\ssleay32.dll => old-libeay32.dll
If everything is OK your phpinfo(); you should ss these stream socket transports
Registered Stream Socket Transports: tcp, udp, ssl, sslv3, sslv2, tls
4. Now you can go to ZenCart Admin Email options and config all required parameters. Make sure Email From match your SMTP Email username. Port should be 587 or 465 depends on Secure Layer is required or not on your server. Either port will work on Windows machine.
How to use limit() function in Mongodb
This query will get all documents that contain MID = “53c6bfbc1ee2f2ed0acb1f0a”, don’t include 2 fields “Cap” and “Type”
$pID = "53c6bfbc1ee2f2ed0acb1f0a";
$cursor = $collection->find(array('MID'=>$pID), array("Cap"=>0, "Type"=>0));
If you wish to limit only 2 documents returned instead of 2000. You can use either 1 of these method below:
$pID = "53c6bfbc1ee2f2ed0acb1f0a";
$cursor = $collection->find(array('MID'=>$pID), array("Cap"=>0, "Type"=>0))->limit(2);
Or
$cursor = $collection->find(array('MID'=>$pID), array("Cap"=>0, "Type"=>0));
$cursor->limit(2);
Install MongoDB and config to work with PHP
Step 1: Go to mongodb.org to download the version that works for your OS. Don’t download to C:\Program Files\ directory because MongoDB doesn’t recognize space in the path. You may want to install under C:\ directory
Step 2: Go to PECL to download the MongoDB driver for PHP version that runs on your OS (https://s3.amazonaws.com/drivers.mongodb.org/php/index.html)
Step 3: Open php.ini, add some config options for mongodb as follow
[mongodb]
mongo.allow_empty_keys =0
mongo.allow_persistent = 1
mongo.chunk_size =262144
mongo.cmd = “$”
mongo.default_host = “localhost”
mongo.default_port = 27017
mongo.is_master_interval =60
mongo.long_as_object =0
mongo.native_long = 1
mongo.ping_interval =5
mongo.utf8 =1
mongo.auto_reconnect=true
Step 4: Restart Apache server