How to resolve the Zen Cart Illegal mix of collations error

We had deployed a Zen Cart website and we came up with the following error in the Zen Cart admin panel when clicking on the Tools -> Send Email link.

Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation 'locate'

After checking the table collation in PHPmyAdmin I found that the subscribers table (created when the Newsletter Subscribe module was installed) collation was different to the configuration table.

Most people on the internet advised that the collation for the subscribers table and email_address field should be changed to that of the remaining tables in the database. I tried to change the collation of the subscribers table and the email_address field to that of the configuration table but met with no success.

I then changed it to ‘utf8_unicode_ci‘ and the page displayed without any problem or error.

The exact SQL I ran in mySQL was

ALTER TABLE subscribers CHANGE email_address email_address varchar( 96 ) NOT NULL default '' UNIQUE COLLATE 'utf8_unicode_ci';
ALTER TABLE customers COLLATE 'utf8_unicode_ci';
ALTER TABLE subscribers COLLATE 'utf8_unicode_ci';
ALTER TABLE customers CHANGE customers_email_address customers_email_address varchar( 96 ) NOT NULL default '' UNIQUE COLLATE 'utf8_unicode_ci';

The first statement in the SQL above is thanks to DrByte.

Hope the above helped someone.

Integrate Zen Cart store to eBay with eBay Zen Cart module

Store owners who use Zen Cart for running their stores on the web can now enjoy the luxury of listing, revising and de-listing products on eBay all from their Zen Cart admin panel. Gone are the days when you needed to add products twice (one in each Zen Cart and eBay) and then constantly worry that you do not oversell an item on eBay if the stock inventory has exhausted for that product.

In short, you will need to list your products once and earn forever*.

This facility is tried and tested and running in production environments on Zen Cart stores based in the USA and UK and clients have been more than happy with the results.

You will be able to do the following when you use this module

1. List/revise/delist items on eBay from your Zen Cart admin panel.
2. Maintain separate product title, product price and product description fields for your products on eBay in your Zen Cart Add/Edit product page.
3. Automatic download of orders from eBay to your Zen Cart orders listing page.
4. Automatic creation of customer accounts on your Zen Cart website as soon as order is downloaded from eBay.
5. Automatic synchronization of product stock and price on your eBay store with the price in your Zen Cart store.

Please see attached snap shot for more detail

List/revise/delist items on eBay from your Zen Cart admin panel

eBay order downloaded to your Zen Cart orders listing page

If you would like to have more information regarding this then please contact me today and I will be more than happy to help you out.

* As long as you have inventory for that product -:)

Wish happy birthday to your customers from Zen Cart

Zen Cart by default requests a customer to enter his/her date of birth during registration. This is optional of course and can be removed from the Zen Cart admin panel. However one can make good use of this to regularly wish their customers a happy birthday thereby keeping in touch with them.

I have developed a script which will send a birthday wish to the customer when their birth date comes along. You will need to setup a cron job on your hosting server to run the script each day. You are also free to make changes to the script according to your needs.

Here is the Zen Cart birthday script and hope it helps some one.

Remember to copy it to your root folder and then setup a cron job to execute it daily.

Bulk generate search engine friendly URLs in Zen Cart using Fast Updates

Our SEO department had recently made a request to implement CEON URI mapping module on one of our leading furniture retailer store in the UK. The module was implemented by the developer assigned to the project in a couple of hours and the website was handed over to the concerned department so they could continue adding the SEO friendly URLs to the e-commerce website.

Now the website had over 5,000 products and if they had to go by the default way of going into  each product edit page and updating that product page to generate the URL then it would have taken quite some time to complete this task and then continue on with their main job of actually optimizing the website.

I decided on using Fast Updates for this purpose. I added an input box on the page where the user could add his own version of the URL or he could leave it empty and let the system generate it for him. To generate the SEO friendly URL I had to use the concerned functions from the CEON URI mapping module. After some search I found the function needed for this purpose.

The actual function which generates the SEO friendly URL can be found in the following class file

includes/classes/class.CeonURIMappingAdminCategoriesProducts.php

The name of the function which does the job is

autogenCategoryOrProductURIMapping

The function expects the following parameters in the order given

id – product id of the product
type – category or product. As we are generating the URLs for the products I will just enter ‘product’ here
category – the category id against which this product is associated
name – the product name of the product
language code – just enter ‘en‘ here as it is for an English language website
language id – the Zen Cart language id for the website. In my case it will be 1 as it is for an English language website

The function returns the URL which I saved into the ceon_uri_mappings table and the problem was resolved. I handed it over to SEO department and they generated all the URLs within a couple of hours.

Comments?

Steps to integrate Google Base with Zencart

Google Base is a place where you can easily submit all types of online and offline content, which will be searchable on Google Shopping product search. You can describe any item you post with attributes, which will help people find it when they do related searches. In fact, based on your items’ relevance, users may find them in their results for searches on Google Shopping, Google Maps and even our main Google web search.

Zencart Google Base Data Feed module has an ability which would help you export easy your products into Google Base engine.

Here are some significant steps which would help you to make this system successful.

Step 1:
Set up a new Google Account which we will use for Google Base. For e.g
Username: googlebase
Password: test1234

Step 2:
Sign in to Merchant center using link http://www.google.com/base/

Step 3:
Once you have logged in go to the Data feed option and specify the Data feed filename (domain_products.xml) and country etc. You don’t need to change the file name because Zencart by default uses this filename.

Before uploading your feed, please read the http://www.google.com/support/merchants/bin/answer.py?hl=en_US&answer=188494

Step 4:
Now you need to go to Settings and click on General option and fill the form accordingly and save the changes.

Now click on FTP option and set username and password of FTP server which would be needed for Zencart integration. For e.g.

FTP server name: uploads.google.com
Username: googlebaseftp
Password: googlebase

Step 5:
Here you would need to login into the admin of Zencart and make sure you have already installed Zencart Google Base Data Feed module.

Step 6:
Once you have logged in to the admin go to the Configuration and click on Google Base Feeder Configuration and put the value of Ftp user name and password which we have done in step 4 and ignore other values.

Step 7:
Now you would need to go to the tools option of admin and click on Google Base Feeder and click upload button and see the message it should be “Uploaded Successfully” and you will get email confirmation on your Google base account email address.

Step 8:
Now you can sign in to the Google Base/Merchant center and see the entire feed status summary like active/ Inactive/ errors in product attributes and statistics reporting etc.

Hope the above helped!!

How to implement Lightbox effect in Zencart

Lightbox effect is now the defacto standard for displaying product, category and other images on your website. Javascript popups are a thing of the past and really don’t look that cool. As more and more website content management and e-commerce frameworks provide this feature I will today discuss how we can use this in Zencart.

Zencart provides a very easy to install module known as the “Zen Lightbox” which you can download from the Free Software Add Ons section.

After downloading the module you can run the install.sql and copy the files from the images, classes, functions and languages (do change the folder name to your template where necessary) to your Zencart folder as they are all new files and do not overwrite any existing file. You will need to be more cautious for the files in the modules and templates folders as they will overwrite your existing files.

In my case I just needed to display the lightbox effect for the images on the product detail page so I made the following customizations in the tpl_product_info_display.php file.

1. First I placed a check to make sure whether Zen Lightbox was enabled or not. If it was then I include the necessary files.

<?php
if (ZEN_LIGHTBOX_STATUS == 'true') {
  require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'zen_lightbox/slimbox.php');
  require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'zen_lightbox/autoload_default.php');		
}
?>

2. Then I check whether the image on which the lightbox effect is to be applied is an individual image or part of a gallery.

<?php
if (ZEN_LIGHTBOX_GALLERY_MODE == 'true' && ZEN_LIGHTBOX_GALLERY_MAIN_IMAGE == 'true') {
	$rel = 'lightbox-g';     //in case of image to be part of gallery
} 
else {
        $rel = 'lightbox';       //in case of individual image
}
?>

3. Finally I call the zen_lightbox function which generates the necessary code for the lightbox to take effect.

<a href="<?php echo zen_lightbox('path to product image', 'product name', width, height); ?>" rel="<?php echo $rel; ?>"><img src='path to product image' alt='product name' width='width' height='height'/></a>

Looking above at the 3 steps you can see how easy it is to implement lightbox effect in Zencart. If you would like to view a live example then please click here.

How to display address details of the customer in Zencart entered on PayPal

The following applies to customers who are using Zencart with PayPal IPN payment module. Customers have the option to change their address on PayPal after leaving the merchant website. When this happens and the customer enters an address which is not covered by the Seller Protection policy the merchant is in danger of facing chargeback in case the transaction turns out to be fraudulent.

To root out any such issues PayPal provides an option of PDT Payment Data Transfer. PDT is defined by PayPal as

Payment Data Transfer is a secure method to retrieve the details about a PayPal transaction so that you can display them to your customer.

To enable PDT:

1. Login to your PayPal account and click on Profile.
2. Click on Website Payment Preferences.
3. Enable Payment Data Transfer and copy the PDT token at the end of the page.

Copy the PDT token you see on the PayPal page and paste it into the Zencart PayPal IPN page as shown in the image below.

That’s it. Now PayPal IPN will send all customer information back to the merchant website. This option is already coded in the PayPal IPN module and it fetches the information and saves it into the “paypal” table in the database.

You can then reference the order_id in the “paypal” table and display the customer information in the admin panel. You can also check whether the address is confirmed or not under the address_status column.

Hope the above helped.

Why shipping address not being passed to PayPal using Zencart PayPal IPN

Zencart provides a number of payment modules by default. One of those is PayPal IPN (Instant Payment Notification) which you can enable from the Zencart admin panel. PayPal IPN works like PayPal Website Payments Standard with the added benefit that PayPal notifies the merchant website when the customer has successfully completed the transaction on the PayPal website. This allows the merchant to update relevant tables in the database in case the customer does not return to the merchant’s website.

By default, the Zencart PayPal IPN module does not pass the shipping address of the customer to the PayPal website. This does not affect the payment transaction of the customer but it does put the merchant in a vulnerable state. PayPal provides “Seller Protection” in case the shipping address of the customer is verified to be safe. If the shipping address is not passed over from the merchant website to PayPal then PayPal will not provide “Seller Protection” to the merchant in case the transaction is found out to be of fraudulent nature.

To enable passing of shipping address details from Zencart to PayPal please do the following steps.

1. Open the paypal.php in the includes/modules/payment folder of your Zencart website.
2. Once opened you will find the following line around line 238-239

'no_shipping' => MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED,

3. Change the above line to

'no_shipping' == 2,

4. Save the file.

That’s it. Now the shipping address will be passed over to PayPal website and hopefully this will have resolved the problem.

Let me know how it went 🙂

PayPal IPN is disabled even though I have input all details in Zencart

I had installed Zencart 1.3.8a for a client and was enabling the Paypal IPN – Website Payments Standard payment module. I input the client email address, made the other configuration details and clicked on Update but the module was still being shown in the yellowish color in the payment modules section of Zencart. This means that the module is not active and has some configuration issues.

I started to trouble shoot the problem and found that the module enabled flag is set to false for some strange reason. I then started to debug it by printing the value of the enabled flag in the code when the module is loaded. The enabled flag is active at the start however once it crosses the following line in the includes/modules/payment/paypal.php file

if (PROJECT_VERSION_MAJOR != '1' && substr(PROJECT_VERSION_MINOR, 0, 3) != '3.8') $this->enabled = false;

the enabled flag is set to false. The above code checks that module is running on Zencart version 1.3.8 and if it’s not then disables it.

I checked the project_version table in the database and found that the minor version is 3.8a instead of 3.8. You can see how much frustrating this is.

I commented the above line as I did not feel that it did not serve any purpose for my version of Zencart. The check had probably been placed there so that if anyone tries to use it on an earlier version of Zencart then it is disabled.

After commenting out the line the module worked fine and I hope the above helped you as well.

Tell a Friend not working when using Ultimate SEO URL addon for Zencart

I had installed Ultimate SEO URL add on for Zencart for a client website. Everything was working fine on the website and the client was quite pleased. However, problem started when the client clicked on the Tell a Friend link. Whenever he tried to Tell a Friend he got the 404 File not Found error.

After checking I found that there was no URL being generated due to which the 404 error was occurring. I started to go through the code.

I was using the function

zen_href_link(FILENAME_TELL_A_FRIEND);

to generate the URL for the page. The Ultimate SEO URL replaces this function with its own version as it generates the URLs for the complete system. I took a close look at the code in this function and found the first few lines seemed to have the solution to the problem.

$sefu = explode(",", ereg_replace( ' +', '', SEO_URLS_ONLY_IN ));
if((SEO_URLS_ONLY_IN!="") && !in_array($page,$sefu)) {
return original_zen_href_link($page, $parameters, $connection, $add_session_id, $search_engine_safe, $static, $use_dir_ws_catalog);
}

The above code checks whether the said page (passed in to the zen_href_link function) exists in the list of approved pages. If not then it will display the page as per the old style i.e. without any url rewriting.

I did a search for SEO_URLS_ONLY_IN and found that it is mentioned in the includes/classes/seo.install.php file.

$this->default_config['SEO_URLS_ONLY_IN'] = array(
'DEFAULT' => 'index, product_info, products_new, products_all, featured_products, specials, contact_us, conditions, privacy, reviews, shippinginfo, faqs_all, site_map, gv_faq, discount_coupon, page, page_2, page_3, page_4',
'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enter pages to allow rewrite', 'SEO_URLS_ONLY_IN', 'index, product_info, products_new, products_all, featured_products, specials, contact_us, conditions, privacy, reviews, shippinginfo, faqs_all, site_map, gv_faq, discount_coupon, page, page_2, page_3, page_4', 'This setting will allow the rewrite only in the specified pages. If it\'s empty all pages will be rewrited. <br /><br />The format <b>MUST</b> be in the form: <b>page1,page2,page3</b>', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, NULL)");

As you can see from above there is no mention of tell_a_friend in the list of approved pages. Maybe this add on was developed when the tell a friend module was not part of Zencart. Who knows!

I added the tell_a_friend to the list of pages in the above code as well as updated the value in the configurations table and voila the Tell a Friend link started working again.

Hope the above helped.