Jump to content

how to change category_shop.position by script?


IgnacioSM

Recommended Posts

Hello,

 

I'm trying to receive the position of the categories by another software, and then, I have to update the category position, or insert the category.

 

 

how could I insert a category in a position and increment the position of the others if there are some duplicate positions? 

 

 

Ex: I want to insert a new category in position 3, and mofify th$cat = new Category($idClasificacionOnline);

 

 

Code:

$cat-id_parent = $idClasFather;

Category::cleanPositions($idClasFather);

$cat->addPosition(3, $idShop);

 

It eliminates all the duplicates, but it left a category with position 3(obviously) and then, it inserts the new category with position 3. Finally, the result is that there are two categories with position 3.

 

Any idea?

Edited by IgnacioSM (see edit history)
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...