网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > X-Cart
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1   IP: 76.164.216.30
Old 2016-05-06, 10:57 PM
Kailynn Kailynn is offline
初级会员
 
Join Date: 2010-12-10
Posts: 5
Kailynn 现在声名狼藉
Default Help with meta description conditionals

Hi All,

I am trying to change my meta description code so that if I am on a product page it will just automatically use the $product.descr information. Right now it is using the site wide meta-description.

I've found the code that I need to alter, but my skills are limited so I could use some help.

The Meta Code:
Code:
{if $printable}
  <meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
{elseif $main eq 'wordpress'}
  <base href="{$catalogs.customer}/" />
  <meta name="description" content="{$page_data.metadescr|truncate:"500":"...":false|escape}" />
  <meta name="keywords" content="{$page_data.metakeywords|truncate:"500":"":false|escape}" />
{if $page_data.additional_meta}
  {foreach from=$page_data.additional_meta key=prop item=val}
  <meta property="{$prop}" content="{$val}" />
  {/foreach}
{/if}
{if $main eq 'product'}
 <meta name="description" content="{$descr}" />
  <meta name="keywords" content="{$page_data.metakeywords|truncate:"500":"":false|escape}" />
{else}
  {meta type='description' page_type=$meta_page_type page_id=$meta_page_id}
  {meta type='keywords' page_type=$meta_page_type page_id=$meta_page_id}
{/if}
I need to add something like this:

Code:
{if $main eq 'products'}

<meta type="description" content="{$product.descr|strip_tags:false}">

{/if}
But I am having difficulty figuring out where to logically add it into the code.

Any help?

X-Cart GoldPlus: 4.6.4
Reply With Quote
  #2   IP: 76.164.216.30
Old 2016-05-06, 10:58 PM
Queen City Queen City is offline
初级会员
 
Join Date: 2010-05-12
Posts: 1
Queen City 现在声名狼藉
Default

Agreed this is not the best behavior. We found it simpler to adjust the code in include/func/func.product.php after:

Code:
 $product['meta_description'] = trim($product['meta_description']);
    $product['meta_keywords']    = trim($product['meta_keywords']);
add

Code:
if (empty($product['meta_description']))
    $product['meta_description'] = trim(strip_tags(func_query_first_cell("SELECT descr FROM $sql_tbl[products_lng_current] WHERE productid='$productid'")));
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 4 (0 members and 4 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Template Conditionals IF topvip vBulletin技术交流 0 2013-05-06 07:52 AM
Adding Description to the Category page (phpld) topvip Web Directory 0 2007-08-17 01:44 AM
Increase description and allow HTML in description entry (phpld) topvip Web Directory 1 2007-07-10 02:29 AM
Meta Tags and Keywords? indianboy 搜索引擎优化 3 2006-04-08 09:29 PM
HTML文档中小meta的大作用 smiling 建站交流 0 2006-02-16 04:27 AM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:03 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.