Jump to content

List ALL products link - is this possible?

Recommended Posts

I've been asked to add a link that will list every product on the site, descending from date added. Is this possible

Share this post

Link to post
Share on other sites

My first thought would be to create a sitemap, then add a Document with an external target which points to the sitemap.


Share this post

Link to post
Share on other sites

Thanks, that seems to work.

Now if only I could get "Your Search Returned X amount of Products"...

Share this post

Link to post
Share on other sites

Initially, we are at /classes/cubecart.class.php, in the private function _category() where the call to search the catalogue is made. This statement:

$GLOBALS['catalogue']->setCategory('cat_name', sprintf($GLOBALS['language']->catalogue['notify_product_search'], $_REQUEST['search']['keywords']));

gives us the Products found matching 'words' phrase.

We can execute a similar statement immediately after the above with what we want to display.

Immediately after that statement, add:

$GLOBALS['catalogue']->setCategory('cat_name', "Your Search Returned ".$Catalogue->_category_count." Products.");

But here is another problem-- this '_category_count' property of Catalogue is private. Catalogue includes this value as a parameter when making calls to other places, but other places cannot ask Catalogue for this value. Not without a specific function of Catalogue to answer such requests. (Note: there is the Category public function getCategoryData(), but this function first loads '_category_data' with fresh data from the database category table. This is not what we want. This function should maybe actually be called loadCategoryData().)

We will need to use a function of Catalogue, while we are in Catalogue, to incorporate the '_category_count' into a variable that we can later ask for outside Catalogue.

In the Catalogue class file, public function searchCatalogue(), starting at the bottom of the function, look for:

$this->_category_count  = (int)count($count);

There will be three instances of this statement. On a new blank line after each occurance, add:

$this->setCategory('category_count', $this->_category_count);

Next, we now need the function to allow an outside place to ask for this value.

In the Catalogue class file:


//=====[ Private ]=======================================

On a new blank line just ABOVE it, add:

	 * Get category property
	 * @param string $id
	 * @return mixed
	public function getCategory($id) {
		return $this->_categoryData[$id];

Finally, we now have a good statement to add in the CubeCart class file -- the first edit made:

$GLOBALS['catalogue']->setCategory('cat_name', "Your Search Returned ".$GLOBALS['catalogue']->getCategory('category_count')." Products.");


Share this post

Link to post
Share on other sites

Would a plugin be able to do this?

Or perhaps make it an option in future versions of Cubecart?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...