Jump to content

 

FernE97

Member Since 08 Sep 2011
Offline Last Active Feb 27 2014 10:04 PM
-----

Posts I've Made

In Topic: Disable Automatic Filling of Meta Description Tag

19 December 2013 - 10:26 PM

I had to update 2 core files to make it so the meta tags wouldn't get auto-generated if they weren't filled out. Not the best way since they are core files but didn't see any other way to do it.

/core/fn.common.php ~ line 2340
/controllers/customer/products.php ~ line 84

In fn.common.php I had to modify this function "fn_generate_meta_description" to have it return false instead of generating a description based of the product description.

function fn_generate_meta_description($html, $max_words = 60)
{
// Disable this function to auto-generate the meta_description
return false;
}

In products.php I disabled a fallback else statement that would generate the description and keywords based off the products category if the product had empty values for meta description or keywords.

if (!empty($product['meta_description']) || !empty($product['meta_keywords'])) {
  $view->assign('meta_description', $product['meta_description']);
  $view->assign('meta_keywords', $product['meta_keywords']);
}
// Disable auto-fill meta tags
// else {
//  $meta_tags = db_get_row("SELECT meta_description, meta_keywords FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $_SESSION['current_category_id'], CART_LANGUAGE);
//  if (!empty($meta_tags)) {
//   $view->assign('meta_description', $meta_tags['meta_description']);
//   $view->assign('meta_keywords', $meta_tags['meta_keywords']);
//  }
// }

Also modified the meta.tpl file.
/skins/basic/customer/meta.tpl

<meta http-equiv="Content-Type" content="text/html; charset={$smarty.const.CHARSET}" />
<meta http-equiv="Content-Language" content="{$smarty.const.CART_LANGUAGE|lower}" />
{if $controller == "index"}
	<meta name="description" content="{$meta_description|default:$lang.home_meta_description}" />
	<meta name="keywords" content="{$meta_keywords|default:$lang.home_meta_keywords}" />
{else}
	{if $meta_description != ""}
		<meta name="description" content="{$meta_description}" />
	{/if}
	{if $meta_keywords != ""}
		<meta name="keywords" content="{$meta_keywords}" />
	{/if}
{/if}

This was on the old 2.0.12 version of the cart but just thought I'd share what I had to do to make it not auto-generate the meta tags.

In Topic: AJAX reloading

11 February 2013 - 10:49 PM

I was trying to add a function to the one-page checkout and I found that using .ajaxComplete() worked. So instead of using document ready just change it to document ajaxComplete and it will run the code any time an ajax request completes. I tried to contact cs-cart customer service to get help with the $.ajaxRequest method but they insisted that required custom development.

http://api.jquery.com/ajaxComplete/

$(document).ajaxComplete(function () {
	// custom js
});