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

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

 
Reply
   X-Cart forums > News and Announcements
 
Thread Tools
  #31  
Old 04-01-2014, 11:51 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

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

Yes it runs only from the command line. Yes I can use it. And while on Win system most of the time I have an old computer on my internal network running Linux server so I can run proper hosting, not Win, not something simulated.
Get your old x86 laptop and just install Ubuntu Server on it - it will run even on 256MB RAM not like Win which will require GBs of RAM just so you can load the system....
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
totaltec (04-02-2014)
  #32  
Old 04-02-2014, 03:28 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

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

Hi Mike!

I don't have Win machine to test it out, but I believe you can call next-sdk like this on Win:
Code:
C:\path\to\php\bin ../../next-sdk/devkit/macros/create-module.php --module=Tony\\News --version=5.0

These resources can be helpful as well:
http://stackoverflow.com/questions/15597067/how-to-run-php-from-windows-command-line (explains how you can call it like > php ../../next-sdk/devkit/...)
http://www.php.net/manual/en/install.windows.commandline.php
Reply With Quote

The following user thanks tony_sologubov for this useful post:
totaltec (04-02-2014)
  #33  
Old 04-02-2014, 07:27 AM
  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.

Steve, yes I think I need to bite the bullet and start running Linux again on an old system. Thanks for the advice.

Tony,
I am going to test it out, really appreciate you taking the time to find those resources for me!

Thanks,
-Mike
__________________
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
  #34  
Old 04-02-2014, 09:35 AM
  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.

Yay, thanks guys, I got it to work on Windows.

One thing that may be obvious to others that wasn't to me, you need to run the script from within the XC5 installation directory. At first I was wondering, how does the macro know where XC5 is installed?

So for me, my path to php is C:\\xampp\php\php.exe
Path to next-sdk is C:\\xampp\htdocs\next-sdk\
Path to XC5 C:\\xampp\htdocs\xcart\

Running the script within the xcart directory the correct usage was:
..\..\php\php.exe ../next-sdk/devkit/macros/create-module.php --module=Tony\News --version=5.0

Note that using --module=Tony\\News caused an error. May be a quirk related to Windows only, I see that Tony was able to use the double slashes like --module=Tony\\News in his tutorial video.

Anyway, it works, and I learned something new, which is always great. Thanks again.
__________________
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

The following user thanks totaltec for this useful post:
tony_sologubov (04-07-2014)
  #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

The following 2 users thank totaltec for this useful post:
ADDISON (04-04-2014), tony_sologubov (04-07-2014)
  #36  
Old 04-06-2014, 09:31 AM
  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.

Tony,
I hope you are still watching this thread, and I hope this is a good place to continue asking questions related to the webinar. I have attempted to take your News module a bit further, and currently I am stuck on creating the ability for translations.

I added a class in XLite\Module\Tony\News\Model\NewsTranslation.php
with the following code:
Code:
<?php namespace XLite\Module\Tony\News\Model; /** * News * * @Entity * @Table (name="news_translations", * indexes={ * @Index (name="ci", columns={"code","id"}), * @Index (name="id", columns={"id"}) * } * ) */ class NewsTranslation extends \XLite\Model\Base\Translation { /** * @Column (type="string", length=255) */ protected $title = ''; /** * @Column (type="text") */ protected $body = ''; }

I imitated the SimpleCMS module code. I see that there are many instances where the translation ability has been added in this way. But when rebuilding I get this error:
ERROR: "30" (code N/A)

There is no column with name 'id' on table 'xc_news_translations'.

Now, I understand that this means we are missing this column, and that it is referenced in the PHPDoc comment so it must exist. But the other modules do not need to define this column in their translation classes, and I see it is defined in \XLite\Model\Base\Translation. Why does this method work for other modules and not this one?
__________________
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
  #37  
Old 04-06-2014, 11:41 AM
  Ksenia's Avatar 
Ksenia Ksenia is offline
 

X-Cart team
  
Join Date: Apr 2013
Posts: 735
 

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

Hi Mike!

Thank you for posting your findings here. I think Tony does monitor it. I'm also resending the notifications to him, so he has no chance to miss them=) I guess he might be overloaded now, as after the webinar he leaves for vacations. But tomorrow I'll try to take's Tony hand, show the thread and make sure he react properly.
__________________
X-Cart team
Reply With Quote

The following user thanks Ksenia for this useful post:
totaltec (04-06-2014)
  #38  
Old 04-06-2014, 04:05 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.

Thanks Ksenia!

Tony,
I solved the problem (thankfully I was stuck for hours!), but I would still like an explanation of why this works. I found that by modifying XLite\Module\Tony\News\Model\News.php and changing the line:
Code:
class News extends \XLite\Model\AEntity
To:
Code:
class News extends \XLite\Model\Base\I18n
Fixes the error that it was throwing, and the table "xc_news_translations" is successfully created. The functioning of the module appears unchanged besides that.

What is the difference here, and why should we ever use "\XLite\Model\AEntity" if it cannot be translated?
__________________
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
  #39  
Old 04-07-2014, 03:34 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

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

Quote:
Originally Posted by totaltec
Running the script within the xcart directory the correct usage was:
..\..\php\php.exe ../next-sdk/devkit/macros/create-module.php --module=Tony\News --version=5.0

Note that using --module=Tony\\News caused an error. May be a quirk related to Windows only

Thanks for spotting it out! I will cover it when I write an article about our SDK.
Reply With Quote

The following user thanks tony_sologubov for this useful post:
Ksenia (04-07-2014)
  #40  
Old 04-07-2014, 03:43 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

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

Thank you Mike for spotting a mistake! I just corrected it.

As for breadcrumbs, this is perfect that you learned it. The thing about X-Cart 5 code is that it is quite terse. You define a single method and voila breadcrumbs appear.

Quote:
Originally Posted by totaltec
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.
Reply With Quote
Reply
   X-Cart forums > News and Announcements



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:48 AM.

   

 
X-Cart forums © 2001-2020