Archive for the ‘Zencart’ Category

What’s new in ZenCart 2.0.0

Monday, January 12th, 2009

After a long time waiting, Zencart team will release the new Zen Cart v2.0.0. It was originally planned to be released at the end of 2008 but they will most likely to release the upcoming Zencart 2.0 release early this year. The following will cover what you can expect from new Zencart 2.0.0, which is a summary of what I got from Zencart forum (Comming soon Zencart 2.0.0).

Speed
An emphasis has been placed on improving performance by various methods, especially reducing the number of database queries required for processing pages.

Code
For the programmers, you’ll be happy to know that the code has been largely converted to a much more efficient OOP structure, which will ultimately end up making future growth much simpler.

Templating
Templating is much simpler, in that the complicated PHP blocks that used to make them so hard to read or follow or customize have been removed. Stylesheets are leaner. And there are some very easy-to-use admin-side layout controls to make setting your desired layouts *much* simpler.

Overrides
The same override system exists for templates and language files, meaning that those already familiar with that part of the directory structure will find it easy to continue using.

Languages
UTF-8 support is now native, and the more complicated language files have been simplified and split off into their own for easier management.

Written for PHP 5
Zen Cart 2.0 takes advantage of features specific to PHP 5.2 and MySQL 4.1, thus, those are the new minimum requirements for your hosting service to provide in order to run it. CURL is also highly recommended.

And Many More…

It’s time to move our system from Zencart 1.3.8 to Zencart 2.0.0 and for those who are planning to customize Zencart system, I would just recommend you to postpone it. So that you can implement the changes in Zencart 2.0.0 directly to reduce overhead cost.

Add custom Admin configuration field setting for Zencart

Wednesday, December 3rd, 2008

Have you created your own module for Zencart? And you would like to add configuration setting for your module, so that your client can configure your module via Admin area? Here is how to do that…

What I do usually is adding new group (with your module name) under Configuration in zencart administrator, then add fields under that group to be setup. Just like if you go to Configuration > My Store, you will find many settings there. All of this fields are declared inside your database, specifically inside zen_configuration_group and zen_configuration table (NB: zen_ is used as table prefix).

So let’s insert new row to your zen_configuration_group to create new group under “Configuration” menu. The following SQL script will add “My New Module” group under “Configuration” menu and position it in the last order. Use this script as template.

1
2
3
4
5
INSERT INTO configuration_group
(configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible)
VALUES (NULL, 'My New Module', 'My New Module Description....', '1', '1');
 
UPDATE configuration_group SET sort_order = last_insert_id() WHERE configuration_group_id = last_insert_id();

Secondly, to add config items under your new “Configuration > My New Module” use the following SQL

1
2
3
4
5
6
7
8
9
SET @last_id=0;
SELECT (@last_id:=configuration_group_id) AS last_id 
FROM configuration_group
WHERE configuration_group_title= 'My New Module';
 
INSERT INTO configuration 
(configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added)
VALUES 
('', 'Small Image Height', 'IMAGE_VIEWER_SMALL_IMAGE_HEIGHT','75','Description of Small Image Height Setting. Default 75.', @last_id, 1, now());

Note that to run this SQL smoothly without bothering with your zencart database table prefix, execute this script from zencart admin area Tools > Install SQL Patches.

Once you executed those SQL, you will find My New Module category under Configuration menu and Small Image Height setting inside that category. You can then access the value of this configuration from your module straight away by using configuration_key which you have set in your SQL (i.e. echo IMAGE_VIEWER_SMALL_IMAGE_HEIGHT). Please leave comment if you find any difficulties or feel grateful with this blog. Cheers.

Send HTML Newsletter Email to Admin Zencart 1.3.8

Monday, December 1st, 2008

In my last project, I designed new newsletter template and created custom newsletter administration area. When I send newsletter to admin to test the email, it does not send HTML email but plain text mail. Scratching my head, I searched Zencart documentation as well as Google for couple hours to find the answer. Now, I will share the solution here, just in case you go through the same pain as me.

First of all, you need to configure your Zencart to use HTML type email. Login to your administrator area and go to configuration > E-mail options.

  1. Make sure your “E-Mail Transport Method” is set appropriately
  2. Use MIME HTML When Sending Emails = “true”
  3. Send E-Mails = true
  4. Email Admin Format? = HTML

Now try to send a newsletter to the admin, if it still sends plain text mail, do the following. Backup and open in your text editor includes/functions/functions_email.php. In your functions_email.php try to find these codes

120
121
122
if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module,-6)=='_extra') {
        $email_html='';  // just blank out the html portion if admin has selected text-only
}

Just below that add the following codes

125
126
127
128
// if no customer email record found, and admin email format is set to HTML, and sending newsletter, and admin is logged in, use HTML:
if ($customers_email_format_read->RecordCount() == 0 && ADMIN_EXTRA_EMAIL_FORMAT == 'HTML' && in_array($module, array('newsletters', 'product_notification')) && isset($_SESSION['admin_id'])) {
     $customers_email_format = 'HTML';
}

Now, you should send email in HTML format. Leave comment if it does not work for you or if this post has helped you and save your time.