Page 1 of 4

[RELEASED] News / Blog Module

Posted: Mon Nov 23, 2009 3:20 am
by seths
It's a very simple blog module, but it should do the trick for most folks:

http://tinyurl.com/opencart-blog

Enjoy!

Re: [RELEASED] News / Blog Module

Posted: Mon Nov 23, 2009 4:04 am
by leprimo
thank you, good for news.!
Easy to install, works well!

Re: [RELEASED] News / Blog Module

Posted: Thu Nov 26, 2009 11:15 pm
by DannyMacD
do you have any demo stores with this on to see please?

many thanks :)

Re: [RELEASED] News / Blog Module

Posted: Sun Nov 29, 2009 9:22 pm
by richard211986
would this be suitable for older versions of oc 1.3.2?

Re: [RELEASED] News / Blog Module

Posted: Mon Nov 30, 2009 10:43 am
by seths
I can't think of any reason why it wouldn't work with an older release.

Re: [RELEASED] News / Blog Module

Posted: Sun Dec 06, 2009 9:11 pm
by vimal
Followed everything but i get an error saying

Notice: Undefined variable: blog in C:\Server\xampp\htdocs\oc134\catalog\view\theme\dark_red\template\common\home.tpl on line 8

Any idea what it is?

Re: [RELEASED] News / Blog Module

Posted: Mon Dec 07, 2009 4:01 am
by seths
Yes, it sounds like the home.php controller doesn't have the $this->children[] = 'module/blog' in the right place (or perhaps it's missing altogether).

Re: [RELEASED] News / Blog Module

Posted: Mon Dec 07, 2009 10:40 pm
by vimal
Hi My home.php file (\catalog\controller\common\home.php) is as below.

Code: Select all

<?php  
class ControllerCommonHome extends Controller {
	public function index() {
		$this->children[] = "module/blog";
		$this->language->load('common/home');
		
		$this->document->title = $this->config->get('config_title');
		$this->document->description = $this->config->get('config_meta_description');

		$this->document->breadcrumbs = array();

      	$this->document->breadcrumbs[] = array(
        	'href'      => $this->url->http('common/home'),
        	'text'      => $this->language->get('text_home'),
        	'separator' => FALSE
      	);
		
		$this->data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_store'));
		$this->data['welcome'] = html_entity_decode($this->config->get('config_welcome_' . $this->language->getId()));
		
		$this->data['text_latest'] = $this->language->get('text_latest');
		$this->load->model('catalog/product');
		$this->load->model('catalog/review');
		$this->load->model('tool/seo_url');
		$this->load->helper('image');
		
		$this->data['products'] = array();

		foreach ($this->model_catalog_product->getLatestProducts(8) as $result) {			
			if ($result['image']) {
				$image = $result['image'];
			} else {
				$image = 'no_image.jpg';
			}
			
			$rating = $this->model_catalog_review->getAverageRating($result['product_id']);	
			
			$special = FALSE;
			
			$discount = $this->model_catalog_product->getProductDiscount($result['product_id']);
			
			if ($discount) {
				$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
			 
				$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
			
				if ($special) {
					$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
				}						
			}
				
          	$this->data['products'][] = array(
            	'name'    => $result['name'],
				'model'   => $result['model'],
            	'rating'  => $rating,
				'stars'   => sprintf($this->language->get('text_stars'), $rating),
				'thumb'   => image_resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
            	'price'   => $price,
				'special' => $special,
				'href'    => $this->model_tool_seo_url->rewrite($this->url->http('product/product&product_id=' . $result['product_id']))
          	);
		}

		if (!$this->config->get('config_customer_price')) {
			$this->data['display_price'] = TRUE;
		} elseif ($this->customer->isLogged()) {
			$this->data['display_price'] = TRUE;
		} else {
			$this->data['display_price'] = FALSE;
		}
				
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/common/home.tpl';
		} else {
			$this->template = 'default/template/common/home.tpl';
		}
		
		$this->children = array(
			'common/header',
			'common/footer',
			'common/column_left',
			'common/column_right'
		);
		
		$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
	}
}
?>

Re: [RELEASED] News / Blog Module

Posted: Mon Dec 07, 2009 11:31 pm
by leprimo
Find

Code: Select all

		$this->children = array(
			'common/header',
			'common/footer',
			'common/column_left',
			'common/column_right'
		);
Add after

Code: Select all

$this->children[] = "module/blog";
Maybe its the better place???

Re: [RELEASED] News / Blog Module

Posted: Tue Dec 08, 2009 2:38 am
by seths
Yes, as stated in the documentation, it must appear after

Code: Select all

    $this->children = array(
         'common/header',
         'common/footer',
         'common/column_left',
         'common/column_right'
      );
As this code overwrites any changes to $this->children. Alternatively, you could simply add 'module/blog' to that call as follows:

Code: Select all

    $this->children = array(
         'common/header',
         'common/footer',
         'common/column_left',
         'common/column_right',
         'module/blog'
      );

Re: [RELEASED] News / Blog Module

Posted: Wed Dec 09, 2009 5:50 pm
by vimal
Thanks all. Got it working.

Re: [RELEASED] News / Blog Module

Posted: Wed Dec 09, 2009 6:57 pm
by DannyMacD
Hello,

i have just installed this on my 1.3.4 shop and i have this error code on main site:

Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/disifin/public_html/shop/catalog/controller/common/home.php on line 89

could someone point out what im doing wrong please?

thank you :)

Re: [RELEASED] News / Blog Module

Posted: Wed Dec 09, 2009 6:59 pm
by DannyMacD
dcrap that, just realised i didnt put a ' after blog on it.

sorted :)

good module!!!

Re: [RELEASED] News / Blog Module

Posted: Mon Dec 14, 2009 8:44 am
by dannowatts
odd, when i go to access it via the admin panel, i am gettin a "permission denied"... any reason why?

rocksteady,
danno~

Re: [RELEASED] News / Blog Module

Posted: Mon Dec 14, 2009 8:50 am
by dannowatts
whelp, solved that issue i just posted, by actually giving my user the ability to use that extension, but now i'm getting this new error:
"Error: Could not load model extension/blog!"

hmmm... help?

rocksteady,
danno~

Re: [RELEASED] News / Blog Module

Posted: Mon Dec 14, 2009 8:59 am
by dannowatts
aaaaaaand i fixed the other error. i'm working in mac os x's Coda application. for some reason it didn't upload the extension directory along with the blog.php file . after i opened up my server via FTP i could see that it wasn't there. after correctly uploading the file it said was missing, all is well.

sometimes it takes just posting that you have a problem to figure it out yourself ;)

thanks again :)

rocksteady,
danno~

Re: [RELEASED] News / Blog Module

Posted: Thu Dec 24, 2009 6:10 am
by JordanAustin
seths,
Nice job with this extension, it's really useful. Also you had great documentation.

What do you think this would take to add an RSS feed to the blog? And does anyone else think this would be useful?

Re: [RELEASED] News / Blog Module

Posted: Thu Dec 24, 2009 6:21 am
by seths
I don't think it would take much. I just don't have a ton of time to work on it just now. But since I haven't gotten any other requests I will do my best to include it in the next release. I was hoping for some bug fixes to include, but I've yet to get any bug reports...

Re: [RELEASED] News / Blog Module

Posted: Thu Dec 24, 2009 7:31 am
by JordanAustin
seths wrote:I don't think it would take much. I just don't have a ton of time to work on it just now. But since I haven't gotten any other requests I will do my best to include it in the next release. I was hoping for some bug fixes to include, but I've yet to get any bug reports...
I'm testing it out right now. It's really cut and dry. So hopefully you won't get any bug reports :)

Re: [RELEASED] News / Blog Module

Posted: Thu Dec 31, 2009 1:28 am
by CEOself
Great Module, I got it working fine.

Now where to put it. I plan on writing on it alot. Therefore, I would like to give it's own page under the Information area. Is there a way to create a new page under Category> Information> Insert, and use the source code setting in the WYSIWYG to show the blog.php file?