Jump to content

Tags block by Prestashop not working


Diana Hansen

Recommended Posts

Hello everyone,

 

Last night, my Prestashop software was upgraded automatically from 1.6.1.15 to 1.6.1.17.

 

Now, the Tags block v. 1.3.1 is not working.

 

I disabled it, uninstalled it, reinstalled it but it's still not working.

 

I checked my tags list in BO, it OK.

I checked my catalog and all products have the tags like before.

 

On my website, I can see that the Tags block is positioned correctly but only an empty tag shows. I have it configured to show 30 tags randomly.

 

I appreciate the help in advance.

 

 

Link to comment
Share on other sites

You can enable the error log first to check if there is any error.

 

To enable error log you can perform following steps:

 

1. config -> defines.inc.php  (From FTP or hosting control panel).

2. define('_PS_MODE_DEV_', false); change this line with: define('_PS_MODE_DEV_', true);

  • Like 1
Link to comment
Share on other sites

Yes I see. Tags are there, but reserved in a small box. Hm...  never seen this problem before. It could be an upgrade problem on a broken database table. In this case take a look with phpMyAdmin if the table ps_tag is empty. If not, than ask your provider to repair database, or search for broken indexes. Normally when you deinstall and install module, than the table repairs by itself, but in some case it could remain broken.

 

If this not solve the problem, than only a rollback will do it. Or you export the data from a database backup made separately and import the data with phpMyAdmin to the table ps_tag again. The same, if the table is now empty. Only an older backup can clean it.

  • Like 1
Link to comment
Share on other sites

Hi Selectshop.at

 

Thanks for your last message.

 

I used the link you sent me to optimize and repair the table in phpMyAdmin. I was not authorized to repair the table but I contacted my hosting provider and they checked the database for any corrupted table or index. They said everything is fine.

 

I then found in another thread some information that I thought was useful, regarding the smarty caché. I uninstalled Tags block module again, erase cache/smarty/cache/blocktags folder content, reinstalled the module ....still the same problem.  :(

 

My tags list is not long. I only have 28 tags. Do you think I should erase the contents and build it again? 

Link to comment
Share on other sites

The delete of cache I didn't wrote before, because if you deinstall the module, the cache will cleared automatically ;) .

You checked the database table, if there is any content on it ? If not, so the table corrupted during Prestashop upgrade process. Empty table, surely cannot delivery data (so if data not in table, so no date to be shown). If it is empty you can transfer the table of older back-up (ask your provider, I'm sure you will not have rights for this too). It's not your fault that upgrade is made automatically

 

Or add the tags again.

 

Another possibility is to make rollback and upgrade again, hoping that this time it would be done in 100%.

 

AND most important thing: disable the automatic upgrade of Prestashop. This is not good, if you use extras (modules, theme), or made changes on code or own adaptations on mail templates for ex.

Link to comment
Share on other sites

Hi Selectshop.at,

 

Thanks for your message. Yes, I checked the database table and it contains all the information correctly. 

 

I guess the only option left is to do a rollback...I am worried that it will cause problems and make the whole website inaccessible to my customers but I will do it and let you know the result. 

 

Thank you very much for your help.  :)

Link to comment
Share on other sites

Before you make an rollback please back-up your database and FTP MANUALLY TO YOUR LOCAL MACHINE to your local machine. If rollback also fails, than you can restore your shop quickly without any troubles.

 

Export database (gzip or zip) with phpMyAdmin - tutorials you will find on Google

Download our FTP with Filezilla to your PC.

  • Like 1
Link to comment
Share on other sites

it seems to me that the blocktags module just needs to be properly debugged.  the blocktag module v1.3.1 didn't change with PS v1.6.1.17, so the same version is used.

 

The module uses this code to obtain the tags from the database

Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR')));

So first 2 things to debug are

1) What is the valid of the id_lang in the cookie

2) What is the value of the configuration "BLOCKTAGS_NBR"

 

Once we understand what those values are, then we look at the select query that is pulling the data Tag::getMainTags

    public static function getMainTags($id_lang, $nb = 10)
    {
        $context = Context::getContext();
        if (Group::isFeatureActive()) {
            $groups = FrontController::getCurrentCustomerGroups();
            return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
            SELECT t.name, counter AS times
            FROM `'._DB_PREFIX_.'tag_count` pt
            LEFT JOIN `'._DB_PREFIX_.'tag` t ON (t.id_tag = pt.id_tag)
            WHERE pt.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').'
            AND pt.`id_lang` = '.(int)$id_lang.' AND pt.`id_shop` = '.(int)$context->shop->id.'
            ORDER BY times DESC
            LIMIT '.(int)$nb);
        } else {
            return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
            SELECT t.name, counter AS times
            FROM `'._DB_PREFIX_.'tag_count` pt
            LEFT JOIN `'._DB_PREFIX_.'tag` t ON (t.id_tag = pt.id_tag)
            WHERE pt.id_group = 0 AND pt.`id_lang` = '.(int)$id_lang.' AND pt.`id_shop` = '.(int)$context->shop->id.'
            ORDER BY times DESC
            LIMIT '.(int)$nb);
        }
    }

In this code, we can see that the tags module takes 2 paths.

1) Does the store have the customer group feature active?

2) Group feature is not active

 

So the next things are to verify the data in the following tables

1) ps_tag_count

2) ps_tag
 

Both tables need to have the right data for each tag based on the following

1) id_group

2) id_lang

3) id_shop

 

That should be enough information to determine if the data is corrupt.  This has nothing to do with broken tables or a broken mysql instance, it just means that the data in the tables need to exist properly, and that perhaps it no longer does. 

 

 

If you want to export the data from both tables and attach to this topic, I could review it and see.

Link to comment
Share on other sites

Hi Bellini,

 

Thank you very much for your message.

 

It is definitely strange that the Tags Block module stopped working after upgrading Prestashop and when I uninstalled it and reinstalled it, I get the message by Prestashop asking if I am sure I want to install the module since Prestashop doesn't know it. 

 

I am very happy to include the two tables you mention but I was not allowed to upload them. I tried csv and sql formats.

 

Edited:

I decided to try Word format but I was not allowed to upload them either

Edited by Diana EFB (see edit history)
Link to comment
Share on other sites

"FTP MANUALLY TO YOUR LOCAL MACHINE to your local machine". 

 

Would you be so kind and explain it to me? 

 

Thank you for your help.

Simply download all from your FTP to your local machine with filezilla, by the same way when you install Prestashop manually on a server, but in opposite case than. Instead to upload from your PC the unzipped package, you DOWNLOAD all to your machine in a new folder you created before.

 

Tutorial: https://secure.hitdirector.com/knowledgebase/157/FileZilla---How-to-download-files-with-filezilla.html

 

For the Tip of bellini: if you don't have permissions to do anything on your database, like as repair tables or sync one table with another, than you will also fail to use this tip, as you dont' have enough permissions as database user for that. In this case only your provider can repair the database for your. Normally the tip also will apply when you refresh the module or deinstall it and reinstall again, cause code was not changed. Broken data, broken index or at least database tables means that something got wrong during upgrade in this case. Perhaps there are more of broken things you didn't yet noticed, in this case better to make a rollback to the time on which all was correctly working.

Link to comment
Share on other sites

Hi Bellini,

 

Thank you very much for your message.

 

It is definitely strange that the Tags Block module stopped working after upgrading Prestashop and when I uninstalled it and reinstalled it, I get the message by Prestashop asking if I am sure I want to install the module since Prestashop doesn't know it. 

 

I am very happy to include the two tables you mention but I was not allowed to upload them. I tried csv and sql formats.

 

Edited:

I decided to try Word format but I was not allowed to upload them either

Try to zip the .sql file first before uploading them.  If you want, you can visit my website, and use the contact us page to send me the zip'ed sql file

Link to comment
Share on other sites

Ok file received.

 

So here is the content of your ps_tag table, things here look fine

INSERT INTO `ps_tag` (`id_tag`, `id_lang`, `name`) VALUES
(191, 1, 'wedding flowers'),
(192, 1, 'white flowers'),
(203, 1, 'jumbo hydrangeas'),
(231, 1, 'blue hydrangeas'),
(274, 1, 'green hydrangeas'),
(275, 1, 'bright colors'),
(384, 1, 'pink flowers'),
(386, 1, 'green flowers'),
(412, 1, 'pastel colors'),
(438, 1, 'purple flowers'),
(488, 1, 'bicolor flowers'),
(503, 1, 'orange roses'),
(517, 1, 'yellow roses'),
(535, 1, 'red roses'),
(572, 1, 'green roses'),
(573, 1, 'light pink flowers'),
(574, 1, 'GalleryImage1'),
(575, 1, 'GalleryImage2'),
(576, 1, 'GalleryImage3'),
(584, 1, 'lavender flowers'),
(599, 1, 'TopImage1'),
(606, 1, 'TopImage2'),
(609, 1, 'mini hydrangeas'),
(610, 1, 'antique hydrangeas');

Here is the content of the ps_tag_count table.  The good thing is that all of the tags in the tag table, also exist in the tag_count table. 

However as I was explaining in my previous post, we must consider the Customer Group, Language and Shop

 

1) In the tag count table, you have the value 0 for id_group.  This means you have Customer Groups disabled in your store.  Is this true and intended?

2) The id_lang value is 1.  Do you have more than 1 language in your store?

3) The value of id_shop is 5.  Are you using Multistore, and do you have 5 or more stores?  If not, then this is certainly an issue.

INSERT INTO `ps_tag_count` (`id_group`, `id_tag`, `id_lang`, `id_shop`, `counter`) VALUES
(0, 191, 1, 5, 67),
(0, 192, 1, 5, 8),
(0, 203, 1, 5, 3),
(0, 231, 1, 5, 3),
(0, 274, 1, 5, 3),
(0, 275, 1, 5, 26),
(0, 381, 1, 1, 1),
(0, 384, 1, 5, 16),
(0, 386, 1, 5, 6),
(0, 412, 1, 5, 11),
(0, 438, 1, 5, 7),
(0, 488, 1, 5, 18),
(0, 503, 1, 5, 13),
(0, 517, 1, 5, 6),
(0, 535, 1, 5, 4),
(0, 572, 1, 5, 3),
(0, 573, 1, 5, 5),
(0, 574, 1, 5, 8),
(0, 575, 1, 5, 6),
(0, 576, 1, 5, 3),
(0, 584, 1, 5, 7),
(0, 599, 1, 5, 6),
(0, 606, 1, 5, 3),
(0, 609, 1, 5, 1),
(0, 610, 1, 5, 1);

 

Link to comment
Share on other sites

Hi, Bellini,

 

No, I do not have customer groups disabled. At least, I have not disabled it because I have created one additional customer group.

I only use English on any of my shops and, even I use Multistore, I only have 2 shops. Certainly not 5.

 

What should I do?

 

 

Edited:

I checked Multistore:

 

I have 2 shop groups:

shop group id: 1 is the Default

shop group id: 3 I call Wholesale

 

But when I look at the shops: Default Shop has id 1 and the Wholesale shop has id 5. 

Edited by Diana EFB (see edit history)
Link to comment
Share on other sites

Hello, Selectshop and Bellini,

 

I rolled back to Prestashop 1.6.1.15 with a backup. 

 

It didn't help at all with the Tags block. I am totally confused but I am ready to give up, just uninstall the module and forget about it. 

 

Anyway, thank you for trying to help me solve the problem.

Link to comment
Share on other sites

Strange, it must be something on your server. Rollback should work, if it worked before.

 

 

Deinstall module, Install again, and add the tags (new) again to your products. If this also not work, so surely some setting of your server is causing the problem. Debug mode activated we already had ? Sorry but I don't remember all topics I'm helping... Yeah was in post #2 and gave also no result... Strange thing. Best is to add all the tags again as new data.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...