[{if $oView->getNewestArticles() }]
[{assign var=‘rsslinks’ value=$oView->getRssLinks() }]
[{include file=“widget/product/list.tpl” type=“product_new” head=“PAGE_SHOP_START_JUSTARRIVED”|oxmultilangassign listId=“newItems” products=$oView->getNewestArticles() rsslink=$rsslinks.newestArticles rssId=“rssNewestProducts” showMainLink=true}]
[{/if}]
this code is there in the new-products.tpl file to display the latest products from the articles table. I am new to oxid and i can’t understand this code. what does this $oView->getNewestArticles() mean. where is $oView file. getNewestArticles() is written in application/controllers/start.php file.
can anyone please explain this code and how we assign $oView->getNewestArticles() this function and where.
OXID makes use of MVC design pattern. Have a look into application/ folder in shop root directory:
views/ contains smarty templates,
controllers/ contains all the controllers for every page, like start, contact, details, search
models/ contains all the data models like articles, actions, orders.
Templates are basically your views and $oView always refers to the controller, in this case “start.php”, which is the controller for start page.
You can use source code documentation when searching for functions.
http://docu.oxid-esales.com/CE/sourcecodedocumentation/
just pick your shop version and type function name (e.g. “getNewestArticles” ) into the search bar. If there is such a function, it will show you all classes with this method/function. So you do not need to manually search in shop files.
Thank you for the information. In the front end under the new products, new products were displayed using the same code that I have mentioned in the new-product.tpl file . the code is
[{if $oView->getNewestArticles() }]
[{assign var=‘rsslinks’ value=$oView->getRssLinks() }]
[{include file=“widget/product/list.tpl” type=“product_new” head=“PAGE_SHOP_START_JUSTARRIVED”|oxmultilangassi gn listId=“newItems” products=$oView->getNewestArticles() rsslink=$rsslinks.newestArticles rssId=“rssNewestProducts” showMainLink=true}]
[{/if}]
But now no products are displayed under the tab new products. the same code is used but i have changed one field in oxcategories table. Please explain why it is so and what to do next.
Are you familiar with OOP, @reshmiarm? Not all classes are loaded in all views in order to safe resources. What works in one view, doesn’t necessarily has to work in the other one. In doubt you have to write an own getter for your specific view.
Cheers