Prestashop 1.5.6.2 shows wrong products in the category (FrontOffice) -


i'm using prestashop 1.5.6 , make bulk category , product operation mysql via 3rd party libraries (which wrote). fine till of products show in wrong category. eg have product in category; when go b category product there. think wrong ps_category_product table position column. i'm updating table code below;

$sqlfirst = 'select id_product, id_category_default, xml_id_product ps_shop_product'; $queryfirst = $db->prepare($sqlfirst); $queryfirst->execute(); while ($rowfirst = $queryfirst->fetch(pdo::fetch_obj)){      $sqlproductaddcatposfirst = '         insert ps_shop_category_product         (id_product, id_category, position)         values          (?, ?, ?)         ';     // ps_shop_category_product sql sorgumuzu hazırlayalım     $queryproductaddcatposfirst = $db->prepare($sqlproductaddcatposfirst);     $queryproductaddcatposfirst->bindparam(1, $rowfirst->id_product, pdo::param_int);     $queryproductaddcatposfirst->bindparam(2, $rowfirst->id_category_default, pdo::param_int);     $queryproductaddcatposfirst->bindparam(3, $rowfirst->id_product, pdo::param_int);     // ps_shop_category_product hazır sql sorgumuzu çalıştıralım     $queryproductaddcatposfirst->execute(); } 

but fine on backoffice > products > filter category tab. shows correct products under category. there specific detail in front office? if truncate table (ps_category_product), products dont shown in categories in front office. missing?

any appricated.

update

after @bcsteeve s comment, create sample category backoffice , products shown in correct categories. when @ changes on mysql tables; ps_category table has changed values nleft , nright columns.

in simple webservice, assign nleft , nright 0 (zero). have values different 0 (zero).

now think problem recalculating hierarchy of ps_category table.

is there specific prestashop core controller and/or method can recalculate nleft , nright values on ps_category table? because dont want add category manually after webservice update products , categories.

thanks in advance!

you can regenerate nleft , nright columns of ps_category table following code:

require_once '../config/config.inc.php';  try {   category::regenerateentirentree(); } catch (categoryexception $e) {   echo $e->getmessage(); } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -