'.$seo_text, $code);
}
$show_google_ecomm_track = preg_match( '/\/ecomm-order-thankyou\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if(isset($final_config['DynamicHeadTagContent']) && $final_config['DynamicHeadTagContent']!=='0'){
$dynamic_headtag_content = $final_config['DynamicHeadTagContent'];
$dynamic_headtag_content = str_replace('', $url_based_custom_refinements_code, $dynamic_headtag_content);
$code = str_replace('', $dynamic_headtag_content, $code);
}
if(isset($final_config['GoogleTagManagerCode']) && $final_config['GoogleTagManagerCode']!=='0') {
$google_tagmanager_code = str_replace("\|\|","||",$final_config['GoogleTagManagerCode']);
$code = str_replace('', $google_tagmanager_code, $code);
}
if(isset($final_config['GoogleTagBody']) && $final_config['GoogleTagBody']!=='0') {
$google_tagmanager_code_body = str_replace("\|\|","||",$final_config['GoogleTagBody']);
$code = str_replace('', $google_tagmanager_code_body, $code);
}
if($final_config['GoogleAnalyticsCode']!=='0') {
$google_analytics_code = str_replace("\|\|","||",$final_config['GoogleAnalyticsCode']);
$code = str_replace('', $google_analytics_code, $code);
}
if($final_config['GoogleWebmasterToolsCode']!=='0') {
$google_webmaster_code = str_replace("\|\|","||",$final_config['GoogleWebmasterToolsCode']);
$code = str_replace('', $google_webmaster_code, $code);
}
if(isset($final_config['GoogleMarketingCode'])){
if($final_config['GoogleMarketingCode']!=='0') {
$google_marketing_code = str_replace("\|\|","||",$final_config['GoogleMarketingCode']);
$code = str_replace('', $google_marketing_code, $code);
}
}
//----------------------------------------------------------
//-- Google Adwords Conversion Code
//----------------------------------------------------------
if (isset($final_config['GoogleAdwordsConversionCode']) && $show_google_ecomm_track==1) {
$google_adwords_conversion_code = globalclient_inc_google_adwords_conversion_code($final_config['GoogleAdwordsConversionCode']);
if ($google_adwords_conversion_code) {
$code = str_replace('', $google_adwords_conversion_code, $code);
}
}
//----------------------------------------------------------
//-- Google Trusted Stores Code
//----------------------------------------------------------
$show_google_ecomm_track = preg_match( '/\/ecomm-order-thankyou\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($show_google_ecomm_track==1) {
$google_trusted_stores_code = globalclient_inc_google_trusted_stores();
if ($google_trusted_stores_code) {
$code = str_replace('', $google_trusted_stores_code, $code);
}
}
if($final_config['ClickTaleTopCode']!=='0') {
$clicktale_top_code = str_replace("\|\|","||",$final_config['ClickTaleTopCode']);
$code = str_replace('', $clicktale_top_code, $code);
}
if($final_config['ClickTaleBottomCode']!=='0') {
$clicktale_bottom_code = str_replace("\|\|","||",$final_config['ClickTaleBottomCode']);
$code = str_replace('', $clicktale_bottom_code, $code);
}
//----------------------------------------------------------
//-- SearchSpring
//----------------------------------------------------------
if (isset($final_config['EnableSearchSpringIntelliSuggestTracking']) && $final_config['EnableSearchSpringIntelliSuggestTracking']=='Y') {
$searchspring_id = $final_config['SearchSpringID'];
$searchspring_productdetail_track_code = globalclient_inc_searchspring_productdetail_track_code($searchspring_id);
if ($searchspring_productdetail_track_code) {
$code = str_replace('', $searchspring_productdetail_track_code, $code);
}
$searchspring_shoppingcart_track_code = globalclient_inc_searchspring_shoppingcart_track_code($searchspring_id);
if ($searchspring_shoppingcart_track_code) {
$code = str_replace('', $searchspring_shoppingcart_track_code, $code);
}
$searchspring_checkout_track_code = globalclient_inc_searchspring_checkout_track_code($searchspring_id);
if ($searchspring_checkout_track_code) {
$code = str_replace('', $searchspring_checkout_track_code, $code);
}
}
//----------------- End Include Google / ClickTale / VoiceStar Code into Template --------------------//
/*------------------------------+
| GLOBAL INC FUNCTIONS |
+------------------------------*/
function globalclient_inc_redirect_by_country_code($redirect_by_countrycode)
{
if (!$redirect_by_countrycode) {
return;
}
$the_ip = get_client_ip();
$country = get_country( $the_ip );
if ( $country ) {
$_SESSION['IPCountryCode'] = $country;
$iso_code = $country['iso_code'];
$redirect_data = explode( ',', $redirect_by_countrycode );
foreach ( $redirect_data as $redirect ) {
$countrycode_and_url = array_map( 'trim', explode( '|', $redirect ) );
if ( $iso_code == $countrycode_and_url[0] ) {
header( 'Location: ' . $countrycode_and_url[1] ) ;
}
}
}
}
function globalclient_inc_inner_page_widgets($client_id, $innerpage_content_xml)
{
$out = array();
preg_match_all('/HTMLWidget:(.+?):HTMLWidget/', $innerpage_content_xml, $out);
if(isset($out[1])) {
foreach($out[1] as $function_data) {
$function_data_array = explode("/", $function_data, 4);
$function_name = 'HTMLWidget';
if(isset($function_data_array[0])) {
$function_param_id = $function_data_array[0];
$function_param_style = $function_data_array[1];
$function_param_height = $function_data_array[2];
$function_param_width = $function_data_array[3];
if(function_exists($function_name)) {
$innerpage_content_xml=str_replace('HTMLWidget:'.$function_data.':HTMLWidget', call_user_func('HTMLWidget', $function_param_id, $function_param_style, $function_param_height, $function_param_width, $client_id), $innerpage_content_xml);
}
}
}
}
return $innerpage_content_xml;
}
function globalclient_inc_inner_page_plugins($client_id, $innerpage_content_xml, $managed_by_module_id='')
{
$out = array();
preg_match_all('/Plugin:(.+?):Plugin/', $innerpage_content_xml, $out);
if(isset($out[1])) {
foreach($out[1] as $function_data) {
$function_data_array = explode("/", $function_data, 2);
if(isset($function_data_array[0])) {
$function_name = 'inline_plugin_'.$function_data_array[0];
$function_style = $function_data_array[1];
//-- Product Plugin
if($function_name=='inline_plugin_product_results'){
$innerpage_content_xml = globalclient_inc_products_plugin($client_id, $innerpage_content_xml, $function_style, $function_data);
} else {
//-- Other Plugins
if (strpos($function_data_array[1],'/nocache') !== false) {
$innerpage_content_xml=str_replace('Plugin:'.$function_data.':Plugin', '
'.$function_data.'
', $innerpage_content_xml);
} else {
if ('N' == POWERTRAIN_V2) {
$plugin_path = 'plugins/content-inline/plugins.php';
} else {
$plugin_path = 'client/inline_controller.php';
}
if(file_exists($plugin_path)) {
$plugin_content=require_once($plugin_path);
if($function_name!=='') {
$innerpage_content_xml=str_replace('Plugin:'.$function_data.':Plugin', call_user_func($function_name, $function_style), $innerpage_content_xml);
//$innerpage_content_xml=str_replace('Plugin:'.$function_data.':Plugin', '
'.$function_data.'
', $innerpage_content_xml);
}
}
}
}
}
}
}
return $innerpage_content_xml;
}
function globalclient_inc_products_plugin($client_id, $innerpage_content_xml, $function_style, $function_data)
{
global $results_breadcrumb_div;
//-- XML Plugin Config Call
if ('Y' == POWERTRAIN_V2) {
$plugin_config_obj = new DC_PluginConfig(CLIENT_ID, WEBSITE_ID, 'PREMProducts');
$plugin_config = $plugin_config_obj->getPluginConfigAsArray();
} else {
$plugin_config_xml_parser = new xml_parser(SITE_ROOT.'xml/'.WEBSITE_ID.'/plugin_config.xml',0,1,'tag','Y');
$plugin_config=$plugin_config_xml_parser->xml_output['GenericPluginConfig']['PREMProducts'];
}
//-- ****** Results Page ******
$_SESSION['GlobalIncProductSearchCategoryID'] = $search_base_category_id_for_plugin = $function_style;
$product_list = ''; // will be set below by plugins/e-commerce/results-page-main-query.php
//get page
if(isset($_POST['PageID'])) {
$results_page=$_POST['PageID'];
} else if(isset($_GET['PageID'])) {
$results_page=$_GET['PageID'];
} else {
$results_page=1;
}
require_once('plugins/e-commerce/results-page-main-query.php'); // gets value for $product_list includes 'plugins/e-commerce/results-page.class.php'; uses $search_base_category_id_for_plugin.
$results_fields_to_display = $plugin_config['ProductsResultsFieldsToDisplay'];
$results_output = $results_breadcrumb_div;
$results_output .= '
';
if(isset($plugin_config['ProductsResultsPageAllowPaginationAboveProducts'])) {
$display_pagination_above_products = $plugin_config['ProductsResultsPageAllowPaginationAboveProducts'];
} else {
$display_pagination_above_products = '';
}
if(isset($plugin_config['ProductsResultsPageAllowPagination'])) {
$display_pagination = $plugin_config['ProductsResultsPageAllowPagination'];
} else {
$display_pagination = '';
}
if(isset($plugin_config['ProductsResultsEnableScrollLoadPagination'])) {
$ajax_load_products = $plugin_config['ProductsResultsEnableScrollLoadPagination'];
} else {
$ajax_load_products = '';
}
if($ajax_load_products == 'Y') {
$display_pagination_above_products = 'N';
$display_pagination = 'N';
}
// do top pagination
if( $product_list && isset($plugin_config['ProductsResultsPageAllowPaginationAboveProducts'])){
if($display_pagination_above_products=='Y'){
//get recs per page
$products_landing_recsperpage = $plugin_config['ProductsResultsPageRecsPerPage'];
if ( !$products_landing_recsperpage ) {
$products_landing_recsperpage = 1000;
}
$default_url_arr = explode('/', sanitizeText($_SERVER['REQUEST_URI']));
$default_url = '/'.$default_url_arr[1].'/';
//print_r($default_url_arr);
$results_page_pagination = ecomm_generate_paged_navigation($products_landing_recsperpage, $results_page, $product_list, $pages_per_set = 5, $default_url);
if($results_page_pagination){
$results_output .= '';
}
}
}
$results_output .= build_results_output( $plugin_config, $product_list, $results_fields_to_display, /*$image_size_override=*/'', /*$results_output_type=*/'', $product_filter_list );
$results_output .= '
';
// do pagination
if( $product_list && isset($plugin_config['ProductsResultsPageAllowPagination'])){
if($display_pagination=='Y'){
//get recs per page
$products_landing_recsperpage = $plugin_config['ProductsResultsPageRecsPerPage'];
if ( !$products_landing_recsperpage ) {
$products_landing_recsperpage = 1000;
}
$default_url_arr = explode('/', sanitizeText($_SERVER['REQUEST_URI']));
$default_url = '/'.$default_url_arr[1].'/';
//print_r($default_url_arr);
$results_page_pagination = ecomm_generate_paged_navigation($products_landing_recsperpage, $results_page, $product_list, $pages_per_set = 5, $default_url);
if($results_page_pagination){
$results_output .= '';
}
}
}
if($ajax_load_products == 'Y') {
$results_page_pagination = ecomm_generate_scroll_load_navigation('/plugins/content-inline/plugin_products_ajax.class.php', 'results', '#product_container', $results_page);
if($results_page_pagination){
$results_output .= $results_page_pagination;
}
}
$innerpage_content_xml=str_replace('Plugin:'.$function_data.':Plugin', $results_output, $innerpage_content_xml);
return $innerpage_content_xml;
}
function globalclient_inc_dynamic_metadata($content_xml, $preview_html='N', $meta_data_value_array=array())
{
$meta_data = '';
$meta_title_tag = '';
$meta_keyword_tag = '';
$meta_description_tag = '';
$meta_product_detail_path = '';
$conical_url_code = '
';
if($meta_data_value_array){
$meta_title_tag = $meta_data_value_array['MetaTitle'];
$meta_description_tag = $meta_data_value_array['MetaDescription'];
} else {
//--Overrides the Team Detail Title Meta Tag to Display the Individuals Name--//
$team_string = $_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];
$team_find = '/team-detail/';
if(strpos($team_string, $team_find)){
$person_url_raw=str_replace('/team-detail/','',$_SERVER["REQUEST_URI"]);
$person_url_part = str_replace('%20', ' ',$person_url_raw);
$person_url_final = explode( "/", $person_url_part );
$person_url = $person_url_final[0];
$name_for_query=explode('-',$person_url);
$team_fname=$name_for_query[0];
$team_lname=$name_for_query[1];
$meta_title_tag = ucwords($team_fname).' '.ucwords($team_lname).' - '.COMPANY_NAME;
}else {
$meta_title_tag = $content_xml['MetaTitle'];
}
$meta_keyword_tag = $content_xml['MetaKeywords'];
$meta_description_tag = $content_xml['MetaDescription'];
//-- If Products Module, handle page title and keywords
if($content_xml['ManagedBySystemModuleID']==110){
$prod_url_str = urldecode( trim( $_SERVER["REQUEST_URI"], '/' ) );
$prod_url_parts = explode( "/", $prod_url_str );
$prod_id = '';
$prod_name = '';
$prod_meta_info = '';
//--Custom Product Meta Info
if ('Y' == POWERTRAIN_V2) {
$plugin_config_obj = new DC_PluginConfig(CLIENT_ID, WEBSITE_ID, 'PREMProducts');
$plugin_config = $plugin_config_obj->getPluginConfigAsArray();
} else {
$plugin_config_xml_parser = new xml_parser(SITE_ROOT.'xml/'.WEBSITE_ID.'/plugin_config.xml',0,1,'tag','Y');
$plugin_config=$plugin_config_xml_parser->xml_output['GenericPluginConfig']['PREMProducts'];
}
if(isset($plugin_config['ProductsDetailsUniqueURLPrefix'])){
$meta_unique_url_prefix = $plugin_config['ProductsDetailsUniqueURLPrefix'];
}else {
$meta_unique_url_prefix = '/ecomm-product-detail/';
}
$pos = strpos( $_SERVER["REQUEST_URI"], $meta_unique_url_prefix );
$pos_shoppingcart = strpos( $_SERVER["REQUEST_URI"], '/ecomm-shopping-cart/' );
/*
if ( $pos_shoppingcart !== false ) {
echo '
FILE ' . __FILE__ . ', LINE ' . __LINE__ . '
';
print_r( $_SESSION );
}
*/
if( $pos !== false ){
//$prod_id = end( $prod_url_parts );
if(isset($_GET['PID'])){
$prod_id = $_GET['PID'];
}else {
$meta_current_page_url = rtrim(sanitizeText($_SERVER['REQUEST_URI']), '/');
$meta_current_page_url_array = explode( '/', urldecode( $meta_current_page_url ) );
$meta_current_page_url_array_count = (count($meta_current_page_url_array))-(1);
if(is_numeric($meta_current_page_url_array[$meta_current_page_url_array_count])){
$prod_id = $meta_current_page_url_array[$meta_current_page_url_array_count];
}else {
$prod_id = 0;
}
}
reset( $prod_url_parts );
if( $prod_id ){
$prod_meta_info = db_search::sp_execute("DCEcomm_Client_ProductMetaInfo",
'@ProductID||@SystemClientID',
$prod_id.'||'.$_SESSION['SystemClientID'],
'SQLINT4||SQLINT4');
if( $prod_meta_info ){
$prod_name = $prod_meta_info[0]['ProductName'];
if( 'N' == $prod_meta_info[0]['GenerateMetaDynamically'] ){
$meta_title_tag = isset( $prod_meta_info[0]['CustomMetaTitle'] ) ? $prod_meta_info[0]['CustomMetaTitle'] : $prod_name;
$meta_keyword_tag = isset( $prod_meta_info[0]['CustomMetaKeywords'] ) ? $prod_meta_info[0]['CustomMetaKeywords'] : strtolower( $prod_name );
$meta_description_tag = isset( $prod_meta_info[0]['CustomMetaDescription'] ) ? $prod_meta_info[0]['CustomMetaDescription'] : strtolower( $prod_name );
if( $prod_meta_info[0]['ProductPermaLink']=='' ){
$meta_product_detail_path = '';
$meta_product_detail_path_raw = str_replace( ' ', '-', ( strtolower( $prod_meta_info[0]['ProductName'] ) ) ) ;
$meta_product_detail_path_raw = str_replace( '/', '-', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( '%', '-percent-', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( '&', '-and-', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( '"', '', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( "'", '', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( '(', '', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( ')', '', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( '----', '-', ( $meta_product_detail_path_raw ) ) ;
$meta_product_detail_path_raw = str_replace( '---', '-', ( $meta_product_detail_path_raw ) ) ;
$product_detail_path = str_replace( '--', '-', ( $meta_product_detail_path_raw ) ) ;
}else {
$meta_product_detail_path = $prod_meta_info[0]['ProductPermaLink'];
}
//$conical_url_code = '
';
}else{
$meta_title_tag = $meta_keyword_tag = $meta_description_tag = $prod_name;
}
}
}
}elseif( $pos_shoppingcart !== false ){
//-- XML Plugin Config Call
if ('Y' == POWERTRAIN_V2) {
$plugin_config_obj = new DC_PluginConfig(CLIENT_ID, WEBSITE_ID, 'PREMProducts');
$product_plugin_config = $plugin_config_obj->getPluginConfigAsArray();
} else {
$plugin_config_xml_parser = new xml_parser(SITE_ROOT.'xml/'.WEBSITE_ID.'/plugin_config.xml',0,1,'tag','Y');
$product_plugin_config=$plugin_config_xml_parser->xml_output['GenericPluginConfig']['PREMProducts'];
}
$meta_title_tag = !empty($product_plugin_config['ProductsShoppingCartPageTitle']) ? $product_plugin_config['ProductsShoppingCartPageTitle'] : '';
} else { //--Standard Meta Info
$prod_title_str = '';
$prod_keyword_str = '';
foreach( $prod_url_parts as $upart ){
if( 'e' == $upart ){
break;
}
if( $prod_title_str ){
$prod_title_str .= ' - ';
}
$prod_title_str .= ucwords( $upart );
$prod_keyword_str .= $upart . ',';
}
//trim( $prod_keyword_str, ',' );
$meta_title_tag = $prod_title_str;
$meta_title_tag = str_replace('Ecomm-', '', $meta_title_tag);
$meta_title_tag = ucwords($meta_title_tag);
$meta_keyword_tag = $prod_keyword_str . $content_xml['MetaKeywords'];
// collections cutoms title and meta description
if(strpos(sanitizeText($_SERVER['REQUEST_URI']), 'collections')) {
//echo '1';
$collectionID = null;
//$collectionID = (int) preg_replace('/[^0-9]/', '', sanitizeText($_SERVER['REQUEST_URI']));
if(empty($collectionID)) { // should have permalink
//echo '2';
$urlArr = explode('/', sanitizeText($_SERVER['REQUEST_URI']));
$permalink = $urlArr[2];
$spcall = new DC_StoredProcedureCall('DCEComm_Merchandisingv2_Collections_SearchForMeta');
$spcall->addParam( '@Page', 1, 'SQLINT4' );
$spcall->addParam( '@RecsPerPage', 20, 'SQLINT4' );
$spcall->addParam('@WhereClause', 'Permalink = \''.$permalink.' \' AND SystemClientID = '.CLIENT_ID.'', 'SQLVARCHAR');
$collection_result = $spcall->doExecute();
if(!is_null($collection_result)) {
//echo '3 | '.$collection_result[0]['CollectionID'];
$collectionID = $collection_result[0]['CollectionID'];
}
}
if(!empty($collectionID)) {
//echo ' | 4';
$collection_profile = db_search::sp_execute( 'dbo.DCEComm_Merchandisingv2_Collection_Profile', '@SystemClientID||@CollectionID', CLIENT_ID .'||'. $collectionID, 'SQLINT4||SQLINT4' );
// echo '
';
// print_r($collection_profile );
//echo '
';
if(!is_null($collection_profile) && !empty($collection_profile[0]['PageTitle'])) {
$meta_title_tag = $collection_profile[0]['PageTitle'];
}
if(!empty($collection_profile[0]['MetaDescription'])) {
$meta_description_tag = $collection_profile[0]['MetaDescription'];
}
}
}
}
}
//-- If Rental Listings Module, handle page title and keywords
if($content_xml['ManagedBySystemModuleID']==288){
$matches = array();
preg_match( '/\/rental-listing-detail\/[0-9]+\/(.+)\/$/', sanitizeText($_SERVER['REQUEST_URI']), $matches );
if ( isset( $matches[1] ) ) {
$url_str = $matches[1];
$meta_title_tag = str_replace( '-', ' ', $url_str );
}
$kwds = preg_replace("/[^a-zA-Z ]+/", " ", trim( $meta_title_tag) );
$meta_keyword_tag = preg_replace('/ +/', ',', strtolower( $kwds ) );
//$meta_title_tag = $content_xml['MetaTitle'];
//$meta_keyword_tag = $content_xml['MetaKeywords'];
//$meta_description_tag = $content_xml['MetaDescription'];
}
//-- If Sales Listings Module, handle page title and keywords
if($content_xml['ManagedBySystemModuleID']==275){
$matches = array();
preg_match( '/\/sales-listing-detail\/[0-9]+\/(.+)\/$/', sanitizeText($_SERVER['REQUEST_URI']), $matches );
if ( isset( $matches[1] ) ) {
$url_str = $matches[1];
$meta_title_tag = str_replace( '-', ' ', $url_str );
}
$kwds = preg_replace("/[^a-zA-Z ]+/", " ", trim( $meta_title_tag) );
$meta_keyword_tag = preg_replace('/ +/', ',', strtolower( $kwds ) );
//$meta_title_tag = $content_xml['MetaTitle'];
//$meta_keyword_tag = $content_xml['MetaKeywords'];
//$meta_description_tag = $content_xml['MetaDescription'];
}
//-- If News Module, handle page title and keywords
if($content_xml['ManagedBySystemModuleID']==35){
$news_item_url=$_SERVER["REQUEST_URI"];
$news_item_detail_url=strpos($news_item_url,'/newsdetail/');
//--Custom News Meta Info
if($news_item_detail_url!==false) {
if(isset($_GET['DetailID'])){
$newsarticle_id=$_GET['DetailID'];
$news_item_detail = db_search::sp_execute('dbo.DCExp_Client_NewsArticles_Detail', '@SystemClientID||@WebsiteID||@NewsArticleID', CLIENT_ID.'||'.WEBSITE_ID.'||'.$newsarticle_id, 'SQLINT4||SQLINT4||SQLINT4');
}else {
$permalink_default_folder=str_replace('/newsdetail','',$_SERVER["REQUEST_URI"]);
$newsarticle_permalink= $permalink_default_folder;
$news_item_detail = db_search::sp_execute('dbo.DCExp_Client_NewsArticles_Detail_ByPermaLink', '@SystemClientID||@WebsiteID||@NewsPermaLink', CLIENT_ID.'||'.WEBSITE_ID.'||'.$newsarticle_permalink, 'SQLINT4||SQLINT4||SQLVARCHAR');
}
$meta_title_tag = $news_item_detail[0]['NewsArticleTitle'];
$meta_description_tag = isset( $news_item_detail[0]['NewsArticleSummary'] ) ? $news_item_detail[0]['NewsArticleSummary'] : strtolower( $meta_title_tag );
//-- Build keywords from description (article summary )
$keyword_array = explode( ' ', $meta_description_tag );
$keyword_array_nonoise = array();
if( $keyword_array ){
$keyword_array_nonoise = array_diff( $keyword_array, explode( ',', STOPWORDS ) );
}
$meta_keyword_tag = $keyword_array_nonoise ? implode( ', ', $keyword_array_nonoise ) : str_replace( ' ', ', ', $meta_title_tag );
$meta_keyword_tag = str_replace( ',, ', ',', $meta_keyword_tag );
$punct1 = array( '.', '!', '?', '"', '<', '>', '(', ')', '[', ']' );
$punct2 = array( '/', '=' );
$meta_keyword_tag = str_replace( $punct1, '', $meta_keyword_tag );
$meta_keyword_tag = str_replace( $punct2, ' ', $meta_keyword_tag );
}else { //--Standard Meta Info
$news_article_url_str = urldecode( trim( $news_item_url, '/' ) );
$news_article_url_parts = explode( "/", $news_article_url_str );
$news_article_keyword_str = isset( $news_article_url_parts[1] ) ? str_replace(' ', ', ', $news_article_url_parts[1]) : '';
//$meta_title_tag = isset( $news_article_keyword_str ) ? ucwords( $news_article_keyword_str ) : '';
$meta_title_tag = $content_xml['MetaTitle'];
$meta_keyword_tag = $news_article_keyword_str . $content_xml['MetaKeywords'];
}
}
//-- If Blog Module, handle page title and keywords
if($content_xml['ManagedBySystemModuleID']==182){
//--Custom Blog Meta Info
$blogpost_url=$_SERVER["REQUEST_URI"];
$blogpost_detail_url=strpos($blogpost_url,'/blogpost/');
if($blogpost_detail_url!==false) {
$blogpost_url_array = explode( '/', urldecode( $blogpost_url ) );
$blogpost_url_array_count = (count($blogpost_url_array))-(2);
$blogpost_permalink= str_replace('/','',$blogpost_url_array[$blogpost_url_array_count]);
$blogpost_permalink= str_replace('?CommentPosted=Y','',$blogpost_permalink);
$blogpost_detail = db_search::sp_execute('dbo.DCExp_Client_BlogPost_Detail', '@SystemClientID||@WebsiteID||@BlogPostPermaLink', CLIENT_ID.'||'.WEBSITE_ID.'||'.$blogpost_permalink, 'SQLINT4||SQLINT4||SQLVARCHAR');
$blogpost_id = $blogpost_detail[0]['BlogPostID'];
$blogpost_thmb_id = $blogpost_detail[0]['BlogPostThumbnailID'];
if( $blogpost_thmb_id ){
$pic_info = db_search::sp_execute( 'dbo.DCExp_Client_Image_Profile','@SystemClientID||@ImageID',$_SESSION['SystemClientID'] .'||'. $blogpost_thmb_id,'SQLINT4||SQLINT4');
if( $pic_info ){
$og_thmb_path = $pic_info[0]['ImagePath'];
}
}
if(empty($blogpost_detail[0]['BlogPostMetaTitle'])) {
$meta_title_tag = $blogpost_detail[0]['PostTitle'];
} else {
$meta_title_tag = $blogpost_detail[0]['BlogPostMetaTitle'];
}
$meta_keyword_tag = isset( $blogpost_detail[0]['PostTagValues'] ) ? $blogpost_detail[0]['PostTagValues'] : strtolower( $meta_title_tag );
if(empty($blogpost_detail[0]['BlogPostMetaDescription'])) {
$meta_description_tag = strtolower( $meta_title_tag );
} else {
$meta_description_tag = $blogpost_detail[0]['BlogPostMetaDescription'];
}
}else { //--Standard Meta Info
$meta_title_tag = $content_xml['MetaTitle'];
$meta_keyword_tag = $content_xml['MetaKeywords'];
$meta_description_tag = $content_xml['MetaDescription'];
}
}
//-- If Locator Module, handle page title and keywords
$locator_detail_url=strpos( $_SERVER["REQUEST_URI"],'ContactID=');
if($content_xml['ManagedBySystemModuleID']==227 && $locator_detail_url!==false){
$meta_keyword_tag = '';
$meta_title_tag = '';
$meta_description_tag = '';
//--Custom Locator Meta Info
$contact_id = '';
if($locator_detail_url!==false) {
$matches = array();
preg_match( '/[0-9]+$/', $_SERVER["REQUEST_URI"], $matches );
if( $matches ){
$contact_id = $matches[0];
}
//die("ContactID: $contact_id");
if( $contact_id ){
$locator_detail_info = db_search::sp_execute('dbo.DCExp_Client_SimpleCRMContact_Profile',
'@SystemClientID||@SimpleCRMContactID',
CLIENT_ID.'||'. $contact_id,
'SQLINT4||SQLINT4'
);
if( $locator_detail_info ){
$og_thmb_path = $locator_detail_info[0]['ProfileImagePath'];
if ('Y' == POWERTRAIN_V2) {
$plugin_config_obj = new DC_PluginConfig(CLIENT_ID, WEBSITE_ID, 'PREMContactLocator');
$plugin_config = $plugin_config_obj->getPluginConfigAsArray();
} else {
$plugin_config_xml_parser = new xml_parser('/xml/'.$_SESSION['WebsiteID'].'/plugin_config.xml');
$plugin_config=$plugin_config_xml_parser->xml_output['GenericPluginConfig']['PREMContactLocator'];
}
$details_fields = $plugin_config['ContactLocatorDetailsFieldsToDisplay'];
$details_fields_array = explode(',', $details_fields );
$to_meta = array(
'FirstName',
'LastName',
//'CompanyName',
//'OfficeLocationName',
'SimpleCRMSpecialtyID',
//'AssociatedWith',
'MailingCity'
);
foreach( $to_meta as $field ){
if( in_array( $field, $details_fields_array ) ){
if( 'SimpleCRMSpecialtyID' == $field ){
$specialty_map = array();
$specialty_list = db_search::sp_execute("dbo.DCExp_Client_SimpleCRMSpecialty_List",'@SystemClientID',$_SESSION['SystemClientID'],'SQLINT4');
if( $specialty_list ){
foreach( $specialty_list as $specialty_row ){
$specialty_map[$specialty_row['SimpleCRMSpecialtyID']] = trim( $specialty_row['SimpleCRMSpecialtyName'] );
}
}
$specialty_str = $locator_detail_info[0]['SimpleCRMSpecialtyID'];
$pattern = array( '(', ')' );
$id_array = explode( ',', str_replace( $pattern, '', $specialty_str ) );
if( $id_array ){
foreach( $id_array as $spec_id ){
if ( isset( $specialty_map[$spec_id] ) ) {
$spec_name = $specialty_map[$spec_id];
$meta_keyword_tag .= $meta_keyword_tag ? ', ' . strtolower( $specialty_map[$spec_id] ) : strtolower( $specialty_map[$spec_id] );
$meta_title_tag .= $meta_title_tag ? ' - ' . $specialty_map[$spec_id] : $specialty_map[$spec_id];
}
}
}
}elseif( 'LastName' == $field ){
$meta_keyword_tag .= $meta_keyword_tag ? ', ' . strtolower( $locator_detail_info[0][$field] ) : strtolower( $locator_detail_info[0][$field] );
$meta_title_tag .= $meta_title_tag ? ' ' . $locator_detail_info[0][$field] : $locator_detail_info[0][$field];
}elseif( $meta_keyword_tag ){
$meta_keyword_tag .= ', ' . trim( strtolower( $locator_detail_info[0][$field] ) );
$meta_title_tag .= ' - ' . trim( $locator_detail_info[0][$field] );
}else{
$meta_keyword_tag .= trim( strtolower( $locator_detail_info[0][$field] ) );
$meta_title_tag .= trim( $locator_detail_info[0][$field] );
}
}
}
// Cannot use ShortBio. Markup (e.g. links) can break the metatags.
//if( 'Y' == $plugin_config['ContactLocatorDetailsShowShortBio'] ){
// $meta_description_tag = $locator_detail_info[0]['ShortBio'] ? $locator_detail_info[0]['ShortBio'] : strtolower( $meta_title_tag );
//}else{
$meta_description_tag = strtolower( $meta_title_tag );
//}
}
}else{ //--Standard Meta Info
$contact_url_str = urldecode( trim( $_SERVER["REQUEST_URI"], '/' ) );
$contact_url_parts = explode( "/", $contact_url_str );
$contact_keyword_str = isset( $contact_url_parts[1] ) ? $contact_url_parts[1] : '';
$meta_title_tag = isset( $contact_keyword_str ) ? ucwords( $contact_keyword_str ) : '';
$meta_keyword_tag = $contact_keyword_str . $content_xml['MetaKeywords'];
}
}
}
//-- If Listing Module, handle page title and keywords
if($content_xml['ManagedBySystemModuleID']==203){
$listing_url_str = urldecode( trim( $_SERVER["REQUEST_URI"], '/' ) );
$listing_url_parts = explode( "_", $listing_url_str );
$listing_id = '';
$listing_name = '';
$listing_meta_info = '';
$listing_url_pos =false;
//--Custom Listing Meta Info
$restaurants_detail = preg_match( '/\/restaurants-detail\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($restaurants_detail==1){
$listing_url_pos = strpos( $_SERVER["REQUEST_URI"], '/restaurants-detail/' );
}
$bars_detail = preg_match( '/\/bars-detail\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($bars_detail==1){
$listing_url_pos = strpos( $_SERVER["REQUEST_URI"], '/bars-detail/' );
}
$clubs_detail = preg_match( '/\/clubs-detail\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($clubs_detail==1){
$listing_url_pos = strpos( $_SERVER["REQUEST_URI"], '/clubs-detail/' );
}
$comedys_detail = preg_match( '/\/comedys-detail\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($comedys_detail==1){
$listing_url_pos = strpos( $_SERVER["REQUEST_URI"], '/comedys-detail/' );
}
$theaters_detail = preg_match( '/\/theaters-detail\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($theaters_detail==1){
$listing_url_pos = strpos( $_SERVER["REQUEST_URI"], '/theaters-detail/' );
}
$limo_services_detail = preg_match( '/\/limo-services-detail\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($limo_services_detail==1){
$listing_url_pos = strpos( $_SERVER["REQUEST_URI"], '/limo-services-detail/' );
}
if( $listing_url_pos !== false ){
$listing_id = intval(end( $listing_url_parts ));
reset( $listing_url_parts );
if(is_int($listing_id)){
$listing_meta_info = db_search::sp_execute("DCEcomm_Client_ListingMetaInfo",
'@ListingID||@SystemClientID',
$listing_id.'||'.$_SESSION['SystemClientID'],
'SQLINT4||SQLINT4');
if( $listing_meta_info ){
$listing_name = $listing_meta_info[0]['ListingName'];
if( 'N' == $listing_meta_info[0]['GenerateMetaDynamically'] ){
$meta_title_tag = isset( $listing_meta_info[0]['CustomMetaTitle'] ) ? $listing_meta_info[0]['CustomMetaTitle'] : $listing_name;
$meta_keyword_tag = isset( $listing_meta_info[0]['CustomMetaKeywords'] ) ? $listing_meta_info[0]['CustomMetaKeywords'] : strtolower( $listing_name );
$meta_description_tag = isset( $listing_meta_info[0]['CustomMetaDescription'] ) ? $listing_meta_info[0]['CustomMetaDescription'] : strtolower( $listing_name );
}else{
$meta_title_tag = $meta_keyword_tag = $meta_description_tag = $listing_name;
}
}
}
}else { //--Standard Meta Info
$listing_title_str = '';
$listing_keyword_str = '';
foreach( $listing_url_parts as $upart ){
if( 'e' == $upart ){
break;
}
if( $listing_title_str ){
$listing_title_str .= ' - ';
}
$listing_title_str .= ucwords( $upart );
$listing_keyword_str .= $upart . ',';
}
//trim( $listing_keyword_str, ',' );
$meta_title_tag = $content_xml['MetaTitle'];
$meta_keyword_tag = $content_xml['MetaKeywords'];
$meta_description_tag = $content_xml['MetaDescription'];
}
}
$pos = strpos( $_SERVER["REQUEST_URI"], '/ecomm-checkout/' );
if( $pos !== false ){
$meta_title_tag = $content_xml['MetaTitle'];
$meta_keyword_tag = $content_xml['MetaKeywords'];
$meta_description_tag = $content_xml['MetaDescription'];
}
$pos = strpos( $_SERVER["REQUEST_URI"], '/ecomm-order-thankyou/' );
if( $pos !== false ){
$meta_title_tag = $content_xml['MetaTitle'];
$meta_keyword_tag = $content_xml['MetaKeywords'];
$meta_description_tag = $content_xml['MetaDescription'];
}
$pos = strpos( $_SERVER["REQUEST_URI"], '/blogpost/' );
if( $pos !== false ){
$blogpost_url=$_SERVER["REQUEST_URI"];
$blogpost_permalink= str_replace('/blogpost/','',$blogpost_url);
$blogpost_permalink= str_replace('/','',$blogpost_permalink);
$blogpost_permalink= str_replace('?CommentPosted=Y','',$blogpost_permalink);
$blogpost_permalink = substr($blogpost_permalink,8);
$blogpost_detail = db_search::sp_execute('dbo.DCExp_Client_BlogPost_Detail', '@SystemClientID||@WebsiteID||@BlogPostPermaLink', CLIENT_ID.'||'.WEBSITE_ID.'||'.$blogpost_permalink, 'SQLINT4||SQLINT4||SQLVARCHAR');
$blogpost_id = $blogpost_detail[0]['BlogPostID'];
$meta_title_tag = $blogpost_detail[0]['PostTitle'];
$meta_keyword_tag = $blogpost_detail[0]['PostTitle'];
$meta_description_tag = $blogpost_detail[0]['PostExcerpt'];
}
}
//------------------------------------------------
//-- Final Metadata Output
//------------------------------------------------
if($preview_html=='N'){
$meta_data.='
'.$meta_title_tag.'';
}else {
$meta_data.='
PREVIEW: '.$meta_title_tag.'';
}
//$meta_data.='
';
$meta_data.='
';
$meta_data.='
';
//- Sets the Open Graph Meta
$meta_data.='
';
$meta_data.='
';
$meta_data.='
';
$meta_data.='
';
$meta_data.= '
';
if(isset($_GET['show-cart']) || isset($_GET['back-to'])) {
$meta_data .= '
';
}
if( isset( $og_thmb_path ) ){
$meta_data.='
';
}else{
if(isset($content_xml['OpenGraphImagePath']) && $content_xml['OpenGraphImagePath'] !== 0){
$meta_data.='
';
}
}
//$meta_data.=$conical_url_code;
if(strpos( $_SERVER["REQUEST_URI"], '/ecomm-collections/' )!==false) {
$meta_data .= '
';
}
return $meta_data;
}
function globalclient_inc_revive_shoppingcart()
{
$_SESSION['ShoppingCartID'] = tdes_dec($_GET['revive']);
$shoppingcart_profile = db_search::sp_execute("dbo.DCEcomm_Client_Order_Profile","@OrderID||@SystemClientID",$_SESSION['ShoppingCartID'].'||'.CLIENT_ID,'SQLINT4||SQLINT4');
if($shoppingcart_profile){
$_SESSION['ShoppingCartItemCount'] = $shoppingcart_profile[0]['NumberOfItemsOnOrder'];
$_SESSION['ShoppingCartItemTotal'] = $shoppingcart_profile[0]['SubTotalCostOfItemsOnly'];
}
if ('Y' == POWERTRAIN_V2) {
header('Location: /?show-cart=Y');
} else {
header('Location: /ecomm-shopping-cart/');
}
die();
}
function globalclient_inc_shoppingcart_session()
{
if (isset($_SESSION['ShoppingCartID'])) {
if($_SESSION['ShoppingCartID']!=0){
$shoppingcart_status = db_search::sp_execute("dbo.DCEcomm_Client_ShoppingCart_Status","@OrderID||@SystemClientID",$_SESSION['ShoppingCartID'].'||'.CLIENT_ID,'SQLINT4||SQLINT4');
//echo('
$shoppingcart_status[0][OrderStatusID]='.$shoppingcart_status[0]['OrderStatusID']);
if($shoppingcart_status){
if($shoppingcart_status[0]['OrderStatusID']==5 || $shoppingcart_status[0]['OrderStatusID']==38){
define('SHOPPINGCART_ID', $_SESSION['ShoppingCartID']);
$set_cart_item_count_to_zero = 'N';
$set_cart_total_to_zero = 'N';
}else {
if(sanitizeText($_SERVER['REQUEST_URI'])=='/ecomm-order-thankyou/'){
define('SHOPPINGCART_ID', $_SESSION['ShoppingCartID']);
$set_cart_item_count_to_zero = 'N';
$set_cart_total_to_zero = 'N';
}else {
define('SHOPPINGCART_ID', 0);
$_SESSION['ShoppingCartID']= 0;
$set_cart_item_count_to_zero = 'Y';
$set_cart_total_to_zero = 'Y';
}
}
}else {
define('SHOPPINGCART_ID', $_SESSION['ShoppingCartID']);
$set_cart_item_count_to_zero = 'N';
$set_cart_total_to_zero = 'N';
}
} else {
define('SHOPPINGCART_ID', $_SESSION['ShoppingCartID']);
$set_cart_item_count_to_zero = 'N';
$set_cart_total_to_zero = 'N';
}
} else {
$set_cart_item_count_to_zero = 'Y';
$set_cart_total_to_zero = 'Y';
define('SHOPPINGCART_ID', 0);
$_SESSION['ShoppingCartID']= 0;
$_SESSION['ShoppingCartShippingTypeID'] = 0;
}
if(isset($_SESSION['ShoppingCartShippingTypeID']) && $set_cart_item_count_to_zero=='Y') {
$_SESSION['ShoppingCartShippingTypeID']= 0;
}
if(isset($_SESSION['ShoppingCartItemCount']) && $set_cart_item_count_to_zero=='N') {
define('SHOPPINGCART_ITEM_COUNT', $_SESSION['ShoppingCartItemCount']);
}else {
define('SHOPPINGCART_ITEM_COUNT', 0);
$_SESSION['ShoppingCartItemCount']= 0;
}
if(isset($_SESSION['ShoppingCartItemTotal']) && $set_cart_total_to_zero=='N') {
define('SHOPPINGCART_ITEM_TOTAL', $_SESSION['ShoppingCartItemTotal']); // Total before tax & shipping
}else {
define('SHOPPINGCART_ITEM_TOTAL', 0);
$_SESSION['ShoppingCartItemTotal']= 0;
}
if(isset($_SESSION['ShoppingCartLastProductIDAdded'])) {
define('SHOPPINGCART_LAST_ID_ADDED', $_SESSION['ShoppingCartLastProductIDAdded']);
}else {
define('SHOPPINGCART_LAST_ID_ADDED', 0);
$_SESSION['ShoppingCartLastProductIDAdded']= 0;
}
if(isset($_SESSION['ShoppingCartLastOrderDetailIDAdded'])) {
define('SHOPPINGCART_LAST_ORDER_DETAIL_ID_ADDED', $_SESSION['ShoppingCartLastOrderDetailIDAdded']);
}else {
define('SHOPPINGCART_LAST_ORDER_DETAIL_ID_ADDED', 0);
$_SESSION['ShoppingCartLastOrderDetailIDAdded']= 0;
}
}
function globalclient_inc_get_module_functions($managed_by_system_module_id, $powertrain_v2_enabled=false)
{
//echo '
Line ' . __LINE__;
//echo "
managed_by_system_module_id=$managed_by_system_module_id
";
/*if ($powertrain_v2_enabled && 110==$managed_by_system_module_id) {
$results = array(
'module_path' => '',
'module_function' => 'products',
'plugin_path' => SITE_ROOT . 'client/e-commerce/main.php',
);
return $results;
}*/
if ($powertrain_v2_enabled) {
$products_plugin_path = 'client/e-commerce/main.php';
$my_account_plugin_path = 'client/my-account/main.php';
} else {
$products_plugin_path = 'plugins/e-commerce/plugin_main.php';
$my_account_plugin_path = 'plugins/my-account/plugin_main.php';
}
$plugin_router = array(
//------------------------------------------
//-- Inline Plugins
//------------------------------------------
60 => array(
'module_path' => 'modules/services.php',
'module_function' => '',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
35 => array(
'module_path' => '',
'module_function' => 'newsarticles',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
52 => array(
'module_path' => '',
'module_function' => 'contactus',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
163 => array(
'module_path' => '',
'module_function' => 'testimonials',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
11 => array(
'module_path' => '',
'module_function' => 'documents',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
13 => array(
'module_path' => '',
'module_function' => 'imagegallery',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
323 => array(
'module_path' => '',
'module_function' => 'newimagegallery',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
39 => array(
'module_path' => '',
'module_function' => 'faq',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
106 => array(
'module_path' => '',
'module_function' => 'team',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
182 => array(
'module_path' => '',
'module_function' => 'blog',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
139 => array(
'module_path' => '',
'module_function' => 'events',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
156 => array(
'module_path' => '',
'module_function' => 'sitesearch',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
147 => array(
'module_path' => 'portfolio',
'module_function' => '',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
187 => array(
'module_path' => '',
'module_function' => 'sitemap',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
203 => array(
'module_path' => '',
'module_function' => 'listings',
'plugin_path' => 'plugins/content-inline/plugin_listings.php',
),
227 => array(
'module_path' => '',
'module_function' => 'contactlocator',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
275 => array(
'module_path' => '',
'module_function' => 'saleslistings',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
288 => array(
'module_path' => '',
'module_function' => 'rentallistings',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
299 => array(
'module_path' => '',
'module_function' => 'joblistings',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
267 => array(
'module_path' => '',
'module_function' => 'productsearch',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
//------------------------------------------
//-- My-Account Plugin/Modules
//------------------------------------------
151 => array(
'module_path' => '',
'module_function' => 'registeraccount',
'plugin_path' => $my_account_plugin_path,
),
//------------------------------------------
//-- E-Commerce Plugins/Modules
//------------------------------------------
110 => array(
'module_path' => '',
'module_function' => 'products',
'plugin_path' => $products_plugin_path,
),
339 => array(
'module_path' => '',
'module_function' => 'giftregistry',
'plugin_path' => 'plugins/content-inline/plugins.php',
),
);
//------------------------------------------
//-- Default values if no match
//------------------------------------------
$defaults = array(
'module_path' => '',
'module_function' => '',
'plugin_path' => 'plugins/content-inline/plugins.php'
);
$results = isset($plugin_router[$managed_by_system_module_id]) ? $plugin_router[$managed_by_system_module_id] : $defaults;
//echo '
Line ' . __LINE__;
//echo "
results=" . print_r($results,true);
return $results;
}
function globalclient_inc_google_adwords_conversion_code($code_from_config)
{
$google_adwords_conversion_code = str_replace("\|\|","||",$code_from_config);
$google_order_info = db_search::sp_execute('dbo.DCEcomm_Client_Order_Profile_ForGoogleEcommTracking','@OrderID||@SystemClientID',SHOPPINGCART_ID .'||'. CLIENT_ID,'SQLINT4||SQLINT4');
if($google_order_info){
$google_adwords_conversion_code = str_replace("|TRANSACTION-VALUE|",$google_order_info[0]['OrderGrandTotal'],$google_adwords_conversion_code);
$google_adwords_conversion_code = str_replace("|TAX-VALUE|",$google_order_info[0]['TaxCost'],$google_adwords_conversion_code);
$google_adwords_conversion_code = str_replace("|SHIPPING-VALUE|",$google_order_info[0]['ShippingCost'],$google_adwords_conversion_code);
}else {
$google_adwords_conversion_code = str_replace("|TRANSACTION-VALUE|",0,$google_adwords_conversion_code);
$google_adwords_conversion_code = str_replace("|TAX-VALUE|",0,$google_adwords_conversion_code);
$google_adwords_conversion_code = str_replace("|SHIPPING-VALUE|",0,$google_adwords_conversion_code);
}
return $google_adwords_conversion_code;
}
function globalclient_inc_google_trusted_stores() {
$google_tag_manager_data_layer = '';
$google_trusted_stores_code = '';
$google_order_info = db_search::sp_execute('dbo.DCEcomm_Client_Order_Profile_ForGoogleEcommTracking','@OrderID||@SystemClientID',SHOPPINGCART_ID .'||'. CLIENT_ID,'SQLINT4||SQLINT4');
if ($google_order_info) {
$order_total_conversion_value = $google_order_info[0]['OrderGrandTotal'];
$ga_ecomm_track_code = globalclient_inc_generate_google_ecomm_track_code( SHOPPINGCART_ID, CLIENT_ID, WEBSITE_DOMAIN);
$google_tag_manager_data_layer .= '';
$google_trusted_stores_code = globalclient_inc_generate_google_trusted_stores_code( SHOPPINGCART_ID, CLIENT_ID, WEBSITE_DOMAIN);
return $google_tag_manager_data_layer . $google_trusted_stores_code;
}
}
function globalclient_inc_searchspring_productdetail_track_code($searchspring_id)
{
if ('Y' == POWERTRAIN_V2) {
$plugin_config_obj = new DC_PluginConfig(CLIENT_ID, WEBSITE_ID, 'PREMProducts');
$product_plugin_config = $plugin_config_obj->getPluginConfigAsArray();
} else {
$plugin_config_xml_parser = new xml_parser(SITE_ROOT.'xml/'.WEBSITE_ID.'/plugin_config.xml',0,1,'tag','Y');
$product_plugin_config=$plugin_config_xml_parser->xml_output['GenericPluginConfig']['PREMProducts'];
}
if (isset($product_plugin_config['ProductsDetailsUniqueURLPrefix'])) {
$product_detail_url_prefix = $product_plugin_config['ProductsDetailsUniqueURLPrefix'];
} else {
$product_detail_url_prefix = 'ecomm-product-detail';
}
$searchspring_productdetail_track_code = '';
$show_searchspring_productdetail_track = preg_match( '/\/'.str_replace('/','',$product_detail_url_prefix).'\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if ($show_searchspring_productdetail_track==0) {
return '';
}
$current_page_url = sanitizeText($_SERVER['REQUEST_URI']);
$current_page_url_has_qstring = strpos($current_page_url,'/?');
if ($current_page_url_has_qstring === false) {
$current_page_url = sanitizeText($_SERVER['REQUEST_URI']);
} else {
$current_page_url_with_qstring_array = explode( '?', $current_page_url );
$current_page_url = $current_page_url_with_qstring_array[0];
}
$current_page_url = rtrim($current_page_url, '/');
$current_page_url_array = explode( '/', urldecode( $current_page_url ) );
$current_page_url_array_count = (count($current_page_url_array))-(1);
if(is_numeric($current_page_url_array[$current_page_url_array_count])){
$searchspring_product_id = $current_page_url_array[$current_page_url_array_count];
} else {
$searchspring_product_id = 0;
}
$searchspring_productdetail_track_code .= '
';
return $searchspring_productdetail_track_code;
}
function globalclient_inc_generate_searchspring_ecomm_track_code($order_id,$systemclient_id, $website_domainname){
//$google_ecomm_track_code = '
';
return $searchspring_shoppingcart_track_code;
}
function globalclient_inc_searchspring_checkout_track_code($searchspring_id)
{
$searchspring_checkout_track_code = '';
$show_searchspring_checkout_track = preg_match( '/\/ecomm-order-thankyou\//', sanitizeText($_SERVER['REQUEST_URI']) ) ? 1 : 0;
if($show_searchspring_checkout_track==0) {
return '';
}
//require_once $_SERVER['DOCUMENT_ROOT'] . '/plugins/e-commerce/functions-common.php';
$searchspring_checkout_data_array = globalclient_inc_generate_searchspring_ecomm_track_code( SHOPPINGCART_ID, CLIENT_ID, WEBSITE_DOMAIN);
$searchspring_checkout_track_code .= '
';
return $searchspring_checkout_track_code;
}
function globalclient_inc_generate_google_ecomm_track_code($order_id,$systemclient_id, $website_domainname){
//$google_ecomm_track_code = '