Author Topic: Please Add This (Code Attached)  (Read 2261 times)

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10359
  • VirtueMart Version: 3+
Please Add This (Code Attached)
« on: November 15, 2011, 20:47:32 pm »
This is for SEO page title control of the category. This will allow you to set the page title to something different than the category name.

Category Table SQL
ADD
Column Name  customtitle
Length 70
Default NONE

NEXT

virtuemart/views/category/view.html.php

CHANGE this
$categoryStripped = strip_tags($category->category_name);

to this
if ($category->customtitle) {
         $categoryStripped = strip_tags($category->customtitle);
      } else {
      $categoryStripped = strip_tags($category->category_name);
      }



Language String Add:
COM_VIRTUEMART_CATEGORY_TITLE="Custom Category Title"

ADD the Field To The Category Edit Form

<tr>
                  <td class="key">
                     <label for="customtitle">
                        <?php echo JText::_('COM_VIRTUEMART_CATEGORY_TITLE'); ?>
                     </label>
                  </td>
                  <td>
                     <textarea class="inputbox" name="customtitle" id="customtitle" cols="35" rows="5"><?php echo

$this->category->customtitle; ?></textarea>
                  </td>
               </tr>
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

stinga

  • Contributing Developer
  • Full Member
  • *
  • Posts: 872
    • Squangle ltd
Re: Please Add This (Code Attached)
« Reply #1 on: November 17, 2011, 12:38:28 pm »
G'day BT,

Why do you need to strip_tags on a title? (just in case?)
Why 35 cols by 5 rows and a varchar of 70?

Must have a look for all the strip_tags on our site and remove those that are not needed, on category_name for instance, might make it go a bit faster!.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10359
  • VirtueMart Version: 3+
Re: Please Add This (Code Attached)
« Reply #2 on: November 17, 2011, 14:12:02 pm »
G'day BT,

Why do you need to strip_tags on a title? (just in case?)
Why 35 cols by 5 rows and a varchar of 70?

Must have a look for all the strip_tags on our site and remove those that are not needed, on category_name for instance, might make it go a bit faster!.

Strip tags were already there for Page Title, so I left it there.
Varcharacter , NO, Text (I believe).
Column size and rows doesnt really matter. But 70 length Is good

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)