Extend class and not substitute pages but add new

I need to make product list pages with practically no design (for export purposes) in addition to existing product list pages. So far I managed only to alter the designs of existing pages. But I need both existing product list pages and my alternative list pages to work (with different urls, obviously). How can I achieve this? Tutorials aren’t clear about how to create totally new pages using existing classes.
Any advice would be really appreciated!

for Export?

Why not have atry with the RSS?

I need more data than standard RSS shows and I have to preserve everything, even RSS feeds, exactly as it currently is.

To answer your question: you have to look in the /views folder

You can copy and paste/rename the file “alist.php” rename the class allso to lets say: “whatever”

Now you can reach this Site with “www.yourshop.com?cl=whatever

with “www.yourshop.com?cl=whatever&cnid={CATEGORYOXID}” you will get the aproriate category list.

To sum it up:

  • Files in the /views folder are new Pages.
  • They need to contain classes which extends oxUBase
  • You can reach them by addin the URL Parameter: cl={classname}
  • At least this class needs one function render() which calls
parent::render()

and returns the path to a Template(starting from /out/{template}/tpl/).

Regards

Rafael

Don’t need a new class.

Just try:


alternativeTemplate4aList extends alternativeTemplate4aList_parent{
  public function render(){
    $sParent=parent::render();
    return 'true' == oxConfig::getParameter( 'altTemplate' )?'myListingTemplate.tpl':$sParent;
  }
}


alist=>alternativeTemplate4aList

… and you need a new List-Template ‘myListingTemplate.tpl’.

Normal Url:
example.com/path/to/category/

With alternative Template
example.com/path/to/category/?altTemplate=true

[QUOTE=MBa;73490]Don’t need a new class.

Just try:


alternativeTemplate4aList extends alternativeTemplate4aList_parent{
  public function render(){
    $sParent=parent::render();
    return 'true' == oxConfig::getParameter( 'altTemplate' )?'myListingTemplate.tpl':$sParent;
  }
}


alist=>alternativeTemplate4aList

… and you need a new List-Template ‘myListingTemplate.tpl’.

Normal Url:
example.com/path/to/category/

With alternative Template
example.com/path/to/category/?altTemplate=true[/QUOTE]

Actually this is already implemented: ?tpl={path to template}
ie.: www.shop.com/Category?tpl=myListingTemplate.tpl

But he wanted to

… Tutorials aren’t clear about how to create totally new pages using existing classes…

Regards

Rafael
[

Works OK, but how do I get a list of all products in the whole shop on one page?


$allProducts = oxNew("oxarticlelist");
$allProducts->loadPriceArticles(0, 9999);

if you do not hav a product with a price higher than 9999{$currency}

Alternatively you extend oxarticlelist with a function with gives you all products via a databasequery.

Regards

Rafael

The Databasequery should look like this to get all products:


public function getAllArticles()
{
  $sArticleTable = getViewName('oxarticles');
  $oBaseObject = $this->getBaseObject();
  $sFieldNames = $oBaseObject->getSelectFields();
  $sSelect  = "select $sFieldNames from $sArticleTable ";
  $sSelect .= "WHERE " . $oBaseObject->getSqlActiveSnippet() . " and $sArticleTable.oxparentid = ''  "; //only active and no variants

  if ( $this->_sCustomSorting ) {
    $sSelect .= " ORDER BY {$this->_sCustomSorting} ";
  }
	 
  $this->selectString( $sSelect);
  return $this->count();
}
		 

Regards

Rafael

Thanks a lot!

maybe this one helps?

[QUOTE=Rafael Dabrowski;73594]The Databasequery should look like this to get all products:


public function getAllArticles()
{
  $sArticleTable = getViewName('oxarticles');
  $oBaseObject = $this->getBaseObject();
  $sFieldNames = $oBaseObject->getSelectFields();
  $sSelect  = "select $sFieldNames from $sArticleTable ";
  $sSelect .= "WHERE " . $oBaseObject->getSqlActiveSnippet() . " and $sArticleTable.oxparentid = ''  "; //only active and no variants

  if ( $this->_sCustomSorting ) {
    $sSelect .= " ORDER BY {$this->_sCustomSorting} ";
  }
	 
  $this->selectString( $sSelect);
  return $this->count();
}
		 

Regards

Rafael[/QUOTE]
OK, I can insert this getAllArticles() procedure into a template.
But, again, how to create totally new URL for this kind of output?

[QUOTE=Rafael Dabrowski;73488]To answer your question: you have to look in the /views folder

You can copy and paste/rename the file “alist.php” rename the class allso to lets say: “whatever”

Now you can reach this Site with “www.yourshop.com?cl=whatever

with “www.yourshop.com?cl=whatever&cnid={CATEGORYOXID}” you will get the aproriate category list.

To sum it up:

  • Files in the /views folder are new Pages.
  • They need to contain classes which extends oxUBase
  • You can reach them by addin the URL Parameter: cl={classname}
  • At least this class needs one function render() which calls
parent::render()

and returns the path to a Template(starting from /out/{template}/tpl/).

Regards

Rafael[/QUOTE]

This is the totaly new URL … or am i wrong ?

or du you mean a seo url like www.shop.de/all-products ?

regards

Rafael

This keeps redirecting me to home page.

if you got some errorrs in you code it is no wonder :wink: can you please provide your code ?

regards

Rafael