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

X-Cart 5: Target and View.

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 07-23-2014, 02:01 AM
 
Dewiar Dewiar is offline
 

Newbie
  
Join Date: Jan 2012
Posts: 3
 

Default X-Cart 5: Target and View.

Can somebody explain ( or give a link ) how to assign a view to an action? I have a controller and I can call any its action, but I don't understand how to assign a view and template to these actions.
__________________
LC 1.0.14
Reply With Quote
  #2  
Old 07-23-2014, 06:44 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

Default Re: X-Cart 5: Target and View.

Hi Dewiar!

I can explain, but I need to get a bit clearer idea of what you are trying to achieve. Could you please explain your task in more detail?

Thank you.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 07-23-2014, 07:14 AM
 
Dewiar Dewiar is offline
 

Newbie
  
Join Date: Jan 2012
Posts: 3
 

Default Re: X-Cart 5: Target and View.

I want just display some content for my target (Controller).
I have analyzed controllers of some modules and saw that almost all controllers have View which returns default template.
Also i found records in table view_lists.
Then i made the same structure, but when i call cart.php?target=bbb&action=ccc
I see only the title which i define in getTitle() method.
So, I don't know why content is empty and my View class isn't used.
Thanks for response.
__________________
LC 1.0.14
Reply With Quote
  #4  
Old 07-24-2014, 12:02 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: X-Cart 5: Target and View.

Hello!

Just to confirm: is it the XC5 question, or is it the "LiteCommerce 3 core v1.0.14" question?

Anyway, in most cases LC3/XC5 controllers do not decide what view is to be shown to the visitor. They just perform requested actions and prepare some data if asked by the view.

The default view renders the page layout and displays other views (widgets) added themselves to the "center" view list.

For example, check the XLite\View\AccessDenied widget that adds itself to the "center" view (see the @ListChild (list="center") directive) and appears for the "access_denied" target.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #5  
Old 07-24-2014, 05:12 AM
 
Dewiar Dewiar is offline
 

Newbie
  
Join Date: Jan 2012
Posts: 3
 

Default Re: X-Cart 5: Target and View.

Yes it's XC5.
I already have @ListChild directive. Maybe there is another issue. Take a look at my View please:
Quote:
<?php
// vim: set ts=4 sw=4 sts=4 et:
namespace XLite\Module\Bob\Bbb\View;

/**
* Bbb widget for Bbb target.
* @ListChild (list="center", zone="customer")
*/
class Bbb extends \XLite\View\AView
{
public static function getAllowedTargets() {
return array_merge( parent::getAllowedTargets(), array ( 'bbb' ) );
}

protected function getDefaultTemplate() {
return 'modules/Bob/Bbb/ccc/body.tpl';
}
}
__________________
LC 1.0.14
Reply With Quote
  #6  
Old 07-29-2014, 06:23 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

Default Re: X-Cart 5: Target and View.

Hi Dweiar!

What you are trying to achieve is described in this article:
http://kb.x-cart.com/display/XDD/Webinar+1+-+18+Mar+2014+-+developing+modules+for+X-Cart+5#Webinar1-18Mar2...ewsdetailspage

Please check this out and let me know if there are any additional questions.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 08:55 PM.

   

 
X-Cart forums © 2001-2020