You are here:  » Trying to set Product meta title & Description


Trying to set Product meta title & Description

Submitted by webie on Sun, 2019-01-13 03:23 in

HI Dave,

Been a while just setting up new site I have created some extra fields for meta title & meta description.

1. Meta Title gets populated with product name
2. Meta Description gets populated with product description

All working OK data imports into correct fields problem I have got I am trying to modify Meta title & description within my code to build better SEO but my code also changes product name & product description and don't know why ? i just need the meta fields to be modified.

Regards
Darren

<?php
// Import Product Meta Data build from product name & product Decsriptions
        // Meta Title Build from product name
    $record[$admin_importFeed["field_meta_title"]] = ("Keyword Keyword " . $record[$admin_importFeed["field_meta_title"]]) . " Keyword";
    // Meta Decription Build from product description
    $text_limit = "300";
    $record[$admin_importFeed["field_meta_description"]] = ucsentence(superentities(clean_title(truncate_meta("Keyword " . $record[$admin_importFeed["field_meta_description"]], $text_limit)))) . " Keyword keyword";
?>

Submitted by support on Mon, 2019-01-14 10:34

Hello Darren,

In your code, instead of setting $record[$admin_importFeed[...]] you just need to populate $record["meta_title"] and $record["meta_description"] - have a go with:

<?php
  
// Import Product Meta Data build from product name & product Decsriptions
  // Meta Title Build from product name
  
$record["meta_title"] = ("Keyword Keyword " $record[$admin_importFeed["field_meta_title"]]) . " Keyword";
  
// Meta Decription Build from product description
  
$text_limit "300";
  
$record["meta_description"] = ucsentence(superentities(clean_title(truncate_meta("Keyword " $record[$admin_importFeed["field_meta_description"]], $text_limit)))) . " Keyword keyword";
?>

Cheers,
David.
--
PriceTapestry.com