X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   X-Cart 5: Target and View. (https://forum.x-cart.com/showthread.php?t=69648)

Dewiar 07-23-2014 02:01 AM

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.

tony_sologubov 07-23-2014 06:44 AM

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.

Dewiar 07-23-2014 07:14 AM

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.

qualiteam 07-24-2014 12:02 AM

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.

Dewiar 07-24-2014 05:12 AM

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';
}
}


tony_sologubov 07-29-2014 06:23 AM

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.


All times are GMT -8. The time now is 06:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.