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


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 🙂

How to send product details to SagePay from Zencart store and safeguard against abandoned carts

Some times I come across issues which are very frustrating for me as well as for the client. It happened like this that a client had decided to spend £1000 via Google Adwords in order to promote his website and try and get some orders. As the website was related to wooden furniture it became all the more important as this was an expensive product line and there are not many buyers especially when the recession is in full swing.

The campaign bore fruit in a just a few days and the client received an order worth £600. Unfortunately, even though the customer paid online via SagePay, the order was not registered on the website and the client made his frustration well known. As the website was in Zencart the order does not get saved into the orders table till the customer pays for the products. In this case, the customer did not return from Sage Pay so the order was not visible in the admin panel. As the order details such as product information were not sent to Sage Pay the client had no way of knowing what the customer ordered and the client had to contact the customer to obtain the product details. You can understand how that would have felt for the client as well as what the customer would have thought of the website.

The default Sage Pay (formerly Protx) payment module does not provide the option to send the product details to Sage Pay even though this option is very much there. So, I went about writing a payment module which would allow the system to send the product details to Sage Pay so that the details are logged there as well. In case the customer did not return from Sage Pay after making the payment the client would still have the option of viewing the product details on Sage Pay.

I also installed the Zencart Abandoned Cart Module which would display the products in the admin panel if a customer did not proceed to purchase the order from the website.

What I (and probably you) learned from the above event is that you can never be safe and you must do all you can to prevent any sort of mishap which would affect the credibility of the website.

If you would like to download the Zencart payment module for Sage Pay form which allows you to send product details to Sage Pay then you can download it from here

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


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.

How to setup Zencart TEXT attribute for your product

Zencart provides you option to display attributes of your products on the product info page. You can display attributes in radio button, checkbox, dropdown etc controls.
Zencart also provides you the option of displaying text boxes where you can take input from the customer and you can charge the customer for it. This is a good option
but sometimes it does not work as intended due to corrupt template files or conflict due to other modules.

Here I will try to add a TEXT attribute and associate it with a product and then list the most common problem associated with it

If you would like to use TEXT attribute in Zencart please do the following steps

1. Click on Option Name Manager in the Catalog menu

2. Add the option name and select TEXT from the drop down

3. After saving it proceed directly to the Attribute Controller page. Remember we do not need to add any value to the TEXT attribute on the option value manager page.

4. Select the product against which you would like to add the TEXT attribute. The in the Option Value drop down you should see TEXT [RESERVED FOR TEXT/FILE ONLY ATTRIBUTES]. Select it and add the price against it.

5. Click on Insert button and you should see the TEXT attribute against that product on the page.

If you see the TEXT attribute against the product which you have added and it is calculating the price of the product as well as the attribute on the shopping cart page then your system is working correctly and you have nothing to worry about.

If not then you should do the following steps

1. Run the following statements on mySQL or in the Zencart Install SQL patches

INSERT INTO `configuration` VALUES ('', 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Upload prefix', 'UPLOAD_PREFIX', 'upload_', 'Prefix used to differentiate between upload options and other options', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Text prefix', 'TEXT_PREFIX', 'txt_', 'Prefix used to differentiate between text option values and other option values', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Image Handler Version', 'IH_VERSION', '2.0', 'This is used by image handler to check if the database is up to date with uploaded image handler files.', 0, 100, NULL, '2007-06-06 16:47:03', NULL, 'zen_cfg_textarea_small(');  

2. Run the following statement if you don’t see the TEXT [RESERVED FOR TEXT/FILE ONLY ATTRIBUTES] in the Option Value drop down on the Attribute Controller page

INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES (0, 1, 'TEXT');

After running the above SQL statements you should be fine and everything should work correctly. If you still face a problem then do let me know.

How to display state/province dropdown instead of input box in Zencart

In the default Zencart template the customer is asked for his State/Province by entering the value into the text box. However, mistakes can happen at any time and the customer may mistype the name. Zencart checks the name against the zones input in the admin panel. If it does not match Zencart flags an error and the customer has to retype it thus causing frustration which may lead to lost sales.

The way to go is display the State/Province in a drop down so the customer has to just select the name in the drop down and continue with the checkout process.

To do that you need to open the includes/modules/create_account.php file and go to the end of the file where you will see the following line

 $flag_show_pulldown_states = ((($process == true || $entry_state_has_zones == true) && $zone_name == '') || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input) ? true : false;

This is code which determines whether or not to show the drop down. Now you can either confirm that all the conditions are true or take the practical (aka shorter) route and comment the line and add the following code on the next line. So the above line would look like

// $flag_show_pulldown_states = ((($process == true || $entry_state_has_zones == true) && $zone_name == '') || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input) ? true : false;

$flag_show_pulldown_states = true;

Now if you run the register page you can see that the dropdown will show.

Hope the above helped.

How to add an input field in a delivery module in Zencart?

I was working on implementing the Royal Mail Airmail and DPD International delivery modules for a client. His website had been developed in Zencart and he wanted to use Royal Mail and DPD on his website. As there was no ready to use module available for these two so I got down to developing my own module.

After studying the formula provided by the client I decided it was best to hack the Zones delivery module (provided in Zencart 1.3.8 by default) and use it for the task in hand. After completing the module and testing it I deployed the code online. However, as luck would have it, client wanted to customize it further by allowing him to change the rate of VAT. Currently the rate of VAT is 15% in the UK but this would be increased to 17.5% in the year 2011 so he wanted to change the rate as and when he wanted.

So, I did the following changes in the includes/modules/shipping/<module_file>
where module_file is the name of the file I have created for my function. Your file can have any other name.

I added the following line in the function install()

$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('VAT', 'MODULE_DPDINTERNATIONAL_VAT', '', 'Enter rate of VAT:', '6', '1', 'zen_cfg_textarea(', now())");

To let the system know that VAT is an input field I had to add the key MODULE_DPDINTERNATIONAL_VAT in the keys array in the function keys().
I added it at the end.

To let Zencart know of this change I removed the module and reinstalled it and the input box for the VAT came up. I added the 15% in the input box and saved it. The system performed the calculations perfectly and

Hope the above helped.

What is the minimum mySQL version requirement for Zencart?

A client of mine developed his website in Zencart and after careful scrutiny approved the website for deployment to his production machine. He provided the FTP and mySQL information for us to deploy the website.

As is the practice, I check for any version conflicts that may conflict with our system before I give the signal to my team for deployment. Howsoever was I in for a shock. When I checked the mySQL version using the following statement


I got the result 4.1.x which was not compatible with our system. The minimum mySQL version supported by the latest Zencart version 1.3.8 is 4.3.x.

I at once updated the client of this and realizing his mistake he contacted his hosting support to have the issue resolved.

This just goes to show you that you need to check everything and not leave anything to others no matter who they are because mistakes can happen at any time and at any time. They don’t need a reason to come up so DON’T GIVE THEM THAT REASON.

Hope the above helped

Zencart ver. 1.3.8 security update

A vulnerability has been discovered in the admin section of v1.3.8 (and previous versions). To take advantage of this vulnerability any attacker must know the URL of your admin section

Please apply the following updates

Yes, if you haven’t already renamed your /admin/ folder, do it NOW!
Instructions can be found here:


3. Subscribe yourself to the Zen Cart Announcements mailing list:

4. Keep your site’s Zen Cart software up-to-date at all times. Numerous bugs, improvements, and security fixes are included in every new release. It is in your best interests to remain current.

Hope the above helps