Jump to content
Sign in to follow this  
vidmarc

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:

Find:

//=====[ 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

The only way I can get this to work (simply) is to add a new top category called "Store", and then add each product menu item as a sub-category of "Store". Unless there's any other way of doing this since I was last here?

Here are the menu items/categories I have so far. https://www.mondo-macabro.com/

 

Share this post


Link to post
Share on other sites

If I add all theese categories as a sub category of "Store", they are no longer displayed as main menu items and instead are "Store" sub-menu items. Is there a way around this?

Share this post


Link to post
Share on other sites
Posted (edited)
On 8/14/2018 at 2:40 PM, bsmither said:

Try:
/search.html?search[keywords]=*&_a=category 

This seems like a good option - but can I modify the link to list only in-stock items from all categories?

Edited by vidmarc

Share this post


Link to post
Share on other sites

By asking this question, we can assume you choose to show out-of-stock items everywhere else? Otherwise, in admin, Store Settings, Stock tab, set the "Hide out-of-stock product" setting to checked. (To verify its operation, log out of admin, or use a different browser.)

Share this post


Link to post
Share on other sites
Posted (edited)

I need to list out of stock / out of print items in a different menu, so I will need a custom search term for this.

Edited by vidmarc

Share this post


Link to post
Share on other sites
Posted (edited)

If the above URL worked for you, try this:

/search.html?search[keywords]=*&_a=category&inStock=1

Maybe not. Checking...

Edited by bsmither

Share this post


Link to post
Share on other sites
Posted (edited)

There is a bug in CC624 that is thwarting my attempts to create a URL that will show only in-stock items.

/search.html?search[keywords]=*&_a=category&search[inStock]=1

The above is the URL I am working with.

Edited by bsmither

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks for your help with this - I'm sure it is possible, somehow...

It must be possible to generate a valid search query via the advanced search form:

/search.html

It has an "in stock" option. But I can't find the best way to list all items. The asterisk doesn't work.

Perhaps the advanced search form needs expanding to allow more search terms, for example a wild card and "category".

Edited by vidmarc

Share this post


Link to post
Share on other sites

The asterisk is meant to cause the search to "find" all items using an RLIKE syntax. Still working on what it may take to avoid pagination.

Share this post


Link to post
Share on other sites

I would also really like to have my store showing "View All Products" and pagination 1,2,3 
so if this thread turns out to a plugin please let me know :)

Share this post


Link to post
Share on other sites

Depending on your skin, there may be a All link at the end of pagination.

The URL we are experimenting with, where one can place this link on any other site or any other location in your store, would be:

search.html?search[keywords]=*&_a=category&page=all

Hopefully, you have a sane amount of products to be showing all of them at one time. (I think there may be a limit in the code for 100 items.) Or your hosting site has given you a dedicated server and database.

Share this post


Link to post
Share on other sites
Posted (edited)

Hopefully there would be a way of adding "Your search produced XXX results" :)

Edited by vidmarc

Share this post


Link to post
Share on other sites

Try this:

In the template content.category.php, find:

<h2>{$category.cat_name}</h2>

Change to:

{if $VAL_SELF|strpos:'search.html'}<h2>Your search produced {$TOTAL_RESULTS} results...</h2>{/if}
<h2>{$category.cat_name}</h2>

Share this post


Link to post
Share on other sites

Ws wondering if anybody had found a way of hiding out of stock/sold out products, except in a separate "archive" section?

Share this post


Link to post
Share on other sites
Posted (edited)

Now I'm more confused :)

Will this hide OOP items from the main search, yet still allow them to be displayed in the "archive" section of our site?

Edited by vidmarc

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.

Guest
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.

Sign in to follow this  

×
×
  • Create New...