Web Design Forum: Display "free delivery" text on products in 1 category (opencart) - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Display "free delivery" text on products in 1 category (opencart) Rate Topic: -----

#1 User is offline   matlamont 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 136
  • Joined: 23-May 09
  • Reputation: 0
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 February 2012 - 08:57 AM

Hi all

I'm very new to PHP and i'm trying to add what i think is simple code to display a message in the product descriptions within a single category. I have tried the code below but it's not working

<?php

if ($category['category_id'] == "88" ) {
echo "Free Delivery";
}

?>


You can probably tell i have no idea your help would be much appreciated thanks :)
0

#2 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,105
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 08 February 2012 - 11:12 AM

You need to load the category info into the template from the controller to be able to see if its the right one
Open
/catalog/controller/product/category.php


Find this line
$this->document->setTitle($category_info['name']);


before it put
$this->data['category_id'] = $category_id;


Then in your template use
if ($category_id == "88" ) {
echo "Free Delivery";
}

This post has been edited by Jay Gilford: 08 February 2012 - 11:13 AM

1

#3 User is offline   matlamont 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 136
  • Joined: 23-May 09
  • Reputation: 0
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 February 2012 - 11:40 AM

View PostJay Gilford, on 08 February 2012 - 11:12 AM, said:

You need to load the category info into the template from the controller to be able to see if its the right one
Open
/catalog/controller/product/category.php


Find this line
$this->document->setTitle($category_info['name']);


before it put
$this->data['category_id'] = $category_id;


Then in your template use
if ($category_id == "88" ) {
echo "Free Delivery";
}



OK just for you to see where i need to put that is some custom code for page titles

			//===wommon 2011-7-25 add pagetitle start
			//$this->document->setTitle($category_info['name']);
			if($category_info['pagetitle']){
                $this->document->setTitle($category_info['pagetitle']);
            }else{
                $this->document->setTitle($category_info['name']);
            }
			//===wommon 2011-7-25 add pagetitle end


shall i still put it there?
0

#4 User is offline   matlamont 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 136
  • Joined: 23-May 09
  • Reputation: 0
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 10 February 2012 - 11:06 AM

Ok i tried the above but it still doesn't show. any help is much appreciated as i have thousands of products to update manually otherwise :(

PS im using 1.5.0

This post has been edited by matlamont: 10 February 2012 - 11:53 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users