Tag Archives: prestashop

No Products Displaying under Manufacturers in Prestashop 1.5

This issue might help someone out there that had the same problem as I did when upgrading a shop from an older version of Prestashop.

I upgraded from 1.3.x to 1.5.x using the manual upgrade whereby I copied all images across and migrated the database etc. When I performed the upgrade to 1.5 all looked well until I clicked on manufacturers and no products where showing.  The message I kept getting was:

“No products for this manufacturer.”

From the back office all products were associated with the correct manufacturer so it seemed to be a front end issue.

After tearing my hair out and comparing the database tables with a sample prestashop install I started trying all sorts of settings at the back office. In the end it turned out to be a simple filter issue.

I went into preferences->products and scrolled down to the pagination section and changed the filter from manufacturers to product name and it worked a charm.

filter

Essentially what seemed to be happening is when manufacturer was clicked the default pagination was set to manufacturer and this was causing a filter issue.  Changing it to product name solved that issue and now the products display when manufacturer items are clicked.

ftp unzip

Here’s a little trick for web masters out there who upload and extract wordpress, prestashop, joomla or any other open source products with loads of fiddly little files that normally take an age to upload via ftp.

The usual case is you extract the zip locally and upload the few thousand files via FTP and even with a nice wide broadband pipe it can take time to upload each file individually. A better solution would be to upload the zip file via ftp and then log in to your server using ssh or whatever to extract the file, but sometimes it can be a pain on shared hosting to set up ssh and then go through setting up logins etc. or maybe you don’t have that option at all.

Here’s an alternative that might save a few minutes. Look, I’m lazy OK!

What I do is run a little script on the server that calls a method on the ZipArchive class.

The example below extracts the prestashop zip file to the same directory that the archive is in.

<?php
//new zip archive object
$zipArchive = new ZipArchive;

//file to unzip in same directory as this script
$fileToUnzip = "prestashop_1.5.3.1.zip";

//retrieve current path from the zip
$unzipPath = pathinfo(realpath($fileToUnzip), PATHINFO_DIRNAME);

//open and extract the zip file
if ($zipArchive->open($fileToUnzip) === TRUE) 
{
    echo "Unzipping $file to $unzipPath...<br/>";
    $zipArchive->extractTo($unzipPath);
    $zipArchive->close();
    echo "Hey presta!!!";
} 
else 
{
    echo "Cannot open $fileToUnzip... Doh!";
}
?>

If the zip file extracts to a subfolder it will only take seconds to copy the files back to the root directory, if that’s what is required.

Might be handy for someone.

Prestashop – No Search Results

So you’ve built your amazing prestashop and you’ve imported hundreds of products into the system but alas, when you peform a search, nothing is returned even though you know you’ve entered text present in one of your products.

This one had me stumped for a bit as I assumed that the data would be stored within the system or that prestashop would do some dynamic search on the database records. It turns out prestashop is a little more sophisticated than that and actually indexes all the products in the site to make search results quicker.

To ensure all of your products are indexed go to your backend, click on preferences and then search.

Once in there you will see how many products have been indexed. If you had the same problem as me you will see that 0 products have been indexed. This is because I imported products from a CSV. Manually inserted products are automatically indexed.

Once you are in backoffice->preferences->search you will see something like

Indexed products: 44 / 44.
-> Add missing products to index.
-> Re-build entire index.

You can click either option to re-index your products. Once you don’t have thousands of entries it should take < 1 min to do. You can also set up a cron job to perform this indexing regularly for you. Other options on this screen inclued

  • Ajax search: To automatically fill in your search box, like google
  • Minimum word length
  • Blacklisted words

There are also options here to weight your search results using various factors such as weight, tags etc.