Jump to content

Data structure changes from 1.4 to 1.5


Recommended Posts

Hello,

 

over the past couple of years we have written some tools that help us manage our store running Prestashop 1.4.

We recently upgraded to version 1.5 and found that there are some changes to how the new version handles quantities of products stored in the database, their state (active/inactive) and many other things.

 

 

We went through the official developer guide at http://doc.prestasho...Developer+Guide, but found little information about changes made to the underlying data structure when moving from 1.4 to 1.5.

 

It took us a couple hours to find this question, http://forge.prestas...owse/PSCFV-5376 where the answer by a member of the Prestashop team was: "... the quantity field is not used anymore, you need to use the stock_available table."

 

This is a very important piece of information yet I did not find it anywhere in the developer guide. Did I miss something?

 

I have read some forum posts about some guide being translated from french to english, but it's now year and a half since the release of v1.5 and it's still not done??

 

Prestashop team, how do you expect people to write code for your platform if you don't document well what have you done when moving from 1.4 to 1.5? Are we supposed to just guess how you moved the data around in the tables and what the different tables and their columns mean??

 

I hope I just missed something...

 

Thanks for your response.

 

Jan

Link to comment
Share on other sites

  • 1 month later...

I understand the frustation but before I upgrade I test my modifications and it should be obvious in a couple of minutes that my old approaches are not working any more. Besides your frustration I don't know how PS Team should communicate such changes.

 

I will not get into detail but maybe this is what you are looking for

StockAvailable::setQuantity(Tools::getValue('id_product'), '', Tools::getValue('quantity'));

^^

No need to worry about db structure.

 

Imo more nifty than the spagettie 1.4.X approach I used before

Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET `'.pSQL(Tools::getValue('action')).'` = '.Tools::getValue('quantity').', date_upd = NOW() WHERE  `id_product` = '.intval(Tools::getValue('id_product')).'');

 

One more example on howto change e.g. availability

$product = new Product(intval(Tools::getValue('id_product')));
if (!Validate::isLoadedObject($product))
 die('error: invalid id');
$product->active = Tools::getValue('active');
$product->save();

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

×
×
  • Create New...