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.

Leave a Comment