Jump to content

Problem with state in ps_product


lifeform

Recommended Posts

hello,

i found in sql filter in product list prestashop that "state = 1" what it used for?

i also found that the id product is jumping, it will looks like 1202, create another product and the id will be 1204 the 1203 will be disappeared. but in the database i found that the id 1203 state = 0

can someone explain what going on? it not happened in 1.6.x

 

i use 1.7.5.0 right now...

 

sorry for my bad english. and thanks for replying

Link to comment
Share on other sites

State means "new" vs "second hand".

As for your id's: I don't know. I have one shop that skips one number too each time. It does that for all auto-increase table fields. According to the hosting provider it has something to do with the setup of their database server and its backup.

Link to comment
Share on other sites

@musicmaster the BO of product list query used state = 1, so if the state = 1 is new and state =0 is used item, the product list never show the used item in the list. and you never edit them with backoffice editor. right?

 

i download fresh install 1.7.5.0 and 1.7.5.1, i install in local server and trying the prestashop add product. the 1.7.5.0 have bug to make the id jumping. and left state = 0 to product that not listed (as i said state = 0) is not show in the product list

after trying 1.7.5.1 i trying, the problem is gone. so i might must upgrade it to 1.7.5.1 (latest trying failed) to vanish the bug.

 

for state. i still do not get it why state = 1 must be hardcoded in query... i hope someone can gave some explanation about this

Link to comment
Share on other sites

I had a better look and I see that I was mistaken. State is new for Prestashop 1.7. It is Condition that stands for old or new.

It would be easier to help you if you told us what you know instead of the absolute minimum. Instead of " the BO of product list query used state = 1" you could have shown the whole query and told us exactly where you found it.

The changelog for prestashop 1.7.5.1 is here: https://assets.prestashop2.com/en/system/files/ps_releases/changelog_1.7.5.1.txt

Link to comment
Share on other sites

  • 2 months later...
On 3/5/2019 at 12:26 AM, lifeform said:

i found in sql filter in product list prestashop that "state = 1" what it used for?

State = 0 -> means Temporary
State = 1 -> means Saved

https://github.com/prestaShop/PrestaShop/blob/develop/classes/Product.php#L313

When we hit "Add new product" PS creates a new record on DB (table product) with State = 0 (Temporary) and when we finally hit "Save" it change State to 1 (Saved).

BO doesn't list this (State = 0) in any way.

I only discovery this "problem" because I was creating new Products using API (WebServices)

  • Like 1
Link to comment
Share on other sites

  • 4 years later...

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...