Post by Mlee » Mon Jan 29, 2018 3:44 am

Hi, I'm new to these forums so I hope this is alright to post;

I am trying to integrate banner descriptions in OpenCart. But I can't seem to get the output right front-end.

In catalog/model/design/banner.php I use the following query, which DOES show description values:

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image bi LEFT JOIN " . DB_PREFIX . "banner_image_description bid ON (bi.banner_image_id  = bid.banner_image_id) WHERE bi.banner_id = '" . (int)$banner_id . "' AND bid.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY bi.sort_order ASC");
result e.g.

Code: Select all

Array ( [0] => Array ( [banner_image_id] => 299 [banner_id] => 14 [link] => https://www.kidsspeelgoed.nl/specials [image] => catalog/image.png [sort_order] => 1 [language_id] => 4 [title] => banner-1 [description] => <h2>Title</h2> <p>text</P> ) )
In the catalog/controller/module/banner.php I use the following data variable:

Code: Select all

	foreach ($results as $result) {
		if (is_file(DIR_IMAGE . $result['image'])) {
			$data['banners'][] = array(
				'title' => $result['title'],
				'link'  => $result['link'],
				'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']),
				'description' => $result['description'],
			);
		}
		}
In the theme/template/module/banner.tpl I use the following;

Code: Select all

<?php echo $banner['description']; ?>
yet this returns an empty value. I can't seem to figure it out! Any help?

Newbie

Posts

Joined
Mon Jan 29, 2018 3:39 am

Post by thekrotek » Mon Jan 29, 2018 11:51 pm

If you're editing core files, try to refresh modification cache.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Mlee » Tue Jan 30, 2018 2:51 am

That doesn't seem to be the issue, as applying a print_r does deliver results

Newbie

Posts

Joined
Mon Jan 29, 2018 3:39 am

Post by thekrotek » Tue Jan 30, 2018 3:14 am

Mlee wrote:
Tue Jan 30, 2018 2:51 am
That doesn't seem to be the issue, as applying a print_r does deliver results
Did you do that or you're just guessing?

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Mlee » Wed Jan 31, 2018 3:31 am

I did that; added <?php print_r($banner); ?> in the banner.tpl, which returns

Code: Select all

 Array ( [description] => [title] => hallo [link] => http://demo.nl/index.php?route=product/search&search [image] => https://www.demo.nl/image/cache/catalog/image/banner-900x300.jpg ) 
So oddly description is not send... I did add it to the controller and it ís returned from the model

Newbie

Posts

Joined
Mon Jan 29, 2018 3:39 am
Who is online

Users browsing this forum: No registered users and 5 guests