Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

News posts on home page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-03-2009, 11:25 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default News posts on home page

How can I ahve more than one news post on the home page? Like maybe all active?
__________________
xcart 5.1.2
Reply With Quote
  #2  
Old 07-05-2009, 07:22 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: News posts on home page

anyone?
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 07-14-2009, 02:27 PM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: News posts on home page

add in the end of modules/News_Management/func.php
Code:
function insert_news_get_num($lngcode) { return array_slice(func_news_get($lngcode), 0, 3);}



then in skin1/customer/news.tpl change
Code:
{if $is_news_exist} {capture name=menu} <div class="news item"> {include file="today_news.tpl"} </div>

to

Code:
{if $is_news_exist} {capture name=menu} {if $news_message eq ""} <div class="news item">{$lng.txt_no_news_available}</div> {else} {insert name="gate" func="news_get_num" assign="all_news" lngcode=$shop_language} {section name=newsloop loop=$all_news} <div class="news item"> <strong> {$all_news[newsloop].date|date_format:$config.Appearance.date_format}</strong><br /> {$all_news[newsloop].body}<br /> </div> {/section} <br /> {if $usertype eq "C"} <a href="news.php" class="small-link prev-news">{$lng.lbl_previous_news}</a> {/if} {/if}

This should work, though I didn't tested it.
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote

The following 3 users thank Victor D for this useful post:
matallen (09-11-2009), PC Doctor (02-15-2010), SCUBA1609 (07-16-2009)
  #4  
Old 09-10-2009, 07:14 AM
 
matallen matallen is offline
 

Advanced Member
  
Join Date: Nov 2008
Posts: 78
 

Default Re: News posts on home page

I just tried this and am getting this error:

Quote:
Warning: array_slice() expects parameter 1 to be array, boolean given in /modules/News_Management/func.php on line 82

I'd really appreciate your help as this is EXACTLY what I need to do! Thanks so much!
__________________
Matt Allen
Xcart Gold v4.2.2
LINUX - Apache
PHP 5.2.9 / MySQL 5.0.81-community
Reply With Quote
  #5  
Old 09-11-2009, 06:45 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: News posts on home page

Quote:
Originally Posted by matallen
Warning: array_slice() expects parameter 1 to be array, boolean given in /modules/News_Management/func.php on line 82

You have no news for the current language I suppose.

try to replace
Code:
function insert_news_get_num($lngcode) { return array_slice(func_news_get($lngcode), 0, 3);}
with
Code:
function insert_news_get_num($lngcode) {$news = func_news_get($lngcode); return $news ? array_slice($news, 0, 3) : false;}
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote

The following 2 users thank Victor D for this useful post:
matallen (09-11-2009), PC Doctor (02-15-2010)
  #6  
Old 09-11-2009, 06:50 AM
 
matallen matallen is offline
 

Advanced Member
  
Join Date: Nov 2008
Posts: 78
 

Default Re: News posts on home page

Okay I did that - That got rid of the error but now there are no news items showing. If I click the "Previous News" link it takes me to the news page where I have two items showing. What classifies as "Current News"?? Thanks SOOO much for your help!
__________________
Matt Allen
Xcart Gold v4.2.2
LINUX - Apache
PHP 5.2.9 / MySQL 5.0.81-community
Reply With Quote
  #7  
Old 09-11-2009, 07:01 AM
 
matallen matallen is offline
 

Advanced Member
  
Join Date: Nov 2008
Posts: 78
 

Default Re: News posts on home page

Also - I went and looked at the news system and saw where it said I could pick a language. Well there is nothing there for language. I have english set as the default/only language in my cart. I tried enabling Spanish and a drop down appeared across from the language label on the news management screen. It was grayed out and said English. This did not fix the issue however.
__________________
Matt Allen
Xcart Gold v4.2.2
LINUX - Apache
PHP 5.2.9 / MySQL 5.0.81-community
Reply With Quote
  #8  
Old 09-11-2009, 07:06 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: News posts on home page

Thank you, it should be
Code:
function insert_news_get_num($conf) {$news = func_news_get($conf['lngcode']); return $news ? array_slice($news, 0, 3) : false;}
as the language code was taken incorrectly.
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote

The following 3 users thank Victor D for this useful post:
matallen (09-11-2009), parekh81 (12-24-2009), PC Doctor (02-15-2010)
  #9  
Old 09-11-2009, 11:16 AM
 
matallen matallen is offline
 

Advanced Member
  
Join Date: Nov 2008
Posts: 78
 

Default Re: News posts on home page

You are amazing! Thanks so much! Hopefully I'm not bothering you too much but can you point me in the right direction if I only want to show the Message "Subject" or if I'd want to only display the first x number of words the message?
__________________
Matt Allen
Xcart Gold v4.2.2
LINUX - Apache
PHP 5.2.9 / MySQL 5.0.81-community
Reply With Quote
  #10  
Old 09-15-2009, 02:00 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: News posts on home page

Code:
{if $is_news_exist} {capture name=menu} {if $news_message eq ""} <div class="news item">{$lng.txt_no_news_available}</div> {else} {insert name="gate" func="news_get_num" assign="all_news" lngcode=$shop_language} {section name=newsloop loop=$all_news} <div class="news item"> <strong> {$all_news[newsloop].date|date_format:$config.Appearance.date_format}</strong><br /> {$all_news[newsloop].body}<br /> </div> {/section} <br /> {if $usertype eq "C"} <a href="news.php" class="small-link prev-news">{$lng.lbl_previous_news}</a> {/if} {/if}
->
Code:
{if $is_news_exist} {capture name=menu} {if $news_message eq ""} <div class="news item">{$lng.txt_no_news_available}</div> {else} {insert name="gate" func="news_get_num" assign="all_news" lngcode=$shop_language} {section name=newsloop loop=$all_news} <div class="news item"> <strong> {$all_news[newsloop].date|date_format:$config.Appearance.date_format}</strong><br /> {$all_news[newsloop].body|truncate:200}<br /> </div> {/section} <br /> {if $usertype eq "C"} <a href="news.php" class="small-link prev-news">{$lng.lbl_previous_news}</a> {/if} {/if}
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote

The following 3 users thank Victor D for this useful post:
matallen (09-15-2009), parekh81 (12-24-2009), PC Doctor (02-15-2010)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:50 AM.

   

 
X-Cart forums © 2001-2020