Jump to content

Some product features are not displayed on the frontend


Recommended Posts

I have a problem with my store after upgrading from 1.6.0.11 to 1.6.0.14. The problem is that some of the features are not displayed on the frontend but in the backend i can see, edit and save them.

I believed that this was a database but i checked the tables and those look ok to me.

 

Did anyone encountered this problem? Do you have any suggestion for this?

 

Frontend : http://i.imgur.com/RfR2VPm.png

Backend: http://i.imgur.com/YhRIdGa.png

Site: http://shop.energiaitalia.info/it/lampadine-led/366-led-lampadina-5w-45-smd3014-bianco-neutro.html

Link to comment
Share on other sites

Front Office and Back Office screen shots are for different products. I believe only filled features are shown on the product page.

 

Yes they are, the screenshots are taken from the same product. There are filled features, as you can see in the screenshot, that don't appear on the frontend.

Any other advice please?

Link to comment
Share on other sites

Odd, since you have other languages, do they appear if you switch them? Did you ever modify the template, somehow? Checkout product.tpl, {foreach from="$features... , see if there is any condition that sets a few of them to be visible only

  • Like 1
Link to comment
Share on other sites

Odd, since you have other languages, do they appear if you switch them? Did you ever modify the template, somehow? Checkout product.tpl, {foreach from="$features... , see if there is any condition that sets a few of them to be visible only

 

Thanks for your reply Nemo,

No, it's the same thing if i change the language.

The theme wasn't changed and product.tpl is unchanged, it doesn't have any feature limit condition.

I noticed that if i add some products to compare it displays all the feature titles but not the value too for each one.

Do you have any other ideas?

Thanks alot

Link to comment
Share on other sites

Odd. At this point, it's worth investigating the product class. First off, are you using any override?

If not, open classes/product.php and located the getFrontFeatures method. Try to debug that

 

The shop doesn't have any override.

I've made a test with that function and it looks that it doesn't take the information correctly/entirely from the database. I think there's a problem with the function or more probably with the database because i've made an update recently.

 

Database tables:

ps_feature - http://i.imgur.com/Mt7eKgP.png

ps_feature_lang - http://i.imgur.com/H8lGWCD.png

ps_feature_product - http://i.imgur.com/LGZ1cEq.png

ps_feature_shop - http://i.imgur.com/vx8ZiMN.png

ps_feature_value - http://i.imgur.com/HPTwESO.png

ps_feature_value_lang - http://i.imgur.com/Lf3DLzn.png

public static function getFrontFeaturesStatic($id_lang, $id_product)
    {
        if (!Feature::isFeatureActive())
            return array();
        if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
        {
            self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
                SELECT name, value, pf.id_feature
                FROM '._DB_PREFIX_.'feature_product pf
                LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
                LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
                LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
                '.Shop::addSqlAssociation('feature', 'f').'
                WHERE pf.id_product = '.(int)$id_product.'
                ORDER BY f.position ASC'
            );
        }
        return self::$_frontFeaturesCache[$id_product.'-'.$id_lang];
    }

    public function getFrontFeatures($id_lang)
    {
        return Product::getFrontFeaturesStatic($id_lang, $this->id);
    }
Edited by iDan (see edit history)
Link to comment
Share on other sites

Which version did you upgrade from? CHeck that the features exists in the _shop table

 

It was an upgrade from 1.6.0.11 to 1.6.0.14.

I checked the ps_feature_shop and found the problem. The features were assigned to unexisting shop ids so i changed all of them to 1.

Thanks Nemo, you are awesome!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Thank you, guys, this saved my day! Although I don´t understand why and how this happened. In my case one feature was completely missing in the ps_feature_shop table. Was looking for hours, did not assume the solution could be in the database ...

Link to comment
Share on other sites

×
×
  • Create New...