News:

Looking for documentation? Take a look on our wiki

Main Menu

Category description ONLY on first page

Started by SightVision, March 05, 2013, 20:32:29 PM

Previous topic - Next topic

SightVision

Hello everyone,

does anyone knowhow I can show de category description ONLY on the first page of the categroy view?

Thanks!!

socratesmakuyana

Here is how I solved the issue. Go to the the "com_virtuemart/views/categories/tmpl/default.php" file, or you can change whatever template file you are using for your categories view.

the original file before it was edited looked like this

          // Show Category ?>
          <div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
             <div class="spacer">
                <h2>
                   <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
                   <?php echo $category->category_name ?>
                   <br />
                   <?php // if ($category->ids) {
                      echo $category->images[0]->displayMediaThumb("",false);
                   //} ?>
                   </a>
                </h2>
            </div>

          </div>
...


After editing the file to display the category description, the file looked like this

....
          // Show Category ?>
          <div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
             <div class="spacer">
                <h2>
                   <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
                   <?php echo $category->category_name ?>
                   <br />
                   <?php // if ($category->ids) {
                      echo $category->images[0]->displayMediaThumb("",false);
                   //} ?>
                   </a>
                </h2>
            </div>

                                This is the added text.
            <!-- Show category description -->
            <div class="category-description">
               <?php echo $category->category_description ?>
            </div>

          </div>
....

Now after this has been done, the category description is displayed on the categories layout page.

PromoNet

You have not answered the question that was asked. They asked how to display the description on ONLY the first page...   I.e. for SEO the category description should not display on page 2/3/4/5 etc of the category due to duplicate content.

I will look for a resolution and if I find one I will post it.
Virtuemart for the Promotional Products Industry: http://www.promonet.co.uk/ (ProMart)

GJC Web Design

just hide it by css when a snippet detects that the limitstart var is > 0

something like

$limitstart = JRequest::getVar('limitstart');
if($limitstart > 0) {
echo '<style type="text/css">
.category-description {
    display.none;
   }
  </style>';

}
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

PromoNet

Lol you beat me to it!  I was just posting.

Find this in the default category view

$this->category->category_description;

and change it to this
<?php $url 'http://' $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (
false !== strpos($url,'limitstart')) {
    echo 
'';
} else {
    echo 
$this->category->category_description;
?>


This checks for the limitstart text in the URL and if it exists shows nothing. If it doesent then it shows the category description.
   
Virtuemart for the Promotional Products Industry: http://www.promonet.co.uk/ (ProMart)

jenkinhill

Don't know if the OPs are really bothered about this now. The thread is from 2 years ago........    ;)
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

GJC Web Design

Ah you never know - he may still be struggling with this...   :o
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation