View Single Post
  #35  
Old 04-03-2014, 12:19 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Webinar for X-Cart 5 developers on March,18th.

Found time to finish working through the tutorial. There is a typo in this section:
"Update controller
Edit the classes/XLite/Module/Tony/News/View/Model/NewsEdit.php file and add the following code there:"

The file path is wrong, it should be:
"classes/XLite/Module/Tony/News/Controller/Admin/NewsEdit.php"

Also, I added this code to the News controller in classes/XLite/Module/Tony/News/Controller/Customer/NewsEdit.php:
Code:
public function getNewsTitle() { $id = intval(\XLite\Core\Request::getInstance()->news_id); $return = ''; if ($id != 0) { $news = \XLite\Core\Database::getRepo('XLite\Module\Tony\News\Model\News')->find($id); if ($news) { $return = $news->getTitle(); } } return $return; } /** * Return the current page title (for the content area) * * @return string */ public function getTitle() { return 'News'; } /** * Common method to determine current location * * @return string */ protected function getLocation() { return $this->getTitle(); }
This allowed the section name "News" to be displayed in the bread crumb area and the page title. It also allowed me to use the function getNewsTitle() to display the title on the news page in the customer area after adding the following code to skins/default/en/modules/Tony/News/page/news/body.tpl
Code:
<h2>{getNewsTitle():h}</h2>

Thanks again for this learning experience, I feel much better about XC5 and my own ability to work with it.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote